diff options
author | Andy Polyakov <appro@openssl.org> | 2014-02-14 17:43:31 +0100 |
---|---|---|
committer | Andy Polyakov <appro@openssl.org> | 2014-02-14 17:45:33 +0100 |
commit | aff78bb39aa077874f91151033f44306515c3d2f (patch) | |
tree | e236f2309dd407e9b65a73177837e1c31d06a907 /crypto/evp | |
parent | 104c032b7bed893f87d08ef3178848715e7035b3 (diff) |
ssl/s3_pkt.c: detect RAND_bytes error in multi-block.
(cherry picked from commit 701134320a94908d8c0ac513741cab41e215a7b5)
Diffstat (limited to 'crypto/evp')
-rw-r--r-- | crypto/evp/e_aes_cbc_hmac_sha1.c | 3 | ||||
-rw-r--r-- | crypto/evp/e_aes_cbc_hmac_sha256.c | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/crypto/evp/e_aes_cbc_hmac_sha1.c b/crypto/evp/e_aes_cbc_hmac_sha1.c index 0b6f292f62..6ece66f27a 100644 --- a/crypto/evp/e_aes_cbc_hmac_sha1.c +++ b/crypto/evp/e_aes_cbc_hmac_sha1.c @@ -212,7 +212,8 @@ static size_t tls1_1_multi_block_encrypt(EVP_AES_HMAC_SHA1 *key, u64 seqnum; #endif - RAND_bytes((IVs=blocks[0].c),16*x4); /* ask for IVs in bulk */ + if (RAND_bytes((IVs=blocks[0].c),16*x4)<=0) /* ask for IVs in bulk */ + return 0; ctx = (SHA1_MB_CTX *)(storage+32-((size_t)storage%32)); /* align */ diff --git a/crypto/evp/e_aes_cbc_hmac_sha256.c b/crypto/evp/e_aes_cbc_hmac_sha256.c index c2c48f045c..df031cc1c0 100644 --- a/crypto/evp/e_aes_cbc_hmac_sha256.c +++ b/crypto/evp/e_aes_cbc_hmac_sha256.c @@ -208,7 +208,8 @@ static size_t tls1_1_multi_block_encrypt(EVP_AES_HMAC_SHA256 *key, u64 seqnum; #endif - RAND_bytes((IVs=blocks[0].c),16*x4); /* ask for IVs in bulk */ + if (RAND_bytes((IVs=blocks[0].c),16*x4)<=0) /* ask for IVs in bulk */ + return 0; ctx = (SHA256_MB_CTX *)(storage+32-((size_t)storage%32)); /* align */ |