summaryrefslogtreecommitdiff
path: root/cipher
diff options
context:
space:
mode:
authorTobias Heider <tobias.heider@canonical.com>2022-09-27 13:31:05 +0900
committerNIIBE Yutaka <gniibe@fsij.org>2022-09-27 13:31:05 +0900
commit3c04b692de1e7b45b764ff8d66bf84609b012e3a (patch)
tree18f7d0951bcd9b3833cba3cf543d2f8821eec32b /cipher
parent857e6f467d0fc9fd858a73d84122695425970075 (diff)
downloadlibgcrypt-3c04b692de1e7b45b764ff8d66bf84609b012e3a.tar.gz
kdf:pkdf2: Check minimum allowed key size when running in FIPS mode.
* cipher/kdf.c (_gcry_kdf_pkdf2): Add output length check. -- GnuPG-bug-id: 6219
Diffstat (limited to 'cipher')
-rw-r--r--cipher/kdf.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/cipher/kdf.c b/cipher/kdf.c
index 81523320..67c60df8 100644
--- a/cipher/kdf.c
+++ b/cipher/kdf.c
@@ -160,6 +160,10 @@ _gcry_kdf_pkdf2 (const void *passphrase, size_t passphraselen,
return GPG_ERR_INV_VALUE;
#endif
+ /* Check minimum key size */
+ if (fips_mode () && dklen < 14)
+ return GPG_ERR_INV_VALUE;
+
/* HMAC requires longer input for approved use case. */
if (fips_mode () && passphraselen < 14)
return GPG_ERR_INV_VALUE;