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, 8 insertions, 7 deletions
diff --git a/src/lib/libcrypto/asn1/p5_pbe.c b/src/lib/libcrypto/asn1/p5_pbe.c
index ec788267e0..da91170094 100644
--- a/src/lib/libcrypto/asn1/p5_pbe.c
+++ b/src/lib/libcrypto/asn1/p5_pbe.c
@@ -82,17 +82,17 @@ X509_ALGOR *PKCS5_pbe_set(int alg, int iter, unsigned char *salt,
82 ASN1_TYPE *astype=NULL; 82 ASN1_TYPE *astype=NULL;
83 83
84 if (!(pbe = PBEPARAM_new ())) { 84 if (!(pbe = PBEPARAM_new ())) {
85 ASN1err(ASN1_F_ASN1_PBE_SET,ERR_R_MALLOC_FAILURE); 85 ASN1err(ASN1_F_PKCS5_PBE_SET,ERR_R_MALLOC_FAILURE);
86 goto err; 86 goto err;
87 } 87 }
88 if(iter <= 0) iter = PKCS5_DEFAULT_ITER; 88 if(iter <= 0) iter = PKCS5_DEFAULT_ITER;
89 if (!ASN1_INTEGER_set(pbe->iter, iter)) { 89 if (!ASN1_INTEGER_set(pbe->iter, iter)) {
90 ASN1err(ASN1_F_ASN1_PBE_SET,ERR_R_MALLOC_FAILURE); 90 ASN1err(ASN1_F_PKCS5_PBE_SET,ERR_R_MALLOC_FAILURE);
91 goto err; 91 goto err;
92 } 92 }
93 if (!saltlen) saltlen = PKCS5_SALT_LEN; 93 if (!saltlen) saltlen = PKCS5_SALT_LEN;
94 if (!(pbe->salt->data = OPENSSL_malloc (saltlen))) { 94 if (!(pbe->salt->data = OPENSSL_malloc (saltlen))) {
95 ASN1err(ASN1_F_ASN1_PBE_SET,ERR_R_MALLOC_FAILURE); 95 ASN1err(ASN1_F_PKCS5_PBE_SET,ERR_R_MALLOC_FAILURE);
96 goto err; 96 goto err;
97 } 97 }
98 pbe->salt->length = saltlen; 98 pbe->salt->length = saltlen;
@@ -101,13 +101,14 @@ X509_ALGOR *PKCS5_pbe_set(int alg, int iter, unsigned char *salt,
101 goto err; 101 goto err;
102 102
103 if (!(astype = ASN1_TYPE_new())) { 103 if (!(astype = ASN1_TYPE_new())) {
104 ASN1err(ASN1_F_ASN1_PBE_SET,ERR_R_MALLOC_FAILURE); 104 ASN1err(ASN1_F_PKCS5_PBE_SET,ERR_R_MALLOC_FAILURE);
105 goto err; 105 goto err;
106 } 106 }
107 107
108 astype->type = V_ASN1_SEQUENCE; 108 astype->type = V_ASN1_SEQUENCE;
109 if(!ASN1_pack_string(pbe, i2d_PBEPARAM, &astype->value.sequence)) { 109 if(!ASN1_pack_string_of(PBEPARAM, pbe, i2d_PBEPARAM,
110 ASN1err(ASN1_F_ASN1_PBE_SET,ERR_R_MALLOC_FAILURE); 110 &astype->value.sequence)) {
111 ASN1err(ASN1_F_PKCS5_PBE_SET,ERR_R_MALLOC_FAILURE);
111 goto err; 112 goto err;
112 } 113 }
113 PBEPARAM_free (pbe); 114 PBEPARAM_free (pbe);
@@ -115,7 +116,7 @@ X509_ALGOR *PKCS5_pbe_set(int alg, int iter, unsigned char *salt,
115 116
116 al = OBJ_nid2obj(alg); /* never need to free al */ 117 al = OBJ_nid2obj(alg); /* never need to free al */
117 if (!(algor = X509_ALGOR_new())) { 118 if (!(algor = X509_ALGOR_new())) {
118 ASN1err(ASN1_F_ASN1_PBE_SET,ERR_R_MALLOC_FAILURE); 119 ASN1err(ASN1_F_PKCS5_PBE_SET,ERR_R_MALLOC_FAILURE);
119 goto err; 120 goto err;
120 } 121 }
121 ASN1_OBJECT_free(algor->algorithm); 122 ASN1_OBJECT_free(algor->algorithm);