diff options
Diffstat (limited to 'Cryptlib/OpenSSL/crypto/evp/p_seal.c')
| -rw-r--r-- | Cryptlib/OpenSSL/crypto/evp/p_seal.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/Cryptlib/OpenSSL/crypto/evp/p_seal.c b/Cryptlib/OpenSSL/crypto/evp/p_seal.c index be297dc9..ba9dfff2 100644 --- a/Cryptlib/OpenSSL/crypto/evp/p_seal.c +++ b/Cryptlib/OpenSSL/crypto/evp/p_seal.c @@ -82,15 +82,17 @@ 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)) - RAND_pseudo_bytes(iv, EVP_CIPHER_CTX_iv_length(ctx)); + 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; for (i = 0; i < npubk; i++) { - ekl[i] = EVP_PKEY_encrypt(ek[i], key, EVP_CIPHER_CTX_key_length(ctx), - pubk[i]); + ekl[i] = + EVP_PKEY_encrypt_old(ek[i], key, EVP_CIPHER_CTX_key_length(ctx), + pubk[i]); if (ekl[i] <= 0) return (-1); } @@ -113,6 +115,7 @@ int EVP_SealFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) { int i; i = EVP_EncryptFinal_ex(ctx, out, outl); - EVP_EncryptInit_ex(ctx, NULL, NULL, NULL, NULL); + if (i) + i = EVP_EncryptInit_ex(ctx, NULL, NULL, NULL, NULL); return i; } |
