summaryrefslogtreecommitdiffstats
path: root/crypto/evp/p_seal.c
diff options
context:
space:
mode:
authorKurt Roeckx <kurt@roeckx.be>2018-03-08 22:30:28 +0100
committerDr. Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>2018-03-19 15:04:40 +0100
commit16cfc2c90d9e7776965db07c1f31bbec2f6c41e3 (patch)
treedab155d1453fce5e7e2a5d6c2d4d02557227cb41 /crypto/evp/p_seal.c
parentMake the public and private DRBG thread local (diff)
downloadopenssl-16cfc2c90d9e7776965db07c1f31bbec2f6c41e3.tar.xz
openssl-16cfc2c90d9e7776965db07c1f31bbec2f6c41e3.zip
Don't use a ssl specific DRBG anymore
Since the public and private DRBG are per thread we don't need one per ssl object anymore. It could also try to get entropy from a DRBG that's really from an other thread because the SSL object moved to an other thread. Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Paul Dale <paul.dale@oracle.com> Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com> (Merged from https://github.com/openssl/openssl/pull/5547)
Diffstat (limited to 'crypto/evp/p_seal.c')
-rw-r--r--crypto/evp/p_seal.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/crypto/evp/p_seal.c b/crypto/evp/p_seal.c
index 731879330b..50ea60235a 100644
--- a/crypto/evp/p_seal.c
+++ b/crypto/evp/p_seal.c
@@ -14,8 +14,6 @@
#include <openssl/evp.h>
#include <openssl/objects.h>
#include <openssl/x509.h>
-#include <openssl/rand_drbg.h>
-#include "evp_locl.h"
int EVP_SealInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type,
unsigned char **ek, int *ekl, unsigned char *iv,
@@ -33,14 +31,9 @@ int EVP_SealInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type,
return 1;
if (EVP_CIPHER_CTX_rand_key(ctx, key) <= 0)
return 0;
- if (EVP_CIPHER_CTX_iv_length(ctx)) {
- if (ctx->drbg) {
- if (RAND_DRBG_bytes(ctx->drbg, iv, EVP_CIPHER_CTX_iv_length(ctx)) == 0)
- return 0;
- } else if (RAND_bytes(iv, EVP_CIPHER_CTX_iv_length(ctx)) <= 0) {
- return 0;
- }
- }
+ if (EVP_CIPHER_CTX_iv_length(ctx)
+ && RAND_bytes(iv, EVP_CIPHER_CTX_iv_length(ctx)) <= 0)
+ return 0;
if (!EVP_EncryptInit_ex(ctx, NULL, NULL, key, iv))
return 0;