Skip to content

Fix the PIN getter evmctl was using#34

Open
stefanberger wants to merge 2 commits intolinux-integrity:next-testingfrom
stefanberger:fix-pin-getter
Open

Fix the PIN getter evmctl was using#34
stefanberger wants to merge 2 commits intolinux-integrity:next-testingfrom
stefanberger:fix-pin-getter

Conversation

@stefanberger
Copy link
Copy Markdown
Contributor

@stefanberger stefanberger commented Apr 9, 2026

This PR fixes the PIN getter that evmctl was using for keys accessed using PKCS11. It was returning the wrong value from the callback function. It also adjusts test cases to test the PIN getter now by stripping the suffix ?pin-value=1234 from the URI and passing the PIN separately to evmctl using --pass=... to exercise the PIN getter.

Since openssl command line tool is used to for test-signing with the PKCS11 URI, the pin-value needs to be appended to the URI to avoid openssl prompting for the PIN.

Fix the return code of the PIN getter. The bug was not noticed since the
pkcs11 URI for the SoftHSM private key contains the pin-value (needed for
signing but also for testing whether signing is possible).

When UI_set_result() returns != 0 for failure, return 0 on the PIN getter,
1 otherwise.

From UI_method_set_reader man page:

"All of these functions are expected to return 0 on error, 1 on
 success..."

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Test evmctl's PIN getter by stripping the PIN from the pkcs11 URI and
passing the PIN to evmctl using the --pass option. Since test-signing
with the PKCS11 URI also requires access to the key and therefore also
access to the PIN, append the PIN to the URI so that OpenSSL can use
the key without prompting for the PIN.

Upgrade some of the PKCS11 URI tests to use sha384 instead of outdated
sha1.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant