`random` returns a number within a range that includes 0; but the code does not
always handle that, leading to misleading error messages ("malloc failed" but
it was a request for a memory buffer of size 0) on test run. Those should now
be fixed.
The `ock_tests.sh.in` file has been slightly tweaked to account for some flags
that are not available on AIX. No functional differences expected across all
supported platforms.
On Linux, a null pointer is printed as "(null)", whereas on AIX nothing is
printed. Since this is only for tests, AIX now also prints the same string as
Linux when a nullptr is attempted to be printed.
Signed-off-by: Akash Kulhalli <akash.kulhalli@ibm.com>
Make use of mechanism table to translate between string and numeric format of
mechanisms. Remove duplicated code dealing with mechanism translations.
Signed-off-by: Juergen Christ <jchrist@linux.ibm.com>
If at least one test step ends with ERROR or FAILURE, exit the
process with a non-zero return code to let the caller easily detect
if the testcase showed any errors.
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
EP11 supports the vendor (IBM) specific mechanism CKM_IBM_CMAC.
With older EP11 firmware this is the only CMAC mechanism supported
by EP11.
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
PKCS#11 v2.4 does not define any mechanisms for SHA3.
To support SHA3 anyway, add support for the vendor (IBM) specific
mechanisms CKM_IBM_SHA3_224, CKM_IBM_SHA3_256, CKM_IBM_SHA3_384,
CKM_IBM_SHA3_512, CKM_IBM_SHA3_224_HMAC, CKM_IBM_SHA3_256_HMAC,
CKM_IBM_SHA3_384_HMAC, and CKM_IBM_SHA3_512_HMAC.
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>
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>
Add mechanisms CKM_SHA512_224, CKM_SHA512_224_HMAC, CKM_SHA512_224_HMAC_GENERAL
CKM_SHA512_256, CKM_SHA512_256_HMAC, and CKM_SHA512_256_HMAC_GENERAL
to common code and the EP11 token.
Signed-off-by: Ingo Franzki <ifranzki@linux.vnet.ibm.com>
Add mechanisms CKM_SHA224_KEY_DERIVATION, CKM_SHA384_KEY_DERIVATION,
and CKM_SHA512_KEY_DERIVATION to common code and EP11.
Signed-off-by: Ingo Franzki <ifranzki@linux.vnet.ibm.com>
The digest testcase (digest_func.c) will now also test
mechanisms CKM_SHA224, CKM_SHA224_HMAC, and
CKM_SHA224_HMAC_GENERAL.
Signed-off-by: Ingo Franzki <ifranzki@linux.vnet.ibm.com>
Slightly adapted version of Ingo's patch:
Patch hunks needed relocation because of previous commits
in some files. Removed some trailing whitespaces.
Tested, works.
Signed-off-by: Ingo Franzki <ifranzki@de.ibm.com>
Signed-off-by: Harald Freudenberger <freude@linux.vnet.ibm.com>
- multipart digest update now really breaks down the data
into chunks.
- fix in regress.h: macro testcase_pass prints out timev differences
but start time was nowhere set (causing to print just some kind of
random time). Now the testcase_begin* macros set start time and thus
the time values printed out make sense.
Signed-off-by: Joy Latten <jmlatten@linux.vnet.ibm.com>
This ensures only published test vectors are not run on secure key tokens.
Before we were checking for securekey based on mode name, but this won't
work for ICSF whose model name is not hardcoded or set by OCK.
Signed-off-by: Joy Latten <latten@linux.vnet.ibm.com>
Reviewed-by: Debora Babb
Reviewed-by: Marcelo Cerri
Errors are tallied, and included in summary results.
Total number of tests don't need to be hardcoded;
instead total = run + skipped.
Signed-off-by: Fionnuala Gunter <fin@linux.vnet.ibm.com>
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>
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>
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>
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>
- Now testcases inside testcases/driver can be run separatedly
- ock-tests.sh now calls individual tests instead of testcases/driver/driver binary
- since all usage() were the same inside testcases/driver, this is now located at testcases/common.c. To avoid namespace conflict, the other usage() ones were renamed to <testcase_binary_name>_usage()
- skip_token_obj, no_stop and no_init are now declared in testcases/include/regress,h