fs/ubifs/auth.c:249:2: error: implicit declaration of function 'request_key'

From: kbuild test robot
Date: Tue Nov 06 2018 - 13:25:53 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 8053e5b93eca9b011f7b79bb019bf1eeaaf96c4b
commit: d8a22773a12c6d78ee758c9e530f3a488bb7cb29 ubifs: Enable authentication support
date: 2 weeks ago
config: i386-randconfig-h1-11070135 (attached as .config)
compiler: gcc-4.9 (Debian 4.9.4-2) 4.9.4
reproduce:
git checkout d8a22773a12c6d78ee758c9e530f3a488bb7cb29
# save the attached .config to linux build tree
make ARCH=i386

All error/warnings (new ones prefixed by >>):

fs/ubifs/auth.c: In function 'ubifs_init_authentication':
>> fs/ubifs/auth.c:249:2: error: implicit declaration of function 'request_key' [-Werror=implicit-function-declaration]
keyring_key = request_key(&key_type_logon, c->auth_key_name, NULL);
^
>> fs/ubifs/auth.c:249:29: error: 'key_type_logon' undeclared (first use in this function)
keyring_key = request_key(&key_type_logon, c->auth_key_name, NULL);
^
fs/ubifs/auth.c:249:29: note: each undeclared identifier is reported only once for each function it appears in
>> fs/ubifs/auth.c:257:24: error: dereferencing pointer to incomplete type
down_read(&keyring_key->sem);
^
In file included from arch/x86/include/asm/atomic.h:5:0,
from include/linux/atomic.h:7,
from include/linux/crypto.h:20,
from fs/ubifs/auth.c:12:
fs/ubifs/auth.c:259:17: error: dereferencing pointer to incomplete type
if (keyring_key->type != &key_type_logon) {
^
include/linux/compiler.h:58:30: note: in definition of macro '__trace_if'
if (__builtin_constant_p(!!(cond)) ? !!(cond) : \
^
>> fs/ubifs/auth.c:259:2: note: in expansion of macro 'if'
if (keyring_key->type != &key_type_logon) {
^
fs/ubifs/auth.c:259:17: error: dereferencing pointer to incomplete type
if (keyring_key->type != &key_type_logon) {
^
include/linux/compiler.h:58:42: note: in definition of macro '__trace_if'
if (__builtin_constant_p(!!(cond)) ? !!(cond) : \
^
>> fs/ubifs/auth.c:259:2: note: in expansion of macro 'if'
if (keyring_key->type != &key_type_logon) {
^
fs/ubifs/auth.c:259:17: error: dereferencing pointer to incomplete type
if (keyring_key->type != &key_type_logon) {
^
include/linux/compiler.h:69:16: note: in definition of macro '__trace_if'
______r = !!(cond); \
^
>> fs/ubifs/auth.c:259:2: note: in expansion of macro 'if'
if (keyring_key->type != &key_type_logon) {
^
>> fs/ubifs/auth.c:265:2: error: implicit declaration of function 'user_key_payload_locked' [-Werror=implicit-function-declaration]
ukp = user_key_payload_locked(keyring_key);
^
>> fs/ubifs/auth.c:265:6: warning: assignment makes pointer from integer without a cast
ukp = user_key_payload_locked(keyring_key);
^
fs/ubifs/auth.c:304:44: error: dereferencing pointer to incomplete type
err = crypto_shash_setkey(c->hmac_tfm, ukp->data, ukp->datalen);
^
fs/ubifs/auth.c:304:55: error: dereferencing pointer to incomplete type
err = crypto_shash_setkey(c->hmac_tfm, ukp->data, ukp->datalen);
^
fs/ubifs/auth.c:323:22: error: dereferencing pointer to incomplete type
up_read(&keyring_key->sem);
^
cc1: some warnings being treated as errors

vim +/request_key +249 fs/ubifs/auth.c

49525e5e Sascha Hauer 2018-09-07 219
49525e5e Sascha Hauer 2018-09-07 220 /**
49525e5e Sascha Hauer 2018-09-07 221 * ubifs_init_authentication - initialize UBIFS authentication support
49525e5e Sascha Hauer 2018-09-07 222 * @c: UBIFS file-system description object
49525e5e Sascha Hauer 2018-09-07 223 *
49525e5e Sascha Hauer 2018-09-07 224 * This function returns 0 for success or a negative error code otherwise.
49525e5e Sascha Hauer 2018-09-07 225 */
49525e5e Sascha Hauer 2018-09-07 226 int ubifs_init_authentication(struct ubifs_info *c)
49525e5e Sascha Hauer 2018-09-07 227 {
49525e5e Sascha Hauer 2018-09-07 228 struct key *keyring_key;
49525e5e Sascha Hauer 2018-09-07 229 const struct user_key_payload *ukp;
49525e5e Sascha Hauer 2018-09-07 230 int err;
49525e5e Sascha Hauer 2018-09-07 231 char hmac_name[CRYPTO_MAX_ALG_NAME];
49525e5e Sascha Hauer 2018-09-07 232
49525e5e Sascha Hauer 2018-09-07 233 if (!c->auth_hash_name) {
49525e5e Sascha Hauer 2018-09-07 234 ubifs_err(c, "authentication hash name needed with authentication");
49525e5e Sascha Hauer 2018-09-07 235 return -EINVAL;
49525e5e Sascha Hauer 2018-09-07 236 }
49525e5e Sascha Hauer 2018-09-07 237
49525e5e Sascha Hauer 2018-09-07 238 c->auth_hash_algo = match_string(hash_algo_name, HASH_ALGO__LAST,
49525e5e Sascha Hauer 2018-09-07 239 c->auth_hash_name);
49525e5e Sascha Hauer 2018-09-07 240 if ((int)c->auth_hash_algo < 0) {
49525e5e Sascha Hauer 2018-09-07 241 ubifs_err(c, "Unknown hash algo %s specified",
49525e5e Sascha Hauer 2018-09-07 242 c->auth_hash_name);
49525e5e Sascha Hauer 2018-09-07 243 return -EINVAL;
49525e5e Sascha Hauer 2018-09-07 244 }
49525e5e Sascha Hauer 2018-09-07 245
49525e5e Sascha Hauer 2018-09-07 246 snprintf(hmac_name, CRYPTO_MAX_ALG_NAME, "hmac(%s)",
49525e5e Sascha Hauer 2018-09-07 247 c->auth_hash_name);
49525e5e Sascha Hauer 2018-09-07 248
49525e5e Sascha Hauer 2018-09-07 @249 keyring_key = request_key(&key_type_logon, c->auth_key_name, NULL);
49525e5e Sascha Hauer 2018-09-07 250
49525e5e Sascha Hauer 2018-09-07 251 if (IS_ERR(keyring_key)) {
49525e5e Sascha Hauer 2018-09-07 252 ubifs_err(c, "Failed to request key: %ld",
49525e5e Sascha Hauer 2018-09-07 253 PTR_ERR(keyring_key));
49525e5e Sascha Hauer 2018-09-07 254 return PTR_ERR(keyring_key);
49525e5e Sascha Hauer 2018-09-07 255 }
49525e5e Sascha Hauer 2018-09-07 256
49525e5e Sascha Hauer 2018-09-07 @257 down_read(&keyring_key->sem);
49525e5e Sascha Hauer 2018-09-07 258
49525e5e Sascha Hauer 2018-09-07 @259 if (keyring_key->type != &key_type_logon) {
49525e5e Sascha Hauer 2018-09-07 260 ubifs_err(c, "key type must be logon");
49525e5e Sascha Hauer 2018-09-07 261 err = -ENOKEY;
49525e5e Sascha Hauer 2018-09-07 262 goto out;
49525e5e Sascha Hauer 2018-09-07 263 }
49525e5e Sascha Hauer 2018-09-07 264
49525e5e Sascha Hauer 2018-09-07 @265 ukp = user_key_payload_locked(keyring_key);
49525e5e Sascha Hauer 2018-09-07 266 if (!ukp) {
49525e5e Sascha Hauer 2018-09-07 267 /* key was revoked before we acquired its semaphore */
49525e5e Sascha Hauer 2018-09-07 268 err = -EKEYREVOKED;
49525e5e Sascha Hauer 2018-09-07 269 goto out;
49525e5e Sascha Hauer 2018-09-07 270 }
49525e5e Sascha Hauer 2018-09-07 271
49525e5e Sascha Hauer 2018-09-07 272 c->hash_tfm = crypto_alloc_shash(c->auth_hash_name, 0,
49525e5e Sascha Hauer 2018-09-07 273 CRYPTO_ALG_ASYNC);
49525e5e Sascha Hauer 2018-09-07 274 if (IS_ERR(c->hash_tfm)) {
49525e5e Sascha Hauer 2018-09-07 275 err = PTR_ERR(c->hash_tfm);
49525e5e Sascha Hauer 2018-09-07 276 ubifs_err(c, "Can not allocate %s: %d",
49525e5e Sascha Hauer 2018-09-07 277 c->auth_hash_name, err);
49525e5e Sascha Hauer 2018-09-07 278 goto out;
49525e5e Sascha Hauer 2018-09-07 279 }
49525e5e Sascha Hauer 2018-09-07 280
49525e5e Sascha Hauer 2018-09-07 281 c->hash_len = crypto_shash_digestsize(c->hash_tfm);
49525e5e Sascha Hauer 2018-09-07 282 if (c->hash_len > UBIFS_HASH_ARR_SZ) {
49525e5e Sascha Hauer 2018-09-07 283 ubifs_err(c, "hash %s is bigger than maximum allowed hash size (%d > %d)",
49525e5e Sascha Hauer 2018-09-07 284 c->auth_hash_name, c->hash_len, UBIFS_HASH_ARR_SZ);
49525e5e Sascha Hauer 2018-09-07 285 err = -EINVAL;
49525e5e Sascha Hauer 2018-09-07 286 goto out_free_hash;
49525e5e Sascha Hauer 2018-09-07 287 }
49525e5e Sascha Hauer 2018-09-07 288
49525e5e Sascha Hauer 2018-09-07 289 c->hmac_tfm = crypto_alloc_shash(hmac_name, 0, CRYPTO_ALG_ASYNC);
49525e5e Sascha Hauer 2018-09-07 290 if (IS_ERR(c->hmac_tfm)) {
49525e5e Sascha Hauer 2018-09-07 291 err = PTR_ERR(c->hmac_tfm);
49525e5e Sascha Hauer 2018-09-07 292 ubifs_err(c, "Can not allocate %s: %d", hmac_name, err);
49525e5e Sascha Hauer 2018-09-07 293 goto out_free_hash;
49525e5e Sascha Hauer 2018-09-07 294 }
49525e5e Sascha Hauer 2018-09-07 295
49525e5e Sascha Hauer 2018-09-07 296 c->hmac_desc_len = crypto_shash_digestsize(c->hmac_tfm);
49525e5e Sascha Hauer 2018-09-07 297 if (c->hmac_desc_len > UBIFS_HMAC_ARR_SZ) {
49525e5e Sascha Hauer 2018-09-07 298 ubifs_err(c, "hmac %s is bigger than maximum allowed hmac size (%d > %d)",
49525e5e Sascha Hauer 2018-09-07 299 hmac_name, c->hmac_desc_len, UBIFS_HMAC_ARR_SZ);
49525e5e Sascha Hauer 2018-09-07 300 err = -EINVAL;
49525e5e Sascha Hauer 2018-09-07 301 goto out_free_hash;
49525e5e Sascha Hauer 2018-09-07 302 }
49525e5e Sascha Hauer 2018-09-07 303
49525e5e Sascha Hauer 2018-09-07 304 err = crypto_shash_setkey(c->hmac_tfm, ukp->data, ukp->datalen);
49525e5e Sascha Hauer 2018-09-07 305 if (err)
49525e5e Sascha Hauer 2018-09-07 306 goto out_free_hmac;
49525e5e Sascha Hauer 2018-09-07 307
49525e5e Sascha Hauer 2018-09-07 308 c->authenticated = true;
49525e5e Sascha Hauer 2018-09-07 309
49525e5e Sascha Hauer 2018-09-07 310 c->log_hash = ubifs_hash_get_desc(c);
49525e5e Sascha Hauer 2018-09-07 311 if (IS_ERR(c->log_hash))
49525e5e Sascha Hauer 2018-09-07 312 goto out_free_hmac;
49525e5e Sascha Hauer 2018-09-07 313
49525e5e Sascha Hauer 2018-09-07 314 err = 0;
49525e5e Sascha Hauer 2018-09-07 315
49525e5e Sascha Hauer 2018-09-07 316 out_free_hmac:
49525e5e Sascha Hauer 2018-09-07 317 if (err)
49525e5e Sascha Hauer 2018-09-07 318 crypto_free_shash(c->hmac_tfm);
49525e5e Sascha Hauer 2018-09-07 319 out_free_hash:
49525e5e Sascha Hauer 2018-09-07 320 if (err)
49525e5e Sascha Hauer 2018-09-07 321 crypto_free_shash(c->hash_tfm);
49525e5e Sascha Hauer 2018-09-07 322 out:
49525e5e Sascha Hauer 2018-09-07 323 up_read(&keyring_key->sem);
49525e5e Sascha Hauer 2018-09-07 324 key_put(keyring_key);
49525e5e Sascha Hauer 2018-09-07 325
49525e5e Sascha Hauer 2018-09-07 326 return err;
49525e5e Sascha Hauer 2018-09-07 327 }
49525e5e Sascha Hauer 2018-09-07 328

:::::: The code at line 249 was first introduced by commit
:::::: 49525e5eecca5e1b4a83ac217868e8d8b843539f ubifs: Add helper functions for authentication support

:::::: TO: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
:::::: CC: Richard Weinberger <richard@xxxxxx>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Attachment: .config.gz
Description: application/gzip