diff options
Diffstat (limited to 'src/lib/libcrypto/x509v3/v3_cpols.c')
-rw-r--r-- | src/lib/libcrypto/x509v3/v3_cpols.c | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/src/lib/libcrypto/x509v3/v3_cpols.c b/src/lib/libcrypto/x509v3/v3_cpols.c index 466713b50d..8203ed7571 100644 --- a/src/lib/libcrypto/x509v3/v3_cpols.c +++ b/src/lib/libcrypto/x509v3/v3_cpols.c | |||
@@ -73,7 +73,7 @@ static POLICYINFO *policy_section(X509V3_CTX *ctx, | |||
73 | STACK_OF(CONF_VALUE) *polstrs, int ia5org); | 73 | STACK_OF(CONF_VALUE) *polstrs, int ia5org); |
74 | static POLICYQUALINFO *notice_section(X509V3_CTX *ctx, | 74 | static POLICYQUALINFO *notice_section(X509V3_CTX *ctx, |
75 | STACK_OF(CONF_VALUE) *unot, int ia5org); | 75 | STACK_OF(CONF_VALUE) *unot, int ia5org); |
76 | static STACK *nref_nos(STACK_OF(CONF_VALUE) *nos); | 76 | static STACK_OF(ASN1_INTEGER) *nref_nos(STACK_OF(CONF_VALUE) *nos); |
77 | 77 | ||
78 | X509V3_EXT_METHOD v3_cpols = { | 78 | X509V3_EXT_METHOD v3_cpols = { |
79 | NID_certificate_policies, 0, | 79 | NID_certificate_policies, 0, |
@@ -282,20 +282,22 @@ static POLICYQUALINFO *notice_section(X509V3_CTX *ctx, | |||
282 | return NULL; | 282 | return NULL; |
283 | } | 283 | } |
284 | 284 | ||
285 | static STACK *nref_nos(STACK_OF(CONF_VALUE) *nos) | 285 | static STACK_OF(ASN1_INTEGER) *nref_nos(STACK_OF(CONF_VALUE) *nos) |
286 | { | 286 | { |
287 | STACK *nnums; | 287 | STACK_OF(ASN1_INTEGER) *nnums; |
288 | CONF_VALUE *cnf; | 288 | CONF_VALUE *cnf; |
289 | ASN1_INTEGER *aint; | 289 | ASN1_INTEGER *aint; |
290 | |||
290 | int i; | 291 | int i; |
291 | if(!(nnums = sk_new_null())) goto merr; | 292 | |
293 | if(!(nnums = sk_ASN1_INTEGER_new_null())) goto merr; | ||
292 | for(i = 0; i < sk_CONF_VALUE_num(nos); i++) { | 294 | for(i = 0; i < sk_CONF_VALUE_num(nos); i++) { |
293 | cnf = sk_CONF_VALUE_value(nos, i); | 295 | cnf = sk_CONF_VALUE_value(nos, i); |
294 | if(!(aint = s2i_ASN1_INTEGER(NULL, cnf->name))) { | 296 | if(!(aint = s2i_ASN1_INTEGER(NULL, cnf->name))) { |
295 | X509V3err(X509V3_F_NREF_NOS,X509V3_R_INVALID_NUMBER); | 297 | X509V3err(X509V3_F_NREF_NOS,X509V3_R_INVALID_NUMBER); |
296 | goto err; | 298 | goto err; |
297 | } | 299 | } |
298 | if(!sk_push(nnums, (char *)aint)) goto merr; | 300 | if(!sk_ASN1_INTEGER_push(nnums, aint)) goto merr; |
299 | } | 301 | } |
300 | return nnums; | 302 | return nnums; |
301 | 303 | ||
@@ -303,7 +305,7 @@ static STACK *nref_nos(STACK_OF(CONF_VALUE) *nos) | |||
303 | X509V3err(X509V3_F_NOTICE_SECTION,ERR_R_MALLOC_FAILURE); | 305 | X509V3err(X509V3_F_NOTICE_SECTION,ERR_R_MALLOC_FAILURE); |
304 | 306 | ||
305 | err: | 307 | err: |
306 | sk_pop_free(nnums, ASN1_STRING_free); | 308 | sk_ASN1_INTEGER_pop_free(nnums, ASN1_STRING_free); |
307 | return NULL; | 309 | return NULL; |
308 | } | 310 | } |
309 | 311 | ||
@@ -399,7 +401,7 @@ void POLICYINFO_free(POLICYINFO *a) | |||
399 | if (a == NULL) return; | 401 | if (a == NULL) return; |
400 | ASN1_OBJECT_free(a->policyid); | 402 | ASN1_OBJECT_free(a->policyid); |
401 | sk_POLICYQUALINFO_pop_free(a->qualifiers, POLICYQUALINFO_free); | 403 | sk_POLICYQUALINFO_pop_free(a->qualifiers, POLICYQUALINFO_free); |
402 | Free (a); | 404 | OPENSSL_free (a); |
403 | } | 405 | } |
404 | 406 | ||
405 | static void print_qualifiers(BIO *out, STACK_OF(POLICYQUALINFO) *quals, | 407 | static void print_qualifiers(BIO *out, STACK_OF(POLICYQUALINFO) *quals, |
@@ -441,15 +443,15 @@ static void print_notice(BIO *out, USERNOTICE *notice, int indent) | |||
441 | BIO_printf(out, "%*sOrganization: %s\n", indent, "", | 443 | BIO_printf(out, "%*sOrganization: %s\n", indent, "", |
442 | ref->organization->data); | 444 | ref->organization->data); |
443 | BIO_printf(out, "%*sNumber%s: ", indent, "", | 445 | BIO_printf(out, "%*sNumber%s: ", indent, "", |
444 | (sk_num(ref->noticenos) > 1) ? "s" : ""); | 446 | sk_ASN1_INTEGER_num(ref->noticenos) > 1 ? "s" : ""); |
445 | for(i = 0; i < sk_num(ref->noticenos); i++) { | 447 | for(i = 0; i < sk_ASN1_INTEGER_num(ref->noticenos); i++) { |
446 | ASN1_INTEGER *num; | 448 | ASN1_INTEGER *num; |
447 | char *tmp; | 449 | char *tmp; |
448 | num = (ASN1_INTEGER *)sk_value(ref->noticenos, i); | 450 | num = sk_ASN1_INTEGER_value(ref->noticenos, i); |
449 | if(i) BIO_puts(out, ", "); | 451 | if(i) BIO_puts(out, ", "); |
450 | tmp = i2s_ASN1_INTEGER(NULL, num); | 452 | tmp = i2s_ASN1_INTEGER(NULL, num); |
451 | BIO_puts(out, tmp); | 453 | BIO_puts(out, tmp); |
452 | Free(tmp); | 454 | OPENSSL_free(tmp); |
453 | } | 455 | } |
454 | BIO_puts(out, "\n"); | 456 | BIO_puts(out, "\n"); |
455 | } | 457 | } |
@@ -551,7 +553,7 @@ void POLICYQUALINFO_free(POLICYQUALINFO *a) | |||
551 | } | 553 | } |
552 | 554 | ||
553 | ASN1_OBJECT_free(a->pqualid); | 555 | ASN1_OBJECT_free(a->pqualid); |
554 | Free (a); | 556 | OPENSSL_free (a); |
555 | } | 557 | } |
556 | 558 | ||
557 | int i2d_USERNOTICE(USERNOTICE *a, unsigned char **pp) | 559 | int i2d_USERNOTICE(USERNOTICE *a, unsigned char **pp) |
@@ -597,7 +599,7 @@ void USERNOTICE_free(USERNOTICE *a) | |||
597 | if (a == NULL) return; | 599 | if (a == NULL) return; |
598 | NOTICEREF_free(a->noticeref); | 600 | NOTICEREF_free(a->noticeref); |
599 | M_DISPLAYTEXT_free(a->exptext); | 601 | M_DISPLAYTEXT_free(a->exptext); |
600 | Free (a); | 602 | OPENSSL_free (a); |
601 | } | 603 | } |
602 | 604 | ||
603 | int i2d_NOTICEREF(NOTICEREF *a, unsigned char **pp) | 605 | int i2d_NOTICEREF(NOTICEREF *a, unsigned char **pp) |
@@ -605,12 +607,14 @@ int i2d_NOTICEREF(NOTICEREF *a, unsigned char **pp) | |||
605 | M_ASN1_I2D_vars(a); | 607 | M_ASN1_I2D_vars(a); |
606 | 608 | ||
607 | M_ASN1_I2D_len (a->organization, i2d_DISPLAYTEXT); | 609 | M_ASN1_I2D_len (a->organization, i2d_DISPLAYTEXT); |
608 | M_ASN1_I2D_len_SEQUENCE(a->noticenos, i2d_ASN1_INTEGER); | 610 | M_ASN1_I2D_len_SEQUENCE_type(ASN1_INTEGER, a->noticenos, |
611 | i2d_ASN1_INTEGER); | ||
609 | 612 | ||
610 | M_ASN1_I2D_seq_total(); | 613 | M_ASN1_I2D_seq_total(); |
611 | 614 | ||
612 | M_ASN1_I2D_put (a->organization, i2d_DISPLAYTEXT); | 615 | M_ASN1_I2D_put (a->organization, i2d_DISPLAYTEXT); |
613 | M_ASN1_I2D_put_SEQUENCE(a->noticenos, i2d_ASN1_INTEGER); | 616 | M_ASN1_I2D_put_SEQUENCE_type(ASN1_INTEGER, a->noticenos, |
617 | i2d_ASN1_INTEGER); | ||
614 | 618 | ||
615 | M_ASN1_I2D_finish(); | 619 | M_ASN1_I2D_finish(); |
616 | } | 620 | } |
@@ -639,7 +643,8 @@ NOTICEREF *d2i_NOTICEREF(NOTICEREF **a, unsigned char **pp,long length) | |||
639 | if(!ret->organization) { | 643 | if(!ret->organization) { |
640 | M_ASN1_D2I_get(ret->organization, d2i_DISPLAYTEXT); | 644 | M_ASN1_D2I_get(ret->organization, d2i_DISPLAYTEXT); |
641 | } | 645 | } |
642 | M_ASN1_D2I_get_seq(ret->noticenos, d2i_ASN1_INTEGER, ASN1_STRING_free); | 646 | M_ASN1_D2I_get_seq_type(ASN1_INTEGER, ret->noticenos, d2i_ASN1_INTEGER, |
647 | ASN1_STRING_free); | ||
643 | M_ASN1_D2I_Finish(a, NOTICEREF_free, ASN1_F_D2I_NOTICEREF); | 648 | M_ASN1_D2I_Finish(a, NOTICEREF_free, ASN1_F_D2I_NOTICEREF); |
644 | } | 649 | } |
645 | 650 | ||
@@ -647,8 +652,8 @@ void NOTICEREF_free(NOTICEREF *a) | |||
647 | { | 652 | { |
648 | if (a == NULL) return; | 653 | if (a == NULL) return; |
649 | M_DISPLAYTEXT_free(a->organization); | 654 | M_DISPLAYTEXT_free(a->organization); |
650 | sk_pop_free(a->noticenos, ASN1_STRING_free); | 655 | sk_ASN1_INTEGER_pop_free(a->noticenos, ASN1_STRING_free); |
651 | Free (a); | 656 | OPENSSL_free (a); |
652 | } | 657 | } |
653 | 658 | ||
654 | IMPLEMENT_STACK_OF(POLICYQUALINFO) | 659 | IMPLEMENT_STACK_OF(POLICYQUALINFO) |