diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2015-05-21 01:16:31 +0100 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2015-05-26 13:09:25 +0100 |
commit | fef034f85ea8b533423d4102cb8f83ef0ac24154 (patch) | |
tree | cbbd750cc1c2fa0eccd542581257f2d5d91cdba7 /crypto/evp/scrypt.c | |
parent | 764ca96c953b4bcc23a390a1f68dbcad81a2b12f (diff) | |
download | openssl-fef034f85ea8b533423d4102cb8f83ef0ac24154.tar.gz |
Error if memory limit exceeded.
Set a specific error if the parameters are otherwise valid but exceed the
memory limit.
Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'crypto/evp/scrypt.c')
-rw-r--r-- | crypto/evp/scrypt.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/crypto/evp/scrypt.c b/crypto/evp/scrypt.c index 971d53e443..09dfdf2515 100644 --- a/crypto/evp/scrypt.c +++ b/crypto/evp/scrypt.c @@ -61,6 +61,7 @@ #include <stdio.h> #include <string.h> #include <openssl/evp.h> +#include <openssl/err.h> #include <internal/numbers.h> #define R(a,b) (((a) << (b)) | ((a) >> (32 - (b)))) @@ -255,8 +256,10 @@ int EVP_PBE_scrypt(const char *pass, size_t passlen, if (maxmem == 0) maxmem = SCRYPT_MAX_MEM; - if (Blen + Vlen > maxmem) + if (Blen + Vlen > maxmem) { + EVPerr(EVP_F_EVP_PBE_SCRYPT, EVP_R_MEMORY_LIMIT_EXCEEDED); return 0; + } /* If no key return to indicate parameters are OK */ if (key == NULL) |