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

16 Commits

Author SHA1 Message Date
Ingo Franzki
3f6fb6d30b TESTCASES: Add unit tests for PKCS#7 padding and unpadding
Test the PKCS#7 padding and unpadding functions to behave correctly
on various valid and invalid inputs.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2026-10-22 12:53:13 +02:00
Ingo Franzki
238eb40a57 TESTCASES: Enhance the ASN.1 unit tests to test for PKCS#8 and SPKI compatibility
Produce a PKCS#8 and SPKI encoding using OpenSSL and test if the ASN.1 routines
can decode that key and also if the round trip produces the exact same encoded data.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2026-10-20 14:31:37 +02:00
Ingo Franzki
a57f9a02c3 TESTCASES: Add unit tests for invalid AlgorithmIdentifier decoding
Add tests that checks if wrong AlgorithmIdentifier are detected, i.e.
cases where the OID is too short or too long, or invalid by other means.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2026-10-13 11:56:12 +02:00
Ingo Franzki
90df45fe70 COMMON: Remove dependency on liblber in common code
The use of liblber has been eliminated for most of the cases already.
The only leftover cases are in RSA, DSA, and DH public key encoding
functions for encoding BIT STRINGs.

Update these leftover places and use the already existing
ber_encode_BIT_STRING() function instead.

With this, '-lber' can be removed from the make files for most of
the tokens and tools. The ICSF token still requires liblber for its
LDAP communication.

Also adjust the configure script and example RPM spec accordingly.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2026-09-07 11:11:06 +02:00
Ingo Franzki
dbd41d4a6c TESTS: Add unit and fuzzing tests for object flatten and unflatten in object.c
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
Assisted-by: IBM Bob: 1.0.1
2026-05-28 10:41:26 +02:00
Ingo Franzki
45c14a7f76 TESTS: Add fuzzing tests for the basic BER encoding functions in asn1.c
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
Assisted-by: IBM Bob: 1.0.1
2026-05-28 10:41:26 +02:00
Ingo Franzki
a7f2b36962 TESTS: Add unit tests for the BER encoding/decoding functions
Add unit tests for the basic BER encoding and decoding functions in asn1.c.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
Assisted-by: IBM Bob: 1.0.1
2026-05-28 10:41:26 +02:00
Akash Kulhalli
d1785b5e54 testcases: miscellaneous updates
`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>
2024-04-24 09:48:07 +02:00
Ingo Franzki
278a65e660 Makefile: Fix noinst_HEADERS and EXTRA_DIST to include all headers and files
Headers not specified either in xxx_SOURCES or noinst_HEADERS will not
be included for 'make dist', and will cause compile errors during
'make distcheck'. Also include several extra files into EXTRA_DIST to
make sure they are distributed as well.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2023-09-13 11:15:23 +02:00
Ingo Franzki
26fe51d922 POLICY: Dilithium strength and signature size depends on variant
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2023-01-24 14:52:11 +01:00
Holger Dengler
13f72b9295 testcases: unit: add tests for pin_prompt
Signed-off-by: Holger Dengler <dengler@linux.ibm.com>
2022-09-20 11:18:59 +02:00
Holger Dengler
1eb3f05c07 testcases: unit: add tests for buffer and uri
Add unit tests for internal library functions for p11_buffer and p11_uri.

Signed-off-by: Holger Dengler <dengler@linux.ibm.com>
2022-08-03 08:26:28 +02:00
Ingo Franzki
c06ffa0ef6 Makefile: Fix make files for building the config parser
Only reference the .y and .l files in SOURCES, but not the generated .c
files.

Building the configuration parser requires own rules for yacc and lex.
Avoid automake target override warning using Wno-override.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2021-11-11 16:37:59 +01:00
Juergen Christ
b80631dff0 CONFIG: Add some unit tests
Signed-off-by: Juergen Christ <jchrist@linux.ibm.com>
2021-11-08 17:32:09 +01:00
Juergen Christ
3b0a198aa9 Exploit mechanism table
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>
2021-11-08 16:29:24 +01:00
Juergen Christ
c233e5b842 TEST: Policy, hashmap, and mechtable tests
Added some unit tests and a system test for manual execution.

Signed-off-by: Juergen Christ <jchrist@linux.ibm.com>
2021-11-08 16:29:24 +01:00