diff options
Diffstat (limited to 'src/lib/libcrypto/asn1/x_name.c')
-rw-r--r-- | src/lib/libcrypto/asn1/x_name.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/src/lib/libcrypto/asn1/x_name.c b/src/lib/libcrypto/asn1/x_name.c index 31f3377b64..caece0f158 100644 --- a/src/lib/libcrypto/asn1/x_name.c +++ b/src/lib/libcrypto/asn1/x_name.c | |||
@@ -160,22 +160,21 @@ static int x509_name_ex_d2i(ASN1_VALUE **val, unsigned char **in, long len, cons | |||
160 | int tag, int aclass, char opt, ASN1_TLC *ctx) | 160 | int tag, int aclass, char opt, ASN1_TLC *ctx) |
161 | { | 161 | { |
162 | unsigned char *p = *in, *q; | 162 | unsigned char *p = *in, *q; |
163 | STACK *intname = NULL, **intname_pp = &intname; | 163 | STACK *intname = NULL; |
164 | int i, j, ret; | 164 | int i, j, ret; |
165 | X509_NAME *nm = NULL, **nm_pp = &nm; | 165 | X509_NAME *nm = NULL; |
166 | STACK_OF(X509_NAME_ENTRY) *entries; | 166 | STACK_OF(X509_NAME_ENTRY) *entries; |
167 | X509_NAME_ENTRY *entry; | 167 | X509_NAME_ENTRY *entry; |
168 | q = p; | 168 | q = p; |
169 | 169 | ||
170 | /* Get internal representation of Name */ | 170 | /* Get internal representation of Name */ |
171 | ret = ASN1_item_ex_d2i((ASN1_VALUE **)intname_pp, | 171 | ret = ASN1_item_ex_d2i((ASN1_VALUE **)&intname, &p, len, ASN1_ITEM_rptr(X509_NAME_INTERNAL), |
172 | &p, len, ASN1_ITEM_rptr(X509_NAME_INTERNAL), | 172 | tag, aclass, opt, ctx); |
173 | tag, aclass, opt, ctx); | ||
174 | 173 | ||
175 | if(ret <= 0) return ret; | 174 | if(ret <= 0) return ret; |
176 | 175 | ||
177 | if(*val) x509_name_ex_free(val, NULL); | 176 | if(*val) x509_name_ex_free(val, NULL); |
178 | if(!x509_name_ex_new((ASN1_VALUE **)nm_pp, NULL)) goto err; | 177 | if(!x509_name_ex_new((ASN1_VALUE **)&nm, NULL)) goto err; |
179 | /* We've decoded it: now cache encoding */ | 178 | /* We've decoded it: now cache encoding */ |
180 | if(!BUF_MEM_grow(nm->bytes, p - q)) goto err; | 179 | if(!BUF_MEM_grow(nm->bytes, p - q)) goto err; |
181 | memcpy(nm->bytes->data, q, p - q); | 180 | memcpy(nm->bytes->data, q, p - q); |
@@ -219,7 +218,7 @@ static int x509_name_ex_i2d(ASN1_VALUE **val, unsigned char **out, const ASN1_IT | |||
219 | 218 | ||
220 | static int x509_name_encode(X509_NAME *a) | 219 | static int x509_name_encode(X509_NAME *a) |
221 | { | 220 | { |
222 | STACK *intname = NULL, **intname_pp = &intname; | 221 | STACK *intname = NULL; |
223 | int len; | 222 | int len; |
224 | unsigned char *p; | 223 | unsigned char *p; |
225 | STACK_OF(X509_NAME_ENTRY) *entries = NULL; | 224 | STACK_OF(X509_NAME_ENTRY) *entries = NULL; |
@@ -237,12 +236,10 @@ static int x509_name_encode(X509_NAME *a) | |||
237 | } | 236 | } |
238 | if(!sk_X509_NAME_ENTRY_push(entries, entry)) goto memerr; | 237 | if(!sk_X509_NAME_ENTRY_push(entries, entry)) goto memerr; |
239 | } | 238 | } |
240 | len = ASN1_item_ex_i2d((ASN1_VALUE **)intname_pp, NULL, | 239 | len = ASN1_item_ex_i2d((ASN1_VALUE **)&intname, NULL, ASN1_ITEM_rptr(X509_NAME_INTERNAL), -1, -1); |
241 | ASN1_ITEM_rptr(X509_NAME_INTERNAL), -1, -1); | ||
242 | if (!BUF_MEM_grow(a->bytes,len)) goto memerr; | 240 | if (!BUF_MEM_grow(a->bytes,len)) goto memerr; |
243 | p=(unsigned char *)a->bytes->data; | 241 | p=(unsigned char *)a->bytes->data; |
244 | ASN1_item_ex_i2d((ASN1_VALUE **)intname_pp, | 242 | ASN1_item_ex_i2d((ASN1_VALUE **)&intname, &p, ASN1_ITEM_rptr(X509_NAME_INTERNAL), -1, -1); |
245 | &p, ASN1_ITEM_rptr(X509_NAME_INTERNAL), -1, -1); | ||
246 | sk_pop_free(intname, sk_internal_free); | 243 | sk_pop_free(intname, sk_internal_free); |
247 | a->modified = 0; | 244 | a->modified = 0; |
248 | return len; | 245 | return len; |