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 * Internal PKCS #11 functions. Should only be called by pkcs11.c | 5 * Internal PKCS #11 functions. Should only be called by pkcs11.c |
6 */ | 6 */ |
7 #include "pkcs11.h" | 7 #include "pkcs11.h" |
8 #include "pkcs11i.h" | 8 #include "pkcs11i.h" |
9 #include "lowkeyi.h" | 9 #include "lowkeyi.h" |
10 #include "secasn1.h" | 10 #include "secasn1.h" |
(...skipping 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1239 CKA_SUBPRIME, CKA_PRIME, CKA_BASE, CKA_VALUE | 1239 CKA_SUBPRIME, CKA_PRIME, CKA_BASE, CKA_VALUE |
1240 }; | 1240 }; |
1241 static const CK_ULONG dsaPubKeyAttrsCount = | 1241 static const CK_ULONG dsaPubKeyAttrsCount = |
1242 sizeof(dsaPubKeyAttrs)/sizeof(dsaPubKeyAttrs[0]); | 1242 sizeof(dsaPubKeyAttrs)/sizeof(dsaPubKeyAttrs[0]); |
1243 | 1243 |
1244 static const CK_ATTRIBUTE_TYPE dhPubKeyAttrs[] = { | 1244 static const CK_ATTRIBUTE_TYPE dhPubKeyAttrs[] = { |
1245 CKA_PRIME, CKA_BASE, CKA_VALUE | 1245 CKA_PRIME, CKA_BASE, CKA_VALUE |
1246 }; | 1246 }; |
1247 static const CK_ULONG dhPubKeyAttrsCount = | 1247 static const CK_ULONG dhPubKeyAttrsCount = |
1248 sizeof(dhPubKeyAttrs)/sizeof(dhPubKeyAttrs[0]); | 1248 sizeof(dhPubKeyAttrs)/sizeof(dhPubKeyAttrs[0]); |
1249 #ifdef NSS_ENABLE_ECC | 1249 #ifndef NSS_DISABLE_ECC |
1250 static const CK_ATTRIBUTE_TYPE ecPubKeyAttrs[] = { | 1250 static const CK_ATTRIBUTE_TYPE ecPubKeyAttrs[] = { |
1251 CKA_EC_PARAMS, CKA_EC_POINT | 1251 CKA_EC_PARAMS, CKA_EC_POINT |
1252 }; | 1252 }; |
1253 static const CK_ULONG ecPubKeyAttrsCount = | 1253 static const CK_ULONG ecPubKeyAttrsCount = |
1254 sizeof(ecPubKeyAttrs)/sizeof(ecPubKeyAttrs[0]); | 1254 sizeof(ecPubKeyAttrs)/sizeof(ecPubKeyAttrs[0]); |
1255 #endif | 1255 #endif |
1256 | 1256 |
1257 static const CK_ATTRIBUTE_TYPE commonPrivKeyAttrs[] = { | 1257 static const CK_ATTRIBUTE_TYPE commonPrivKeyAttrs[] = { |
1258 CKA_DECRYPT, CKA_SIGN, CKA_SIGN_RECOVER, CKA_UNWRAP, CKA_SUBJECT, | 1258 CKA_DECRYPT, CKA_SIGN, CKA_SIGN_RECOVER, CKA_UNWRAP, CKA_SUBJECT, |
1259 CKA_SENSITIVE, CKA_EXTRACTABLE, CKA_NETSCAPE_DB | 1259 CKA_SENSITIVE, CKA_EXTRACTABLE, CKA_NETSCAPE_DB |
(...skipping 12 matching lines...) Expand all Loading... |
1272 CKA_SUBPRIME, CKA_PRIME, CKA_BASE, CKA_VALUE | 1272 CKA_SUBPRIME, CKA_PRIME, CKA_BASE, CKA_VALUE |
1273 }; | 1273 }; |
1274 static const CK_ULONG dsaPrivKeyAttrsCount = | 1274 static const CK_ULONG dsaPrivKeyAttrsCount = |
1275 sizeof(dsaPrivKeyAttrs)/sizeof(dsaPrivKeyAttrs[0]); | 1275 sizeof(dsaPrivKeyAttrs)/sizeof(dsaPrivKeyAttrs[0]); |
1276 | 1276 |
1277 static const CK_ATTRIBUTE_TYPE dhPrivKeyAttrs[] = { | 1277 static const CK_ATTRIBUTE_TYPE dhPrivKeyAttrs[] = { |
1278 CKA_PRIME, CKA_BASE, CKA_VALUE | 1278 CKA_PRIME, CKA_BASE, CKA_VALUE |
1279 }; | 1279 }; |
1280 static const CK_ULONG dhPrivKeyAttrsCount = | 1280 static const CK_ULONG dhPrivKeyAttrsCount = |
1281 sizeof(dhPrivKeyAttrs)/sizeof(dhPrivKeyAttrs[0]); | 1281 sizeof(dhPrivKeyAttrs)/sizeof(dhPrivKeyAttrs[0]); |
1282 #ifdef NSS_ENABLE_ECC | 1282 #ifndef NSS_DISABLE_ECC |
1283 static const CK_ATTRIBUTE_TYPE ecPrivKeyAttrs[] = { | 1283 static const CK_ATTRIBUTE_TYPE ecPrivKeyAttrs[] = { |
1284 CKA_EC_PARAMS, CKA_VALUE | 1284 CKA_EC_PARAMS, CKA_VALUE |
1285 }; | 1285 }; |
1286 static const CK_ULONG ecPrivKeyAttrsCount = | 1286 static const CK_ULONG ecPrivKeyAttrsCount = |
1287 sizeof(ecPrivKeyAttrs)/sizeof(ecPrivKeyAttrs[0]); | 1287 sizeof(ecPrivKeyAttrs)/sizeof(ecPrivKeyAttrs[0]); |
1288 #endif | 1288 #endif |
1289 | 1289 |
1290 static const CK_ATTRIBUTE_TYPE certAttrs[] = { | 1290 static const CK_ATTRIBUTE_TYPE certAttrs[] = { |
1291 CKA_CERTIFICATE_TYPE, CKA_VALUE, CKA_SUBJECT, CKA_ISSUER, CKA_SERIAL_NUMBER | 1291 CKA_CERTIFICATE_TYPE, CKA_VALUE, CKA_SUBJECT, CKA_ISSUER, CKA_SERIAL_NUMBER |
1292 }; | 1292 }; |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1383 rsaPrivKeyAttrsCount); | 1383 rsaPrivKeyAttrsCount); |
1384 break; | 1384 break; |
1385 case CKK_DSA: | 1385 case CKK_DSA: |
1386 crv = stfk_CopyTokenAttributes(destObject, src_to, dsaPrivKeyAttrs, | 1386 crv = stfk_CopyTokenAttributes(destObject, src_to, dsaPrivKeyAttrs, |
1387 dsaPrivKeyAttrsCount); | 1387 dsaPrivKeyAttrsCount); |
1388 break; | 1388 break; |
1389 case CKK_DH: | 1389 case CKK_DH: |
1390 crv = stfk_CopyTokenAttributes(destObject, src_to, dhPrivKeyAttrs, | 1390 crv = stfk_CopyTokenAttributes(destObject, src_to, dhPrivKeyAttrs, |
1391 dhPrivKeyAttrsCount); | 1391 dhPrivKeyAttrsCount); |
1392 break; | 1392 break; |
1393 #ifdef NSS_ENABLE_ECC | 1393 #ifndef NSS_DISABLE_ECC |
1394 case CKK_EC: | 1394 case CKK_EC: |
1395 crv = stfk_CopyTokenAttributes(destObject, src_to, ecPrivKeyAttrs, | 1395 crv = stfk_CopyTokenAttributes(destObject, src_to, ecPrivKeyAttrs, |
1396 ecPrivKeyAttrsCount); | 1396 ecPrivKeyAttrsCount); |
1397 break; | 1397 break; |
1398 #endif | 1398 #endif |
1399 default: | 1399 default: |
1400 crv = CKR_DEVICE_ERROR; /* shouldn't happen unless we store more types | 1400 crv = CKR_DEVICE_ERROR; /* shouldn't happen unless we store more types |
1401 * of token keys into our database. */ | 1401 * of token keys into our database. */ |
1402 } | 1402 } |
1403 fail: | 1403 fail: |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1445 rsaPubKeyAttrsCount); | 1445 rsaPubKeyAttrsCount); |
1446 break; | 1446 break; |
1447 case CKK_DSA: | 1447 case CKK_DSA: |
1448 crv = stfk_CopyTokenAttributes(destObject, src_to, dsaPubKeyAttrs, | 1448 crv = stfk_CopyTokenAttributes(destObject, src_to, dsaPubKeyAttrs, |
1449 dsaPubKeyAttrsCount); | 1449 dsaPubKeyAttrsCount); |
1450 break; | 1450 break; |
1451 case CKK_DH: | 1451 case CKK_DH: |
1452 crv = stfk_CopyTokenAttributes(destObject, src_to, dhPubKeyAttrs, | 1452 crv = stfk_CopyTokenAttributes(destObject, src_to, dhPubKeyAttrs, |
1453 dhPubKeyAttrsCount); | 1453 dhPubKeyAttrsCount); |
1454 break; | 1454 break; |
1455 #ifdef NSS_ENABLE_ECC | 1455 #ifndef NSS_DISABLE_ECC |
1456 case CKK_EC: | 1456 case CKK_EC: |
1457 crv = stfk_CopyTokenAttributes(destObject, src_to, ecPubKeyAttrs, | 1457 crv = stfk_CopyTokenAttributes(destObject, src_to, ecPubKeyAttrs, |
1458 ecPubKeyAttrsCount); | 1458 ecPubKeyAttrsCount); |
1459 break; | 1459 break; |
1460 #endif | 1460 #endif |
1461 default: | 1461 default: |
1462 crv = CKR_DEVICE_ERROR; /* shouldn't happen unless we store more types | 1462 crv = CKR_DEVICE_ERROR; /* shouldn't happen unless we store more types |
1463 * of token keys into our database. */ | 1463 * of token keys into our database. */ |
1464 } | 1464 } |
1465 fail: | 1465 fail: |
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1970 { | 1970 { |
1971 return !sftk_isToken(obj->handle) ? (SFTKSessionObject *)obj : NULL; | 1971 return !sftk_isToken(obj->handle) ? (SFTKSessionObject *)obj : NULL; |
1972 } | 1972 } |
1973 | 1973 |
1974 SFTKTokenObject * | 1974 SFTKTokenObject * |
1975 sftk_narrowToTokenObject(SFTKObject *obj) | 1975 sftk_narrowToTokenObject(SFTKObject *obj) |
1976 { | 1976 { |
1977 return sftk_isToken(obj->handle) ? (SFTKTokenObject *)obj : NULL; | 1977 return sftk_isToken(obj->handle) ? (SFTKTokenObject *)obj : NULL; |
1978 } | 1978 } |
1979 | 1979 |
OLD | NEW |