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/asn1/asn1_lib.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/asn1/asn1_lib.c')
-rw-r--r-- | src/lib/libcrypto/asn1/asn1_lib.c | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/src/lib/libcrypto/asn1/asn1_lib.c b/src/lib/libcrypto/asn1/asn1_lib.c index 5af559ef8d..1bcb44aee2 100644 --- a/src/lib/libcrypto/asn1/asn1_lib.c +++ b/src/lib/libcrypto/asn1/asn1_lib.c | |||
@@ -340,20 +340,31 @@ int asn1_GetSequence(ASN1_const_CTX *c, long *length) | |||
340 | return(1); | 340 | return(1); |
341 | } | 341 | } |
342 | 342 | ||
343 | ASN1_STRING *ASN1_STRING_dup(ASN1_STRING *str) | 343 | int ASN1_STRING_copy(ASN1_STRING *dst, const ASN1_STRING *str) |
344 | { | 344 | { |
345 | ASN1_STRING *ret; | 345 | if (str == NULL) |
346 | return 0; | ||
347 | dst->type = str->type; | ||
348 | if (!ASN1_STRING_set(dst,str->data,str->length)) | ||
349 | return 0; | ||
350 | dst->flags = str->flags; | ||
351 | return 1; | ||
352 | } | ||
346 | 353 | ||
347 | if (str == NULL) return(NULL); | 354 | ASN1_STRING *ASN1_STRING_dup(const ASN1_STRING *str) |
348 | if ((ret=ASN1_STRING_type_new(str->type)) == NULL) | 355 | { |
349 | return(NULL); | 356 | ASN1_STRING *ret; |
350 | if (!ASN1_STRING_set(ret,str->data,str->length)) | 357 | if (!str) |
358 | return NULL; | ||
359 | ret=ASN1_STRING_new(); | ||
360 | if (!ret) | ||
361 | return NULL; | ||
362 | if (!ASN1_STRING_copy(ret,str)) | ||
351 | { | 363 | { |
352 | ASN1_STRING_free(ret); | 364 | ASN1_STRING_free(ret); |
353 | return(NULL); | 365 | return NULL; |
354 | } | 366 | } |
355 | ret->flags = str->flags; | 367 | return ret; |
356 | return(ret); | ||
357 | } | 368 | } |
358 | 369 | ||
359 | int ASN1_STRING_set(ASN1_STRING *str, const void *_data, int len) | 370 | int ASN1_STRING_set(ASN1_STRING *str, const void *_data, int len) |
@@ -427,11 +438,12 @@ ASN1_STRING *ASN1_STRING_type_new(int type) | |||
427 | void ASN1_STRING_free(ASN1_STRING *a) | 438 | void ASN1_STRING_free(ASN1_STRING *a) |
428 | { | 439 | { |
429 | if (a == NULL) return; | 440 | if (a == NULL) return; |
430 | if (a->data != NULL) OPENSSL_free(a->data); | 441 | if (a->data && !(a->flags & ASN1_STRING_FLAG_NDEF)) |
442 | OPENSSL_free(a->data); | ||
431 | OPENSSL_free(a); | 443 | OPENSSL_free(a); |
432 | } | 444 | } |
433 | 445 | ||
434 | int ASN1_STRING_cmp(ASN1_STRING *a, ASN1_STRING *b) | 446 | int ASN1_STRING_cmp(const ASN1_STRING *a, const ASN1_STRING *b) |
435 | { | 447 | { |
436 | int i; | 448 | int i; |
437 | 449 | ||
@@ -457,7 +469,7 @@ void asn1_add_error(const unsigned char *address, int offset) | |||
457 | ERR_add_error_data(4,"address=",buf1," offset=",buf2); | 469 | ERR_add_error_data(4,"address=",buf1," offset=",buf2); |
458 | } | 470 | } |
459 | 471 | ||
460 | int ASN1_STRING_length(ASN1_STRING *x) | 472 | int ASN1_STRING_length(const ASN1_STRING *x) |
461 | { return M_ASN1_STRING_length(x); } | 473 | { return M_ASN1_STRING_length(x); } |
462 | 474 | ||
463 | void ASN1_STRING_length_set(ASN1_STRING *x, int len) | 475 | void ASN1_STRING_length_set(ASN1_STRING *x, int len) |