openCryptoki/ocki-3.1_06_0005-Small-reworks.patch

145 lines
5.1 KiB
Diff

From b0fc36e0e1fd549164a2502213163ce23d2f0138 Mon Sep 17 00:00:00 2001
From: Harald Freudenberger <freude@linux.vnet.ibm.com>
Date: Mon, 14 Apr 2014 13:13:11 -0500
Subject: [PATCH 5/6] Small reworks: - Some of the ock testcase c files are
tracked by git as 755. Fixed, c code files should
appear 644 now. - pkcs11 misc_func test improved to
show not just the mechanism number but also the
(preprocessor defined) mechanism name. - misc speed
test rsa encrypt receive buffer increased so the
"buffer size too small" is fixed now. - misc speed test
rsa uses now an exponent value of 17 (0x01,0x00,0x01)
instead of 3 (0x03). Some tokens (eg. ep11) do not
allow such low exponents and reject RSA key
generation.
Signed-off-by: Harald Freudenberger <freude@linux.vnet.ibm.com>
Signed-off-by: Joy Latten <jmlatten@linux.vnet.ibm.com>
---
testcases/misc_tests/speed.c | 14 ++++++++------
testcases/pkcs11/misc_func.c | 3 ++-
2 files changed, 10 insertions(+), 7 deletions(-)
mode change 100755 => 100644 testcases/crypto/aes_func.c
mode change 100755 => 100644 testcases/crypto/des3_func.c
mode change 100755 => 100644 testcases/crypto/des_func.c
mode change 100755 => 100644 testcases/crypto/digest_func.c
mode change 100755 => 100644 testcases/crypto/dsa_func.c
mode change 100755 => 100644 testcases/crypto/rsa_func.c
mode change 100755 => 100644 testcases/crypto/ssl3_func.c
mode change 100755 => 100644 testcases/pkcs11/misc_func.c
mode change 100755 => 100644 testcases/pkcs11/sess_mgmt.c
mode change 100755 => 100644 testcases/pkcs11/sess_perf.c
diff --git a/testcases/crypto/aes_func.c b/testcases/crypto/aes_func.c
old mode 100755
new mode 100644
diff --git a/testcases/crypto/des3_func.c b/testcases/crypto/des3_func.c
old mode 100755
new mode 100644
diff --git a/testcases/crypto/des_func.c b/testcases/crypto/des_func.c
old mode 100755
new mode 100644
diff --git a/testcases/crypto/digest_func.c b/testcases/crypto/digest_func.c
old mode 100755
new mode 100644
diff --git a/testcases/crypto/dsa_func.c b/testcases/crypto/dsa_func.c
old mode 100755
new mode 100644
diff --git a/testcases/crypto/rsa_func.c b/testcases/crypto/rsa_func.c
old mode 100755
new mode 100644
diff --git a/testcases/crypto/ssl3_func.c b/testcases/crypto/ssl3_func.c
old mode 100755
new mode 100644
diff --git a/testcases/misc_tests/speed.c b/testcases/misc_tests/speed.c
index 102ba72..5df3169 100755
--- a/testcases/misc_tests/speed.c
+++ b/testcases/misc_tests/speed.c
@@ -60,6 +60,7 @@ long speed_process_time(SYSTEMTIME t1, SYSTEMTIME t2)
int do_RSA_PKCS_EncryptDecrypt( void )
{
CK_BYTE data1[100];
+ CK_BYTE data2[200];
CK_BYTE signature[256];
CK_SLOT_ID slot_id;
CK_SESSION_HANDLE session;
@@ -69,14 +70,14 @@ int do_RSA_PKCS_EncryptDecrypt( void )
CK_BYTE user_pin[PKCS11_MAX_PIN_LEN];
CK_ULONG user_pin_len;
CK_ULONG i;
- CK_ULONG len1, sig_len;
+ CK_ULONG len1, len2, sig_len;
CK_RV rc;
SYSTEMTIME t1, t2;
CK_ULONG diff, min_time, max_time, avg_time;
CK_ULONG bits = 1024;
- CK_BYTE pub_exp[] = { 0x3 };
+ CK_BYTE pub_exp[] = { 0x01, 0x00, 0x01 };
CK_ATTRIBUTE pub_tmpl[] =
{
@@ -190,7 +191,8 @@ int do_RSA_PKCS_EncryptDecrypt( void )
return FALSE;
}
- rc = funcs->C_Decrypt( session, signature,sig_len,data1, &len1 );
+ len2 = sizeof(data2);
+ rc = funcs->C_Decrypt( session, signature, sig_len, data2, &len2 );
if (rc != CKR_OK) {
show_error(" C_Decrypt #1", rc );
return FALSE;
@@ -259,7 +261,7 @@ int do_RSA_KeyGen_2048( void )
{
SYSTEMTIME t1, t2;
CK_ULONG bits = 2048;
- CK_BYTE pub_exp[] = { 0x3 };
+ CK_BYTE pub_exp[] = { 0x01, 0x00, 0x01 };
CK_ATTRIBUTE pub_tmpl[] =
{
@@ -368,7 +370,7 @@ int do_RSA_KeyGen_1024( void )
{
SYSTEMTIME t1, t2;
CK_ULONG bits = 1024;
- CK_BYTE pub_exp[] = { 0x3 };
+ CK_BYTE pub_exp[] = { 0x01, 0x00, 0x01 };
CK_ATTRIBUTE pub_tmpl[] =
{
@@ -468,7 +470,7 @@ int do_RSA_PKCS_SignVerify_1024( void )
CK_ULONG diff, min_time, max_time, avg_time;
CK_ULONG bits = 1024;
- CK_BYTE pub_exp[] = { 0x3 };
+ CK_BYTE pub_exp[] = { 0x01, 0x00, 0x01 };
CK_ATTRIBUTE pub_tmpl[] =
{
diff --git a/testcases/pkcs11/misc_func.c b/testcases/pkcs11/misc_func.c
old mode 100755
new mode 100644
index 8103649..d6619fd
--- a/testcases/pkcs11/misc_func.c
+++ b/testcases/pkcs11/misc_func.c
@@ -602,7 +602,8 @@ CK_RV do_GetMechanismInfo( void )
return rc;
}
- printf(" Mechanism #%ld\n", mech_list[i] );
+ printf(" Mechanism #%ld %s\n", mech_list[i],
+ p11_get_ckm(mech_list[i]) );
printf(" ulMinKeySize: %ld\n", info.ulMinKeySize );
printf(" ulMaxKeySize: %ld\n", info.ulMaxKeySize );
printf(" flags: %p\n", (void *)info.flags );
diff --git a/testcases/pkcs11/sess_mgmt.c b/testcases/pkcs11/sess_mgmt.c
old mode 100755
new mode 100644
diff --git a/testcases/pkcs11/sess_perf.c b/testcases/pkcs11/sess_perf.c
old mode 100755
new mode 100644
--
1.7.12.4