Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch pkcs11 crate for cryptoki instead #754

Merged
merged 10 commits into from
Jan 14, 2022

Conversation

ximon18
Copy link
Member

@ximon18 ximon18 commented Jan 4, 2022

This PR attempts to resolve #752.

On my Raspberry Pi 4b with the YubiHSM2 Nano with a cross compiled build of this PR code I can now get Krill to talk to the YubiHSM2 via the PKCS#11 interface. It remains to be seen if all tests pass, I suspect they do not yet, but it at least gets this far now: (with some parts of the logging stripped such as timestamps and function paths to make it easier to read here)

[INFO] [...] Using PKCS#11 token 'YubiHSM (model: YubiHSM, vendor: Yubico (www.yubico.com))' in slot 0 of server 'Yubico (www.yubico.com) (Cryptoki v2.30)' via library '/home/pi/yubihsm/yubihsm-shell-2.3.0b/build/pkcs11/yubihsm_pkcs11.so'
[TRACE] [...] yubihsm_pkcs11.so::C_OpenSession()
[TRACE] [...] yubihsm_pkcs11.so::C_FindObjectsInit, C_FindObjects & C_FindObjectsFinal()
[DEBUG] [...] Signer 'YubiHSM2 Nano via PKCS#11' not matched: private key id 'A77978094DEFCCC09F7CE1D5CD94C7727D5371E1' not found
[TRACE] [...] Attempting to register signer 'YubiHSM2 Nano via PKCS#11'
[TRACE] [...] yubihsm_pkcs11.so::C_OpenSession()
[TRACE] [...] yubihsm_pkcs11.so::C_GenerateKeyPair()
[INFO] [...] Updated announcements (1097172) based on BGP Ris Dumps
[TRACE] [...] yubihsm_pkcs11.so::C_OpenSession()
[TRACE] [...] yubihsm_pkcs11.so::C_GetAttributeValue()
[TRACE] [...] yubihsm_pkcs11.so::C_OpenSession()
[TRACE] [...] yubihsm_pkcs11.so::C_FindObjectsInit, C_FindObjects & C_FindObjectsFinal()
[TRACE] [...] yubihsm_pkcs11.so::C_OpenSession()
[TRACE] [...] yubihsm_pkcs11.so::C_SignInit & C_Sign()
[DEBUG] [...] Signer 'YubiHSM2 Nano via PKCS#11' is ready and new, binding
[DEBUG] [...] Signer 'YubiHSM2 Nano via PKCS#11' bound to signer handle 'a71378fb-3046-4d99-b0da-1bf68cb4145f'
[INFO] [...] Signer 'YubiHSM2 Nano via PKCS#11' is ready for use

…to support non x86_64 architectures, e.g. ARMv7 on a Raspberry Pi 4b. Now gets as far as "2022-01-05 00:36:38 [INFO] [krill::commons::crypto::signing::dispatch::signerrouter] Signer 'YubiHSM2 Nano via PKCS#11' is ready for use" in my testing. Uses the unreleased cryptoki main HEAD code because the released 0.2.0 version lacks functionality we need, e.g. get library and slot info.
@ximon18 ximon18 added the hsm Relates to adding HSM support to Krill label Jan 5, 2022
@ximon18 ximon18 mentioned this pull request Jan 5, 2022
6 tasks
@ximon18 ximon18 requested a review from timbru January 11, 2022 10:59
Copy link
Contributor

@timbru timbru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not comfortable with using an unreleased version of cryptoki. Other than that it seems to me that all of this is fine. Lots of changes - but as far as I can tell they are all just about using the other API and none of them introduce different behaviour.

Cargo.toml Outdated Show resolved Hide resolved
@ximon18
Copy link
Member Author

ximon18 commented Jan 14, 2022

I am not comfortable with using an unreleased version of cryptoki. Other than that it seems to me that all of this is fine. Lots of changes - but as far as I can tell they are all just about using the other API and none of them introduce different behaviour.

This is resolved now.

@ximon18 ximon18 requested a review from timbru January 14, 2022 10:26
@timbru
Copy link
Contributor

timbru commented Jan 14, 2022

Great! I think we can start merging all this into dev then!

@ximon18 ximon18 merged commit a5114a8 into hsm Jan 14, 2022
@ximon18 ximon18 deleted the switch-pkcs11-crate-for-cryptoki-instead branch January 14, 2022 10:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hsm Relates to adding HSM support to Krill
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants