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>
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>
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>
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>
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>
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>
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>
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>
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>