diff options
author | Jeffrey Walton <noloader@gmail.com> | 2019-06-28 14:22:03 -0400 |
---|---|---|
committer | Jeffrey Walton <noloader@gmail.com> | 2019-06-28 14:22:03 -0400 |
commit | 18d5e5528f480885d3373d200dffc8cd6beeca81 (patch) | |
tree | 0e289a9bd653301394db79bced22f531e3f41d26 /pwdbased.h | |
parent | 26a59cd94b854399b8c9516169532bb939e8728d (diff) | |
download | cryptopp-git-18d5e5528f480885d3373d200dffc8cd6beeca81.tar.gz |
Fix divide by 0 finding (GH #855)
I'm not sure which tool is producing this finding. I am pretty sure it is a false positive, but clear it for the sake of dark and silent cockpits
Diffstat (limited to 'pwdbased.h')
-rw-r--r-- | pwdbased.h | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -245,7 +245,11 @@ size_t PKCS5_PBKDF2_HMAC<T>::DeriveKey(byte *derived, size_t derivedLen, byte pu // Business logic
if (!iterations) { iterations = 1; }
+ // DigestSize check due to https://github.com/weidai11/cryptopp/issues/855
HMAC<T> hmac(secret, secretLen);
+ if (hmac.DigestSize() == 0)
+ throw InvalidArgument("PKCS5_PBKDF2_HMAC: DigestSize cannot be 0");
+
SecByteBlock buffer(hmac.DigestSize());
ThreadUserTimer timer;
|