Signed-off-by: Harald Freudenberger <[email protected]>
---
usr/lib/pkcs11/ep11_stdll/ep11_specific.c | 49 +++++++++++++++++++----------
1 file changed, 33 insertions(+), 16 deletions(-)
diff --git a/usr/lib/pkcs11/ep11_stdll/ep11_specific.c
b/usr/lib/pkcs11/ep11_stdll/ep11_specific.c
index 387145a..e5bc270 100644
--- a/usr/lib/pkcs11/ep11_stdll/ep11_specific.c
+++ b/usr/lib/pkcs11/ep11_stdll/ep11_specific.c
@@ -1188,9 +1188,15 @@ static CK_RV print_mechanism(void)
/* random number generator */
CK_RV token_specific_rng(CK_BYTE *output, CK_ULONG bytes)
{
- CK_RV rc = m_GenerateRandom(output,bytes,ep11tok_target);
+ CK_RV rc = CKR_OK;
+
+ if (bytes) {
+ rc = m_GenerateRandom(output,bytes,ep11tok_target);
+ }
+
if (rc != CKR_OK)
EP11TOK_ELOG(1,"output=%p bytes=%lu rc=0x%lx", output, bytes,
rc);
+
return rc;
}
@@ -1732,10 +1738,12 @@ CK_RV token_specific_sha(DIGEST_CONTEXT *c, CK_BYTE
*in_data,
CK_RV token_specific_sha_update(DIGEST_CONTEXT *c, CK_BYTE *in_data,
CK_ULONG in_data_len)
{
- CK_RV rc;
+ CK_RV rc = CKR_OK;
- rc = m_DigestUpdate(c->context,c->context_len, in_data,in_data_len,
- ep11tok_target) ;
+ if (in_data_len) {
+ rc = m_DigestUpdate(c->context,c->context_len, in_data,
+ in_data_len, ep11tok_target) ;
+ }
if (rc != CKR_OK) {
EP11TOK_ELOG(1,"rc=0x%lx",rc);
@@ -2951,11 +2959,14 @@ CK_RV token_specific_sign(SESSION *session, CK_BBOOL
length_only,
CK_RV token_specific_sign_update(SESSION *session, CK_BYTE *in_data,
CK_ULONG in_data_len)
{
- CK_RV rc;
+ CK_RV rc = CKR_OK;
+
SIGN_VERIFY_CONTEXT *ctx = &session->sign_ctx;
- rc = m_SignUpdate(ctx->context, ctx->context_len, in_data,
- in_data_len, ep11tok_target);
+ if (in_data_len) {
+ rc = m_SignUpdate(ctx->context, ctx->context_len, in_data,
+ in_data_len, ep11tok_target);
+ }
if (rc != CKR_OK) {
EP11TOK_ELOG(1,"rc=0x%lx",rc);
@@ -3052,11 +3063,13 @@ CK_RV token_specific_verify(SESSION *session, CK_BYTE
*in_data,
CK_RV token_specific_verify_update(SESSION *session, CK_BYTE *in_data,
CK_ULONG in_data_len)
{
- CK_RV rc;
+ CK_RV rc = CKR_OK;
SIGN_VERIFY_CONTEXT *ctx = &session->verify_ctx;
- rc = m_VerifyUpdate(ctx->context, ctx->context_len, in_data,
- in_data_len, ep11tok_target);
+ if (in_data_len) {
+ rc = m_VerifyUpdate(ctx->context, ctx->context_len, in_data,
+ in_data_len, ep11tok_target);
+ }
if (rc != CKR_OK) {
EP11TOK_ELOG(1,"rc=0x%lx",rc);
@@ -3134,9 +3147,11 @@ CK_RV token_specific_decrypt_update(SESSION *session,
CK_BYTE_PTR input_part,
CK_RV rc = CKR_OK;
ENCR_DECR_CONTEXT *decr_ctx = &session->decr_ctx;
- rc = m_DecryptUpdate(decr_ctx->context,decr_ctx->context_len,
- input_part, input_part_len, output_part,
- p_output_part_len, ep11tok_target) ;
+ if (input_part_len) {
+ rc = m_DecryptUpdate(decr_ctx->context,decr_ctx->context_len,
+ input_part, input_part_len, output_part,
+ p_output_part_len, ep11tok_target) ;
+ }
if (rc != CKR_OK) {
EP11TOK_ELOG(1,"rc=0x%lx",rc);
@@ -3196,9 +3211,11 @@ CK_RV token_specific_encrypt_update(SESSION *session,
CK_BYTE_PTR input_part,
CK_RV rc = CKR_OK;
ENCR_DECR_CONTEXT *encr_ctx = &session->encr_ctx;
- rc = m_EncryptUpdate(encr_ctx->context, encr_ctx->context_len,
- input_part, input_part_len, output_part,
- p_output_part_len, ep11tok_target);
+ if (input_part_len) {
+ rc = m_EncryptUpdate(encr_ctx->context, encr_ctx->context_len,
+ input_part, input_part_len, output_part,
+ p_output_part_len, ep11tok_target);
+ }
if (rc != CKR_OK) {
EP11TOK_ELOG(1,"rc=0x%lx",rc);
--
1.7.9.5
------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
Opencryptoki-tech mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opencryptoki-tech