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