X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=crypto%2Fevp%2Fp_seal.c;h=e5919b0fbf982320c13672c6ca886c82f2b3f414;hb=6f77f82bfcdf40c41e095bf292e887d15f2bf69d;hp=be021ee3cf02f717be51a7a37afce5c74fe6483c;hpb=a91dedca48ec58e6baab75839753121fb725c9e1;p=oweals%2Fopenssl.git diff --git a/crypto/evp/p_seal.c b/crypto/evp/p_seal.c index be021ee3cf..e5919b0fbf 100644 --- a/crypto/evp/p_seal.c +++ b/crypto/evp/p_seal.c @@ -59,14 +59,14 @@ #include #include "cryptlib.h" #include -#ifndef NO_RSA +#ifndef OPENSSL_NO_RSA #include #endif #include #include #include -int EVP_SealInit(EVP_CIPHER_CTX *ctx, EVP_CIPHER *type, unsigned char **ek, +int EVP_SealInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, unsigned char **ek, int *ekl, unsigned char *iv, EVP_PKEY **pubk, int npubk) { unsigned char key[EVP_MAX_KEY_LENGTH]; @@ -74,19 +74,20 @@ int EVP_SealInit(EVP_CIPHER_CTX *ctx, EVP_CIPHER *type, unsigned char **ek, if(type) { EVP_CIPHER_CTX_init(ctx); - EVP_EncryptInit(ctx,type,NULL,NULL); + 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)); - if(!EVP_EncryptInit(ctx,NULL,key,iv)) return 0; + if(!EVP_EncryptInit_ex(ctx,NULL,NULL,key,iv)) return 0; for (i=0; i