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

[dpi,aes] Allow partial last message blocks for AES-GCM #7

Merged

Conversation

andrea-caforio
Copy link
Collaborator

Unlike the existing AES modes, the new GCM mode allows for partial last message blocks.
This commit adds this option to the c_dpi implementation, i.e., the automatic padding of
partial blocks.

if (impl == 0) {
// The C model is currently not supported.
printf(
"ERROR: c_dpi_aes_crypt_message() currently supports OpenSSL/BoringSSL "
"only\n");
} else { // OpenSSL/BoringSSL
if (!op) {
crypto_encrypt(ref_out, iv, ref_in, data_len, key, key_len, mode, aad_in,
crypto_encrypt(ref_out, iv, ref_in, data_len, key, key_len, kCryptoAesGcm, aad_in,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this change intentional?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Nice catch. Thank you. :-)

Copy link
Owner

@vogelpi vogelpi left a comment

Choose a reason for hiding this comment

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

This looks good to me except for the point raised by @nasahlpa . Thanks for the PR @andrea-caforio !

@vogelpi
Copy link
Owner

vogelpi commented Nov 15, 2024

Also, it currently fails lint. Can you please do a clang-format -i on this?

Unlike the existing AES modes, the new GCM mode allows for partial
last message blocks. This commit adds this option to the `c_dpi`
implementation, i.e., the automatic padding of partial blocks.

Signed-off-by: Andrea Caforio <[email protected]>
@andrea-caforio andrea-caforio force-pushed the c-dpi-aes-gcm-partial-blocks branch from d90e6d0 to ab6695e Compare November 15, 2024 15:18
@andrea-caforio
Copy link
Collaborator Author

It should be alright now (except for the lint error in that unrelated DV file).
Thanks for the reviews @vogelpi @nasahlpa.

Copy link
Collaborator

@nasahlpa nasahlpa left a comment

Choose a reason for hiding this comment

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

Thanks for working on that!

@vogelpi vogelpi merged commit d592957 into vogelpi:aes-gcm-review Nov 15, 2024
7 of 9 checks passed
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.

3 participants