Coverage Report

Created: 2026-07-19 06:36

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/openssl/crypto/x509/v3_cpols.c
Line
Count
Source
1
/*
2
 * Copyright 1999-2026 The OpenSSL Project Authors. All Rights Reserved.
3
 *
4
 * Licensed under the Apache License 2.0 (the "License").  You may not use
5
 * this file except in compliance with the License.  You can obtain a copy
6
 * in the file LICENSE in the source distribution or at
7
 * https://www.openssl.org/source/license.html
8
 */
9
10
#include <stdio.h>
11
#include "internal/cryptlib.h"
12
#include <openssl/conf.h>
13
#include <openssl/asn1.h>
14
#include <openssl/asn1t.h>
15
#include <openssl/x509v3.h>
16
17
#include "x509_local.h"
18
#include "pcy_local.h"
19
#include "ext_dat.h"
20
21
#include <crypto/asn1.h>
22
23
/* Certificate policies extension support: this one is a bit complex... */
24
25
static int i2r_certpol(X509V3_EXT_METHOD *method, STACK_OF(POLICYINFO) *pol,
26
    BIO *out, int indent);
27
static STACK_OF(POLICYINFO) *r2i_certpol(X509V3_EXT_METHOD *method,
28
    X509V3_CTX *ctx, const char *value);
29
static void print_qualifiers(BIO *out, STACK_OF(POLICYQUALINFO) *quals,
30
    int indent);
31
static void print_notice(BIO *out, USERNOTICE *notice, int indent);
32
static POLICYINFO *policy_section(X509V3_CTX *ctx,
33
    STACK_OF(CONF_VALUE) *polstrs, int ia5org);
34
static POLICYQUALINFO *notice_section(X509V3_CTX *ctx,
35
    STACK_OF(CONF_VALUE) *unot, int ia5org);
36
static int nref_nos(STACK_OF(ASN1_INTEGER) *nnums, STACK_OF(CONF_VALUE) *nos);
37
static int displaytext_str2tag(const char *tagstr, unsigned int *tag_len);
38
static int displaytext_get_tag_len(const char *tagstr);
39
40
const X509V3_EXT_METHOD ossl_v3_cpols = {
41
    NID_certificate_policies, 0, ASN1_ITEM_ref(CERTIFICATEPOLICIES),
42
    0, 0, 0, 0,
43
    0, 0,
44
    0, 0,
45
    (X509V3_EXT_I2R)i2r_certpol,
46
    (X509V3_EXT_R2I)r2i_certpol,
47
    NULL
48
};
49
50
ASN1_ITEM_TEMPLATE(CERTIFICATEPOLICIES) = ASN1_EX_TEMPLATE_TYPE(ASN1_TFLG_SEQUENCE_OF, 0, CERTIFICATEPOLICIES, POLICYINFO)
51
0
ASN1_ITEM_TEMPLATE_END(CERTIFICATEPOLICIES)
52
53
IMPLEMENT_ASN1_FUNCTIONS(CERTIFICATEPOLICIES)
54
55
ASN1_SEQUENCE(POLICYINFO) = {
56
    ASN1_SIMPLE(POLICYINFO, policyid, ASN1_OBJECT),
57
    ASN1_SEQUENCE_OF_OPT(POLICYINFO, qualifiers, POLICYQUALINFO)
58
0
} ASN1_SEQUENCE_END(POLICYINFO)
59
0
60
0
IMPLEMENT_ASN1_FUNCTIONS(POLICYINFO)
61
0
62
0
ASN1_ADB_TEMPLATE(policydefault) = ASN1_SIMPLE(POLICYQUALINFO, d.other, ASN1_ANY);
63
0
64
0
ASN1_ADB(POLICYQUALINFO) = {
65
0
    ADB_ENTRY(NID_id_qt_cps, ASN1_SIMPLE(POLICYQUALINFO, d.cpsuri, ASN1_IA5STRING)),
66
0
    ADB_ENTRY(NID_id_qt_unotice, ASN1_SIMPLE(POLICYQUALINFO, d.usernotice, USERNOTICE))
67
0
} ASN1_ADB_END(POLICYQUALINFO, 0, pqualid, 0, &policydefault_tt, NULL);
68
69
ASN1_SEQUENCE(POLICYQUALINFO) = {
70
    ASN1_SIMPLE(POLICYQUALINFO, pqualid, ASN1_OBJECT),
71
    ASN1_ADB_OBJECT(POLICYQUALINFO)
72
0
} ASN1_SEQUENCE_END(POLICYQUALINFO)
73
0
74
0
IMPLEMENT_ASN1_FUNCTIONS(POLICYQUALINFO)
75
0
76
0
ASN1_SEQUENCE(USERNOTICE) = {
77
0
    ASN1_OPT(USERNOTICE, noticeref, NOTICEREF),
78
0
    ASN1_OPT(USERNOTICE, exptext, DISPLAYTEXT)
79
0
} ASN1_SEQUENCE_END(USERNOTICE)
80
0
81
0
IMPLEMENT_ASN1_FUNCTIONS(USERNOTICE)
82
0
83
0
ASN1_SEQUENCE(NOTICEREF) = {
84
0
    ASN1_SIMPLE(NOTICEREF, organization, DISPLAYTEXT),
85
0
    ASN1_SEQUENCE_OF(NOTICEREF, noticenos, ASN1_INTEGER)
86
0
} ASN1_SEQUENCE_END(NOTICEREF)
87
0
88
0
IMPLEMENT_ASN1_FUNCTIONS(NOTICEREF)
89
0
90
0
static STACK_OF(POLICYINFO) *r2i_certpol(X509V3_EXT_METHOD *method,
91
0
    X509V3_CTX *ctx, const char *value)
92
0
{
93
0
    STACK_OF(POLICYINFO) *pols;
94
0
    char *pstr;
95
0
    POLICYINFO *pol;
96
0
    ASN1_OBJECT *pobj;
97
0
    STACK_OF(CONF_VALUE) *vals = X509V3_parse_list(value);
98
0
    CONF_VALUE *cnf;
99
0
    const int num = sk_CONF_VALUE_num(vals);
100
0
    int i, ia5org;
101
102
0
    if (vals == NULL) {
103
0
        ERR_raise(ERR_LIB_X509V3, ERR_R_X509V3_LIB);
104
0
        return NULL;
105
0
    }
106
107
0
    pols = sk_POLICYINFO_new_reserve(NULL, num);
108
0
    if (pols == NULL) {
109
0
        ERR_raise(ERR_LIB_X509V3, ERR_R_CRYPTO_LIB);
110
0
        goto err;
111
0
    }
112
113
0
    ia5org = 0;
114
0
    for (i = 0; i < num; i++) {
115
0
        cnf = sk_CONF_VALUE_value(vals, i);
116
0
        if (cnf->value != NULL || cnf->name == NULL) {
117
0
            ERR_raise(ERR_LIB_X509V3, X509V3_R_INVALID_POLICY_IDENTIFIER);
118
0
            X509V3_conf_add_error_name_value(cnf);
119
0
            goto err;
120
0
        }
121
0
        pstr = cnf->name;
122
0
        if (strcmp(pstr, "ia5org") == 0) {
123
0
            ia5org = 1;
124
0
            continue;
125
0
        } else if (*pstr == '@') {
126
0
            STACK_OF(CONF_VALUE) *polsect;
127
128
0
            polsect = X509V3_get_section(ctx, pstr + 1);
129
0
            if (polsect == NULL) {
130
0
                ERR_raise_data(ERR_LIB_X509V3, X509V3_R_INVALID_SECTION,
131
0
                    "%s", cnf->name);
132
0
                goto err;
133
0
            }
134
0
            pol = policy_section(ctx, polsect, ia5org);
135
0
            X509V3_section_free(ctx, polsect);
136
0
            if (pol == NULL)
137
0
                goto err;
138
0
        } else {
139
0
            if ((pobj = OBJ_txt2obj(cnf->name, 0)) == NULL) {
140
0
                ERR_raise_data(ERR_LIB_X509V3,
141
0
                    X509V3_R_INVALID_OBJECT_IDENTIFIER,
142
0
                    "%s", cnf->name);
143
0
                goto err;
144
0
            }
145
0
            pol = POLICYINFO_new();
146
0
            if (pol == NULL) {
147
0
                ASN1_OBJECT_free(pobj);
148
0
                ERR_raise(ERR_LIB_X509V3, ERR_R_ASN1_LIB);
149
0
                goto err;
150
0
            }
151
0
            pol->policyid = pobj;
152
0
        }
153
0
        if (!sk_POLICYINFO_push(pols, pol)) {
154
0
            POLICYINFO_free(pol);
155
0
            ERR_raise(ERR_LIB_X509V3, ERR_R_CRYPTO_LIB);
156
0
            goto err;
157
0
        }
158
0
    }
159
0
    sk_CONF_VALUE_pop_free(vals, X509V3_conf_free);
160
0
    return pols;
161
0
err:
162
0
    sk_CONF_VALUE_pop_free(vals, X509V3_conf_free);
163
0
    sk_POLICYINFO_pop_free(pols, POLICYINFO_free);
164
0
    return NULL;
165
0
}
166
167
static POLICYINFO *policy_section(X509V3_CTX *ctx,
168
    STACK_OF(CONF_VALUE) *polstrs, int ia5org)
169
0
{
170
0
    int i;
171
0
    CONF_VALUE *cnf;
172
0
    POLICYINFO *pol;
173
0
    POLICYQUALINFO *qual;
174
175
0
    if ((pol = POLICYINFO_new()) == NULL) {
176
0
        ERR_raise(ERR_LIB_X509V3, ERR_R_ASN1_LIB);
177
0
        goto err;
178
0
    }
179
0
    for (i = 0; i < sk_CONF_VALUE_num(polstrs); i++) {
180
0
        cnf = sk_CONF_VALUE_value(polstrs, i);
181
0
        if (strcmp(cnf->name, "policyIdentifier") == 0) {
182
0
            ASN1_OBJECT *pobj;
183
184
0
            if ((pobj = OBJ_txt2obj(cnf->value, 0)) == NULL) {
185
0
                ERR_raise(ERR_LIB_X509V3, X509V3_R_INVALID_OBJECT_IDENTIFIER);
186
0
                X509V3_conf_err(cnf);
187
0
                goto err;
188
0
            }
189
0
            pol->policyid = pobj;
190
191
0
        } else if (!ossl_v3_name_cmp(cnf->name, "CPS")) {
192
0
            if (pol->qualifiers == NULL)
193
0
                pol->qualifiers = sk_POLICYQUALINFO_new_null();
194
0
            if ((qual = POLICYQUALINFO_new()) == NULL) {
195
0
                ERR_raise(ERR_LIB_X509V3, ERR_R_ASN1_LIB);
196
0
                goto err;
197
0
            }
198
0
            if (!sk_POLICYQUALINFO_push(pol->qualifiers, qual)) {
199
0
                POLICYQUALINFO_free(qual);
200
0
                ERR_raise(ERR_LIB_X509V3, ERR_R_CRYPTO_LIB);
201
0
                goto err;
202
0
            }
203
0
            if ((qual->pqualid = OBJ_nid2obj(NID_id_qt_cps)) == NULL) {
204
0
                ERR_raise(ERR_LIB_X509V3, ERR_R_INTERNAL_ERROR);
205
0
                goto err;
206
0
            }
207
0
            if ((qual->d.cpsuri = ASN1_IA5STRING_new()) == NULL) {
208
0
                ERR_raise(ERR_LIB_X509V3, ERR_R_ASN1_LIB);
209
0
                goto err;
210
0
            }
211
0
            if (!ASN1_STRING_set_string(qual->d.cpsuri, cnf->value)) {
212
0
                ERR_raise(ERR_LIB_X509V3, ERR_R_ASN1_LIB);
213
0
                goto err;
214
0
            }
215
0
        } else if (!ossl_v3_name_cmp(cnf->name, "userNotice")) {
216
0
            STACK_OF(CONF_VALUE) *unot;
217
0
            if (*cnf->value != '@') {
218
0
                ERR_raise(ERR_LIB_X509V3, X509V3_R_EXPECTED_A_SECTION_NAME);
219
0
                X509V3_conf_err(cnf);
220
0
                goto err;
221
0
            }
222
0
            unot = X509V3_get_section(ctx, cnf->value + 1);
223
0
            if (!unot) {
224
0
                ERR_raise(ERR_LIB_X509V3, X509V3_R_INVALID_SECTION);
225
226
0
                X509V3_conf_err(cnf);
227
0
                goto err;
228
0
            }
229
0
            qual = notice_section(ctx, unot, ia5org);
230
0
            X509V3_section_free(ctx, unot);
231
0
            if (!qual)
232
0
                goto err;
233
0
            if (pol->qualifiers == NULL)
234
0
                pol->qualifiers = sk_POLICYQUALINFO_new_null();
235
0
            if (!sk_POLICYQUALINFO_push(pol->qualifiers, qual)) {
236
0
                POLICYQUALINFO_free(qual);
237
0
                ERR_raise(ERR_LIB_X509V3, ERR_R_CRYPTO_LIB);
238
0
                goto err;
239
0
            }
240
0
        } else {
241
0
            ERR_raise(ERR_LIB_X509V3, X509V3_R_INVALID_OPTION);
242
0
            X509V3_conf_err(cnf);
243
0
            goto err;
244
0
        }
245
0
    }
246
0
    if (pol->policyid == NULL) {
247
0
        ERR_raise(ERR_LIB_X509V3, X509V3_R_NO_POLICY_IDENTIFIER);
248
0
        goto err;
249
0
    }
250
251
0
    return pol;
252
253
0
err:
254
0
    POLICYINFO_free(pol);
255
0
    return NULL;
256
0
}
257
258
static int displaytext_get_tag_len(const char *tagstr)
259
0
{
260
0
    const char *colon = strchr(tagstr, ':');
261
262
0
    return (colon == NULL) ? -1 : (int)(colon - tagstr);
263
0
}
264
265
static int displaytext_str2tag(const char *tagstr, unsigned int *tag_len)
266
0
{
267
0
    int len;
268
269
0
    *tag_len = 0;
270
0
    len = displaytext_get_tag_len(tagstr);
271
272
0
    if (len == -1)
273
0
        return V_ASN1_VISIBLESTRING;
274
0
    *tag_len = len;
275
0
    if (len == sizeof("UTF8") - 1 && HAS_PREFIX(tagstr, "UTF8"))
276
0
        return V_ASN1_UTF8STRING;
277
0
    if (len == sizeof("UTF8String") - 1 && HAS_PREFIX(tagstr, "UTF8String"))
278
0
        return V_ASN1_UTF8STRING;
279
0
    if (len == sizeof("BMP") - 1 && HAS_PREFIX(tagstr, "BMP"))
280
0
        return V_ASN1_BMPSTRING;
281
0
    if (len == sizeof("BMPSTRING") - 1 && HAS_PREFIX(tagstr, "BMPSTRING"))
282
0
        return V_ASN1_BMPSTRING;
283
0
    if (len == sizeof("VISIBLE") - 1 && HAS_PREFIX(tagstr, "VISIBLE"))
284
0
        return V_ASN1_VISIBLESTRING;
285
0
    if (len == sizeof("VISIBLESTRING") - 1 && HAS_PREFIX(tagstr, "VISIBLESTRING"))
286
0
        return V_ASN1_VISIBLESTRING;
287
0
    *tag_len = 0;
288
0
    return V_ASN1_VISIBLESTRING;
289
0
}
290
291
static POLICYQUALINFO *notice_section(X509V3_CTX *ctx,
292
    STACK_OF(CONF_VALUE) *unot, int ia5org)
293
0
{
294
0
    int i, ret, len, tag;
295
0
    unsigned int tag_len;
296
0
    CONF_VALUE *cnf;
297
0
    USERNOTICE *not;
298
0
    POLICYQUALINFO *qual;
299
0
    char *value = NULL;
300
301
0
    if ((qual = POLICYQUALINFO_new()) == NULL) {
302
0
        ERR_raise(ERR_LIB_X509V3, ERR_R_ASN1_LIB);
303
0
        goto err;
304
0
    }
305
0
    if ((qual->pqualid = OBJ_nid2obj(NID_id_qt_unotice)) == NULL) {
306
0
        ERR_raise(ERR_LIB_X509V3, ERR_R_INTERNAL_ERROR);
307
0
        goto err;
308
0
    }
309
0
    if ((not = USERNOTICE_new()) == NULL) {
310
0
        ERR_raise(ERR_LIB_X509V3, ERR_R_ASN1_LIB);
311
0
        goto err;
312
0
    }
313
0
    qual->d.usernotice = not;
314
0
    for (i = 0; i < sk_CONF_VALUE_num(unot); i++) {
315
0
        cnf = sk_CONF_VALUE_value(unot, i);
316
317
0
        value = cnf->value;
318
0
        if (strcmp(cnf->name, "explicitText") == 0) {
319
0
            tag = displaytext_str2tag(value, &tag_len);
320
0
            if ((not->exptext = ASN1_STRING_type_new(tag)) == NULL) {
321
0
                ERR_raise(ERR_LIB_X509V3, ERR_R_ASN1_LIB);
322
0
                goto err;
323
0
            }
324
0
            if (tag_len != 0)
325
0
                value += tag_len + 1;
326
0
            len = (int)strlen(value);
327
0
            if (!ASN1_STRING_set_data(not->exptext, (uint8_t *)value, len)) {
328
0
                ERR_raise(ERR_LIB_X509V3, ERR_R_ASN1_LIB);
329
0
                goto err;
330
0
            }
331
0
        } else if (strcmp(cnf->name, "organization") == 0) {
332
0
            NOTICEREF *nref;
333
334
0
            if (!not->noticeref) {
335
0
                if ((nref = NOTICEREF_new()) == NULL) {
336
0
                    ERR_raise(ERR_LIB_X509V3, ERR_R_ASN1_LIB);
337
0
                    goto err;
338
0
                }
339
0
                not->noticeref = nref;
340
0
            } else
341
0
                nref = not->noticeref;
342
0
            if (ia5org)
343
0
                nref->organization->type = V_ASN1_IA5STRING;
344
0
            else
345
0
                nref->organization->type = V_ASN1_VISIBLESTRING;
346
0
            if (!ASN1_STRING_set_string(nref->organization, cnf->value)) {
347
0
                ERR_raise(ERR_LIB_X509V3, ERR_R_ASN1_LIB);
348
0
                goto err;
349
0
            }
350
0
        } else if (strcmp(cnf->name, "noticeNumbers") == 0) {
351
0
            NOTICEREF *nref;
352
353
0
            STACK_OF(CONF_VALUE) *nos;
354
0
            if (!not->noticeref) {
355
0
                if ((nref = NOTICEREF_new()) == NULL) {
356
0
                    ERR_raise(ERR_LIB_X509V3, ERR_R_ASN1_LIB);
357
0
                    goto err;
358
0
                }
359
0
                not->noticeref = nref;
360
0
            } else
361
0
                nref = not->noticeref;
362
0
            nos = X509V3_parse_list(cnf->value);
363
0
            if (!nos || !sk_CONF_VALUE_num(nos)) {
364
0
                ERR_raise(ERR_LIB_X509V3, X509V3_R_INVALID_NUMBERS);
365
0
                X509V3_conf_add_error_name_value(cnf);
366
0
                sk_CONF_VALUE_pop_free(nos, X509V3_conf_free);
367
0
                goto err;
368
0
            }
369
0
            ret = nref_nos(nref->noticenos, nos);
370
0
            sk_CONF_VALUE_pop_free(nos, X509V3_conf_free);
371
0
            if (!ret)
372
0
                goto err;
373
0
        } else {
374
0
            ERR_raise(ERR_LIB_X509V3, X509V3_R_INVALID_OPTION);
375
0
            X509V3_conf_add_error_name_value(cnf);
376
0
            goto err;
377
0
        }
378
0
    }
379
380
0
    if (not->noticeref && (!not->noticeref->noticenos || !not->noticeref->organization)) {
381
0
        ERR_raise(ERR_LIB_X509V3, X509V3_R_NEED_ORGANIZATION_AND_NUMBERS);
382
0
        goto err;
383
0
    }
384
385
0
    return qual;
386
387
0
err:
388
0
    POLICYQUALINFO_free(qual);
389
0
    return NULL;
390
0
}
391
392
static int nref_nos(STACK_OF(ASN1_INTEGER) *nnums, STACK_OF(CONF_VALUE) *nos)
393
0
{
394
0
    CONF_VALUE *cnf;
395
0
    ASN1_INTEGER *aint;
396
397
0
    int i;
398
399
0
    for (i = 0; i < sk_CONF_VALUE_num(nos); i++) {
400
0
        cnf = sk_CONF_VALUE_value(nos, i);
401
0
        if ((aint = s2i_ASN1_INTEGER(NULL, cnf->name)) == NULL) {
402
0
            ERR_raise(ERR_LIB_X509V3, X509V3_R_INVALID_NUMBER);
403
0
            return 0;
404
0
        }
405
0
        if (!sk_ASN1_INTEGER_push(nnums, aint)) {
406
0
            ASN1_INTEGER_free(aint);
407
0
            ERR_raise(ERR_LIB_X509V3, ERR_R_CRYPTO_LIB);
408
0
            return 0;
409
0
        }
410
0
    }
411
0
    return 1;
412
0
}
413
414
static int i2r_certpol(X509V3_EXT_METHOD *method, STACK_OF(POLICYINFO) *pol,
415
    BIO *out, int indent)
416
0
{
417
0
    int i;
418
0
    POLICYINFO *pinfo;
419
    /* First print out the policy OIDs */
420
0
    for (i = 0; i < sk_POLICYINFO_num(pol); i++) {
421
0
        if (i > 0)
422
0
            BIO_puts(out, "\n");
423
0
        pinfo = sk_POLICYINFO_value(pol, i);
424
0
        BIO_printf(out, "%*sPolicy: ", indent, "");
425
0
        i2a_ASN1_OBJECT(out, pinfo->policyid);
426
0
        if (pinfo->qualifiers) {
427
0
            BIO_puts(out, "\n");
428
0
            print_qualifiers(out, pinfo->qualifiers, indent + 2);
429
0
        }
430
0
    }
431
0
    return 1;
432
0
}
433
434
static void print_qualifiers(BIO *out, STACK_OF(POLICYQUALINFO) *quals,
435
    int indent)
436
0
{
437
0
    POLICYQUALINFO *qualinfo;
438
0
    int i;
439
0
    for (i = 0; i < sk_POLICYQUALINFO_num(quals); i++) {
440
0
        if (i > 0)
441
0
            BIO_puts(out, "\n");
442
0
        qualinfo = sk_POLICYQUALINFO_value(quals, i);
443
0
        switch (OBJ_obj2nid(qualinfo->pqualid)) {
444
0
        case NID_id_qt_cps:
445
0
            BIO_printf(out, "%*sCPS: %.*s", indent, "",
446
0
                qualinfo->d.cpsuri->length,
447
0
                qualinfo->d.cpsuri->data);
448
0
            break;
449
450
0
        case NID_id_qt_unotice:
451
0
            BIO_printf(out, "%*sUser Notice:\n", indent, "");
452
0
            print_notice(out, qualinfo->d.usernotice, indent + 2);
453
0
            break;
454
455
0
        default:
456
0
            BIO_printf(out, "%*sUnknown Qualifier: ", indent + 2, "");
457
458
0
            i2a_ASN1_OBJECT(out, qualinfo->pqualid);
459
0
            break;
460
0
        }
461
0
    }
462
0
}
463
464
static void print_notice(BIO *out, USERNOTICE *notice, int indent)
465
0
{
466
0
    int i;
467
0
    if (notice->noticeref) {
468
0
        NOTICEREF *ref;
469
0
        ref = notice->noticeref;
470
0
        BIO_printf(out, "%*sOrganization: %.*s\n", indent, "",
471
0
            ref->organization->length,
472
0
            ref->organization->data);
473
0
        BIO_printf(out, "%*sNumber%s: ", indent, "",
474
0
            sk_ASN1_INTEGER_num(ref->noticenos) > 1 ? "s" : "");
475
0
        for (i = 0; i < sk_ASN1_INTEGER_num(ref->noticenos); i++) {
476
0
            ASN1_INTEGER *num;
477
0
            char *tmp;
478
0
            num = sk_ASN1_INTEGER_value(ref->noticenos, i);
479
0
            if (i)
480
0
                BIO_puts(out, ", ");
481
0
            if (num == NULL)
482
0
                BIO_puts(out, "(null)");
483
0
            else {
484
0
                tmp = i2s_ASN1_INTEGER(NULL, num);
485
0
                if (tmp == NULL)
486
0
                    return;
487
0
                BIO_puts(out, tmp);
488
0
                OPENSSL_free(tmp);
489
0
            }
490
0
        }
491
0
        if (notice->exptext)
492
0
            BIO_puts(out, "\n");
493
0
    }
494
0
    if (notice->exptext)
495
0
        BIO_printf(out, "%*sExplicit Text: %.*s", indent, "",
496
0
            notice->exptext->length,
497
0
            notice->exptext->data);
498
0
}
499
500
void X509_POLICY_NODE_print(BIO *out, X509_POLICY_NODE *node, int indent)
501
0
{
502
0
    const X509_POLICY_DATA *dat = node->data;
503
504
0
    BIO_printf(out, "%*sPolicy: ", indent, "");
505
506
0
    i2a_ASN1_OBJECT(out, dat->valid_policy);
507
0
    BIO_puts(out, "\n");
508
0
    BIO_printf(out, "%*s%s\n", indent + 2, "",
509
0
        node_data_critical(dat) ? "Critical" : "Non Critical");
510
0
    if (dat->qualifier_set) {
511
0
        print_qualifiers(out, dat->qualifier_set, indent + 2);
512
0
        BIO_puts(out, "\n");
513
0
    } else
514
0
        BIO_printf(out, "%*sNo Qualifiers\n", indent + 2, "");
515
0
}