coverity 1484913: Null pointer dereferences (REVERSE_INULL)

Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15425)
This commit is contained in:
Pauli 2021-05-24 08:59:36 +10:00
parent 91f2b15f2e
commit 29604f4920

View File

@ -15,23 +15,28 @@
#include <openssl/evp.h>
#include <openssl/objects.h>
#include <openssl/x509.h>
#include <openssl/evp.h>
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];
const OSSL_PROVIDER *prov = EVP_CIPHER_provider(type);
OSSL_LIB_CTX *libctx = prov != NULL ? ossl_provider_libctx(prov) : NULL;
const OSSL_PROVIDER *prov;
OSSL_LIB_CTX *libctx = NULL;
EVP_PKEY_CTX *pctx = NULL;
const EVP_CIPHER *cipher;
int i, len;
int rv = 0;
if (type) {
if (type != NULL) {
EVP_CIPHER_CTX_reset(ctx);
if (!EVP_EncryptInit_ex(ctx, type, NULL, NULL, NULL))
return 0;
}
if ((cipher = EVP_CIPHER_CTX_get0_cipher(ctx)) != NULL
&& (prov = EVP_CIPHER_provider(cipher)) != NULL)
libctx = ossl_provider_libctx(prov);
if ((npubk <= 0) || !pubk)
return 1;