diff options
author | djm <> | 2010-10-01 22:59:01 +0000 |
---|---|---|
committer | djm <> | 2010-10-01 22:59:01 +0000 |
commit | fe047d8b632246cb2db3234a0a4f32e5c318857b (patch) | |
tree | 939b752540947d33507b3acc48d76a8bfb7c3dc3 /src/lib/libcrypto/x509/x509_req.c | |
parent | 2ea67f4aa254b09ded62e6e14fc893bbe6381579 (diff) | |
download | openbsd-fe047d8b632246cb2db3234a0a4f32e5c318857b.tar.gz openbsd-fe047d8b632246cb2db3234a0a4f32e5c318857b.tar.bz2 openbsd-fe047d8b632246cb2db3234a0a4f32e5c318857b.zip |
resolve conflicts, fix local changes
Diffstat (limited to 'src/lib/libcrypto/x509/x509_req.c')
-rw-r--r-- | src/lib/libcrypto/x509/x509_req.c | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/src/lib/libcrypto/x509/x509_req.c b/src/lib/libcrypto/x509/x509_req.c index 3872e1fb64..48183dc00c 100644 --- a/src/lib/libcrypto/x509/x509_req.c +++ b/src/lib/libcrypto/x509/x509_req.c | |||
@@ -61,6 +61,7 @@ | |||
61 | #include <openssl/bn.h> | 61 | #include <openssl/bn.h> |
62 | #include <openssl/evp.h> | 62 | #include <openssl/evp.h> |
63 | #include <openssl/asn1.h> | 63 | #include <openssl/asn1.h> |
64 | #include <openssl/asn1t.h> | ||
64 | #include <openssl/x509.h> | 65 | #include <openssl/x509.h> |
65 | #include <openssl/objects.h> | 66 | #include <openssl/objects.h> |
66 | #include <openssl/buffer.h> | 67 | #include <openssl/buffer.h> |
@@ -205,10 +206,9 @@ STACK_OF(X509_EXTENSION) *X509_REQ_get_extensions(X509_REQ *req) | |||
205 | if(!ext || (ext->type != V_ASN1_SEQUENCE)) | 206 | if(!ext || (ext->type != V_ASN1_SEQUENCE)) |
206 | return NULL; | 207 | return NULL; |
207 | p = ext->value.sequence->data; | 208 | p = ext->value.sequence->data; |
208 | return d2i_ASN1_SET_OF_X509_EXTENSION(NULL, &p, | 209 | return (STACK_OF(X509_EXTENSION) *) |
209 | ext->value.sequence->length, | 210 | ASN1_item_d2i(NULL, &p, ext->value.sequence->length, |
210 | d2i_X509_EXTENSION, X509_EXTENSION_free, | 211 | ASN1_ITEM_rptr(X509_EXTENSIONS)); |
211 | V_ASN1_SEQUENCE, V_ASN1_UNIVERSAL); | ||
212 | } | 212 | } |
213 | 213 | ||
214 | /* Add a STACK_OF extensions to a certificate request: allow alternative OIDs | 214 | /* Add a STACK_OF extensions to a certificate request: allow alternative OIDs |
@@ -218,8 +218,6 @@ STACK_OF(X509_EXTENSION) *X509_REQ_get_extensions(X509_REQ *req) | |||
218 | int X509_REQ_add_extensions_nid(X509_REQ *req, STACK_OF(X509_EXTENSION) *exts, | 218 | int X509_REQ_add_extensions_nid(X509_REQ *req, STACK_OF(X509_EXTENSION) *exts, |
219 | int nid) | 219 | int nid) |
220 | { | 220 | { |
221 | unsigned char *p = NULL, *q; | ||
222 | long len; | ||
223 | ASN1_TYPE *at = NULL; | 221 | ASN1_TYPE *at = NULL; |
224 | X509_ATTRIBUTE *attr = NULL; | 222 | X509_ATTRIBUTE *attr = NULL; |
225 | if(!(at = ASN1_TYPE_new()) || | 223 | if(!(at = ASN1_TYPE_new()) || |
@@ -227,15 +225,10 @@ int X509_REQ_add_extensions_nid(X509_REQ *req, STACK_OF(X509_EXTENSION) *exts, | |||
227 | 225 | ||
228 | at->type = V_ASN1_SEQUENCE; | 226 | at->type = V_ASN1_SEQUENCE; |
229 | /* Generate encoding of extensions */ | 227 | /* Generate encoding of extensions */ |
230 | len = i2d_ASN1_SET_OF_X509_EXTENSION(exts, NULL, i2d_X509_EXTENSION, | 228 | at->value.sequence->length = |
231 | V_ASN1_SEQUENCE, V_ASN1_UNIVERSAL, IS_SEQUENCE); | 229 | ASN1_item_i2d((ASN1_VALUE *)exts, |
232 | if(!(p = OPENSSL_malloc(len))) goto err; | 230 | &at->value.sequence->data, |
233 | q = p; | 231 | ASN1_ITEM_rptr(X509_EXTENSIONS)); |
234 | i2d_ASN1_SET_OF_X509_EXTENSION(exts, &q, i2d_X509_EXTENSION, | ||
235 | V_ASN1_SEQUENCE, V_ASN1_UNIVERSAL, IS_SEQUENCE); | ||
236 | at->value.sequence->data = p; | ||
237 | p = NULL; | ||
238 | at->value.sequence->length = len; | ||
239 | if(!(attr = X509_ATTRIBUTE_new())) goto err; | 232 | if(!(attr = X509_ATTRIBUTE_new())) goto err; |
240 | if(!(attr->value.set = sk_ASN1_TYPE_new_null())) goto err; | 233 | if(!(attr->value.set = sk_ASN1_TYPE_new_null())) goto err; |
241 | if(!sk_ASN1_TYPE_push(attr->value.set, at)) goto err; | 234 | if(!sk_ASN1_TYPE_push(attr->value.set, at)) goto err; |
@@ -250,7 +243,6 @@ int X509_REQ_add_extensions_nid(X509_REQ *req, STACK_OF(X509_EXTENSION) *exts, | |||
250 | if(!sk_X509_ATTRIBUTE_push(req->req_info->attributes, attr)) goto err; | 243 | if(!sk_X509_ATTRIBUTE_push(req->req_info->attributes, attr)) goto err; |
251 | return 1; | 244 | return 1; |
252 | err: | 245 | err: |
253 | if(p) OPENSSL_free(p); | ||
254 | X509_ATTRIBUTE_free(attr); | 246 | X509_ATTRIBUTE_free(attr); |
255 | ASN1_TYPE_free(at); | 247 | ASN1_TYPE_free(at); |
256 | return 0; | 248 | return 0; |