summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/asn1/p5_pbe.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/asn1/p5_pbe.c')
-rw-r--r--src/lib/libcrypto/asn1/p5_pbe.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/lib/libcrypto/asn1/p5_pbe.c b/src/lib/libcrypto/asn1/p5_pbe.c
index f0f23c668d..390305ad38 100644
--- a/src/lib/libcrypto/asn1/p5_pbe.c
+++ b/src/lib/libcrypto/asn1/p5_pbe.c
@@ -82,22 +82,19 @@ int PKCS5_pbe_set0_algor(X509_ALGOR *algor, int alg, int iter,
82 unsigned char *sstr; 82 unsigned char *sstr;
83 83
84 pbe = PBEPARAM_new(); 84 pbe = PBEPARAM_new();
85 if (!pbe) 85 if (!pbe) {
86 {
87 ASN1err(ASN1_F_PKCS5_PBE_SET0_ALGOR,ERR_R_MALLOC_FAILURE); 86 ASN1err(ASN1_F_PKCS5_PBE_SET0_ALGOR,ERR_R_MALLOC_FAILURE);
88 goto err; 87 goto err;
89 } 88 }
90 if(iter <= 0) 89 if(iter <= 0)
91 iter = PKCS5_DEFAULT_ITER; 90 iter = PKCS5_DEFAULT_ITER;
92 if (!ASN1_INTEGER_set(pbe->iter, iter)) 91 if (!ASN1_INTEGER_set(pbe->iter, iter)) {
93 {
94 ASN1err(ASN1_F_PKCS5_PBE_SET0_ALGOR,ERR_R_MALLOC_FAILURE); 92 ASN1err(ASN1_F_PKCS5_PBE_SET0_ALGOR,ERR_R_MALLOC_FAILURE);
95 goto err; 93 goto err;
96 } 94 }
97 if (!saltlen) 95 if (!saltlen)
98 saltlen = PKCS5_SALT_LEN; 96 saltlen = PKCS5_SALT_LEN;
99 if (!ASN1_STRING_set(pbe->salt, NULL, saltlen)) 97 if (!ASN1_STRING_set(pbe->salt, NULL, saltlen)) {
100 {
101 ASN1err(ASN1_F_PKCS5_PBE_SET0_ALGOR,ERR_R_MALLOC_FAILURE); 98 ASN1err(ASN1_F_PKCS5_PBE_SET0_ALGOR,ERR_R_MALLOC_FAILURE);
102 goto err; 99 goto err;
103 } 100 }
@@ -107,8 +104,7 @@ int PKCS5_pbe_set0_algor(X509_ALGOR *algor, int alg, int iter,
107 else if (RAND_pseudo_bytes(sstr, saltlen) < 0) 104 else if (RAND_pseudo_bytes(sstr, saltlen) < 0)
108 goto err; 105 goto err;
109 106
110 if(!ASN1_item_pack(pbe, ASN1_ITEM_rptr(PBEPARAM), &pbe_str)) 107 if(!ASN1_item_pack(pbe, ASN1_ITEM_rptr(PBEPARAM), &pbe_str)) {
111 {
112 ASN1err(ASN1_F_PKCS5_PBE_SET0_ALGOR,ERR_R_MALLOC_FAILURE); 108 ASN1err(ASN1_F_PKCS5_PBE_SET0_ALGOR,ERR_R_MALLOC_FAILURE);
113 goto err; 109 goto err;
114 } 110 }
@@ -134,8 +130,7 @@ X509_ALGOR *PKCS5_pbe_set(int alg, int iter,
134{ 130{
135 X509_ALGOR *ret; 131 X509_ALGOR *ret;
136 ret = X509_ALGOR_new(); 132 ret = X509_ALGOR_new();
137 if (!ret) 133 if (!ret) {
138 {
139 ASN1err(ASN1_F_PKCS5_PBE_SET,ERR_R_MALLOC_FAILURE); 134 ASN1err(ASN1_F_PKCS5_PBE_SET,ERR_R_MALLOC_FAILURE);
140 return NULL; 135 return NULL;
141 } 136 }