aboutsummaryrefslogtreecommitdiff
path: root/sys/opencrypto/xform_rmd160.c
diff options
context:
space:
mode:
authorConrad Meyer <cem@FreeBSD.org>2017-09-26 16:18:10 +0000
committerConrad Meyer <cem@FreeBSD.org>2017-09-26 16:18:10 +0000
commit3693b18840d868f11e273d24a63eb3e6b7b9d2de (patch)
tree0634bdefbd7b94ff61deee350b2222920098270e /sys/opencrypto/xform_rmd160.c
parent443efc868c3d77d0248346b0384d9c0b3db629c4 (diff)
downloadsrc-3693b18840d868f11e273d24a63eb3e6b7b9d2de.tar.gz
src-3693b18840d868f11e273d24a63eb3e6b7b9d2de.zip
opencrypto: Loosen restriction on HMAC key sizes
Theoretically, HMACs do not actually have any limit on key sizes. Transforms should compact input keys larger than the HMAC block size by using the transform (hash) on the input key. (Short input keys are padded out with zeros to the HMAC block size.) Still, not all FreeBSD crypto drivers that provide HMAC functionality handle longer-than-blocksize keys appropriately, so enforce a "maximum" key length in the crypto API for auth_hashes that previously expressed a requirement. (The "maximum" is the size of a single HMAC block for the given transform.) Unconstrained auth_hashes are left as-is. I believe the previous hardcoded sizes were committed in the original import of opencrypto from OpenBSD and are due to specific protocol details of IPSec. Note that none of the previous sizes actually matched the appropriate HMAC block size. The previous hardcoded sizes made the SHA tests in cryptotest.py useless for testing FreeBSD crypto drivers; none of the NIST-KAT example inputs had keys sized to the previous expectations. The following drivers were audited to check that they handled keys up to the block size of the HMAC safely: Software HMAC: * padlock(4) * cesa * glxsb * safe(4) * ubsec(4) Hardware accelerated HMAC: * ccr(4) * hifn(4) * sec(4) (Only supports up to 64 byte keys despite claiming to support SHA2 HMACs, but validates input key sizes) * cryptocteon (MIPS) * nlmsec (MIPS) * rmisec (MIPS) (Amusingly, does not appear to use key material at all -- presumed broken) Reviewed by: jhb (previous version), rlibby (previous version) Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D12437
Notes
Notes: svn path=/head/; revision=324017
Diffstat (limited to 'sys/opencrypto/xform_rmd160.c')
-rw-r--r--sys/opencrypto/xform_rmd160.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/opencrypto/xform_rmd160.c b/sys/opencrypto/xform_rmd160.c
index 4bce0729fa0b..334b3ce5adcb 100644
--- a/sys/opencrypto/xform_rmd160.c
+++ b/sys/opencrypto/xform_rmd160.c
@@ -58,7 +58,7 @@ static int RMD160Update_int(void *, const u_int8_t *, u_int16_t);
/* Authentication instances */
struct auth_hash auth_hash_hmac_ripemd_160 = {
CRYPTO_RIPEMD160_HMAC, "HMAC-RIPEMD-160",
- RIPEMD160_HMAC_KEY_LEN, RIPEMD160_HASH_LEN, sizeof(RMD160_CTX),
+ RIPEMD160_HMAC_BLOCK_LEN, RIPEMD160_HASH_LEN, sizeof(RMD160_CTX),
RIPEMD160_HMAC_BLOCK_LEN,
(void (*)(void *)) RMD160Init, NULL, NULL, RMD160Update_int,
(void (*)(u_int8_t *, void *)) RMD160Final