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

Initialization Vector (IV) discarded for AES CBC Wrap #782

Open
gshaurya18 opened this issue Jan 22, 2025 · 0 comments
Open

Initialization Vector (IV) discarded for AES CBC Wrap #782

gshaurya18 opened this issue Jan 22, 2025 · 0 comments

Comments

@gshaurya18
Copy link

Hello,

It looks like the iv is discarded for CKM_AES_CBC wrap implementation; An IV = 0 seems to be always be used, regardless of input. So, as in the example here https://github.com/gshaurya18/aes_cbc_test/blob/main/src/main.rs#L122 performing wrap on the same payload with the same wrapping key but different Initialization vectors yields the same result. Is this expected?

Is the implementation missing to set the blocksize to 16 here https://github.com/softhsm/SoftHSMv2/blob/develop/src/lib/SoftHSM.cpp#L6296, causing us to not copy over any bytes from the input iv https://github.com/softhsm/SoftHSMv2/blob/develop/src/lib/SoftHSM.cpp#L6333?

There also seems to be a similar issue for CKM_DES3_CBC where blocksize is not set to 8 https://github.com/softhsm/SoftHSMv2/blob/develop/src/lib/SoftHSM.cpp#L6295

Steps to reproduce:

Reference: https://www.cryptsoft.com/pkcs11doc/v211/group__SEC__12__19__3__AES__CBC.html, RFC: https://datatracker.ietf.org/doc/html/rfc3394#section-2.2.1

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

No branches or pull requests

1 participant