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 PK11Contexts which are used in multipart hashing, | 5 * This file PK11Contexts which are used in multipart hashing, |
6 * encryption/decryption, and signing/verication operations. | 6 * encryption/decryption, and signing/verication operations. |
7 */ | 7 */ |
8 | 8 |
9 #include "seccomon.h" | 9 #include "seccomon.h" |
10 #include "secmod.h" | 10 #include "secmod.h" |
(...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
747 | 747 |
748 /* | 748 /* |
749 * execute a digest/signature operation | 749 * execute a digest/signature operation |
750 */ | 750 */ |
751 SECStatus | 751 SECStatus |
752 PK11_DigestOp(PK11Context *context, const unsigned char * in, unsigned inLen) | 752 PK11_DigestOp(PK11Context *context, const unsigned char * in, unsigned inLen) |
753 { | 753 { |
754 CK_RV crv = CKR_OK; | 754 CK_RV crv = CKR_OK; |
755 SECStatus rv = SECSuccess; | 755 SECStatus rv = SECSuccess; |
756 | 756 |
| 757 if (inLen == 0) { |
| 758 return SECSuccess; |
| 759 } |
757 if (!in) { | 760 if (!in) { |
758 PORT_SetError(SEC_ERROR_INVALID_ARGS); | 761 PORT_SetError(SEC_ERROR_INVALID_ARGS); |
759 return SECFailure; | 762 return SECFailure; |
760 } | 763 } |
761 | 764 |
762 /* if we ran out of session, we need to restore our previously stored | 765 /* if we ran out of session, we need to restore our previously stored |
763 * state. | 766 * state. |
764 */ | 767 */ |
765 context->init = PR_FALSE; | 768 context->init = PR_FALSE; |
766 PK11_EnterContextMonitor(context); | 769 PK11_EnterContextMonitor(context); |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1030 context->init = PR_FALSE; /* allow Begin to start up again */ | 1033 context->init = PR_FALSE; /* allow Begin to start up again */ |
1031 | 1034 |
1032 | 1035 |
1033 if (crv != CKR_OK) { | 1036 if (crv != CKR_OK) { |
1034 PORT_SetError( PK11_MapError(crv) ); | 1037 PORT_SetError( PK11_MapError(crv) ); |
1035 return SECFailure; | 1038 return SECFailure; |
1036 } | 1039 } |
1037 return SECSuccess; | 1040 return SECSuccess; |
1038 } | 1041 } |
1039 | 1042 |
OLD | NEW |