summaryrefslogtreecommitdiffstats
path: root/crypto/srp
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2015-02-26 16:28:59 +0000
committerMatt Caswell <matt@openssl.org>2015-03-25 12:41:28 +0000
commit8f8e4e4f5253085ab673bb74094c3e492c56af44 (patch)
tree1fb6e32d1f10e7ca77521df3a25f887bf083f7a8 /crypto/srp
parenta20718fa2c0a45e6acb975cf6c0438c3ebd45b13 (diff)
Fix RAND_(pseudo_)?_bytes returns
Ensure all calls to RAND_bytes and RAND_pseudo_bytes have their return value checked correctly Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'crypto/srp')
-rw-r--r--crypto/srp/srp_vfy.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/crypto/srp/srp_vfy.c b/crypto/srp/srp_vfy.c
index 701b5cd011..902df1013b 100644
--- a/crypto/srp/srp_vfy.c
+++ b/crypto/srp/srp_vfy.c
@@ -497,7 +497,8 @@ SRP_user_pwd *SRP_VBASE_get_by_user(SRP_VBASE *vb, char *username)
if (!SRP_user_pwd_set_ids(user, username, NULL))
goto err;
- RAND_pseudo_bytes(digv, SHA_DIGEST_LENGTH);
+ if(RAND_pseudo_bytes(digv, SHA_DIGEST_LENGTH) < 0)
+ goto err;
EVP_MD_CTX_init(&ctxt);
EVP_DigestInit_ex(&ctxt, EVP_sha1(), NULL);
EVP_DigestUpdate(&ctxt, vb->seed_key, strlen(vb->seed_key));
@@ -549,7 +550,8 @@ char *SRP_create_verifier(const char *user, const char *pass, char **salt,
}
if (*salt == NULL) {
- RAND_pseudo_bytes(tmp2, SRP_RANDOM_SALT_LEN);
+ if(RAND_pseudo_bytes(tmp2, SRP_RANDOM_SALT_LEN) < 0)
+ goto err;
s = BN_bin2bn(tmp2, SRP_RANDOM_SALT_LEN, NULL);
} else {
@@ -609,7 +611,8 @@ int SRP_create_verifier_BN(const char *user, const char *pass, BIGNUM **salt,
srp_bn_print(g);
if (*salt == NULL) {
- RAND_pseudo_bytes(tmp2, SRP_RANDOM_SALT_LEN);
+ if(RAND_pseudo_bytes(tmp2, SRP_RANDOM_SALT_LEN) < 0)
+ goto err;
*salt = BN_bin2bn(tmp2, SRP_RANDOM_SALT_LEN, NULL);
}