1
0
mirror of https://github.com/opencryptoki/opencryptoki.git synced 2026-10-28 18:37:25 +03:00

120 Commits

Author SHA1 Message Date
Joy Latten
12a8280869 Pass a pointer rather than copy of test suite to the different
testcases in aes.

Signed-off-by: Joy Latten <jmlatten@users.sourceforge.net>
2011-05-17 15:16:16 -05:00
Richa Marwaha
6267b8fae5 Correct aes ctr key wrapping. Also include CBC and ECB key wrapping.
Signed-off-by: Richa Marwaha <rmarwah@linux.ibm.com>
Signed-off-by: Joy Latten <jmlatten@users.sourceforge.net>
2011-05-16 18:03:54 -05:00
Kent Yoder
ac8df4e876 Remove unnecessary rsa testcases.
Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>
2011-05-13 13:43:05 -05:00
Richa Marwaha
9182a45a13 Added decrypt in AES-Counter Mode testcase
Signed-off-by: Richa Marwaha <rmarwah@linux.vnet.ibm.com>
2011-05-12 15:55:24 -05:00
Richa Marwaha
db6b9679b9 Added support for AES-Counter Mode
Signed-off-by: Richa Marwaha <rmarwah@linux.vnet.ibm.com>
2011-05-12 15:40:06 -05:00
Ashley Lai
ef0ec85a58 Added Elliptic Curve support
Signed-off-by: Ashley Lai <adlai@us.ibm.com>
2011-05-11 15:17:08 -05:00
Joy Latten
7f0c29dede SF3131950: The public exponent needs to be added to the private key
for rsa. Also includes a new testcase to test for this.

Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>
2011-05-02 15:15:38 -05:00
Joy Latten
517c7fcb36 Testcases hung when public exponent was omitted.
A side effect from reverting 08fe158617.

Signed-off-by: Joy Latten <jmlatten@users.sourceforge.net>
2011-04-28 11:17:20 -05:00
Joy Latten
96ee90cb56 Prior patches allowed sessions to be stored in a btree.
This patch leverages that to also store pkcs#11 objects in a btree.

Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>
2011-04-19 12:25:12 -05:00
Joy Latten
ccedbebc22 Remove an invalid test in login_test.sh.
Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>
2011-04-18 15:07:08 -05:00
Klaus Heinrich Kiwi
909b54cc9d testsuite - rsa_func.c: Deal with X.509 Unwrap for AES keys corner case
We must provide a CKA_VALUE_LEN in the key template when unwrapping
  AES keys using X.509 RSA mechanism, otherwise there is no way to tell
  the size of the key being unwrapped.

Signed-off-by: Klaus Heinrich Kiwi <klausk@linux.vnet.ibm.com>
2010-12-18 17:32:50 -02:00
Klaus Heinrich Kiwi
0f2514cd23 testsuite: Proper session handling in regress.h macros
If we fail to create a session, invalidade the session
  handler and check that when closing sessions.

  Trying to C_CloseSession() on an invalid handle may
  segfault the caller.

Signed-off-by: Klaus Heinrich Kiwi <klausk@linux.vnet.ibm.com>
2010-12-18 17:32:50 -02:00
Klaus Heinrich Kiwi
f7fb829c61 Fix rsa_keygen testcase
Using an invalid public exponent should yield
  a CKR_TEMPLATE_INCONSISTENT error

Signed-off-by: Klaus Heinrich Kiwi <klausk@linux.vnet.ibm.com>
2010-12-18 15:18:55 -02:00
Kent Yoder
cd4366e0f7 Bug 67985 - correctly derivate CKA_MODULUS_BITS in RSA C_ObjectCreate
On Wed, Nov 10, 2010 at 03:09:03PM -0200, Klaus Heinrich Kiwi wrote:
>    OpenCryptoki is not correctly derivating CKA_MODULUS_BITS when
>    creating an object with C_ObjectCreate(). This value must be
>    derivated from CKA_MODULUS which is a required attribute for
>    C_ObjectCreate() when dealing with RSA Public Keys.
>
>    The most obvios symptom is a CKR_FUNCTION_FAILED for the
>    C_VerifyRecover() function when using NSS to create a
>    self-signed certificate (NSS tries to import the public
>    key into a session object using C_ObjectCreate())

  Looks good to me, Klaus.  template_attribute_find will correctly
return 0 when the base template passed in is NULL, so that should be
safe.

  I noticed that the rsa_keygen test tries that validate that
CKR_FUNCTION_FAILED is returned when an even RSA public exponent is
passed in.  That test now fails, did that check change recently?

  Attached is an updated rsa_keygen.c that tests the stuff in this
patch.

Acked-by: Kent Yoder <key@linux.vnet.ibm.com>
2010-12-18 15:18:55 -02:00
Klaus Heinrich Kiwi
3a88c92125 testsuite: Use testcase_notice() instead of _skip() for warnings
testsuite_notice() should be more appropriate in this case, but
   this file needs refactoring anyway.

Signed-off-by: Klaus Heinrich Kiwi <klausk@linux.vnet.ibm.com>
2010-12-08 18:34:27 -02:00
Klaus Heinrich Kiwi
93ef265dc4 Testsuite: Completely refactor the rsa_func.c tests
Complete rewrite for RSA tests:
    - Encrypt/Decrypt
    - Single-part Sign/Verify (Recover)
    - Multi-part Sign/Verify (Recover)
    - Wrap/Unwrap

Signed-off-by: Klaus Heinrich Kiwi <klausk@linux.vnet.ibm.com>
2010-12-08 17:56:50 -02:00
Klaus Heinrich Kiwi
8a05dedc86 testsuite: add a bunch of new macros to regress.h
Add many new macros with the aim of simplifying
    testcases.

Signed-off-by: Klaus Heinrich Kiwi <klausk@linux.vnet.ibm.com>
2010-12-08 17:56:39 -02:00
Klaus Heinrich Kiwi
9c792d5634 init_cca.sh: A simple script to initialize CCA card (for tests)
The script loads synthethic RSA, AES and SYM keys in a CCA
    card.

    Warning: This *will* replace you card keys with insecure
    version only aimed for testing!

    Do NOT use those keys for production purposes.

Signed-off-by: Klaus Heinrich Kiwi <klausk@linux.vnet.ibm.com>
2010-12-06 17:20:30 -02:00
Kent Yoder
a36be282cd remove md2 in rsa_sign_test
The header file for MD2 has disappeared in openssl-1.0, breaking the
build when it hits rsa_sign_test.  It looks like MD2 is fairly
irrelevant -- all but 2 of the tokens define NOMD2 explicitly, the other
2 don't use it and should probably define NOMD2 themselves. This patch
just removes the MD2 portion of rsa_sign_test so that the test can
build.

Kent

Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>
2010-12-06 17:10:20 -02:00
Kent Yoder
743a386892 testsuite: Check unextractable and sensitive attributes for Secret keys
Klaus, attached is an addition to the misc_func.c driver testcase to
test extractable and sesitive secret keys.  It shows that Matteo's patch
does fix the issue.  Private keys will still need to be tested.

Kent

Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>
2010-11-26 16:22:28 -02:00
Klaus Heinrich Kiwi
cc84b667fc Testsuite: skip token in case of errors with pkcsconf
Make pkcsconf errors non-fatal when querying the token type,
    so that the testsuite can continue with the other tokens

Signed-off-by: Klaus Heinrich Kiwi <klausk@linux.vnet.ibm.com>
2010-09-13 22:39:06 -03:00
Klaus Heinrich Kiwi
7c632b898c testsuite: Introduce standard pass/fail/skip/error macros
Introduce testcase_[pass|fail|skip|error] macros to be used
  across the testsuite and thus standardize testcases format and
  output.

  The macros will also try to time the operation execution, now
  with microsecond resolution.

  I've also provided testcase_*_f alternatives for cases where
  we need to manually identify the test (instead of just using
  __func__).

  This patch also "converts" obj_mgmt.c tests to use the new
  macros.

Signed-off-by: Klaus Heinrich Kiwi <klausk@linux.vnet.ibm.com>
2010-08-30 12:38:19 -03:00
Klaus Heinrich Kiwi
ee2206e7a0 testcases: create separate 'benchmarks' bucket
Create a special category for 'benchmarks' test, and don't run
  them by default unless we are told to.

  Also some really minor cosmetic changes to the ock_test.sh script

Signed-off-by: Klaus Heinrich Kiwi <klausk@linux.vnet.ibm.com>
2010-08-30 12:14:12 -03:00
Klaus Heinrich Kiwi
404053d495 testsuite: Make ock_tests.sh more resilient
Make the ock_tests.sh script more resilient by skipping tokens
  which failed to initialize.

Signed-off-by: Klaus Heinrich Kiwi <klausk@linux.vnet.ibm.com>
2010-08-30 12:13:43 -03:00
Kent Yoder
187581024a run make installcheck tests as an unprivileged user
This patch will look for the PKCS11_TEST_USER environemnt variable and if set, will run the testsuite as that user instead of root.  If the env var is missing, the tests are run as root.

Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>

 testcases/Makefile.am |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
2010-08-30 12:11:20 -03:00
Kent Yoder
f230185893 Add tests for SHA2 HMAC
Update digest_func.c to test SHA256 and SHA512 HMAC algorithms.  The
  patch also adds the p11_get_ckm() function to the new p11util.c file,
  which converts a CK_ULONG mechanism into a string.

Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>

 testcases/driver/digest_func.c  | 3215 +++++++++++----------------------------
 usr/lib/pkcs11/common/p11util.c |  194 +++
 usr/lib/pkcs11/common/p11util.h |    5 +
 3 files changed, 1055 insertions(+), 2359 deletions(-)
2010-08-19 18:50:15 -03:00
Kent Yoder
4be48a087a Test AES 128/192 in ECB and CBC modes
Modify the aes_func.c test to test all modes using key lens 128, 192 and 256.

Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>
2010-08-19 09:25:00 -03:00
Kent Yoder
d37f5ab951 minor testcase fixes
This patch makes 3 minor functional fixes:

testcases/common/common.c:
Print hexdumps to stderr instead of stdout, since most uses of hex dumps in the testcases are to show a mismatch when a test fails.

testcases/driver/des_func.c:
Fix a bad check on a return code

testcases/driver/md5.c:
add a real prototype to the Transform function

Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>
2010-08-18 21:49:36 -03:00
Klaus Heinrich Kiwi
47571bbeab Start consolidating pkcs#11 utility functions
Opencryptoki has a number of places which use misc pkcs#11 utility
  functions.

  This patch creates p11util.c which to start consolidating those
  functions in one place.

Signed-off-by: Klaus Heinrich Kiwi <klausk@linux.vnet.ibm.com>
2010-08-17 12:31:47 -03:00
Kent Yoder
2ea423f04e driver testcase updates: regress.h
- remove incorrect/unused prototypes

Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>

 testcases/include/regress.h |   13 -------------
 1 files changed, 0 insertions(+), 13 deletions(-)
2010-08-13 16:50:01 -03:00
Kent Yoder
f228b4cf26 driver testcase updates: ssl3_func.c
- fix compile warnings generated by -Wall
- always return a non-zero error code to the command line on test error
- use a macro to send output to stderr when appropriate
- print file/line numbers for any failures

Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>

 testcases/driver/ssl3_func.c |  182 +++++++++++++++++++++---------------------
 1 files changed, 92 insertions(+), 90 deletions(-)
2010-08-13 16:50:01 -03:00
Kent Yoder
0db82d0eac driver testcase updates: sess_perf.c
- fix compile warnings generated by -Wall
- always return a non-zero error code to the command line on test error
- use a macro to send output to stderr when appropriate
- print file/line numbers for any failures

Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>

 testcases/driver/sess_perf.c |   23 ++++++++++++-----------
 1 files changed, 12 insertions(+), 11 deletions(-)
2010-08-13 16:50:01 -03:00
Kent Yoder
861bd9fff8 driver testcase updates: sess_mgmt.c
- fix compile warnings generated by -Wall
- always return a non-zero error code to the command line on test error
- use a macro to send output to stderr when appropriate
- print file/line numbers for any failures

Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>

 testcases/driver/sess_mgmt.c |  414 +++++++++++++++++++++---------------------
 1 files changed, 208 insertions(+), 206 deletions(-)
2010-08-13 16:50:01 -03:00
Kent Yoder
15f525c198 driver testcase updates: rsa_func.c
- fix compile warnings generated by -Wall
- always return a non-zero error code to the command line on test error
- use a macro to send output to stderr when appropriate
- print file/line numbers for any failures

Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>

 testcases/driver/rsa_func.c |  442 ++++++++++++++++++++++---------------------
 1 files changed, 223 insertions(+), 219 deletions(-)
2010-08-13 16:50:01 -03:00
Kent Yoder
344878843d driver testcase updates: rijndael_func.c
- fix compile warnings generated by -Wall
- always return a non-zero error code to the command line on test error
- use a macro to send output to stderr when appropriate
- print file/line numbers for any failures

Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>

 testcases/driver/rijndael_func.c |  194 +++++++++++++++++++-------------------
 1 files changed, 98 insertions(+), 96 deletions(-)
2010-08-13 16:50:01 -03:00
Kent Yoder
1f785271b0 driver testcase updates: obj_mgmt.c
- fix compile warnings generated by -Wall
- always return a non-zero error code to the command line on test error
- use a macro to send output to stderr when appropriate
- print file/line numbers for any failures

Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>

 testcases/driver/obj_mgmt.c |  440 ++++++++++++++++++++++---------------------
 1 files changed, 226 insertions(+), 214 deletions(-)
2010-08-13 16:50:01 -03:00
Kent Yoder
41a5b47e9f driver testcase updates: misc_func.c
- fix compile warnings generated by -Wall
- always return a non-zero error code to the command line on test error
- use a macro to send output to stderr when appropriate
- print file/line numbers for any failures

Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>

 testcases/driver/misc_func.c |  388 +++++++++++++++++++++---------------------
 1 files changed, 195 insertions(+), 193 deletions(-)
2010-08-13 16:50:01 -03:00
Kent Yoder
1c466c4e34 driver testcase updates: md5.h
- corrected prototypes

Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>

 testcases/driver/md5.h |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
2010-08-13 16:50:00 -03:00
Kent Yoder
0ecc3ead71 driver testcase updates: dsa_func.c
- fix compile warnings generated by -Wall
- always return a non-zero error code to the command line on test error
- use a macro to send output to stderr when appropriate
- print file/line numbers for any failures

Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>

 testcases/driver/dsa_func.c |   96 +++++++++++++++++++++----------------------
 1 files changed, 47 insertions(+), 49 deletions(-)
2010-08-13 16:50:00 -03:00
Kent Yoder
bb7ff839e9 driver testcase updates: digest_func.c
- fix compile warnings generated by -Wall
- always return a non-zero error code to the command line on test error
- use a macro to send output to stderr when appropriate
- print file/line numbers for any failures

Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>

 testcases/driver/digest_func.c |  959 ++++++++++++++++++++--------------------
 1 files changed, 481 insertions(+), 478 deletions(-)
2010-08-13 16:50:00 -03:00
Kent Yoder
8c1690a2c0 driver testcase updates: dh_func.c
- fix compile warnings generated by -Wall
- always return a non-zero error code to the command line on test error
- use a macro to send output to stderr when appropriate
- print file/line numbers for any failures

Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>

 testcases/driver/dh_func.c |  103 ++++++++++++++++++++++---------------------
 1 files changed, 53 insertions(+), 50 deletions(-)
2010-08-13 16:50:00 -03:00
Kent Yoder
de6f902c61 driver testcase updates: des_func.c
- fix compile warnings generated by -Wall
- always return a non-zero error code to the command line on test error
- use a macro to send output to stderr when appropriate
- print file/line numbers for any failures

Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>

 testcases/driver/des_func.c |  474 ++++++++++++++++++++++---------------------
 1 files changed, 238 insertions(+), 236 deletions(-)
2010-08-13 16:50:00 -03:00
Kent Yoder
c608aaa9e7 driver testcase updates: des3_func.c
- fix compile warnings generated by -Wall
- always return a non-zero error code to the command line on test error
- use a macro to send output to stderr when appropriate
- print file/line numbers for any failures

Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>

 testcases/driver/des3_func.c |  450 +++++++++++++++++++++---------------------
 1 files changed, 226 insertions(+), 224 deletions(-)
2010-08-13 16:50:00 -03:00
Kent Yoder
29830f5050 driver testcase updates: aes_func.c
- fix compile warnings generated by -Wall
- always return a non-zero error code to the command line on test error
- use a macro to send output to stderr when appropriate
- print file/line numbers for any failures

Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>

 testcases/driver/aes_func.c |  463 ++++++++++++++++++++++---------------------
 1 files changed, 237 insertions(+), 226 deletions(-)
2010-08-13 16:50:00 -03:00
Kent Yoder
2e88c7ad6f driver testcase updates: Makefile.am
Add -Wall to the compile of the driver/ testcases.

Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>

 testcases/driver/Makefile.am |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
2010-08-13 16:50:00 -03:00
Klaus Heinrich Kiwi
e233c0c8e7 Use correct slot in ock_tests.sh script
Add missing parameter to call init_token.sh script.

Signed-off-by: Klaus Heinrich Kiwi <klausk@linux.vnet.ibm.com>
2010-08-13 09:39:34 -03:00
Kent Yoder
0d4508421c fix loop variable in test script
This patch fixes a loop variable name, which prevented printing the name of the test being executed.

Thanks,
Kent

Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>

 testcases/ock_tests.sh.in |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
2010-08-10 10:46:39 -03:00
Kent Yoder
b5a4e6b106 correct prototype in test_crypto.c
This patch updates an incorrect function prototype in test_crypto.c.

Thanks,
Kent

Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>
2010-08-10 09:13:35 -03:00
Klaus Heinrich Kiwi
39d495872d Clean-up ock_tests.sh script
Hopefully make ock_tests.sh more resilient.

Also introduces a init_tpmtoken.sh script that is used
to initialize the TPM token.

Signed-off-by: Klaus Heinrich Kiwi <klausk@linux.vnet.ibm.com>
2010-07-31 02:15:44 -03:00
Kent Yoder
02d045d533 update show_error to print file and line numbers for any test errors
This patch makes the show_error() function used by the testcases a macro, then adds printing of a file and line number wherever its called.  This patch also changes the file descriptor these strings print to from stdout to stderr.  This will make finding errors in automated test runs easier.

Thanks,
Kent

Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>
2010-07-31 01:26:20 -03:00