Fix the PIN getter evmctl was using#34
Open
stefanberger wants to merge 2 commits intolinux-integrity:next-testingfrom
Open
Fix the PIN getter evmctl was using#34stefanberger wants to merge 2 commits intolinux-integrity:next-testingfrom
stefanberger wants to merge 2 commits intolinux-integrity:next-testingfrom
Conversation
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>
002a5dd to
4f77f35
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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=1234from 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.