diff options
Diffstat (limited to 'lib/libcrypto/x509v3/v3_cpols.c')
-rw-r--r-- | lib/libcrypto/x509v3/v3_cpols.c | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/lib/libcrypto/x509v3/v3_cpols.c b/lib/libcrypto/x509v3/v3_cpols.c index 466713b50d9..8203ed7571a 100644 --- a/lib/libcrypto/x509v3/v3_cpols.c +++ b/lib/libcrypto/x509v3/v3_cpols.c @@ -73,7 +73,7 @@ static POLICYINFO *policy_section(X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *polstrs, int ia5org); static POLICYQUALINFO *notice_section(X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *unot, int ia5org); -static STACK *nref_nos(STACK_OF(CONF_VALUE) *nos); +static STACK_OF(ASN1_INTEGER) *nref_nos(STACK_OF(CONF_VALUE) *nos); X509V3_EXT_METHOD v3_cpols = { NID_certificate_policies, 0, @@ -282,20 +282,22 @@ static POLICYQUALINFO *notice_section(X509V3_CTX *ctx, return NULL; } -static STACK *nref_nos(STACK_OF(CONF_VALUE) *nos) +static STACK_OF(ASN1_INTEGER) *nref_nos(STACK_OF(CONF_VALUE) *nos) { - STACK *nnums; + STACK_OF(ASN1_INTEGER) *nnums; CONF_VALUE *cnf; ASN1_INTEGER *aint; + int i; - if(!(nnums = sk_new_null())) goto merr; + + if(!(nnums = sk_ASN1_INTEGER_new_null())) goto merr; for(i = 0; i < sk_CONF_VALUE_num(nos); i++) { cnf = sk_CONF_VALUE_value(nos, i); if(!(aint = s2i_ASN1_INTEGER(NULL, cnf->name))) { X509V3err(X509V3_F_NREF_NOS,X509V3_R_INVALID_NUMBER); goto err; } - if(!sk_push(nnums, (char *)aint)) goto merr; + if(!sk_ASN1_INTEGER_push(nnums, aint)) goto merr; } return nnums; @@ -303,7 +305,7 @@ static STACK *nref_nos(STACK_OF(CONF_VALUE) *nos) X509V3err(X509V3_F_NOTICE_SECTION,ERR_R_MALLOC_FAILURE); err: - sk_pop_free(nnums, ASN1_STRING_free); + sk_ASN1_INTEGER_pop_free(nnums, ASN1_STRING_free); return NULL; } @@ -399,7 +401,7 @@ void POLICYINFO_free(POLICYINFO *a) if (a == NULL) return; ASN1_OBJECT_free(a->policyid); sk_POLICYQUALINFO_pop_free(a->qualifiers, POLICYQUALINFO_free); - Free (a); + OPENSSL_free (a); } static void print_qualifiers(BIO *out, STACK_OF(POLICYQUALINFO) *quals, @@ -441,15 +443,15 @@ static void print_notice(BIO *out, USERNOTICE *notice, int indent) BIO_printf(out, "%*sOrganization: %s\n", indent, "", ref->organization->data); BIO_printf(out, "%*sNumber%s: ", indent, "", - (sk_num(ref->noticenos) > 1) ? "s" : ""); - for(i = 0; i < sk_num(ref->noticenos); i++) { + sk_ASN1_INTEGER_num(ref->noticenos) > 1 ? "s" : ""); + for(i = 0; i < sk_ASN1_INTEGER_num(ref->noticenos); i++) { ASN1_INTEGER *num; char *tmp; - num = (ASN1_INTEGER *)sk_value(ref->noticenos, i); + num = sk_ASN1_INTEGER_value(ref->noticenos, i); if(i) BIO_puts(out, ", "); tmp = i2s_ASN1_INTEGER(NULL, num); BIO_puts(out, tmp); - Free(tmp); + OPENSSL_free(tmp); } BIO_puts(out, "\n"); } @@ -551,7 +553,7 @@ void POLICYQUALINFO_free(POLICYQUALINFO *a) } ASN1_OBJECT_free(a->pqualid); - Free (a); + OPENSSL_free (a); } int i2d_USERNOTICE(USERNOTICE *a, unsigned char **pp) @@ -597,7 +599,7 @@ void USERNOTICE_free(USERNOTICE *a) if (a == NULL) return; NOTICEREF_free(a->noticeref); M_DISPLAYTEXT_free(a->exptext); - Free (a); + OPENSSL_free (a); } int i2d_NOTICEREF(NOTICEREF *a, unsigned char **pp) @@ -605,12 +607,14 @@ int i2d_NOTICEREF(NOTICEREF *a, unsigned char **pp) M_ASN1_I2D_vars(a); M_ASN1_I2D_len (a->organization, i2d_DISPLAYTEXT); - M_ASN1_I2D_len_SEQUENCE(a->noticenos, i2d_ASN1_INTEGER); + M_ASN1_I2D_len_SEQUENCE_type(ASN1_INTEGER, a->noticenos, + i2d_ASN1_INTEGER); M_ASN1_I2D_seq_total(); M_ASN1_I2D_put (a->organization, i2d_DISPLAYTEXT); - M_ASN1_I2D_put_SEQUENCE(a->noticenos, i2d_ASN1_INTEGER); + M_ASN1_I2D_put_SEQUENCE_type(ASN1_INTEGER, a->noticenos, + i2d_ASN1_INTEGER); M_ASN1_I2D_finish(); } @@ -639,7 +643,8 @@ NOTICEREF *d2i_NOTICEREF(NOTICEREF **a, unsigned char **pp,long length) if(!ret->organization) { M_ASN1_D2I_get(ret->organization, d2i_DISPLAYTEXT); } - M_ASN1_D2I_get_seq(ret->noticenos, d2i_ASN1_INTEGER, ASN1_STRING_free); + M_ASN1_D2I_get_seq_type(ASN1_INTEGER, ret->noticenos, d2i_ASN1_INTEGER, + ASN1_STRING_free); M_ASN1_D2I_Finish(a, NOTICEREF_free, ASN1_F_D2I_NOTICEREF); } @@ -647,8 +652,8 @@ void NOTICEREF_free(NOTICEREF *a) { if (a == NULL) return; M_DISPLAYTEXT_free(a->organization); - sk_pop_free(a->noticenos, ASN1_STRING_free); - Free (a); + sk_ASN1_INTEGER_pop_free(a->noticenos, ASN1_STRING_free); + OPENSSL_free (a); } IMPLEMENT_STACK_OF(POLICYQUALINFO) |