X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=crypto%2Fevp%2Fp_seal.c;h=e5919b0fbf982320c13672c6ca886c82f2b3f414;hb=6f77f82bfcdf40c41e095bf292e887d15f2bf69d;hp=ba2dd657aba8e639a91cf227f82104690258399f;hpb=581f1c84940d77451c2592e9fa470893f6c3c3eb;p=oweals%2Fopenssl.git diff --git a/crypto/evp/p_seal.c b/crypto/evp/p_seal.c index ba2dd657ab..e5919b0fbf 100644 --- a/crypto/evp/p_seal.c +++ b/crypto/evp/p_seal.c @@ -76,9 +76,10 @@ int EVP_SealInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, unsigned char **ek EVP_CIPHER_CTX_init(ctx); if(!EVP_EncryptInit_ex(ctx,type,NULL,NULL,NULL)) return 0; } - if (npubk <= 0) return(0); - if (RAND_bytes(key,EVP_MAX_KEY_LENGTH) <= 0) - return(0); + if ((npubk <= 0) || !pubk) + return 1; + if (EVP_CIPHER_CTX_rand_key(ctx, key) <= 0) + return 0; if (EVP_CIPHER_CTX_iv_length(ctx)) RAND_pseudo_bytes(iv,EVP_CIPHER_CTX_iv_length(ctx)); @@ -86,7 +87,7 @@ int EVP_SealInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, unsigned char **ek for (i=0; i