Skip to content
Commit 67412f0e authored by Herbert Xu's avatar Herbert Xu
Browse files

[CRYPTO] hmac: Avoid calling virt_to_page on key



When HMAC gets a key longer than the block size of the hash, it needs
to feed it as input to the hash to reduce it to a fixed length.  As
it is HMAC converts the key to a scatter and gather list.  However,
this doesn't work on certain platforms if the key is not allocated
via kmalloc.  For example, the keys from tcrypt are stored in the
rodata section and this causes it to fail with HMAC on x86-64.

This patch fixes this by copying the key to memory obtained via
kmalloc before hashing it.

Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent c0a18111
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment