summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/pkcs12/p12_key.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/pkcs12/p12_key.c')
-rw-r--r--src/lib/libcrypto/pkcs12/p12_key.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/lib/libcrypto/pkcs12/p12_key.c b/src/lib/libcrypto/pkcs12/p12_key.c
index 61d58502fd..b3672a95e5 100644
--- a/src/lib/libcrypto/pkcs12/p12_key.c
+++ b/src/lib/libcrypto/pkcs12/p12_key.c
@@ -95,7 +95,7 @@ int PKCS12_key_gen_asc(const char *pass, int passlen, unsigned char *salt,
95 return 0; 95 return 0;
96 if(unipass) { 96 if(unipass) {
97 OPENSSL_cleanse(unipass, uniplen); /* Clear password from memory */ 97 OPENSSL_cleanse(unipass, uniplen); /* Clear password from memory */
98 OPENSSL_free(unipass); 98 free(unipass);
99 } 99 }
100 return ret; 100 return ret;
101} 101}
@@ -135,14 +135,14 @@ int PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt,
135 u = EVP_MD_size (md_type); 135 u = EVP_MD_size (md_type);
136 if (u < 0) 136 if (u < 0)
137 return 0; 137 return 0;
138 D = OPENSSL_malloc (v); 138 D = malloc (v);
139 Ai = OPENSSL_malloc (u); 139 Ai = malloc (u);
140 B = OPENSSL_malloc (v + 1); 140 B = malloc (v + 1);
141 Slen = v * ((saltlen+v-1)/v); 141 Slen = v * ((saltlen+v-1)/v);
142 if(passlen) Plen = v * ((passlen+v-1)/v); 142 if(passlen) Plen = v * ((passlen+v-1)/v);
143 else Plen = 0; 143 else Plen = 0;
144 Ilen = Slen + Plen; 144 Ilen = Slen + Plen;
145 I = OPENSSL_malloc (Ilen); 145 I = malloc (Ilen);
146 Ij = BN_new(); 146 Ij = BN_new();
147 Bpl1 = BN_new(); 147 Bpl1 = BN_new();
148 if (!D || !Ai || !B || !I || !Ij || !Bpl1) 148 if (!D || !Ai || !B || !I || !Ij || !Bpl1)
@@ -209,10 +209,10 @@ err:
209 PKCS12err(PKCS12_F_PKCS12_KEY_GEN_UNI,ERR_R_MALLOC_FAILURE); 209 PKCS12err(PKCS12_F_PKCS12_KEY_GEN_UNI,ERR_R_MALLOC_FAILURE);
210 210
211end: 211end:
212 OPENSSL_free (Ai); 212 free (Ai);
213 OPENSSL_free (B); 213 free (B);
214 OPENSSL_free (D); 214 free (D);
215 OPENSSL_free (I); 215 free (I);
216 BN_free (Ij); 216 BN_free (Ij);
217 BN_free (Bpl1); 217 BN_free (Bpl1);
218 EVP_MD_CTX_cleanup(&ctx); 218 EVP_MD_CTX_cleanup(&ctx);