include/crypto/internal/des.h:31: undefined reference to `des_expand_key'

From: kbuild test robot
Date: Sat Nov 23 2019 - 18:43:12 EST


Hi Ard,

It's probably a bug fix that unveils the link errors.

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 2027cabe6afea5d471401ec704b65ce18f958fdc
commit: 18fbe0da8e98fe167fbfe1757003e2a2a74d24f3 crypto: des - remove now unused __des3_ede_setkey()
date: 3 months ago
config: powerpc-randconfig-a001-20191124 (attached as .config)
compiler: powerpc-linux-gcc (GCC) 7.4.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 18fbe0da8e98fe167fbfe1757003e2a2a74d24f3
# save the attached .config to linux build tree
GCC_VERSION=7.4.0 make.cross ARCH=powerpc

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

drivers/crypto/talitos.o: In function `crypto_des_verify_key':
>> include/crypto/internal/des.h:31: undefined reference to `des_expand_key'

vim +31 include/crypto/internal/des.h

6ee41e5420d0af Ard Biesheuvel 2019-08-15 14
6ee41e5420d0af Ard Biesheuvel 2019-08-15 15 /**
6ee41e5420d0af Ard Biesheuvel 2019-08-15 16 * crypto_des_verify_key - Check whether a DES key is weak
6ee41e5420d0af Ard Biesheuvel 2019-08-15 17 * @tfm: the crypto algo
6ee41e5420d0af Ard Biesheuvel 2019-08-15 18 * @key: the key buffer
6ee41e5420d0af Ard Biesheuvel 2019-08-15 19 *
6ee41e5420d0af Ard Biesheuvel 2019-08-15 20 * Returns -EINVAL if the key is weak and the crypto TFM does not permit weak
6ee41e5420d0af Ard Biesheuvel 2019-08-15 21 * keys. Otherwise, 0 is returned.
6ee41e5420d0af Ard Biesheuvel 2019-08-15 22 *
6ee41e5420d0af Ard Biesheuvel 2019-08-15 23 * It is the job of the caller to ensure that the size of the key equals
6ee41e5420d0af Ard Biesheuvel 2019-08-15 24 * DES_KEY_SIZE.
6ee41e5420d0af Ard Biesheuvel 2019-08-15 25 */
6ee41e5420d0af Ard Biesheuvel 2019-08-15 26 static inline int crypto_des_verify_key(struct crypto_tfm *tfm, const u8 *key)
6ee41e5420d0af Ard Biesheuvel 2019-08-15 27 {
04007b0e6cbbab Ard Biesheuvel 2019-08-15 28 struct des_ctx tmp;
04007b0e6cbbab Ard Biesheuvel 2019-08-15 29 int err;
6ee41e5420d0af Ard Biesheuvel 2019-08-15 30
04007b0e6cbbab Ard Biesheuvel 2019-08-15 @31 err = des_expand_key(&tmp, key, DES_KEY_SIZE);
04007b0e6cbbab Ard Biesheuvel 2019-08-15 32 if (err == -ENOKEY) {
04007b0e6cbbab Ard Biesheuvel 2019-08-15 33 if (crypto_tfm_get_flags(tfm) & CRYPTO_TFM_REQ_FORBID_WEAK_KEYS)
6ee41e5420d0af Ard Biesheuvel 2019-08-15 34 err = -EINVAL;
04007b0e6cbbab Ard Biesheuvel 2019-08-15 35 else
04007b0e6cbbab Ard Biesheuvel 2019-08-15 36 err = 0;
6ee41e5420d0af Ard Biesheuvel 2019-08-15 37 }
6ee41e5420d0af Ard Biesheuvel 2019-08-15 38
04007b0e6cbbab Ard Biesheuvel 2019-08-15 39 if (err)
04007b0e6cbbab Ard Biesheuvel 2019-08-15 40 crypto_tfm_set_flags(tfm, CRYPTO_TFM_RES_WEAK_KEY);
04007b0e6cbbab Ard Biesheuvel 2019-08-15 41
04007b0e6cbbab Ard Biesheuvel 2019-08-15 42 memzero_explicit(&tmp, sizeof(tmp));
6ee41e5420d0af Ard Biesheuvel 2019-08-15 43 return err;
6ee41e5420d0af Ard Biesheuvel 2019-08-15 44 }
6ee41e5420d0af Ard Biesheuvel 2019-08-15 45

:::::: The code at line 31 was first introduced by commit
:::::: 04007b0e6cbbab5836ac891626e91edf10d46341 crypto: des - split off DES library from generic DES cipher driver

:::::: TO: Ard Biesheuvel <ard.biesheuvel@xxxxxxxxxx>
:::::: CC: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>

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

Attachment: .config.gz
Description: application/gzip