Re: linux-next: Tree for Jul 29 (drivers/crypto/sa2ul.c)

Randy Dunlap
2020-07-29T16:05:33Z

On 7/29/20 5:22 AM, Stephen Rothwell wrote:
> Hi all,
>
> Changes since 20200728:
>

on i386:

ld: drivers/crypto/sa2ul.o: in function `sa_sha_digest':
sa2ul.c:(.text+0x1faf): undefined reference to `sha512_zero_message_hash'

sa2ul.c uses sha512_zero_message_hash, sha1_zero_message_hash,
and sha256_zero_message_hash, but it does not 'select' any of the
Kconfig symbols that cause those hashes to be present.

Should it select the needed Kconfig symbols or should it use
#ifdef blocks as needed?

like so:

static int zero_message_process(struct ahash_request *req)
{
struct crypto_ahash *tfm = crypto_ahash_reqtfm(req);
int sa_digest_size = crypto_ahash_digestsize(tfm);

switch (sa_digest_size) {
#ifdef CONFIG_CRYPTO_SHA1
case SHA1_DIGEST_SIZE:
memcpy(req->result, sha1_zero_message_hash, sa_digest_size);
break;
#endif
#ifdef CONFIG_CRYPTO_SHA256
case SHA256_DIGEST_SIZE:
memcpy(req->result, sha256_zero_message_hash, sa_digest_size);
break;
#endif
#ifdef CONFIG_CRYPTO_SHA512
case SHA512_DIGEST_SIZE:
memcpy(req->result, sha512_zero_message_hash, sa_digest_size);
break;
#endif
default:
return -EINVAL;
}

return 0;
}

--
~Randy
Reported-by: Randy Dunlap <rdunlap@infradead.org>