X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=blobdiff_plain;f=crypto%2Fevp%2Fp_seal.c;h=ff16370994f960eaaabf966eaa2e1e13c8a73e48;hp=e372f138c70d508f0cb18bb68e0ebd5a95dce38c;hb=78435364ec450408b63acef65494dbe16a97792a;hpb=691401fc53cc14cd98ac885e842e1e8370280abc diff --git a/crypto/evp/p_seal.c b/crypto/evp/p_seal.c index e372f138c7..ff16370994 100644 --- a/crypto/evp/p_seal.c +++ b/crypto/evp/p_seal.c @@ -59,7 +59,7 @@ #include #include "cryptlib.h" #include -#ifndef NO_RSA +#ifndef OPENSSL_NO_RSA #include #endif #include @@ -72,17 +72,21 @@ int EVP_SealInit(EVP_CIPHER_CTX *ctx, EVP_CIPHER *type, unsigned char **ek, unsigned char key[EVP_MAX_KEY_LENGTH]; int i; + if(type) { + EVP_CIPHER_CTX_init(ctx); + if(!EVP_EncryptInit(ctx,type,NULL,NULL)) return 0; + } if (npubk <= 0) return(0); - if (RAND_bytes(key,EVP_MAX_KEY_LENGTH) <= 0) return(0); - if (type->iv_len > 0) - RAND_bytes(iv,type->iv_len); + if (RAND_bytes(key,EVP_MAX_KEY_LENGTH) <= 0) + return(0); + if (EVP_CIPHER_CTX_iv_length(ctx)) + RAND_pseudo_bytes(iv,EVP_CIPHER_CTX_iv_length(ctx)); - EVP_CIPHER_CTX_init(ctx); - EVP_EncryptInit(ctx,type,key,iv); + if(!EVP_EncryptInit(ctx,NULL,key,iv)) return 0; for (i=0; i