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 * This file manages Netscape specific PKCS #11 objects (CRLs, Trust objects, | 5 * This file manages Netscape specific PKCS #11 objects (CRLs, Trust objects, |
6 * etc). | 6 * etc). |
7 */ | 7 */ |
8 | 8 |
9 #include "secport.h" | 9 #include "secport.h" |
10 #include "seccomon.h" | 10 #include "seccomon.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "pki3hack.h" | 26 #include "pki3hack.h" |
27 #include "dev3hack.h" | 27 #include "dev3hack.h" |
28 | 28 |
29 #include "devm.h" | 29 #include "devm.h" |
30 #include "pki.h" | 30 #include "pki.h" |
31 #include "pkim.h" | 31 #include "pkim.h" |
32 | 32 |
33 extern const NSSError NSS_ERROR_NOT_FOUND; | 33 extern const NSSError NSS_ERROR_NOT_FOUND; |
34 | 34 |
35 CK_TRUST | 35 CK_TRUST |
36 pk11_GetTrustField(PK11SlotInfo *slot, PRArenaPool *arena, | 36 pk11_GetTrustField(PK11SlotInfo *slot, PLArenaPool *arena, |
37 CK_OBJECT_HANDLE id, CK_ATTRIBUTE_TYPE type) | 37 CK_OBJECT_HANDLE id, CK_ATTRIBUTE_TYPE type) |
38 { | 38 { |
39 CK_TRUST rv = 0; | 39 CK_TRUST rv = 0; |
40 SECItem item; | 40 SECItem item; |
41 | 41 |
42 item.data = NULL; | 42 item.data = NULL; |
43 item.len = 0; | 43 item.len = 0; |
44 | 44 |
45 if( SECSuccess == PK11_ReadAttribute(slot, id, type, arena, &item) ) { | 45 if( SECSuccess == PK11_ReadAttribute(slot, id, type, arena, &item) ) { |
46 PORT_Assert(item.len == sizeof(CK_TRUST)); | 46 PORT_Assert(item.len == sizeof(CK_TRUST)); |
47 PORT_Memcpy(&rv, item.data, sizeof(CK_TRUST)); | 47 PORT_Memcpy(&rv, item.data, sizeof(CK_TRUST)); |
48 /* Damn, is there an endian problem here? */ | 48 /* Damn, is there an endian problem here? */ |
49 return rv; | 49 return rv; |
50 } | 50 } |
51 | 51 |
52 return 0; | 52 return 0; |
53 } | 53 } |
54 | 54 |
55 PRBool | 55 PRBool |
56 pk11_HandleTrustObject(PK11SlotInfo *slot, CERTCertificate *cert, CERTCertTrust
*trust) | 56 pk11_HandleTrustObject(PK11SlotInfo *slot, CERTCertificate *cert, CERTCertTrust
*trust) |
57 { | 57 { |
58 PRArenaPool *arena; | 58 PLArenaPool *arena; |
59 | 59 |
60 CK_ATTRIBUTE tobjTemplate[] = { | 60 CK_ATTRIBUTE tobjTemplate[] = { |
61 { CKA_CLASS, NULL, 0 }, | 61 { CKA_CLASS, NULL, 0 }, |
62 { CKA_CERT_SHA1_HASH, NULL, 0 }, | 62 { CKA_CERT_SHA1_HASH, NULL, 0 }, |
63 }; | 63 }; |
64 | 64 |
65 CK_OBJECT_CLASS tobjc = CKO_NETSCAPE_TRUST; | 65 CK_OBJECT_CLASS tobjc = CKO_NETSCAPE_TRUST; |
66 CK_OBJECT_HANDLE tobjID; | 66 CK_OBJECT_HANDLE tobjID; |
67 unsigned char sha1_hash[SHA1_LENGTH]; | 67 unsigned char sha1_hash[SHA1_LENGTH]; |
68 | 68 |
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
712 return SECSuccess; | 712 return SECSuccess; |
713 } | 713 } |
714 | 714 |
715 | 715 |
716 CERTSignedCrl * crl_storeCRL (PK11SlotInfo *slot,char *url, | 716 CERTSignedCrl * crl_storeCRL (PK11SlotInfo *slot,char *url, |
717 CERTSignedCrl *newCrl, SECItem *derCrl, int type); | 717 CERTSignedCrl *newCrl, SECItem *derCrl, int type); |
718 | 718 |
719 /* import the CRL into the token */ | 719 /* import the CRL into the token */ |
720 | 720 |
721 CERTSignedCrl* PK11_ImportCRL(PK11SlotInfo * slot, SECItem *derCRL, char *url, | 721 CERTSignedCrl* PK11_ImportCRL(PK11SlotInfo * slot, SECItem *derCRL, char *url, |
722 int type, void *wincx, PRInt32 importOptions, PRArenaPool* arena, | 722 int type, void *wincx, PRInt32 importOptions, PLArenaPool* arena, |
723 PRInt32 decodeoptions) | 723 PRInt32 decodeoptions) |
724 { | 724 { |
725 CERTSignedCrl *newCrl, *crl; | 725 CERTSignedCrl *newCrl, *crl; |
726 SECStatus rv; | 726 SECStatus rv; |
727 CERTCertificate *caCert = NULL; | 727 CERTCertificate *caCert = NULL; |
728 | 728 |
729 newCrl = crl = NULL; | 729 newCrl = crl = NULL; |
730 | 730 |
731 do { | 731 do { |
732 newCrl = CERT_DecodeDERCrlWithFlags(arena, derCRL, type, | 732 newCrl = CERT_DecodeDERCrlWithFlags(arena, derCRL, type, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
776 } while (0); | 776 } while (0); |
777 | 777 |
778 if (crl == NULL) { | 778 if (crl == NULL) { |
779 SEC_DestroyCrl (newCrl); | 779 SEC_DestroyCrl (newCrl); |
780 } | 780 } |
781 if (caCert) { | 781 if (caCert) { |
782 CERT_DestroyCertificate(caCert); | 782 CERT_DestroyCertificate(caCert); |
783 } | 783 } |
784 return (crl); | 784 return (crl); |
785 } | 785 } |
OLD | NEW |