Skip to content

Conversation

@testingapisname
Copy link

Implements comprehensive AES-GCM testing using official Wycheproof test vectors from Google. Tests 313 valid cryptographic operations across multiple key sizes (128/192/256-bit), nonce lengths, tag sizes, and AAD configurations.

Fixes #187

Implements comprehensive AES-GCM testing using official Wycheproof
test vectors from Google. Tests 313 valid cryptographic operations
across multiple key sizes (128/192/256-bit), nonce lengths, tag sizes,
and AAD configurations.

Fixes parallaxsecond#187

Signed-off-by: James Eilers <eilersjames15@gmail.com>
Copy link
Collaborator

@Jakuje Jakuje left a comment

Choose a reason for hiding this comment

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

thank you for your contribution! Just two thoughts regarding the PKCS#11 3.* API

Comment on lines +43 to +44
// Skip tests with nonce sizes that exceed PKCS#11 limits (max 256 bytes)
if test.nonce.len() > 256 {
Copy link
Collaborator

Choose a reason for hiding this comment

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

While the PKCS#11 2.40 has this limitation [1], the higher limit is defined in the current specification 3.2:

The length of the initialization vector can be any number between 1 and (2^32) - 1.

In the tests, you can detect the pkcs11 version and I think we can use the larger ones for the new modules.

Updating the documentation would be good too

[1] https://docs.oasis-open.org/pkcs11/pkcs11-curr/v2.40/errata01/os/pkcs11-curr-v2.40-errata01-os-complete.html#_Toc441850509
[2] https://docs.oasis-open.org/pkcs11/pkcs11-spec/v3.2/pkcs11-spec-v3.2.html#_Toc195693377

};

// Test encryption
let encrypt_result = session.encrypt(&Mechanism::AesGcm(gcm_params), key, &test.pt);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could we test also the PKCS#11 3 API with message-based encryption?

fn encrypt_decrypt_gcm_message_with_aad() -> TestResult {

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.

Add Wycheproof-based tests

2 participants