X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=crypto%2Fasn1%2Fp5_pbe.c;h=4d7a9c61c14e361fbec9bf537d2663f5da7ea832;hb=06b9ff06cc7fdd8f51abb92aaac39d3988a7090e;hp=bdbfdcd67c0727daa2e11af247495e0e81e85521;hpb=0f113f3ee4d629ef9a4a30911b22b224772085e5;p=oweals%2Fopenssl.git diff --git a/crypto/asn1/p5_pbe.c b/crypto/asn1/p5_pbe.c index bdbfdcd67c..4d7a9c61c1 100644 --- a/crypto/asn1/p5_pbe.c +++ b/crypto/asn1/p5_pbe.c @@ -58,7 +58,7 @@ */ #include -#include "cryptlib.h" +#include "internal/cryptlib.h" #include #include #include @@ -82,7 +82,7 @@ int PKCS5_pbe_set0_algor(X509_ALGOR *algor, int alg, int iter, unsigned char *sstr; pbe = PBEPARAM_new(); - if (!pbe) { + if (pbe == NULL) { ASN1err(ASN1_F_PKCS5_PBE_SET0_ALGOR, ERR_R_MALLOC_FAILURE); goto err; } @@ -101,7 +101,7 @@ int PKCS5_pbe_set0_algor(X509_ALGOR *algor, int alg, int iter, sstr = ASN1_STRING_data(pbe->salt); if (salt) memcpy(sstr, salt, saltlen); - else if (RAND_pseudo_bytes(sstr, saltlen) < 0) + else if (RAND_bytes(sstr, saltlen) <= 0) goto err; if (!ASN1_item_pack(pbe, ASN1_ITEM_rptr(PBEPARAM), &pbe_str)) { @@ -116,10 +116,8 @@ int PKCS5_pbe_set0_algor(X509_ALGOR *algor, int alg, int iter, return 1; err: - if (pbe != NULL) - PBEPARAM_free(pbe); - if (pbe_str != NULL) - ASN1_STRING_free(pbe_str); + PBEPARAM_free(pbe); + ASN1_STRING_free(pbe_str); return 0; } @@ -130,7 +128,7 @@ X509_ALGOR *PKCS5_pbe_set(int alg, int iter, { X509_ALGOR *ret; ret = X509_ALGOR_new(); - if (!ret) { + if (ret == NULL) { ASN1err(ASN1_F_PKCS5_PBE_SET, ERR_R_MALLOC_FAILURE); return NULL; }