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 /* | 5 /* |
6 * PKCS7 encoding. | 6 * PKCS7 encoding. |
7 */ | 7 */ |
8 | 8 |
9 #include "p7local.h" | 9 #include "p7local.h" |
10 | 10 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 sec_pkcs7_encoder_start_encrypt (SEC_PKCS7ContentInfo *cinfo, | 52 sec_pkcs7_encoder_start_encrypt (SEC_PKCS7ContentInfo *cinfo, |
53 PK11SymKey *orig_bulkkey) | 53 PK11SymKey *orig_bulkkey) |
54 { | 54 { |
55 SECOidTag kind; | 55 SECOidTag kind; |
56 sec_PKCS7CipherObject *encryptobj; | 56 sec_PKCS7CipherObject *encryptobj; |
57 SEC_PKCS7RecipientInfo **recipientinfos, *ri; | 57 SEC_PKCS7RecipientInfo **recipientinfos, *ri; |
58 SEC_PKCS7EncryptedContentInfo *enccinfo; | 58 SEC_PKCS7EncryptedContentInfo *enccinfo; |
59 SECKEYPublicKey *publickey = NULL; | 59 SECKEYPublicKey *publickey = NULL; |
60 SECKEYPrivateKey *ourPrivKey = NULL; | 60 SECKEYPrivateKey *ourPrivKey = NULL; |
61 PK11SymKey *bulkkey; | 61 PK11SymKey *bulkkey; |
62 void *mark, *wincx; | 62 void *mark; |
63 int i; | 63 int i; |
64 PLArenaPool *arena = NULL; | 64 PLArenaPool *arena = NULL; |
65 | 65 |
66 /* Get the context in case we need it below. */ | |
67 wincx = cinfo->pwfn_arg; | |
68 | |
69 kind = SEC_PKCS7ContentType (cinfo); | 66 kind = SEC_PKCS7ContentType (cinfo); |
70 switch (kind) { | 67 switch (kind) { |
71 default: | 68 default: |
72 case SEC_OID_PKCS7_DATA: | 69 case SEC_OID_PKCS7_DATA: |
73 case SEC_OID_PKCS7_DIGESTED_DATA: | 70 case SEC_OID_PKCS7_DIGESTED_DATA: |
74 case SEC_OID_PKCS7_SIGNED_DATA: | 71 case SEC_OID_PKCS7_SIGNED_DATA: |
75 recipientinfos = NULL; | 72 recipientinfos = NULL; |
76 enccinfo = NULL; | 73 enccinfo = NULL; |
77 break; | 74 break; |
78 case SEC_OID_PKCS7_ENCRYPTED_DATA: | 75 case SEC_OID_PKCS7_ENCRYPTED_DATA: |
(...skipping 1022 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1101 { | 1098 { |
1102 SECStatus rv; | 1099 SECStatus rv; |
1103 | 1100 |
1104 rv = SEC_PKCS7PrepareForEncode (cinfo, bulkkey, pwfn, pwfnarg); | 1101 rv = SEC_PKCS7PrepareForEncode (cinfo, bulkkey, pwfn, pwfnarg); |
1105 if (rv != SECSuccess) | 1102 if (rv != SECSuccess) |
1106 return NULL; | 1103 return NULL; |
1107 | 1104 |
1108 return SEC_ASN1EncodeItem (pool, dest, cinfo, sec_PKCS7ContentInfoTemplate); | 1105 return SEC_ASN1EncodeItem (pool, dest, cinfo, sec_PKCS7ContentInfoTemplate); |
1109 } | 1106 } |
1110 | 1107 |
OLD | NEW |