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