diff options
author | Rich Salz <rsalz@openssl.org> | 2017-10-06 00:52:12 +0100 |
---|---|---|
committer | Rich Salz <rsalz@openssl.org> | 2018-01-22 11:29:52 -0500 |
commit | fa7435820ee9075fa542baf2577b77f5fd8f801d (patch) | |
tree | 9ad94471417c09f46534ea9cc2c04171782accb8 /crypto | |
parent | 2b1aa1988189773497d6edba443cf77f5c31feba (diff) |
Add accessors for AdmissionSyntax
Based on code from Matthias Ballreich, Steve Henson, and Wolf Tobias.
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/4724)
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/x509v3/v3_admis.c | 152 | ||||
-rw-r--r-- | crypto/x509v3/v3_admis.h | 30 |
2 files changed, 160 insertions, 22 deletions
diff --git a/crypto/x509v3/v3_admis.c b/crypto/x509v3/v3_admis.c index bff5d735db..4871cc84d4 100644 --- a/crypto/x509v3/v3_admis.c +++ b/crypto/x509v3/v3_admis.c @@ -202,3 +202,155 @@ static int i2r_ADMISSION_SYNTAX(const struct v3_ext_method *method, void *in, err: return -1; } + +const ASN1_OBJECT *NAMING_AUTHORITY_get0_authorityId(const NAMING_AUTHORITY *n) +{ + return n->namingAuthorityId; +} + +void NAMING_AUTHORITY_set0_authorityId(NAMING_AUTHORITY *n, ASN1_OBJECT* id) +{ + ASN1_OBJECT_free(n->namingAuthorityId); + n->namingAuthorityId = id; +} + +const ASN1_IA5STRING *NAMING_AUTHORITY_get0_authorityURL( + const NAMING_AUTHORITY *n) +{ + return n->namingAuthorityUrl; +} + +void NAMING_AUTHORITY_set0_authorityURL(NAMING_AUTHORITY *n, ASN1_IA5STRING* u) +{ + ASN1_IA5STRING_free(n->namingAuthorityUrl); + n->namingAuthorityUrl = u; +} + +const ASN1_STRING *NAMING_AUTHORITY_get0_authorityText( + const NAMING_AUTHORITY *n) +{ + return n->namingAuthorityText; +} + +void NAMING_AUTHORITY_set0_authorityText(NAMING_AUTHORITY *n, ASN1_STRING* t) +{ + ASN1_IA5STRING_free(n->namingAuthorityText); + n->namingAuthorityText = t; +} + +const GENERAL_NAME *ADMISSION_SYNTAX_get0_admissionAuthority(const ADMISSION_SYNTAX *as) +{ + return as->admissionAuthority; +} + +void ADMISSION_SYNTAX_set0_admissionAuthority(ADMISSION_SYNTAX *as, + GENERAL_NAME *aa) +{ + GENERAL_NAME_free(as->admissionAuthority); + as->admissionAuthority = aa; +} + +const STACK_OF(ADMISSIONS) *ADMISSION_SYNTAX_get0_contentsOfAdmissions(const ADMISSION_SYNTAX *as) +{ + return as->contentsOfAdmissions; +} + +void ADMISSION_SYNTAX_set0_contentsOfAdmissions(ADMISSION_SYNTAX *as, + STACK_OF(ADMISSIONS) *a) +{ + sk_ADMISSIONS_pop_free(as->contentsOfAdmissions, ADMISSIONS_free); + as->contentsOfAdmissions = a; +} + +const GENERAL_NAME *ADMISSIONS_get0_admissionAuthority(const ADMISSIONS *a) +{ + return a->admissionAuthority; +} + +void ADMISSIONS_set0_admissionAuthority(ADMISSIONS *a, GENERAL_NAME *aa) +{ + GENERAL_NAME_free(a->admissionAuthority); + a->admissionAuthority = aa; +} + +const NAMING_AUTHORITY *ADMISSIONS_get0_namingAuthority(const ADMISSIONS *a) +{ + return a->namingAuthority; +} + +void ADMISSIONS_set0_namingAuthority(ADMISSIONS *a, NAMING_AUTHORITY *na) +{ + NAMING_AUTHORITY_free(a->namingAuthority); + a->namingAuthority = na; +} + +const PROFESSION_INFOS *ADMISSIONS_get0_professionInfos(const ADMISSIONS *a) +{ + return a->professionInfos; +} + +void ADMISSIONS_set0_professionInfos(ADMISSIONS *a, PROFESSION_INFOS *pi) +{ + sk_PROFESSION_INFO_pop_free(a->professionInfos, PROFESSION_INFO_free); + a->professionInfos = pi; +} + +const ASN1_OCTET_STRING *PROFESSION_INFO_get0_addProfessionInfo(const PROFESSION_INFO *pi) +{ + return pi->addProfessionInfo; +} + +void PROFESSION_INFO_set0_addProfessionInfo(PROFESSION_INFO *pi, + ASN1_OCTET_STRING *aos) +{ + ASN1_OCTET_STRING_free(pi->addProfessionInfo); + pi->addProfessionInfo = aos; +} + +const NAMING_AUTHORITY *PROFESSION_INFO_get0_namingAuthority(const PROFESSION_INFO *pi) +{ + return pi->namingAuthority; +} + +void PROFESSION_INFO_set0_namingAuthority(PROFESSION_INFO *pi, + NAMING_AUTHORITY *na) +{ + NAMING_AUTHORITY_free(pi->namingAuthority); + pi->namingAuthority = na; +} + +const STACK_OF(ASN1_STRING) *PROFESSION_INFO_get0_professionItems(const PROFESSION_INFO *pi) +{ + return pi->professionItems; +} + +void PROFESSION_INFO_set0_professionItems(PROFESSION_INFO *pi, + STACK_OF(ASN1_STRING) *as) +{ + sk_ASN1_STRING_pop_free(pi->professionItems, ASN1_STRING_free); + pi->professionItems = as; +} + +const STACK_OF(ASN1_OBJECT) *PROFESSION_INFO_get0_professionOIDs(const PROFESSION_INFO *pi) +{ + return pi->professionOIDs; +} + +void PROFESSION_INFO_set0_professionOIDs(PROFESSION_INFO *pi, + STACK_OF(ASN1_OBJECT) *po) +{ + sk_ASN1_OBJECT_pop_free(pi->professionOIDs, ASN1_OBJECT_free); + pi->professionOIDs = po; +} + +const ASN1_PRINTABLESTRING *PROFESSION_INFO_get0_registrationNumber(const PROFESSION_INFO *pi) +{ + return pi->registrationNumber; +} + +void PROFESSION_INFO_set0_registrationNumber(PROFESSION_INFO *pi, + ASN1_PRINTABLESTRING *rn) +{ + ASN1_PRINTABLESTRING_free(pi->registrationNumber); + pi->registrationNumber = rn; +} diff --git a/crypto/x509v3/v3_admis.h b/crypto/x509v3/v3_admis.h index 4f65b6d4f0..90099ef5a7 100644 --- a/crypto/x509v3/v3_admis.h +++ b/crypto/x509v3/v3_admis.h @@ -14,44 +14,30 @@ extern "C" { #endif -typedef struct NamingAuthority_st { +struct NamingAuthority_st { ASN1_OBJECT* namingAuthorityId; ASN1_IA5STRING* namingAuthorityUrl; ASN1_STRING* namingAuthorityText; /* i.e. DIRECTORYSTRING */ -} NAMING_AUTHORITY; +}; -typedef struct ProfessionInfo_st { +struct ProfessionInfo_st { NAMING_AUTHORITY* namingAuthority; STACK_OF(ASN1_STRING)* professionItems; /* i.e. DIRECTORYSTRING */ STACK_OF(ASN1_OBJECT)* professionOIDs; ASN1_PRINTABLESTRING* registrationNumber; ASN1_OCTET_STRING* addProfessionInfo; -} PROFESSION_INFO; +}; -typedef struct Admissions_st { +struct Admissions_st { GENERAL_NAME* admissionAuthority; NAMING_AUTHORITY* namingAuthority; STACK_OF(PROFESSION_INFO)* professionInfos; -} ADMISSIONS; +}; -typedef struct AdmissionSyntax_st { +struct AdmissionSyntax_st { GENERAL_NAME* admissionAuthority; STACK_OF(ADMISSIONS)* contentsOfAdmissions; -} ADMISSION_SYNTAX; - -DECLARE_ASN1_ITEM(ADMISSIONS) -DECLARE_ASN1_ITEM(NAMING_AUTHORITY) -DECLARE_ASN1_ITEM(PROFESSION_INFO) -DECLARE_ASN1_ITEM(ADMISSION_SYNTAX) - -DECLARE_ASN1_FUNCTIONS(NAMING_AUTHORITY) -DECLARE_ASN1_FUNCTIONS(PROFESSION_INFO) -DECLARE_ASN1_FUNCTIONS(ADMISSIONS) -DECLARE_ASN1_FUNCTIONS(ADMISSION_SYNTAX) - -DEFINE_STACK_OF(ADMISSIONS) -DEFINE_STACK_OF(PROFESSION_INFO) -DEFINE_STACK_OF(ASN1_STRING) +}; #ifdef __cplusplus } |