Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #ifndef _GENAME_H_
6 #define _GENAME_H_
8 #include "plarena.h"
9 #include "seccomon.h"
10 #include "secoidt.h"
11 #include "secasn1.h"
12 #include "secder.h"
13 #include "certt.h"
15 /************************************************************************/
16 SEC_BEGIN_PROTOS
18 extern const SEC_ASN1Template CERT_GeneralNamesTemplate[];
20 extern SECItem **
21 cert_EncodeGeneralNames(PLArenaPool *arena, CERTGeneralName *names);
23 extern CERTGeneralName *
24 cert_DecodeGeneralNames(PLArenaPool *arena, SECItem **encodedGenName);
26 extern SECStatus
27 cert_DestroyGeneralNames(CERTGeneralName *name);
29 extern CERTGeneralNameType
30 CERT_GetGeneralNameTypeFromString(const char *string);
32 extern SECStatus
33 cert_EncodeNameConstraints(CERTNameConstraints *constraints, PLArenaPool *arena,
34 SECItem *dest);
36 extern CERTNameConstraints *
37 cert_DecodeNameConstraints(PLArenaPool *arena, const SECItem *encodedConstraints);
39 extern CERTGeneralName *
40 cert_CombineNamesLists(CERTGeneralName *list1, CERTGeneralName *list2);
42 extern CERTNameConstraint *
43 cert_CombineConstraintsLists(CERTNameConstraint *list1, CERTNameConstraint *list2);
45 /*********************************************************************/
46 /* A thread safe implementation of General Names */
47 /*********************************************************************/
49 /* Destroy a Single CERTGeneralName */
50 void
51 CERT_DestroyGeneralName(CERTGeneralName *name);
53 SECStatus
54 CERT_CompareGeneralName(CERTGeneralName *a, CERTGeneralName *b);
56 SECStatus
57 CERT_CopyGeneralName(PLArenaPool *arena,
58 CERTGeneralName *dest,
59 CERTGeneralName *src);
61 /* General Name Lists are a thread safe, reference counting layer to
62 * general names */
64 /* Destroys a CERTGeneralNameList */
65 void
66 CERT_DestroyGeneralNameList(CERTGeneralNameList *list);
68 /* Creates a CERTGeneralNameList */
69 CERTGeneralNameList *
70 CERT_CreateGeneralNameList(CERTGeneralName *name);
72 /* Compares two CERTGeneralNameList */
73 SECStatus
74 CERT_CompareGeneralNameLists(CERTGeneralNameList *a, CERTGeneralNameList *b);
76 /* returns a copy of the first name of the type requested */
77 void *
78 CERT_GetGeneralNameFromListByType(CERTGeneralNameList *list,
79 CERTGeneralNameType type,
80 PLArenaPool *arena);
82 /* Adds a name to the tail of the list */
83 void
84 CERT_AddGeneralNameToList(CERTGeneralNameList *list,
85 CERTGeneralNameType type,
86 void *data, SECItem *oid);
88 /* returns a duplicate of the CERTGeneralNameList */
89 CERTGeneralNameList *
90 CERT_DupGeneralNameList(CERTGeneralNameList *list);
92 /* returns the number of CERTGeneralName objects in the doubly linked
93 ** list of which *names is a member.
94 */
95 extern int
96 CERT_GetNamesLength(CERTGeneralName *names);
98 /************************************************************************/
100 SECStatus
101 CERT_CompareNameSpace(CERTCertificate *cert,
102 CERTGeneralName *namesList,
103 CERTCertificate **certsList,
104 PLArenaPool *reqArena,
105 CERTCertificate **pBadCert);
107 SEC_END_PROTOS
109 #endif