OLD | NEW |
1 /* | 1 /* |
2 * Signature stuff. | 2 * Signature stuff. |
3 * | 3 * |
4 * This Source Code Form is subject to the terms of the Mozilla Public | 4 * This Source Code Form is subject to the terms of the Mozilla Public |
5 * License, v. 2.0. If a copy of the MPL was not distributed with this | 5 * License, v. 2.0. If a copy of the MPL was not distributed with this |
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | 6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
7 | 7 |
8 #include <stdio.h> | 8 #include <stdio.h> |
9 #include "cryptohi.h" | 9 #include "cryptohi.h" |
10 #include "sechash.h" | 10 #include "sechash.h" |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 ** block | 406 ** block |
407 */ | 407 */ |
408 modulusLen = PK11_SignatureLen(privKey); | 408 modulusLen = PK11_SignatureLen(privKey); |
409 if (modulusLen <= 0) { | 409 if (modulusLen <= 0) { |
410 PORT_SetError(SEC_ERROR_INVALID_KEY); | 410 PORT_SetError(SEC_ERROR_INVALID_KEY); |
411 rv = SECFailure; | 411 rv = SECFailure; |
412 goto loser; | 412 goto loser; |
413 } | 413 } |
414 result->len = modulusLen; | 414 result->len = modulusLen; |
415 result->data = (unsigned char*) PORT_Alloc(modulusLen); | 415 result->data = (unsigned char*) PORT_Alloc(modulusLen); |
| 416 result->type = siBuffer; |
416 | 417 |
417 if (result->data == NULL) { | 418 if (result->data == NULL) { |
418 rv = SECFailure; | 419 rv = SECFailure; |
419 goto loser; | 420 goto loser; |
420 } | 421 } |
421 | 422 |
422 rv = PK11_Sign(privKey, result, &digder); | 423 rv = PK11_Sign(privKey, result, &digder); |
423 if (rv != SECSuccess) { | 424 if (rv != SECSuccess) { |
424 PORT_Free(result->data); | 425 PORT_Free(result->data); |
425 result->data = NULL; | 426 result->data = NULL; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 case SEC_OID_SHA512: | 488 case SEC_OID_SHA512: |
488 sigTag = SEC_OID_ANSIX962_ECDSA_SHA512_SIGNATURE; break; | 489 sigTag = SEC_OID_ANSIX962_ECDSA_SHA512_SIGNATURE; break; |
489 default: | 490 default: |
490 break; | 491 break; |
491 } | 492 } |
492 default: | 493 default: |
493 break; | 494 break; |
494 } | 495 } |
495 return sigTag; | 496 return sigTag; |
496 } | 497 } |
OLD | NEW |