1
0
mirror of https://github.com/opencryptoki/opencryptoki.git synced 2026-10-24 05:39:17 +03:00

161 Commits

Author SHA1 Message Date
Ingo Franzki
612cb84e23 TESTCASES: Remove temporary files produced by pkcstok_migrate_test.sh
Remove the .out files when the test has finished.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2026-10-05 08:35:13 +02:00
Ingo Franzki
b0769d6332 CI: Let ock_tests.sh only spawn a certain number of concurrent processes
Spawn only up to MAX_JOBS concurrent jobs. Defer the remaining job until
others have finished. MAX_JOBS defaults to 16, but can be configured at
runtime.

While at it, make the jobs limit for tok2toktest.sh also configurable, with
a default of 16 concurrent jobs. Also use 'wait -n' instead of polling
for jobs to complete.

When configured with the address sanitizer active, limit the number of jobs
to 4 because with ASAN it needs more memory and might run into out-of-memory
situations with too many concurrent jobs.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2026-09-25 08:49:36 +02:00
Ingo Franzki
f0df2b4023 TESTCASES: Skip object mgmt testcases for ICSF token
The ICSF token does not support all attributes used in the object mgmt tests.
Skip the entire test if running against the ICSF token.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2026-09-23 13:25:13 +02:00
Ingo Franzki
2ba0a19469 TESTCASES: Adjust p11sak_test.sh for the ICSF token
The ICSF token does not support public sessions. Communicating to an ICSF
server always requires a login (SO or USER). Skip the --no-logon tests.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2026-09-23 13:25:13 +02:00
Ingo Franzki
d3b97c59c3 TESTCASES: tok2tok: Skip if an EC key with an unsupported curve is generated
Don't treat CKR_CURVE_NOT_SUPPORTED as error, skip instead.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2026-09-11 13:53:23 +02:00
Ingo Franzki
ce11cba0bb CI: Run tok2tok_transport on all slot combination in the CI
Discovers all available, initialized tokens and runs tok2tok_transport
for every combination of slots (including same-slot). When multiple
slots carry tokens of the same type/model, only the first one is used
to avoid redundant runs.

Each run is spawned as a background process. Its combined stdout and
stderr are redirected to log-tok2tok-slots_X_Y.txt where X and Y are
the two slot numbers used. Run only up to 4 concurrent jobs to not run
into out-of-memory situations.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2026-09-09 08:14:11 +02:00
Ingo Franzki
83d8e3ce97 TESTCASES: Add a token migration test to 'make ci-installcheck'
In case the token format is the pre-FIPS format (every other day) then
migrate the token data of the Soft token 'sw0' to the new FIPS format
using the pkcstok_migrate tool after all tests have been run.
Verify that all objects have been migrated successfully.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2026-08-31 08:15:46 +02:00
Ingo Franzki
356c144b9e TESTCASES: Detect if the fork child was killed by a signal
Print the signal that killed the fork child to the test output.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2026-08-19 08:28:00 +02:00
Ingo Franzki
dba13f348f TESTCASES: Better error checking in p11kmip_test.sh
Make sure to capture failing commands and report them through the scripts
exit code.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2026-08-19 08:27:58 +02:00
Ingo Franzki
41294a08a8 TESTCASES: Add the new ECDH_*_AES_KEY_WRAP mechanisms to tok2tok test
Test the new ECDH_*_AES_KEY_WRAP mechanisms.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2026-04-22 13:07:43 +02:00
Ingo Franzki
6b73e1ba57 TESTCASES: Add tests for ML-KEM of PKCS#11 v3.2 to cca_ep11_export_import_test
Test exporting and importing ML-KEM keys via its opaque key blob.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2026-04-13 14:39:43 +02:00
Ingo Franzki
214dedf268 TESTCASES: Add tests for ML-DSA of PKCS#11 v3.2 to cca_ep11_export_import_test
Test exporting and importing ML-DSA keys via its opaque key blob.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2026-04-13 14:39:43 +02:00
Ingo Franzki
ea341db322 TESTCASES: Add PKCS#11 v3.2 ML-DSA and ML-KEM tests for p11sak
Test working with ML-DSA and ML-KEM key types of PKCS#11 v3.2 with p11sak.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2026-04-13 14:39:43 +02:00
Ingo Franzki
9b56859008 TESTCASES: Add tests for ML-DSA and ML-KEM of PKCS#11 v3.2 for tok2tok_transport
Test key wrapping of ML-DSA and ML-KEM keys of PKCS#11 v3.2.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2026-04-13 14:39:43 +02:00
Ingo Franzki
80b2cc99f5 TESTCASES: Add a test for CKM_ECDH_AES_KEY_WRAP with Montgomery keys
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2026-02-04 14:31:15 +01:00
Ingo Franzki
bfe8fd50f5 TESTCASES: Fix return code of speed test
Make sure the speed test program returns 0 on success and 1 on failure.

Fixes: b57644843c

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2026-01-29 08:13:40 +01:00
Ingo Franzki
787b0e45a5 TESTCASES: Add Edwards and Montgomery tests for p11sak
Enhance p11sak_test.sh to also test key operations with Edwards and
Montgomery keys using p11sak.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2026-01-27 08:14:16 +01:00
Ingo Franzki
e4f22d1a9a TESTCASES: Enhance cca_ep11_export_import_test for Edwards curves
Enhance the cca_ep11_export_import_test test to also test exporting and
importing of Edwards and Montgomery key blobs for CCA and EP11.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2026-01-27 08:14:16 +01:00
Ingo Franzki
9298f52ba4 TESTCASES: Add tests for Edwards key type and mechanisms
Enhance the existing testcases to also test Edwards and Montgomery crypto
operations.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2026-01-27 08:14:16 +01:00
Ingo Franzki
9b7d410f8e TESTCASES: Enhance test for CKM_IBM_ML_KEM_WITH_ECDH
Enhance the ibm_ml_kem as well as the tok2tok_transport test to also
perform the CKM_IBM_ML_KEM_WITH_ECDH mechanism.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2025-10-31 14:15:14 +01:00
Ingo Franzki
8edb2b5710 TESTCASES: Add ML-DSA and ML-KEM keys to p11sak tests
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2025-10-31 14:15:14 +01:00
Ingo Franzki
78a5864d7f TESTCASES: Update cca_ep11_export_import_test to also test ML-DSA and ML-KEM
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2025-10-31 14:15:14 +01:00
Ingo Franzki
832e74884f TESTCASES: Add ML-KEM to tok2tok_transport test
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2025-10-31 14:15:14 +01:00
Ingo Franzki
0a4efcc6e1 TESTCASES: Add ML-DSA to tok2tok_transport test
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2025-10-31 14:15:14 +01:00
Ingo Franzki
98817512d2 TESTCASES: Add RSA 8192-bit support for CCA key blob import tests
Running tests with larger RSA sizes increase the run time dramatically.
Thus, the RSA 8192 bit tests are disabled by default, but can be enabled
by running the test with the '-rsa8k' option.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2025-10-09 15:12:50 +02:00
Ingo Franzki
c2c466f414 TESTCASES: Add key wrap tests for p11sak_tests.sh
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2025-08-25 13:55:21 +02:00
Ingo Franzki
ce665a9728 TESTCASES: Add tests for CKM_RSA_X9_31_KEY_PAIR_GEN
Perform some of the RSA tests with keys generated by mechanism
CKM_RSA_X9_31_KEY_PAIR_GEN.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2025-08-11 08:27:39 +02:00
Ingo Franzki
360b6836be TESTCASES: Add tests for SHA-HMAC key types and key gen mechanisms
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2025-06-27 10:23:41 +02:00
Ingo Franzki
c04897acbd TESTCASES: Add test vectors for larger RSA key sizes
Also adjust the testcases to support larger RSA keys, i.e. for RSA 8192 bit
keys.

Running tests with larger RSA sizes increase the run time dramatically.
Thus, the RSA 8192 bit tests are disabled by default, but can be enabled
by running the test with the '-rsa8k' option.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2025-06-24 08:20:59 +02:00
Ingo Franzki
651034f1b1 Fix '-Wunterminated-string-initialization' warnings
Newer GCC versions report errors for string initialization where the
terminating NULL character does not fit into the target variable.

All the fixed places use non-zero-terminated strings, but add an additional
character to make the compiler happy.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2025-05-14 16:41:01 +02:00
Ingo Franzki
14d83ed674 TESTCASES: tok2tok_transport: Test C_WrapKey size queries
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2025-03-28 08:24:26 +01:00
Ingo Franzki
ec1b3d87ba TESTCASES: Enhance the tok2tok_transport for key wrapping with CKM_AES_GCM
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2025-03-28 08:24:26 +01:00
Ingo Franzki
48a1e7ee91 TESTCASES: Fix cca_export_import_test to handle too old EP11 firmware
Error CKR_PUBLIC_KEY_INVALID may even be returned for public key blob
import, so handle it there as well and skip the test.

Fixes: 04b8ebea77

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2025-03-26 09:08:22 +01:00
Ingo Franzki
69db856d1f TESTCASES: Fix KMIP server key setup for p11kmip test
Fix the logic to re-get the login authorization ID from SKLM in case the
login token was expired. This can happen if another system concurrently
obtains a login authorization ID from the same server. This revokes all
previously login tokens.

Thus, in case an operation with SKLM returns message CTGKM6004E, a new
login token must be obtained, and the failed key setup step must be repeated
with the new login token.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2025-03-25 16:42:05 +01:00
Ingo Franzki
04b8ebea77 TESTCASES: Enhance cca_export_import_test to also support EP11
Rename it to cca_ep11_export_import_test while at it.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2025-03-24 08:27:51 +01:00
Ingo Franzki
af4ac660f3 TESTCASES: Fix KMIP server setup for p11kmip test
Fix the logic to re-get the login authorization ID from SKLM in case the
login token was expired. This can happen if another system concurrently
obtains a login authorization ID from the same server. This revokes all
previously login tokens.

Thus, in case an operation with SKLM returns message CTGKM6004E, a new
login token must be obtained, and the failed setup step must be repeated
with the new login token.

While at it, make sure that the retry loop terminates in case of unrecoverable
error situations and make sure RC is set in all such cases.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2025-03-14 11:55:38 +01:00
Ingo Franzki
01bd78ed25 TESTCASES: Adjust p11kmip test to produce parse-able output
Output lines like '* TESTCASE p11kmip_test <test-name> PASS/FAIL <description>'
that can be processed by the CI's post processor.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2025-03-10 15:16:07 +01:00
john-craig
4243c70a4d P11KMIP: Add testcase for p11kmip
Signed-off-by: John Craig <john.craig@ibm.com>
2025-02-19 09:08:19 +01:00
Ingo Franzki
289b95aff2 TESTCASES: Add tests for the CKM_ECDH_AES_KEY_WRAP mechanism
Perform wrap/unwrap with the CKM_ECDH_AES_KEY_WRAP mechanism in the
tok2tok_transport test.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2024-12-11 14:37:58 +01:00
Ingo Franzki
c6a22fb682 TESTCASES: Add tests for the CKM_RSA_AES_KEY_WRAP mechanism
Perform wrap/unwrap with the CKM_RSA_AES_KEY_WRAP mechanism.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2024-12-11 14:37:58 +01:00
Ingo Franzki
7de37d554b TESTCASES: Add tests for CKM_AES_KEY_WRAP[_*] mechanisms
Perform encrypt/decrypt, as well as wrap/unwrap with the
CKM_AES_KEY_WRAP[_*] mechanisms.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2024-12-11 14:37:58 +01:00
Ingo Franzki
41863463ba TESTCASES: Adapt ECDH testcase for use with the CCA token
The CCA token only supports to derive AES-256 keys. Skip all attempts to
derive different key sizes.

The EC testcase usually derives keys of type CKK_GENERIC_SECRET, to allow
various key sizes. It checks that the derived keys are usable and correct
by performing an HMAC operation with them (if supported by the token).

If the test runs against the CCA token, derive AES-256 keys instead, and
perform an AES encrypt operation with them to test the usability and
correctness.

Known answer tests (KAT) for ECDH are not possible with the CCA token, because
CCA only allows to perform ECDH with randomly generated EC keys, but not
with EC keys imported from clear. However, for KATs, we would need to use
imported keys.

Furthermore, ECC keys imported from clear can not have CKA_DERIVE=TRUE for
the CCA token. Make sure CKA_DERIVE is TRUE only for those cases where it
really is required.

The cca_export_import_test is changed to import an ECC private key blob
with CKA_DERIVE=TRUE. This is safe since it did generate the key blob just
before with the CCA token, so it should have everything that is needed to
support key derivation.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2024-11-25 09:18:31 +01:00
Ingo Franzki
7c2be4f13d TESTCASES: Updated cca_export_import_tests to cover CCA CIPHER keys
... and also test export restricting and converting AES keys.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2024-11-11 09:36:47 +01:00
Joerg Schmidbauer
0f936b830a TESTCASES: fix various typos
Signed-off-by: Joerg Schmidbauer <jschmidb@de.ibm.com>
2024-08-27 14:24:24 +02:00
Ingo Franzki
d4014a46ad TESTCASES: Add test for CKA_ALWAYS_AUTHENTICATE
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2024-08-07 10:38:30 +02:00
Ingo Franzki
3d33180033 TESTCASES: Fix EXTRA_DIST for renamed PEM files
Fixes 'make distcheck' failure "make[2]: *** No rule to make target
'testcases/misc_tests/ibm-dilithium-key.pem', needed by 'distdir-am'.  Stop."

Fixes: 2fc60422b8

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2024-07-11 13:02:34 +02:00
Ingo Franzki
2fc60422b8 TESTCASES: Update p11sak_tests.sh to also test oqsprovider operations
... but only if the oqsprovider is available

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2024-06-24 10:51:12 +02:00
Ingo Franzki
c339928d06 TESTCASES: Update tok2tok_transport to wrap/unwrap IBM Dilithium keys
The soft token as well as the EP11 token supports wrapping of IBM Dilithium
keys. The CCA token does not offer a wrapping mechanism that can wrap IBM
Dilithium keys due to the size of the keys.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2024-06-24 10:51:12 +02:00
Ingo Franzki
a5d71aa0f0 TESTCASES: tok2tok_transport: Skip 2nd C_Login if the same slot is used
When the tok2tok_transport testcase is used and both, the source slot and
the target slot are the same, then skip the C_Login of the target slot,
because it is already logged in.

PKCS#11 does not allow to login the same slot twice, this would result in
CKR_USER_ALREADY_LOGGED_IN. Logging in a session on a token changes the
global login state of that token, which affects all sessions of this
token.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2024-06-19 09:09:01 +02:00
Ingo Franzki
85300c219b TESTCASES: tok2tok_transport: Skip AES-XTS keys for CCA or EP11
The CCA and EP11 tokens do not support AES-XTS key to be wrapped.
Furthermore, AES-XTS keys require protected key support, which might not
be enabled in the token config files.

AES-XTS keys as wrapping keys are already skipped, because the CKM_AES_XTS
mechanism does not have the CKF_WRAP and CKF_UNWRAP flags set in case of
the CCA or EP11 token.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2024-06-19 09:09:01 +02:00