xref: /freebsd/crypto/openssl/crypto/x509/v3_admis.c (revision b077aed33b7b6aefca7b17ddb250cf521f938613)
1*b077aed3SPierre Pronchery /*
2*b077aed3SPierre Pronchery  * Copyright 2017-2023 The OpenSSL Project Authors. All Rights Reserved.
3*b077aed3SPierre Pronchery  *
4*b077aed3SPierre Pronchery  * Licensed under the Apache License 2.0 (the "License").  You may not use
5*b077aed3SPierre Pronchery  * this file except in compliance with the License.  You can obtain a copy
6*b077aed3SPierre Pronchery  * in the file LICENSE in the source distribution or at
7*b077aed3SPierre Pronchery  * https://www.openssl.org/source/license.html
8*b077aed3SPierre Pronchery  */
9*b077aed3SPierre Pronchery #include <stdio.h>
10*b077aed3SPierre Pronchery #include "internal/cryptlib.h"
11*b077aed3SPierre Pronchery #include <openssl/conf.h>
12*b077aed3SPierre Pronchery #include <openssl/types.h>
13*b077aed3SPierre Pronchery #include <openssl/asn1.h>
14*b077aed3SPierre Pronchery #include <openssl/asn1t.h>
15*b077aed3SPierre Pronchery 
16*b077aed3SPierre Pronchery #include <openssl/x509v3.h>
17*b077aed3SPierre Pronchery 
18*b077aed3SPierre Pronchery #include <openssl/safestack.h>
19*b077aed3SPierre Pronchery 
20*b077aed3SPierre Pronchery #include "v3_admis.h"
21*b077aed3SPierre Pronchery #include "ext_dat.h"
22*b077aed3SPierre Pronchery 
23*b077aed3SPierre Pronchery ASN1_SEQUENCE(NAMING_AUTHORITY) = {
24*b077aed3SPierre Pronchery     ASN1_OPT(NAMING_AUTHORITY, namingAuthorityId, ASN1_OBJECT),
25*b077aed3SPierre Pronchery     ASN1_OPT(NAMING_AUTHORITY, namingAuthorityUrl, ASN1_IA5STRING),
26*b077aed3SPierre Pronchery     ASN1_OPT(NAMING_AUTHORITY, namingAuthorityText, DIRECTORYSTRING),
27*b077aed3SPierre Pronchery } ASN1_SEQUENCE_END(NAMING_AUTHORITY)
28*b077aed3SPierre Pronchery 
29*b077aed3SPierre Pronchery ASN1_SEQUENCE(PROFESSION_INFO) = {
30*b077aed3SPierre Pronchery     ASN1_EXP_OPT(PROFESSION_INFO, namingAuthority, NAMING_AUTHORITY, 0),
31*b077aed3SPierre Pronchery     ASN1_SEQUENCE_OF(PROFESSION_INFO, professionItems, DIRECTORYSTRING),
32*b077aed3SPierre Pronchery     ASN1_SEQUENCE_OF_OPT(PROFESSION_INFO, professionOIDs, ASN1_OBJECT),
33*b077aed3SPierre Pronchery     ASN1_OPT(PROFESSION_INFO, registrationNumber, ASN1_PRINTABLESTRING),
34*b077aed3SPierre Pronchery     ASN1_OPT(PROFESSION_INFO, addProfessionInfo, ASN1_OCTET_STRING),
35*b077aed3SPierre Pronchery } ASN1_SEQUENCE_END(PROFESSION_INFO)
36*b077aed3SPierre Pronchery 
37*b077aed3SPierre Pronchery ASN1_SEQUENCE(ADMISSIONS) = {
38*b077aed3SPierre Pronchery     ASN1_EXP_OPT(ADMISSIONS, admissionAuthority, GENERAL_NAME, 0),
39*b077aed3SPierre Pronchery     ASN1_EXP_OPT(ADMISSIONS, namingAuthority, NAMING_AUTHORITY, 1),
40*b077aed3SPierre Pronchery     ASN1_SEQUENCE_OF(ADMISSIONS, professionInfos, PROFESSION_INFO),
41*b077aed3SPierre Pronchery } ASN1_SEQUENCE_END(ADMISSIONS)
42*b077aed3SPierre Pronchery 
43*b077aed3SPierre Pronchery ASN1_SEQUENCE(ADMISSION_SYNTAX) = {
44*b077aed3SPierre Pronchery     ASN1_OPT(ADMISSION_SYNTAX, admissionAuthority, GENERAL_NAME),
45*b077aed3SPierre Pronchery     ASN1_SEQUENCE_OF(ADMISSION_SYNTAX, contentsOfAdmissions, ADMISSIONS),
46*b077aed3SPierre Pronchery } ASN1_SEQUENCE_END(ADMISSION_SYNTAX)
47*b077aed3SPierre Pronchery 
48*b077aed3SPierre Pronchery IMPLEMENT_ASN1_FUNCTIONS(NAMING_AUTHORITY)
49*b077aed3SPierre Pronchery IMPLEMENT_ASN1_FUNCTIONS(PROFESSION_INFO)
50*b077aed3SPierre Pronchery IMPLEMENT_ASN1_FUNCTIONS(ADMISSIONS)
51*b077aed3SPierre Pronchery IMPLEMENT_ASN1_FUNCTIONS(ADMISSION_SYNTAX)
52*b077aed3SPierre Pronchery 
53*b077aed3SPierre Pronchery static int i2r_ADMISSION_SYNTAX(const struct v3_ext_method *method, void *in,
54*b077aed3SPierre Pronchery                                 BIO *bp, int ind);
55*b077aed3SPierre Pronchery 
56*b077aed3SPierre Pronchery const X509V3_EXT_METHOD ossl_v3_ext_admission = {
57*b077aed3SPierre Pronchery     NID_x509ExtAdmission,   /* .ext_nid = */
58*b077aed3SPierre Pronchery     0,                      /* .ext_flags = */
59*b077aed3SPierre Pronchery     ASN1_ITEM_ref(ADMISSION_SYNTAX), /* .it = */
60*b077aed3SPierre Pronchery     NULL, NULL, NULL, NULL,
61*b077aed3SPierre Pronchery     NULL,                   /* .i2s = */
62*b077aed3SPierre Pronchery     NULL,                   /* .s2i = */
63*b077aed3SPierre Pronchery     NULL,                   /* .i2v = */
64*b077aed3SPierre Pronchery     NULL,                   /* .v2i = */
65*b077aed3SPierre Pronchery     &i2r_ADMISSION_SYNTAX,  /* .i2r = */
66*b077aed3SPierre Pronchery     NULL,                   /* .r2i = */
67*b077aed3SPierre Pronchery     NULL                    /* extension-specific data */
68*b077aed3SPierre Pronchery };
69*b077aed3SPierre Pronchery 
70*b077aed3SPierre Pronchery 
i2r_NAMING_AUTHORITY(const struct v3_ext_method * method,void * in,BIO * bp,int ind)71*b077aed3SPierre Pronchery static int i2r_NAMING_AUTHORITY(const struct v3_ext_method *method, void *in,
72*b077aed3SPierre Pronchery                                 BIO *bp, int ind)
73*b077aed3SPierre Pronchery {
74*b077aed3SPierre Pronchery     NAMING_AUTHORITY * namingAuthority = (NAMING_AUTHORITY*) in;
75*b077aed3SPierre Pronchery 
76*b077aed3SPierre Pronchery     if (namingAuthority == NULL)
77*b077aed3SPierre Pronchery         return 0;
78*b077aed3SPierre Pronchery 
79*b077aed3SPierre Pronchery     if (namingAuthority->namingAuthorityId == NULL
80*b077aed3SPierre Pronchery         && namingAuthority->namingAuthorityText == NULL
81*b077aed3SPierre Pronchery         && namingAuthority->namingAuthorityUrl == NULL)
82*b077aed3SPierre Pronchery         return 0;
83*b077aed3SPierre Pronchery 
84*b077aed3SPierre Pronchery     if (BIO_printf(bp, "%*snamingAuthority: ", ind, "") <= 0)
85*b077aed3SPierre Pronchery         goto err;
86*b077aed3SPierre Pronchery 
87*b077aed3SPierre Pronchery     if (namingAuthority->namingAuthorityId != NULL) {
88*b077aed3SPierre Pronchery         char objbuf[128];
89*b077aed3SPierre Pronchery         const char *ln = OBJ_nid2ln(OBJ_obj2nid(namingAuthority->namingAuthorityId));
90*b077aed3SPierre Pronchery 
91*b077aed3SPierre Pronchery         if (BIO_printf(bp, "%*s  admissionAuthorityId: ", ind, "") <= 0)
92*b077aed3SPierre Pronchery             goto err;
93*b077aed3SPierre Pronchery 
94*b077aed3SPierre Pronchery         OBJ_obj2txt(objbuf, sizeof(objbuf), namingAuthority->namingAuthorityId, 1);
95*b077aed3SPierre Pronchery 
96*b077aed3SPierre Pronchery         if (BIO_printf(bp, "%s%s%s%s\n", ln ? ln : "",
97*b077aed3SPierre Pronchery                        ln ? " (" : "", objbuf, ln ? ")" : "") <= 0)
98*b077aed3SPierre Pronchery             goto err;
99*b077aed3SPierre Pronchery     }
100*b077aed3SPierre Pronchery     if (namingAuthority->namingAuthorityText != NULL) {
101*b077aed3SPierre Pronchery         if (BIO_printf(bp, "%*s  namingAuthorityText: ", ind, "") <= 0
102*b077aed3SPierre Pronchery             || ASN1_STRING_print(bp, namingAuthority->namingAuthorityText) <= 0
103*b077aed3SPierre Pronchery             || BIO_printf(bp, "\n") <= 0)
104*b077aed3SPierre Pronchery             goto err;
105*b077aed3SPierre Pronchery     }
106*b077aed3SPierre Pronchery     if (namingAuthority->namingAuthorityUrl != NULL ) {
107*b077aed3SPierre Pronchery         if (BIO_printf(bp, "%*s  namingAuthorityUrl: ", ind, "") <= 0
108*b077aed3SPierre Pronchery             || ASN1_STRING_print(bp, namingAuthority->namingAuthorityUrl) <= 0
109*b077aed3SPierre Pronchery             || BIO_printf(bp, "\n") <= 0)
110*b077aed3SPierre Pronchery             goto err;
111*b077aed3SPierre Pronchery     }
112*b077aed3SPierre Pronchery     return 1;
113*b077aed3SPierre Pronchery 
114*b077aed3SPierre Pronchery err:
115*b077aed3SPierre Pronchery     return 0;
116*b077aed3SPierre Pronchery }
117*b077aed3SPierre Pronchery 
i2r_ADMISSION_SYNTAX(const struct v3_ext_method * method,void * in,BIO * bp,int ind)118*b077aed3SPierre Pronchery static int i2r_ADMISSION_SYNTAX(const struct v3_ext_method *method, void *in,
119*b077aed3SPierre Pronchery                                 BIO *bp, int ind)
120*b077aed3SPierre Pronchery {
121*b077aed3SPierre Pronchery     ADMISSION_SYNTAX * admission = (ADMISSION_SYNTAX *)in;
122*b077aed3SPierre Pronchery     int i, j, k;
123*b077aed3SPierre Pronchery 
124*b077aed3SPierre Pronchery     if (admission->admissionAuthority != NULL) {
125*b077aed3SPierre Pronchery         if (BIO_printf(bp, "%*sadmissionAuthority:\n", ind, "") <= 0
126*b077aed3SPierre Pronchery             || BIO_printf(bp, "%*s  ", ind, "") <= 0
127*b077aed3SPierre Pronchery             || GENERAL_NAME_print(bp, admission->admissionAuthority) <= 0
128*b077aed3SPierre Pronchery             || BIO_printf(bp, "\n") <= 0)
129*b077aed3SPierre Pronchery             goto err;
130*b077aed3SPierre Pronchery     }
131*b077aed3SPierre Pronchery 
132*b077aed3SPierre Pronchery     for (i = 0; i < sk_ADMISSIONS_num(admission->contentsOfAdmissions); i++) {
133*b077aed3SPierre Pronchery         ADMISSIONS* entry = sk_ADMISSIONS_value(admission->contentsOfAdmissions, i);
134*b077aed3SPierre Pronchery 
135*b077aed3SPierre Pronchery         if (BIO_printf(bp, "%*sEntry %0d:\n", ind, "", 1 + i) <= 0) goto err;
136*b077aed3SPierre Pronchery 
137*b077aed3SPierre Pronchery         if (entry->admissionAuthority != NULL) {
138*b077aed3SPierre Pronchery             if (BIO_printf(bp, "%*s  admissionAuthority:\n", ind, "") <= 0
139*b077aed3SPierre Pronchery                 || BIO_printf(bp, "%*s    ", ind, "") <= 0
140*b077aed3SPierre Pronchery                 || GENERAL_NAME_print(bp, entry->admissionAuthority) <= 0
141*b077aed3SPierre Pronchery                 || BIO_printf(bp, "\n") <= 0)
142*b077aed3SPierre Pronchery                 goto err;
143*b077aed3SPierre Pronchery         }
144*b077aed3SPierre Pronchery 
145*b077aed3SPierre Pronchery         if (entry->namingAuthority != NULL) {
146*b077aed3SPierre Pronchery             if (i2r_NAMING_AUTHORITY(method, entry->namingAuthority, bp, ind) <= 0)
147*b077aed3SPierre Pronchery                 goto err;
148*b077aed3SPierre Pronchery         }
149*b077aed3SPierre Pronchery 
150*b077aed3SPierre Pronchery         for (j = 0; j < sk_PROFESSION_INFO_num(entry->professionInfos); j++) {
151*b077aed3SPierre Pronchery             PROFESSION_INFO* pinfo = sk_PROFESSION_INFO_value(entry->professionInfos, j);
152*b077aed3SPierre Pronchery 
153*b077aed3SPierre Pronchery             if (BIO_printf(bp, "%*s  Profession Info Entry %0d:\n", ind, "", 1 + j) <= 0)
154*b077aed3SPierre Pronchery                 goto err;
155*b077aed3SPierre Pronchery 
156*b077aed3SPierre Pronchery             if (pinfo->registrationNumber != NULL) {
157*b077aed3SPierre Pronchery                 if (BIO_printf(bp, "%*s    registrationNumber: ", ind, "") <= 0
158*b077aed3SPierre Pronchery                     || ASN1_STRING_print(bp, pinfo->registrationNumber) <= 0
159*b077aed3SPierre Pronchery                     || BIO_printf(bp, "\n") <= 0)
160*b077aed3SPierre Pronchery                     goto err;
161*b077aed3SPierre Pronchery             }
162*b077aed3SPierre Pronchery 
163*b077aed3SPierre Pronchery             if (pinfo->namingAuthority != NULL) {
164*b077aed3SPierre Pronchery                 if (i2r_NAMING_AUTHORITY(method, pinfo->namingAuthority, bp, ind + 2) <= 0)
165*b077aed3SPierre Pronchery                     goto err;
166*b077aed3SPierre Pronchery             }
167*b077aed3SPierre Pronchery 
168*b077aed3SPierre Pronchery             if (pinfo->professionItems != NULL) {
169*b077aed3SPierre Pronchery 
170*b077aed3SPierre Pronchery                 if (BIO_printf(bp, "%*s    Info Entries:\n", ind, "") <= 0)
171*b077aed3SPierre Pronchery                     goto err;
172*b077aed3SPierre Pronchery                 for (k = 0; k < sk_ASN1_STRING_num(pinfo->professionItems); k++) {
173*b077aed3SPierre Pronchery                     ASN1_STRING* val = sk_ASN1_STRING_value(pinfo->professionItems, k);
174*b077aed3SPierre Pronchery 
175*b077aed3SPierre Pronchery                     if (BIO_printf(bp, "%*s      ", ind, "") <= 0
176*b077aed3SPierre Pronchery                         || ASN1_STRING_print(bp, val) <= 0
177*b077aed3SPierre Pronchery                         || BIO_printf(bp, "\n") <= 0)
178*b077aed3SPierre Pronchery                         goto err;
179*b077aed3SPierre Pronchery                 }
180*b077aed3SPierre Pronchery             }
181*b077aed3SPierre Pronchery 
182*b077aed3SPierre Pronchery             if (pinfo->professionOIDs != NULL) {
183*b077aed3SPierre Pronchery                 if (BIO_printf(bp, "%*s    Profession OIDs:\n", ind, "") <= 0)
184*b077aed3SPierre Pronchery                     goto err;
185*b077aed3SPierre Pronchery                 for (k = 0; k < sk_ASN1_OBJECT_num(pinfo->professionOIDs); k++) {
186*b077aed3SPierre Pronchery                     ASN1_OBJECT* obj = sk_ASN1_OBJECT_value(pinfo->professionOIDs, k);
187*b077aed3SPierre Pronchery                     const char *ln = OBJ_nid2ln(OBJ_obj2nid(obj));
188*b077aed3SPierre Pronchery                     char objbuf[128];
189*b077aed3SPierre Pronchery 
190*b077aed3SPierre Pronchery                     OBJ_obj2txt(objbuf, sizeof(objbuf), obj, 1);
191*b077aed3SPierre Pronchery                     if (BIO_printf(bp, "%*s      %s%s%s%s\n", ind, "",
192*b077aed3SPierre Pronchery                                    ln ? ln : "", ln ? " (" : "",
193*b077aed3SPierre Pronchery                                    objbuf, ln ? ")" : "") <= 0)
194*b077aed3SPierre Pronchery                         goto err;
195*b077aed3SPierre Pronchery                 }
196*b077aed3SPierre Pronchery             }
197*b077aed3SPierre Pronchery         }
198*b077aed3SPierre Pronchery     }
199*b077aed3SPierre Pronchery     return 1;
200*b077aed3SPierre Pronchery 
201*b077aed3SPierre Pronchery err:
202*b077aed3SPierre Pronchery     return 0;
203*b077aed3SPierre Pronchery }
204*b077aed3SPierre Pronchery 
NAMING_AUTHORITY_get0_authorityId(const NAMING_AUTHORITY * n)205*b077aed3SPierre Pronchery const ASN1_OBJECT *NAMING_AUTHORITY_get0_authorityId(const NAMING_AUTHORITY *n)
206*b077aed3SPierre Pronchery {
207*b077aed3SPierre Pronchery     return n->namingAuthorityId;
208*b077aed3SPierre Pronchery }
209*b077aed3SPierre Pronchery 
NAMING_AUTHORITY_set0_authorityId(NAMING_AUTHORITY * n,ASN1_OBJECT * id)210*b077aed3SPierre Pronchery void NAMING_AUTHORITY_set0_authorityId(NAMING_AUTHORITY *n, ASN1_OBJECT* id)
211*b077aed3SPierre Pronchery {
212*b077aed3SPierre Pronchery     ASN1_OBJECT_free(n->namingAuthorityId);
213*b077aed3SPierre Pronchery     n->namingAuthorityId = id;
214*b077aed3SPierre Pronchery }
215*b077aed3SPierre Pronchery 
NAMING_AUTHORITY_get0_authorityURL(const NAMING_AUTHORITY * n)216*b077aed3SPierre Pronchery const ASN1_IA5STRING *NAMING_AUTHORITY_get0_authorityURL(
217*b077aed3SPierre Pronchery     const NAMING_AUTHORITY *n)
218*b077aed3SPierre Pronchery {
219*b077aed3SPierre Pronchery     return n->namingAuthorityUrl;
220*b077aed3SPierre Pronchery }
221*b077aed3SPierre Pronchery 
NAMING_AUTHORITY_set0_authorityURL(NAMING_AUTHORITY * n,ASN1_IA5STRING * u)222*b077aed3SPierre Pronchery void NAMING_AUTHORITY_set0_authorityURL(NAMING_AUTHORITY *n, ASN1_IA5STRING* u)
223*b077aed3SPierre Pronchery {
224*b077aed3SPierre Pronchery     ASN1_IA5STRING_free(n->namingAuthorityUrl);
225*b077aed3SPierre Pronchery     n->namingAuthorityUrl = u;
226*b077aed3SPierre Pronchery }
227*b077aed3SPierre Pronchery 
NAMING_AUTHORITY_get0_authorityText(const NAMING_AUTHORITY * n)228*b077aed3SPierre Pronchery const ASN1_STRING *NAMING_AUTHORITY_get0_authorityText(
229*b077aed3SPierre Pronchery     const NAMING_AUTHORITY *n)
230*b077aed3SPierre Pronchery {
231*b077aed3SPierre Pronchery     return n->namingAuthorityText;
232*b077aed3SPierre Pronchery }
233*b077aed3SPierre Pronchery 
NAMING_AUTHORITY_set0_authorityText(NAMING_AUTHORITY * n,ASN1_STRING * t)234*b077aed3SPierre Pronchery void NAMING_AUTHORITY_set0_authorityText(NAMING_AUTHORITY *n, ASN1_STRING* t)
235*b077aed3SPierre Pronchery {
236*b077aed3SPierre Pronchery     ASN1_IA5STRING_free(n->namingAuthorityText);
237*b077aed3SPierre Pronchery     n->namingAuthorityText = t;
238*b077aed3SPierre Pronchery }
239*b077aed3SPierre Pronchery 
ADMISSION_SYNTAX_get0_admissionAuthority(const ADMISSION_SYNTAX * as)240*b077aed3SPierre Pronchery const GENERAL_NAME *ADMISSION_SYNTAX_get0_admissionAuthority(const ADMISSION_SYNTAX *as)
241*b077aed3SPierre Pronchery {
242*b077aed3SPierre Pronchery     return as->admissionAuthority;
243*b077aed3SPierre Pronchery }
244*b077aed3SPierre Pronchery 
ADMISSION_SYNTAX_set0_admissionAuthority(ADMISSION_SYNTAX * as,GENERAL_NAME * aa)245*b077aed3SPierre Pronchery void ADMISSION_SYNTAX_set0_admissionAuthority(ADMISSION_SYNTAX *as,
246*b077aed3SPierre Pronchery                                               GENERAL_NAME *aa)
247*b077aed3SPierre Pronchery {
248*b077aed3SPierre Pronchery     GENERAL_NAME_free(as->admissionAuthority);
249*b077aed3SPierre Pronchery     as->admissionAuthority = aa;
250*b077aed3SPierre Pronchery }
251*b077aed3SPierre Pronchery 
STACK_OF(ADMISSIONS)252*b077aed3SPierre Pronchery const STACK_OF(ADMISSIONS) *ADMISSION_SYNTAX_get0_contentsOfAdmissions(const ADMISSION_SYNTAX *as)
253*b077aed3SPierre Pronchery {
254*b077aed3SPierre Pronchery     return as->contentsOfAdmissions;
255*b077aed3SPierre Pronchery }
256*b077aed3SPierre Pronchery 
ADMISSION_SYNTAX_set0_contentsOfAdmissions(ADMISSION_SYNTAX * as,STACK_OF (ADMISSIONS)* a)257*b077aed3SPierre Pronchery void ADMISSION_SYNTAX_set0_contentsOfAdmissions(ADMISSION_SYNTAX *as,
258*b077aed3SPierre Pronchery                                                 STACK_OF(ADMISSIONS) *a)
259*b077aed3SPierre Pronchery {
260*b077aed3SPierre Pronchery     sk_ADMISSIONS_pop_free(as->contentsOfAdmissions, ADMISSIONS_free);
261*b077aed3SPierre Pronchery     as->contentsOfAdmissions = a;
262*b077aed3SPierre Pronchery }
263*b077aed3SPierre Pronchery 
ADMISSIONS_get0_admissionAuthority(const ADMISSIONS * a)264*b077aed3SPierre Pronchery const GENERAL_NAME *ADMISSIONS_get0_admissionAuthority(const ADMISSIONS *a)
265*b077aed3SPierre Pronchery {
266*b077aed3SPierre Pronchery     return a->admissionAuthority;
267*b077aed3SPierre Pronchery }
268*b077aed3SPierre Pronchery 
ADMISSIONS_set0_admissionAuthority(ADMISSIONS * a,GENERAL_NAME * aa)269*b077aed3SPierre Pronchery void ADMISSIONS_set0_admissionAuthority(ADMISSIONS *a, GENERAL_NAME *aa)
270*b077aed3SPierre Pronchery {
271*b077aed3SPierre Pronchery     GENERAL_NAME_free(a->admissionAuthority);
272*b077aed3SPierre Pronchery     a->admissionAuthority = aa;
273*b077aed3SPierre Pronchery }
274*b077aed3SPierre Pronchery 
ADMISSIONS_get0_namingAuthority(const ADMISSIONS * a)275*b077aed3SPierre Pronchery const NAMING_AUTHORITY *ADMISSIONS_get0_namingAuthority(const ADMISSIONS *a)
276*b077aed3SPierre Pronchery {
277*b077aed3SPierre Pronchery     return a->namingAuthority;
278*b077aed3SPierre Pronchery }
279*b077aed3SPierre Pronchery 
ADMISSIONS_set0_namingAuthority(ADMISSIONS * a,NAMING_AUTHORITY * na)280*b077aed3SPierre Pronchery void ADMISSIONS_set0_namingAuthority(ADMISSIONS *a, NAMING_AUTHORITY *na)
281*b077aed3SPierre Pronchery {
282*b077aed3SPierre Pronchery     NAMING_AUTHORITY_free(a->namingAuthority);
283*b077aed3SPierre Pronchery     a->namingAuthority = na;
284*b077aed3SPierre Pronchery }
285*b077aed3SPierre Pronchery 
ADMISSIONS_get0_professionInfos(const ADMISSIONS * a)286*b077aed3SPierre Pronchery const PROFESSION_INFOS *ADMISSIONS_get0_professionInfos(const ADMISSIONS *a)
287*b077aed3SPierre Pronchery {
288*b077aed3SPierre Pronchery     return a->professionInfos;
289*b077aed3SPierre Pronchery }
290*b077aed3SPierre Pronchery 
ADMISSIONS_set0_professionInfos(ADMISSIONS * a,PROFESSION_INFOS * pi)291*b077aed3SPierre Pronchery void ADMISSIONS_set0_professionInfos(ADMISSIONS *a, PROFESSION_INFOS *pi)
292*b077aed3SPierre Pronchery {
293*b077aed3SPierre Pronchery     sk_PROFESSION_INFO_pop_free(a->professionInfos, PROFESSION_INFO_free);
294*b077aed3SPierre Pronchery     a->professionInfos = pi;
295*b077aed3SPierre Pronchery }
296*b077aed3SPierre Pronchery 
PROFESSION_INFO_get0_addProfessionInfo(const PROFESSION_INFO * pi)297*b077aed3SPierre Pronchery const ASN1_OCTET_STRING *PROFESSION_INFO_get0_addProfessionInfo(const PROFESSION_INFO *pi)
298*b077aed3SPierre Pronchery {
299*b077aed3SPierre Pronchery     return pi->addProfessionInfo;
300*b077aed3SPierre Pronchery }
301*b077aed3SPierre Pronchery 
PROFESSION_INFO_set0_addProfessionInfo(PROFESSION_INFO * pi,ASN1_OCTET_STRING * aos)302*b077aed3SPierre Pronchery void PROFESSION_INFO_set0_addProfessionInfo(PROFESSION_INFO *pi,
303*b077aed3SPierre Pronchery                                             ASN1_OCTET_STRING *aos)
304*b077aed3SPierre Pronchery {
305*b077aed3SPierre Pronchery     ASN1_OCTET_STRING_free(pi->addProfessionInfo);
306*b077aed3SPierre Pronchery     pi->addProfessionInfo = aos;
307*b077aed3SPierre Pronchery }
308*b077aed3SPierre Pronchery 
PROFESSION_INFO_get0_namingAuthority(const PROFESSION_INFO * pi)309*b077aed3SPierre Pronchery const NAMING_AUTHORITY *PROFESSION_INFO_get0_namingAuthority(const PROFESSION_INFO *pi)
310*b077aed3SPierre Pronchery {
311*b077aed3SPierre Pronchery     return pi->namingAuthority;
312*b077aed3SPierre Pronchery }
313*b077aed3SPierre Pronchery 
PROFESSION_INFO_set0_namingAuthority(PROFESSION_INFO * pi,NAMING_AUTHORITY * na)314*b077aed3SPierre Pronchery void PROFESSION_INFO_set0_namingAuthority(PROFESSION_INFO *pi,
315*b077aed3SPierre Pronchery                                           NAMING_AUTHORITY *na)
316*b077aed3SPierre Pronchery {
317*b077aed3SPierre Pronchery     NAMING_AUTHORITY_free(pi->namingAuthority);
318*b077aed3SPierre Pronchery     pi->namingAuthority = na;
319*b077aed3SPierre Pronchery }
320*b077aed3SPierre Pronchery 
STACK_OF(ASN1_STRING)321*b077aed3SPierre Pronchery const STACK_OF(ASN1_STRING) *PROFESSION_INFO_get0_professionItems(const PROFESSION_INFO *pi)
322*b077aed3SPierre Pronchery {
323*b077aed3SPierre Pronchery     return pi->professionItems;
324*b077aed3SPierre Pronchery }
325*b077aed3SPierre Pronchery 
PROFESSION_INFO_set0_professionItems(PROFESSION_INFO * pi,STACK_OF (ASN1_STRING)* as)326*b077aed3SPierre Pronchery void PROFESSION_INFO_set0_professionItems(PROFESSION_INFO *pi,
327*b077aed3SPierre Pronchery                                           STACK_OF(ASN1_STRING) *as)
328*b077aed3SPierre Pronchery {
329*b077aed3SPierre Pronchery     sk_ASN1_STRING_pop_free(pi->professionItems, ASN1_STRING_free);
330*b077aed3SPierre Pronchery     pi->professionItems = as;
331*b077aed3SPierre Pronchery }
332*b077aed3SPierre Pronchery 
STACK_OF(ASN1_OBJECT)333*b077aed3SPierre Pronchery const STACK_OF(ASN1_OBJECT) *PROFESSION_INFO_get0_professionOIDs(const PROFESSION_INFO *pi)
334*b077aed3SPierre Pronchery {
335*b077aed3SPierre Pronchery     return pi->professionOIDs;
336*b077aed3SPierre Pronchery }
337*b077aed3SPierre Pronchery 
PROFESSION_INFO_set0_professionOIDs(PROFESSION_INFO * pi,STACK_OF (ASN1_OBJECT)* po)338*b077aed3SPierre Pronchery void PROFESSION_INFO_set0_professionOIDs(PROFESSION_INFO *pi,
339*b077aed3SPierre Pronchery                                          STACK_OF(ASN1_OBJECT) *po)
340*b077aed3SPierre Pronchery {
341*b077aed3SPierre Pronchery     sk_ASN1_OBJECT_pop_free(pi->professionOIDs, ASN1_OBJECT_free);
342*b077aed3SPierre Pronchery     pi->professionOIDs = po;
343*b077aed3SPierre Pronchery }
344*b077aed3SPierre Pronchery 
PROFESSION_INFO_get0_registrationNumber(const PROFESSION_INFO * pi)345*b077aed3SPierre Pronchery const ASN1_PRINTABLESTRING *PROFESSION_INFO_get0_registrationNumber(const PROFESSION_INFO *pi)
346*b077aed3SPierre Pronchery {
347*b077aed3SPierre Pronchery     return pi->registrationNumber;
348*b077aed3SPierre Pronchery }
349*b077aed3SPierre Pronchery 
PROFESSION_INFO_set0_registrationNumber(PROFESSION_INFO * pi,ASN1_PRINTABLESTRING * rn)350*b077aed3SPierre Pronchery void PROFESSION_INFO_set0_registrationNumber(PROFESSION_INFO *pi,
351*b077aed3SPierre Pronchery                                              ASN1_PRINTABLESTRING *rn)
352*b077aed3SPierre Pronchery {
353*b077aed3SPierre Pronchery     ASN1_PRINTABLESTRING_free(pi->registrationNumber);
354*b077aed3SPierre Pronchery     pi->registrationNumber = rn;
355*b077aed3SPierre Pronchery }
356