1 /* $OpenBSD: v3_crld.c,v 1.18 2015/07/25 16:14:29 jsing Exp $ */
2 /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
5 /* ====================================================================
6 * Copyright (c) 1999-2008 The OpenSSL Project. All rights reserved.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in
17 * the documentation and/or other materials provided with the
20 * 3. All advertising materials mentioning features or use of this
21 * software must display the following acknowledgment:
22 * "This product includes software developed by the OpenSSL Project
23 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
25 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26 * endorse or promote products derived from this software without
27 * prior written permission. For written permission, please contact
28 * licensing@OpenSSL.org.
30 * 5. Products derived from this software may not be called "OpenSSL"
31 * nor may "OpenSSL" appear in their names without prior written
32 * permission of the OpenSSL Project.
34 * 6. Redistributions of any form whatsoever must retain the following
36 * "This product includes software developed by the OpenSSL Project
37 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
39 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
43 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50 * OF THE POSSIBILITY OF SUCH DAMAGE.
51 * ====================================================================
53 * This product includes cryptographic software written by Eric Young
54 * (eay@cryptsoft.com). This product includes software written by Tim
55 * Hudson (tjh@cryptsoft.com).
62 #include <openssl/asn1.h>
63 #include <openssl/asn1t.h>
64 #include <openssl/conf.h>
65 #include <openssl/err.h>
66 #include <openssl/x509v3.h>
68 static void *v2i_crld(const X509V3_EXT_METHOD
*method
,
69 X509V3_CTX
*ctx
, STACK_OF(CONF_VALUE
) *nval
);
70 static int i2r_crldp(const X509V3_EXT_METHOD
*method
, void *pcrldp
, BIO
*out
,
73 const X509V3_EXT_METHOD v3_crld
= {
74 .ext_nid
= NID_crl_distribution_points
,
76 .it
= ASN1_ITEM_ref(CRL_DIST_POINTS
),
90 const X509V3_EXT_METHOD v3_freshest_crl
= {
91 .ext_nid
= NID_freshest_crl
,
93 .it
= ASN1_ITEM_ref(CRL_DIST_POINTS
),
108 STACK_OF(GENERAL_NAME
) *gnames_from_sectname(X509V3_CTX
*ctx
, char *sect
)
110 STACK_OF(CONF_VALUE
) *gnsect
;
111 STACK_OF(GENERAL_NAME
) *gens
;
114 gnsect
= X509V3_get_section(ctx
, sect
+ 1);
116 gnsect
= X509V3_parse_list(sect
);
118 X509V3err(X509V3_F_GNAMES_FROM_SECTNAME
,
119 X509V3_R_SECTION_NOT_FOUND
);
122 gens
= v2i_GENERAL_NAMES(NULL
, ctx
, gnsect
);
124 X509V3_section_free(ctx
, gnsect
);
126 sk_CONF_VALUE_pop_free(gnsect
, X509V3_conf_free
);
131 set_dist_point_name(DIST_POINT_NAME
**pdp
, X509V3_CTX
*ctx
, CONF_VALUE
*cnf
)
133 STACK_OF(GENERAL_NAME
) *fnm
= NULL
;
134 STACK_OF(X509_NAME_ENTRY
) *rnm
= NULL
;
136 if (!strncmp(cnf
->name
, "fullname", 9)) {
137 fnm
= gnames_from_sectname(ctx
, cnf
->value
);
140 } else if (!strcmp(cnf
->name
, "relativename")) {
142 STACK_OF(CONF_VALUE
) *dnsect
;
144 nm
= X509_NAME_new();
147 dnsect
= X509V3_get_section(ctx
, cnf
->value
);
149 X509V3err(X509V3_F_SET_DIST_POINT_NAME
,
150 X509V3_R_SECTION_NOT_FOUND
);
154 ret
= X509V3_NAME_from_section(nm
, dnsect
, MBSTRING_ASC
);
155 X509V3_section_free(ctx
, dnsect
);
159 if (!ret
|| sk_X509_NAME_ENTRY_num(rnm
) <= 0)
161 /* Since its a name fragment can't have more than one
164 if (sk_X509_NAME_ENTRY_value(rnm
,
165 sk_X509_NAME_ENTRY_num(rnm
) - 1)->set
) {
166 X509V3err(X509V3_F_SET_DIST_POINT_NAME
,
167 X509V3_R_INVALID_MULTIPLE_RDNS
);
174 X509V3err(X509V3_F_SET_DIST_POINT_NAME
,
175 X509V3_R_DISTPOINT_ALREADY_SET
);
179 *pdp
= DIST_POINT_NAME_new();
184 (*pdp
)->name
.fullname
= fnm
;
187 (*pdp
)->name
.relativename
= rnm
;
194 sk_GENERAL_NAME_pop_free(fnm
, GENERAL_NAME_free
);
196 sk_X509_NAME_ENTRY_pop_free(rnm
, X509_NAME_ENTRY_free
);
200 static const BIT_STRING_BITNAME reason_flags
[] = {
201 {0, "Unused", "unused"},
202 {1, "Key Compromise", "keyCompromise"},
203 {2, "CA Compromise", "CACompromise"},
204 {3, "Affiliation Changed", "affiliationChanged"},
205 {4, "Superseded", "superseded"},
206 {5, "Cessation Of Operation", "cessationOfOperation"},
207 {6, "Certificate Hold", "certificateHold"},
208 {7, "Privilege Withdrawn", "privilegeWithdrawn"},
209 {8, "AA Compromise", "AACompromise"},
214 set_reasons(ASN1_BIT_STRING
**preas
, char *value
)
216 STACK_OF(CONF_VALUE
) *rsk
= NULL
;
217 const BIT_STRING_BITNAME
*pbn
;
223 rsk
= X509V3_parse_list(value
);
226 for (i
= 0; i
< sk_CONF_VALUE_num(rsk
); i
++) {
227 bnam
= sk_CONF_VALUE_value(rsk
, i
)->name
;
229 *preas
= ASN1_BIT_STRING_new();
233 for (pbn
= reason_flags
; pbn
->lname
; pbn
++) {
234 if (!strcmp(pbn
->sname
, bnam
)) {
235 if (!ASN1_BIT_STRING_set_bit(*preas
,
247 sk_CONF_VALUE_pop_free(rsk
, X509V3_conf_free
);
252 print_reasons(BIO
*out
, const char *rname
, ASN1_BIT_STRING
*rflags
, int indent
)
255 const BIT_STRING_BITNAME
*pbn
;
257 BIO_printf(out
, "%*s%s:\n%*s", indent
, "", rname
, indent
+ 2, "");
258 for (pbn
= reason_flags
; pbn
->lname
; pbn
++) {
259 if (ASN1_BIT_STRING_get_bit(rflags
, pbn
->bitnum
)) {
264 BIO_puts(out
, pbn
->lname
);
268 BIO_puts(out
, "<EMPTY>\n");
275 crldp_from_section(X509V3_CTX
*ctx
, STACK_OF(CONF_VALUE
) *nval
)
279 DIST_POINT
*point
= NULL
;
281 point
= DIST_POINT_new();
284 for (i
= 0; i
< sk_CONF_VALUE_num(nval
); i
++) {
286 cnf
= sk_CONF_VALUE_value(nval
, i
);
287 ret
= set_dist_point_name(&point
->distpoint
, ctx
, cnf
);
292 if (!strcmp(cnf
->name
, "reasons")) {
293 if (!set_reasons(&point
->reasons
, cnf
->value
))
296 else if (!strcmp(cnf
->name
, "CRLissuer")) {
298 gnames_from_sectname(ctx
, cnf
->value
);
299 if (!point
->CRLissuer
)
308 DIST_POINT_free(point
);
313 v2i_crld(const X509V3_EXT_METHOD
*method
, X509V3_CTX
*ctx
,
314 STACK_OF(CONF_VALUE
) *nval
)
316 STACK_OF(DIST_POINT
) *crld
= NULL
;
317 GENERAL_NAMES
*gens
= NULL
;
318 GENERAL_NAME
*gen
= NULL
;
322 if (!(crld
= sk_DIST_POINT_new_null()))
324 for (i
= 0; i
< sk_CONF_VALUE_num(nval
); i
++) {
326 cnf
= sk_CONF_VALUE_value(nval
, i
);
328 STACK_OF(CONF_VALUE
) *dpsect
;
329 dpsect
= X509V3_get_section(ctx
, cnf
->name
);
332 point
= crldp_from_section(ctx
, dpsect
);
333 X509V3_section_free(ctx
, dpsect
);
336 if (!sk_DIST_POINT_push(crld
, point
)) {
337 DIST_POINT_free(point
);
341 if (!(gen
= v2i_GENERAL_NAME(method
, ctx
, cnf
)))
343 if (!(gens
= GENERAL_NAMES_new()))
345 if (!sk_GENERAL_NAME_push(gens
, gen
))
348 if (!(point
= DIST_POINT_new()))
350 if (!sk_DIST_POINT_push(crld
, point
)) {
351 DIST_POINT_free(point
);
354 if (!(point
->distpoint
= DIST_POINT_NAME_new()))
356 point
->distpoint
->name
.fullname
= gens
;
357 point
->distpoint
->type
= 0;
364 X509V3err(X509V3_F_V2I_CRLD
, ERR_R_MALLOC_FAILURE
);
366 GENERAL_NAME_free(gen
);
367 GENERAL_NAMES_free(gens
);
368 sk_DIST_POINT_pop_free(crld
, DIST_POINT_free
);
373 dpn_cb(int operation
, ASN1_VALUE
**pval
, const ASN1_ITEM
*it
, void *exarg
)
375 DIST_POINT_NAME
*dpn
= (DIST_POINT_NAME
*)*pval
;
378 case ASN1_OP_NEW_POST
:
382 case ASN1_OP_FREE_POST
:
384 X509_NAME_free(dpn
->dpname
);
391 static const ASN1_AUX DIST_POINT_NAME_aux
= {
399 static const ASN1_TEMPLATE DIST_POINT_NAME_ch_tt
[] = {
401 .flags
= ASN1_TFLG_IMPLICIT
| ASN1_TFLG_SEQUENCE_OF
,
403 .offset
= offsetof(DIST_POINT_NAME
, name
.fullname
),
404 .field_name
= "name.fullname",
405 .item
= &GENERAL_NAME_it
,
408 .flags
= ASN1_TFLG_IMPLICIT
| ASN1_TFLG_SET_OF
,
410 .offset
= offsetof(DIST_POINT_NAME
, name
.relativename
),
411 .field_name
= "name.relativename",
412 .item
= &X509_NAME_ENTRY_it
,
416 const ASN1_ITEM DIST_POINT_NAME_it
= {
417 .itype
= ASN1_ITYPE_CHOICE
,
418 .utype
= offsetof(DIST_POINT_NAME
, type
),
419 .templates
= DIST_POINT_NAME_ch_tt
,
420 .tcount
= sizeof(DIST_POINT_NAME_ch_tt
) / sizeof(ASN1_TEMPLATE
),
421 .funcs
= &DIST_POINT_NAME_aux
,
422 .size
= sizeof(DIST_POINT_NAME
),
423 .sname
= "DIST_POINT_NAME",
429 d2i_DIST_POINT_NAME(DIST_POINT_NAME
**a
, const unsigned char **in
, long len
)
431 return (DIST_POINT_NAME
*)ASN1_item_d2i((ASN1_VALUE
**)a
, in
, len
,
432 &DIST_POINT_NAME_it
);
436 i2d_DIST_POINT_NAME(DIST_POINT_NAME
*a
, unsigned char **out
)
438 return ASN1_item_i2d((ASN1_VALUE
*)a
, out
, &DIST_POINT_NAME_it
);
442 DIST_POINT_NAME_new(void)
444 return (DIST_POINT_NAME
*)ASN1_item_new(&DIST_POINT_NAME_it
);
448 DIST_POINT_NAME_free(DIST_POINT_NAME
*a
)
450 ASN1_item_free((ASN1_VALUE
*)a
, &DIST_POINT_NAME_it
);
453 static const ASN1_TEMPLATE DIST_POINT_seq_tt
[] = {
455 .flags
= ASN1_TFLG_EXPLICIT
| ASN1_TFLG_OPTIONAL
,
457 .offset
= offsetof(DIST_POINT
, distpoint
),
458 .field_name
= "distpoint",
459 .item
= &DIST_POINT_NAME_it
,
462 .flags
= ASN1_TFLG_IMPLICIT
| ASN1_TFLG_OPTIONAL
,
464 .offset
= offsetof(DIST_POINT
, reasons
),
465 .field_name
= "reasons",
466 .item
= &ASN1_BIT_STRING_it
,
469 .flags
= ASN1_TFLG_IMPLICIT
| ASN1_TFLG_SEQUENCE_OF
| ASN1_TFLG_OPTIONAL
,
471 .offset
= offsetof(DIST_POINT
, CRLissuer
),
472 .field_name
= "CRLissuer",
473 .item
= &GENERAL_NAME_it
,
477 const ASN1_ITEM DIST_POINT_it
= {
478 .itype
= ASN1_ITYPE_SEQUENCE
,
479 .utype
= V_ASN1_SEQUENCE
,
480 .templates
= DIST_POINT_seq_tt
,
481 .tcount
= sizeof(DIST_POINT_seq_tt
) / sizeof(ASN1_TEMPLATE
),
483 .size
= sizeof(DIST_POINT
),
484 .sname
= "DIST_POINT",
489 d2i_DIST_POINT(DIST_POINT
**a
, const unsigned char **in
, long len
)
491 return (DIST_POINT
*)ASN1_item_d2i((ASN1_VALUE
**)a
, in
, len
,
496 i2d_DIST_POINT(DIST_POINT
*a
, unsigned char **out
)
498 return ASN1_item_i2d((ASN1_VALUE
*)a
, out
, &DIST_POINT_it
);
504 return (DIST_POINT
*)ASN1_item_new(&DIST_POINT_it
);
508 DIST_POINT_free(DIST_POINT
*a
)
510 ASN1_item_free((ASN1_VALUE
*)a
, &DIST_POINT_it
);
513 static const ASN1_TEMPLATE CRL_DIST_POINTS_item_tt
= {
514 .flags
= ASN1_TFLG_SEQUENCE_OF
,
517 .field_name
= "CRLDistributionPoints",
518 .item
= &DIST_POINT_it
,
521 const ASN1_ITEM CRL_DIST_POINTS_it
= {
522 .itype
= ASN1_ITYPE_PRIMITIVE
,
524 .templates
= &CRL_DIST_POINTS_item_tt
,
528 .sname
= "CRL_DIST_POINTS",
533 d2i_CRL_DIST_POINTS(CRL_DIST_POINTS
**a
, const unsigned char **in
, long len
)
535 return (CRL_DIST_POINTS
*)ASN1_item_d2i((ASN1_VALUE
**)a
, in
, len
,
536 &CRL_DIST_POINTS_it
);
540 i2d_CRL_DIST_POINTS(CRL_DIST_POINTS
*a
, unsigned char **out
)
542 return ASN1_item_i2d((ASN1_VALUE
*)a
, out
, &CRL_DIST_POINTS_it
);
546 CRL_DIST_POINTS_new(void)
548 return (CRL_DIST_POINTS
*)ASN1_item_new(&CRL_DIST_POINTS_it
);
552 CRL_DIST_POINTS_free(CRL_DIST_POINTS
*a
)
554 ASN1_item_free((ASN1_VALUE
*)a
, &CRL_DIST_POINTS_it
);
557 static const ASN1_TEMPLATE ISSUING_DIST_POINT_seq_tt
[] = {
559 .flags
= ASN1_TFLG_EXPLICIT
| ASN1_TFLG_OPTIONAL
,
561 .offset
= offsetof(ISSUING_DIST_POINT
, distpoint
),
562 .field_name
= "distpoint",
563 .item
= &DIST_POINT_NAME_it
,
566 .flags
= ASN1_TFLG_IMPLICIT
| ASN1_TFLG_OPTIONAL
,
568 .offset
= offsetof(ISSUING_DIST_POINT
, onlyuser
),
569 .field_name
= "onlyuser",
570 .item
= &ASN1_FBOOLEAN_it
,
573 .flags
= ASN1_TFLG_IMPLICIT
| ASN1_TFLG_OPTIONAL
,
575 .offset
= offsetof(ISSUING_DIST_POINT
, onlyCA
),
576 .field_name
= "onlyCA",
577 .item
= &ASN1_FBOOLEAN_it
,
580 .flags
= ASN1_TFLG_IMPLICIT
| ASN1_TFLG_OPTIONAL
,
582 .offset
= offsetof(ISSUING_DIST_POINT
, onlysomereasons
),
583 .field_name
= "onlysomereasons",
584 .item
= &ASN1_BIT_STRING_it
,
587 .flags
= ASN1_TFLG_IMPLICIT
| ASN1_TFLG_OPTIONAL
,
589 .offset
= offsetof(ISSUING_DIST_POINT
, indirectCRL
),
590 .field_name
= "indirectCRL",
591 .item
= &ASN1_FBOOLEAN_it
,
594 .flags
= ASN1_TFLG_IMPLICIT
| ASN1_TFLG_OPTIONAL
,
596 .offset
= offsetof(ISSUING_DIST_POINT
, onlyattr
),
597 .field_name
= "onlyattr",
598 .item
= &ASN1_FBOOLEAN_it
,
602 const ASN1_ITEM ISSUING_DIST_POINT_it
= {
603 .itype
= ASN1_ITYPE_SEQUENCE
,
604 .utype
= V_ASN1_SEQUENCE
,
605 .templates
= ISSUING_DIST_POINT_seq_tt
,
606 .tcount
= sizeof(ISSUING_DIST_POINT_seq_tt
) / sizeof(ASN1_TEMPLATE
),
608 .size
= sizeof(ISSUING_DIST_POINT
),
609 .sname
= "ISSUING_DIST_POINT",
614 d2i_ISSUING_DIST_POINT(ISSUING_DIST_POINT
**a
, const unsigned char **in
, long len
)
616 return (ISSUING_DIST_POINT
*)ASN1_item_d2i((ASN1_VALUE
**)a
, in
, len
,
617 &ISSUING_DIST_POINT_it
);
621 i2d_ISSUING_DIST_POINT(ISSUING_DIST_POINT
*a
, unsigned char **out
)
623 return ASN1_item_i2d((ASN1_VALUE
*)a
, out
, &ISSUING_DIST_POINT_it
);
627 ISSUING_DIST_POINT_new(void)
629 return (ISSUING_DIST_POINT
*)ASN1_item_new(&ISSUING_DIST_POINT_it
);
633 ISSUING_DIST_POINT_free(ISSUING_DIST_POINT
*a
)
635 ASN1_item_free((ASN1_VALUE
*)a
, &ISSUING_DIST_POINT_it
);
638 static int i2r_idp(const X509V3_EXT_METHOD
*method
, void *pidp
, BIO
*out
,
640 static void *v2i_idp(const X509V3_EXT_METHOD
*method
, X509V3_CTX
*ctx
,
641 STACK_OF(CONF_VALUE
) *nval
);
643 const X509V3_EXT_METHOD v3_idp
= {
644 NID_issuing_distribution_point
, X509V3_EXT_MULTILINE
,
645 ASN1_ITEM_ref(ISSUING_DIST_POINT
),
655 v2i_idp(const X509V3_EXT_METHOD
*method
, X509V3_CTX
*ctx
,
656 STACK_OF(CONF_VALUE
) *nval
)
658 ISSUING_DIST_POINT
*idp
= NULL
;
663 idp
= ISSUING_DIST_POINT_new();
666 for (i
= 0; i
< sk_CONF_VALUE_num(nval
); i
++) {
667 cnf
= sk_CONF_VALUE_value(nval
, i
);
670 ret
= set_dist_point_name(&idp
->distpoint
, ctx
, cnf
);
675 if (!strcmp(name
, "onlyuser")) {
676 if (!X509V3_get_value_bool(cnf
, &idp
->onlyuser
))
679 else if (!strcmp(name
, "onlyCA")) {
680 if (!X509V3_get_value_bool(cnf
, &idp
->onlyCA
))
683 else if (!strcmp(name
, "onlyAA")) {
684 if (!X509V3_get_value_bool(cnf
, &idp
->onlyattr
))
687 else if (!strcmp(name
, "indirectCRL")) {
688 if (!X509V3_get_value_bool(cnf
, &idp
->indirectCRL
))
691 else if (!strcmp(name
, "onlysomereasons")) {
692 if (!set_reasons(&idp
->onlysomereasons
, val
))
695 X509V3err(X509V3_F_V2I_IDP
, X509V3_R_INVALID_NAME
);
696 X509V3_conf_err(cnf
);
703 X509V3err(X509V3_F_V2I_IDP
, ERR_R_MALLOC_FAILURE
);
705 ISSUING_DIST_POINT_free(idp
);
710 print_gens(BIO
*out
, STACK_OF(GENERAL_NAME
) *gens
, int indent
)
714 for (i
= 0; i
< sk_GENERAL_NAME_num(gens
); i
++) {
715 BIO_printf(out
, "%*s", indent
+ 2, "");
716 GENERAL_NAME_print(out
, sk_GENERAL_NAME_value(gens
, i
));
723 print_distpoint(BIO
*out
, DIST_POINT_NAME
*dpn
, int indent
)
725 if (dpn
->type
== 0) {
726 BIO_printf(out
, "%*sFull Name:\n", indent
, "");
727 print_gens(out
, dpn
->name
.fullname
, indent
);
730 ntmp
.entries
= dpn
->name
.relativename
;
731 BIO_printf(out
, "%*sRelative Name:\n%*s",
732 indent
, "", indent
+ 2, "");
733 X509_NAME_print_ex(out
, &ntmp
, 0, XN_FLAG_ONELINE
);
740 i2r_idp(const X509V3_EXT_METHOD
*method
, void *pidp
, BIO
*out
, int indent
)
742 ISSUING_DIST_POINT
*idp
= pidp
;
745 print_distpoint(out
, idp
->distpoint
, indent
);
746 if (idp
->onlyuser
> 0)
747 BIO_printf(out
, "%*sOnly User Certificates\n", indent
, "");
749 BIO_printf(out
, "%*sOnly CA Certificates\n", indent
, "");
750 if (idp
->indirectCRL
> 0)
751 BIO_printf(out
, "%*sIndirect CRL\n", indent
, "");
752 if (idp
->onlysomereasons
)
753 print_reasons(out
, "Only Some Reasons",
754 idp
->onlysomereasons
, indent
);
755 if (idp
->onlyattr
> 0)
756 BIO_printf(out
, "%*sOnly Attribute Certificates\n", indent
, "");
757 if (!idp
->distpoint
&& (idp
->onlyuser
<= 0) && (idp
->onlyCA
<= 0) &&
758 (idp
->indirectCRL
<= 0) && !idp
->onlysomereasons
&&
759 (idp
->onlyattr
<= 0))
760 BIO_printf(out
, "%*s<EMPTY>\n", indent
, "");
766 i2r_crldp(const X509V3_EXT_METHOD
*method
, void *pcrldp
, BIO
*out
, int indent
)
768 STACK_OF(DIST_POINT
) *crld
= pcrldp
;
772 for (i
= 0; i
< sk_DIST_POINT_num(crld
); i
++) {
774 point
= sk_DIST_POINT_value(crld
, i
);
775 if (point
->distpoint
)
776 print_distpoint(out
, point
->distpoint
, indent
);
778 print_reasons(out
, "Reasons", point
->reasons
,
780 if (point
->CRLissuer
) {
781 BIO_printf(out
, "%*sCRL Issuer:\n", indent
, "");
782 print_gens(out
, point
->CRLissuer
, indent
);
789 DIST_POINT_set_dpname(DIST_POINT_NAME
*dpn
, X509_NAME
*iname
)
792 STACK_OF(X509_NAME_ENTRY
) *frag
;
795 if (!dpn
|| (dpn
->type
!= 1))
797 frag
= dpn
->name
.relativename
;
798 dpn
->dpname
= X509_NAME_dup(iname
);
801 for (i
= 0; i
< sk_X509_NAME_ENTRY_num(frag
); i
++) {
802 ne
= sk_X509_NAME_ENTRY_value(frag
, i
);
803 if (!X509_NAME_add_entry(dpn
->dpname
, ne
, -1, i
? 0 : 1)) {
804 X509_NAME_free(dpn
->dpname
);
809 /* generate cached encoding of name */
810 if (i2d_X509_NAME(dpn
->dpname
, NULL
) < 0) {
811 X509_NAME_free(dpn
->dpname
);