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

316 Commits

Author SHA1 Message Date
Ingo Franzki
9f4bc214f0 TESTCASE: EP11 does only support RSA-OAEP with SHA1
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2018-11-12 13:24:01 +01:00
Ingo Franzki
56b34dcfa5 TESTCASE: Add elliptic curve secp256k1 to EC tests
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2018-11-12 13:24:01 +01:00
Patrick Steuer
ecba88fe7f Fix memleak in sess_mgmt test case
Signed-off-by: Patrick Steuer <patrick.steuer@de.ibm.com>
2018-11-08 15:46:01 +01:00
Patrick Steuer
91437aa048 dlclose libopencryptoki on testcase exit
This supresses some valgrind output.

Signed-off-by: Patrick Steuer <patrick.steuer@de.ibm.com>
2018-11-08 09:53:49 +01:00
Patrick Steuer
45f66616b2 Count findobjects tests corretly
Signed-off-by: Patrick Steuer <patrick.steuer@de.ibm.com>
2018-11-08 09:53:49 +01:00
Patrick Steuer
d4bd8e7cd8 Fix conditional jump or move depending on uninitialised value(s)
Valgrind complaints about some uninitialized local variables.

Signed-off-by: Patrick Steuer <patrick.steuer@de.ibm.com>
2018-11-07 15:31:46 +01:00
Patrick Steuer
2b36533cb8 Expand %C% and %D% in makefiles
Old autotools dont know %C% and %D%.

Signed-off-by: Patrick Steuer <patrick.steuer@de.ibm.com>
2018-11-06 17:22:29 +01:00
Ingo Franzki
1f455d2a20 TESTCASE: Fix obj_mgmt_lock testcase
When spinlock_tests.sh is used with more than 10 concurrent processes,
some child processes may fail with " TESTCASE do_FindObjects FAIL
(testcases/misc_tests/obj_mgmt_lock.c:627) could not find object handle"
or "TESTCASE do_CreateTokenObjects FAIL (testcases/misc_tests/
obj_mgmt_lock.c:853) could not find 2nd object's handle".

This is because each child process creates an object with the same ID
attribute, and then performs a C_FindObjects for this ID and expects
to find the object (i.e. the exact same handle). However, C_FindObjects
is called with usMaxObjectCount of 10, limiting the number of find
results to 10 per call to C_FindObjects. If the desired object handle
is not found within the first 10 results, then the testcase fails.
When more than 10 child processes are active, the find results may
contain more then 10 objects, and thus the desired object might not
be within the first 10 results.

This patch fixes this by obtaining further find results, until no more
results are available, or the desired object has been found.
Also call C_FindObjectsFinal before failing the testcase to do
proper cleanup.

Fixes: https://github.com/opencryptoki/opencryptoki/issues/211

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2018-11-05 17:24:48 +01:00
Ingo Franzki
7efbc8eeb3 TESTCASES: Print correct return code in error message
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2018-10-29 17:28:32 +01:00
Ingo Franzki
f767a1ac69 TESTCASES: Fix memory leak
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2018-10-29 17:28:32 +01:00
Ingo Franzki
78d28e6680 TESTCASE: Fix double free
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2018-10-29 17:28:32 +01:00
Ingo Franzki
840763b088 TESTCASE: dlclose on error
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2018-10-29 17:28:32 +01:00
Ingo Franzki
9bcfcd2a4e TESTCASE: DestroyObject only if handle is valid
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2018-10-29 17:28:32 +01:00
Ingo Franzki
2726d91de3 TESTCASE: Correct testcase cleanup handling
Prevent a loop if testcase_user_logout() is called after
label testcase_cleanup and the session handle is invalid
or C_Logout returns an error.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2018-10-10 14:55:48 +02:00
Ingo Franzki
f3e162321b TESTCASE: Harden argument parsing
Harden parsing of the -slot argument and detect if no or an
invalid slot ID is specified.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2018-10-10 14:55:48 +02:00
Patrick Steuer
e6d7071e89 Autotools rework: get rid of recursive make
Signed-off-by: Patrick Steuer <patrick.steuer@de.ibm.com>
2018-10-08 10:48:42 +02:00
Ingo Franzki
c0891fb999 TESTCASE: RSA-OAEP without any source data must specify NULL
When ulSourceDataLen in CK_RSA_PKCS_OAEP_PARAMS is 0, then
also pSourceData must be NULL.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2018-10-01 14:01:05 +02:00
Ingo Franzki
18b27fec45 TESTCASES: Correct test vector numbering
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2018-09-27 11:45:05 +02:00
Ingo Franzki
2b930ae8b1 TESTCASES: Stop the test after a testcase_error
Not all cases where a function has failed and testcase_error
is called cause a stop of the test. This leads to follow on
failures.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2018-09-26 13:30:36 +02:00
Patrick Steuer
d78f417db8 Fix dist and distcheck make targets
Signed-off-by: Patrick Steuer <patrick.steuer@de.ibm.com>
2018-09-25 17:40:31 +02:00
Patrick Steuer
c7916cda87 User per-object CFLAGS
Signed-off-by: Patrick Steuer <patrick.steuer@de.ibm.com>
2018-09-25 17:40:31 +02:00
Patrick Steuer
e2b8ffb2c9 Appease -Woverflow
Signed-off-by: Patrick Steuer <patrick.steuer@de.ibm.com>
2018-09-25 17:40:31 +02:00
Patrick Steuer
d51414f44c Appease -Wmissing-field-initializers
Signed-off-by: Patrick Steuer <patrick.steuer@de.ibm.com>
2018-09-25 17:40:31 +02:00
Patrick Steuer
09a2d0d810 Appease dlsym warnings
See dlopen(3) example section.

Signed-off-by: Patrick Steuer <patrick.steuer@de.ibm.com>
2018-09-25 17:40:31 +02:00
Patrick Steuer
9f701a3f88 Appease -Wgnu-empty-initializer
Signed-off-by: Patrick Steuer <patrick.steuer@de.ibm.com>
2018-09-25 17:40:31 +02:00
Patrick Steuer
6b58053e0d Appease -Wmissing-braces
Signed-off-by: Patrick Steuer <patrick.steuer@de.ibm.com>
2018-09-25 17:40:31 +02:00
Patrick Steuer
380da88697 Appease -Wmissing-field-initializers
Signed-off-by: Patrick Steuer <patrick.steuer@de.ibm.com>
2018-09-25 17:40:31 +02:00
Patrick Steuer
b1244182da __FUNCTION__ ---> _func_
__FUNCTION__ is non-standard.

Signed-off-by: Patrick Steuer <patrick.steuer@de.ibm.com>
2018-09-25 17:40:31 +02:00
Patrick Steuer
4fa5af564b Appease -Wpointer-sign
Signed-off-by: Patrick Steuer <patrick.steuer@de.ibm.com>
2018-09-25 17:40:31 +02:00
Patrick Steuer
ea99b624d2 c99 does not allow empty initializers
Signed-off-by: Patrick Steuer <patrick.steuer@de.ibm.com>
2018-09-25 17:40:31 +02:00
Patrick Steuer
1d91f6c08f Appease -Wsign-compare
Signed-off-by: Patrick Steuer <patrick.steuer@de.ibm.com>
2018-09-25 17:40:31 +02:00
Patrick Steuer
c6ef49a4c7 Appease -Wcast-function-type
Signed-off-by: Patrick Steuer <patrick.steuer@de.ibm.com>
2018-09-25 17:40:31 +02:00
Patrick Steuer
a934a56559 Appease -Wunused-parameter
Signed-off-by: Patrick Steuer <patrick.steuer@de.ibm.com>
2018-09-25 17:40:31 +02:00
Ingo Franzki
7152895024 TESTCASE: Enhance SKIP message with human readable mechanism
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2018-09-19 17:41:20 +02:00
Patrick Steuer
ec469b69fa ec_func.c: fix double free
Signed-off-by: Patrick Steuer <patrick.steuer@de.ibm.com>
2018-09-19 17:36:00 +02:00
Ingo Franzki
87f166c361 TESTCASE: Use CKM_ECDH1_DERIVE in PKCS#11 flavor
EP11 now also supports C_DeriveKey with CKM_ECDH1_DERIVE
in PKCS#11 flavor. Remove the special handling for the EP11
token, and use PKCS#11 flavor for all tokens.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2018-09-19 17:32:42 +02:00
Ingo Franzki
e49f06d647 TESTCASES: Add twisted versions of brainpool curves
EP11 also supports the twisted versions of the brainpool
curves. Add them to the ec_tests testcase (for EP11 token
only).

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2018-09-18 17:42:23 +02:00
Ingo Franzki
aa286984e3 Revert: Compare check for token min and max keysize correction
The compare check for token min and max keysize as changed by
commit 4cdd5038e7 is not correct.

Key size units as reported by C_GetMechanismInfo are in bits
or in bytes dependent on the mechanism. Leave it up to the
caller of check_supp_keysize() to use the correct unit for the
mechanism specified. That way function check_supp_keysize() is
mechanism independent.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2018-09-17 14:19:07 +02:00
Harald Freudenberger
4cdd5038e7 testcases: Compare check for token min and max keysize correction
The check_supp_keysize() function compared the min and max
keysize in bits for a mechanism with the call argument of
keysize in bytes. Fixed: the caller's argument keysize in
bytes is now multiplied by 8 and then compared.

Signed-off-by: Harald Freudenberger <freude@linux.ibm.com>
2018-09-10 14:32:54 +02:00
Patrick Steuer
8f84ca5a13 Appease warnings
Signed-off-by: Patrick Steuer <patrick.steuer@de.ibm.com>
2018-09-10 11:23:35 +02:00
Patrick Steuer
bd181a9113 Appease -Wsometimes-uninitialized
Signed-off-by: Patrick Steuer <patrick.steuer@de.ibm.com>
2018-09-10 10:37:38 +02:00
Patrick Steuer
1938a588f9 Appease -Wformat
Signed-off-by: Patrick Steuer <patrick.steuer@de.ibm.com>
2018-09-10 10:37:38 +02:00
Ingo Franzki
2558c04e6a TESTCASES: Add tests for Sign/VerifyRecover for RSA
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2018-08-30 12:47:53 +02:00
Patrick Steuer
17814a3f0f Fix out of bounds read in testcases
Signed-off-by: Patrick Steuer <patrick.steuer@de.ibm.com>
2018-08-30 10:58:02 +02:00
Ingo Franzki
411aecdd22 TESTCASES: Re-enable 3DES test vectors with FIPS compliant keys
Replace the 3DES test vectors with better ones from
http://csrc.nist.gov/groups/STM/cavp/documents/des/tdesmmt.zip
using the TxxxMMT3.rsp files.

This fixes issue #132.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2018-08-28 16:45:44 +02:00
Ingo Franzki
51005da663 TESTCASE: Add SHA-512/224 and SHA-512/256 digests tests
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2018-08-20 16:40:18 +02:00
Ingo Franzki
288ade5ab6 Correct AES testcase for un-wrapable key tests
When performing a C_WrapKey call using a mechanism that does
not support wrapping, the testcase expects CKR_MECHANISM_INVALID,
but some tokens return CKR_KEY_NOT_WRAPPABLE instead.

Adapt the tesctase to allow both return codes.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2018-08-20 10:34:58 +02:00
Ingo Franzki
60559f77e7 Enhance gen_purpose testcase to check for invalid mechanism handling
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2018-08-20 10:34:58 +02:00
Ingo Franzki
a075a3bd2b TESTCASE: Display total elapsed time together with summary
testcase_pass() already displays the elapsed time since the
corresponding testcase_begin(). This patch adds code to also
display the total elapsed time in testcase_print_result()
since the corresponding testcase_setup().

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2018-08-20 10:34:58 +02:00
Eduardo Barretto
1c47a6cf8b Testcases/pkcs11: Fix coding style
Signed-off-by: Eduardo Barretto <ebarretto@linux.vnet.ibm.com>
2018-08-08 17:27:53 +02:00