| 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 object type indepentent functions. | 5 * This file manages object type indepentent functions. |
| 6 */ | 6 */ |
| 7 #include "seccomon.h" | 7 #include "seccomon.h" |
| 8 #include "secmod.h" | 8 #include "secmod.h" |
| 9 #include "secmodi.h" | 9 #include "secmodi.h" |
| 10 #include "secmodti.h" | 10 #include "secmodti.h" |
| (...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 678 /* 129 is 1024 bits translated to bytes and | 678 /* 129 is 1024 bits translated to bytes and |
| 679 * padded with an optional '0' to maintain a | 679 * padded with an optional '0' to maintain a |
| 680 * positive sign */ | 680 * positive sign */ |
| 681 (key->u.dsa.params.prime.len > 129)) { | 681 (key->u.dsa.params.prime.len > 129)) { |
| 682 /* we need to get a slot that not only can do DSA, but can do DSA2 | 682 /* we need to get a slot that not only can do DSA, but can do DSA2 |
| 683 * key lengths */ | 683 * key lengths */ |
| 684 length = key->u.dsa.params.prime.len; | 684 length = key->u.dsa.params.prime.len; |
| 685 if (key->u.dsa.params.prime.data[0] == 0) { | 685 if (key->u.dsa.params.prime.data[0] == 0) { |
| 686 length --; | 686 length --; |
| 687 } | 687 } |
| 688 /* convert keysize to bits for slot lookup */ |
| 689 length *= 8; |
| 688 } | 690 } |
| 689 slot = PK11_GetBestSlotWithAttributes(mech.mechanism, | 691 slot = PK11_GetBestSlotWithAttributes(mech.mechanism, |
| 690 CKF_VERIFY,length,wincx); | 692 CKF_VERIFY,length,wincx); |
| 691 if (slot == NULL) { | 693 if (slot == NULL) { |
| 692 PORT_SetError( SEC_ERROR_NO_MODULE ); | 694 PORT_SetError( SEC_ERROR_NO_MODULE ); |
| 693 return SECFailure; | 695 return SECFailure; |
| 694 } | 696 } |
| 695 id = PK11_ImportPublicKey(slot,key,PR_FALSE); | 697 id = PK11_ImportPublicKey(slot,key,PR_FALSE); |
| 696 | 698 |
| 697 } else { | 699 } else { |
| (...skipping 1269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1967 PORT_SetError( PK11_MapError(crv) ); | 1969 PORT_SetError( PK11_MapError(crv) ); |
| 1968 return NULL; | 1970 return NULL; |
| 1969 } | 1971 } |
| 1970 | 1972 |
| 1971 item->data = (unsigned char*) theTemplate[0].pValue; | 1973 item->data = (unsigned char*) theTemplate[0].pValue; |
| 1972 item->len =theTemplate[0].ulValueLen; | 1974 item->len =theTemplate[0].ulValueLen; |
| 1973 | 1975 |
| 1974 return item; | 1976 return item; |
| 1975 } | 1977 } |
| 1976 | 1978 |
| OLD | NEW |