X-Git-Url: https://git.openssl.org/?a=blobdiff_plain;f=crypto%2Fpkcs12%2Fp12_decr.c;h=8996b9ed8470661a6d02d5c47d4182a941a7864d;hb=bfb0641f932490c2e7fb5f9f7cb4a88017a5abfa;hp=19efd967d805e217990cd42e3b5ce12e06a76fae;hpb=2ace745022f5af0709297e96eb0b0829c87c4291;p=openssl.git diff --git a/crypto/pkcs12/p12_decr.c b/crypto/pkcs12/p12_decr.c index 19efd967d8..8996b9ed84 100644 --- a/crypto/pkcs12/p12_decr.c +++ b/crypto/pkcs12/p12_decr.c @@ -58,7 +58,7 @@ */ #include -#include "cryptlib.h" +#include "internal/cryptlib.h" #include /* Define this to dump decrypted output to files called DERnnn */ @@ -75,7 +75,7 @@ unsigned char *PKCS12_pbe_crypt(X509_ALGOR *algor, const char *pass, int passlen, unsigned char *in, int inlen, unsigned char **data, int *datalen, int en_de) { - unsigned char *out; + unsigned char *out = NULL; int outlen, i; EVP_CIPHER_CTX ctx; @@ -85,10 +85,11 @@ unsigned char *PKCS12_pbe_crypt(X509_ALGOR *algor, const char *pass, algor->parameter, &ctx, en_de)) { PKCS12err(PKCS12_F_PKCS12_PBE_CRYPT, PKCS12_R_PKCS12_ALGOR_CIPHERINIT_ERROR); - return NULL; + goto err; } - if (!(out = OPENSSL_malloc(inlen + EVP_CIPHER_CTX_block_size(&ctx)))) { + if ((out = OPENSSL_malloc(inlen + EVP_CIPHER_CTX_block_size(&ctx))) + == NULL) { PKCS12err(PKCS12_F_PKCS12_PBE_CRYPT, ERR_R_MALLOC_FAILURE); goto err; } @@ -174,7 +175,8 @@ ASN1_OCTET_STRING *PKCS12_item_i2d_encrypt(X509_ALGOR *algor, ASN1_OCTET_STRING *oct = NULL; unsigned char *in = NULL; int inlen; - if (!(oct = ASN1_OCTET_STRING_new())) { + + if ((oct = ASN1_OCTET_STRING_new()) == NULL) { PKCS12err(PKCS12_F_PKCS12_ITEM_I2D_ENCRYPT, ERR_R_MALLOC_FAILURE); goto err; }