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 maps various PKCS #11 Mechanisms to related mechanisms, key | 5 * This file maps various PKCS #11 Mechanisms to related mechanisms, key |
6 * types, and ASN.1 encodings. | 6 * types, and ASN.1 encodings. |
7 */ | 7 */ |
8 #include "seccomon.h" | 8 #include "seccomon.h" |
9 #include "secmod.h" | 9 #include "secmod.h" |
10 #include "secmodi.h" | 10 #include "secmodi.h" |
(...skipping 1117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1128 | 1128 |
1129 | 1129 |
1130 /* Generate a mechaism param from a type, and iv. */ | 1130 /* Generate a mechaism param from a type, and iv. */ |
1131 SECItem * | 1131 SECItem * |
1132 PK11_ParamFromAlgid(SECAlgorithmID *algid) | 1132 PK11_ParamFromAlgid(SECAlgorithmID *algid) |
1133 { | 1133 { |
1134 CK_RC2_CBC_PARAMS * rc2_cbc_params = NULL; | 1134 CK_RC2_CBC_PARAMS * rc2_cbc_params = NULL; |
1135 CK_RC2_PARAMS * rc2_ecb_params = NULL; | 1135 CK_RC2_PARAMS * rc2_ecb_params = NULL; |
1136 CK_RC5_CBC_PARAMS * rc5_cbc_params = NULL; | 1136 CK_RC5_CBC_PARAMS * rc5_cbc_params = NULL; |
1137 CK_RC5_PARAMS * rc5_ecb_params = NULL; | 1137 CK_RC5_PARAMS * rc5_ecb_params = NULL; |
1138 PRArenaPool * arena = NULL; | 1138 PLArenaPool * arena = NULL; |
1139 SECItem * mech = NULL; | 1139 SECItem * mech = NULL; |
1140 SECOidTag algtag; | 1140 SECOidTag algtag; |
1141 SECStatus rv; | 1141 SECStatus rv; |
1142 CK_MECHANISM_TYPE type; | 1142 CK_MECHANISM_TYPE type; |
1143 /* initialize these to prevent UMRs in the ASN1 decoder. */ | 1143 /* initialize these to prevent UMRs in the ASN1 decoder. */ |
1144 SECItem iv = {siBuffer, NULL, 0}; | 1144 SECItem iv = {siBuffer, NULL, 0}; |
1145 sec_rc2cbcParameter rc2 = { {siBuffer, NULL, 0}, {siBuffer, NULL, 0} }; | 1145 sec_rc2cbcParameter rc2 = { {siBuffer, NULL, 0}, {siBuffer, NULL, 0} }; |
1146 sec_rc5cbcParameter rc5 = { {siBuffer, NULL, 0}, {siBuffer, NULL, 0}, | 1146 sec_rc5cbcParameter rc5 = { {siBuffer, NULL, 0}, {siBuffer, NULL, 0}, |
1147 {siBuffer, NULL, 0}, {siBuffer, NULL, 0} }; | 1147 {siBuffer, NULL, 0}, {siBuffer, NULL, 0} }; |
1148 | 1148 |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1511 int keyLen = key ? PK11_GetKeyLength(key) : 0; | 1511 int keyLen = key ? PK11_GetKeyLength(key) : 0; |
1512 | 1512 |
1513 return pk11_GenerateNewParamWithKeyLen(type, keyLen); | 1513 return pk11_GenerateNewParamWithKeyLen(type, keyLen); |
1514 } | 1514 } |
1515 | 1515 |
1516 #define RC5_V10 0x10 | 1516 #define RC5_V10 0x10 |
1517 | 1517 |
1518 /* turn a PKCS #11 parameter into a DER Encoded Algorithm ID */ | 1518 /* turn a PKCS #11 parameter into a DER Encoded Algorithm ID */ |
1519 SECStatus | 1519 SECStatus |
1520 PK11_ParamToAlgid(SECOidTag algTag, SECItem *param, | 1520 PK11_ParamToAlgid(SECOidTag algTag, SECItem *param, |
1521 » » » » PRArenaPool *arena, SECAlgorithmID *algid) { | 1521 » » » » PLArenaPool *arena, SECAlgorithmID *algid) { |
1522 CK_RC2_CBC_PARAMS *rc2_params; | 1522 CK_RC2_CBC_PARAMS *rc2_params; |
1523 sec_rc2cbcParameter rc2; | 1523 sec_rc2cbcParameter rc2; |
1524 CK_RC5_CBC_PARAMS *rc5_params; | 1524 CK_RC5_CBC_PARAMS *rc5_params; |
1525 sec_rc5cbcParameter rc5; | 1525 sec_rc5cbcParameter rc5; |
1526 CK_MECHANISM_TYPE type = PK11_AlgtagToMechanism(algTag); | 1526 CK_MECHANISM_TYPE type = PK11_AlgtagToMechanism(algTag); |
1527 SECItem *newParams = NULL; | 1527 SECItem *newParams = NULL; |
1528 SECStatus rv = SECFailure; | 1528 SECStatus rv = SECFailure; |
1529 unsigned long rc2version; | 1529 unsigned long rc2version; |
1530 | 1530 |
1531 switch (type) { | 1531 switch (type) { |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1877 case SEC_OID_MISSI_DSS: | 1877 case SEC_OID_MISSI_DSS: |
1878 case SEC_OID_MISSI_DSS_OLD: | 1878 case SEC_OID_MISSI_DSS_OLD: |
1879 case SEC_OID_MISSI_KEA_DSS_OLD: | 1879 case SEC_OID_MISSI_KEA_DSS_OLD: |
1880 case SEC_OID_BOGUS_DSA_SIGNATURE_WITH_SHA1_DIGEST: | 1880 case SEC_OID_BOGUS_DSA_SIGNATURE_WITH_SHA1_DIGEST: |
1881 return SEC_OID_ANSIX9_DSA_SIGNATURE; | 1881 return SEC_OID_ANSIX9_DSA_SIGNATURE; |
1882 default: | 1882 default: |
1883 break; | 1883 break; |
1884 } | 1884 } |
1885 return algTag; | 1885 return algTag; |
1886 } | 1886 } |
OLD | NEW |