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

When doing MBEDTLS_CIPHER_AES_128_CBC decryption with a zeroed key, output is set to a random number #9083

Open
andre-rosa opened this issue May 1, 2024 · 1 comment · May be fixed by #9082
Labels
component-crypto Crypto primitives and low-level interfaces enhancement priority-medium Medium priority - this can be reviewed as time permits size-xs Estimated task size: extra small (a few hours at most)

Comments

@andre-rosa
Copy link

andre-rosa commented May 1, 2024

Summary

Even thought mbedtls returns an error if there's invalid padding, the output parameter was being set instead of leaving it with zero. This check exists in openssl, so this makes the behavior closer between both libraries.

System information

Mbed TLS version (number or commit id): 3.6
Operating system and version: Linux
Configuration (if not default, please attach mbedtls_config.h): default
Compiler and options (if you used a pre-built binary, please indicate how you obtained it): default
Additional environment information: N/A

Expected behavior

In case of error, output should contain zero.

Actual behavior

In case of error, output may contain some random number like 18446744073709551516.

Steps to reproduce

Trying to decrypt AES 128 CBR with a zeroed key and MBEDTLS_PADDING_PKCS7 padding enabled.

Additional information

Please see the related PR: #9082 (development), #9132 (3.6 backport).

@andre-rosa andre-rosa linked a pull request May 1, 2024 that will close this issue
4 tasks
@tgonzalezorlandoarm tgonzalezorlandoarm added component-crypto Crypto primitives and low-level interfaces enhancement priority-medium Medium priority - this can be reviewed as time permits size-xs Estimated task size: extra small (a few hours at most) labels May 2, 2024
@andre-rosa
Copy link
Author

Hi @tgonzalezorlandoarm, is it possible to add another reviewer to #9082, please? Many thanks for considering my request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component-crypto Crypto primitives and low-level interfaces enhancement priority-medium Medium priority - this can be reviewed as time permits size-xs Estimated task size: extra small (a few hours at most)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants