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

Support AES in PKCS5 #7038

Closed
gilles-peskine-arm opened this issue Feb 2, 2023 · 6 comments · Fixed by #7604
Closed

Support AES in PKCS5 #7038

gilles-peskine-arm opened this issue Feb 2, 2023 · 6 comments · Fixed by #7604
Assignees
Labels
component-crypto Crypto primitives and low-level interfaces enhancement good-first-issue Good for newcomers size-s Estimated task size: small (~2d)

Comments

@gilles-peskine-arm
Copy link
Contributor

gilles-peskine-arm commented Feb 2, 2023

The PBES2 tests in test_suite_pkcs5 all rely on DES, which is deprecated. The PKCS5 module does not support AES, but it's cryptographically agile, so it should be easy to add AES support.

The goal of this task is:

  • Add the AES-CBC OID from RFC 8018 to the OID module.
  • In test_suite_pkcs5, add test cases using AES, equivalent to what we have for DES.
@jethrogb
Copy link

It's not just about the test suite, the pkcs5 module just doesn't support PBES2-AES at all right now.

@gilles-peskine-arm gilles-peskine-arm changed the title Augment DES test cases with AES: pkcs5 Support AES in PKCS5 May 15, 2023
@gilles-peskine-arm
Copy link
Contributor Author

@jethrogb Good point! Fortunately the PKCS5 module has no direct dependency on DES, so I think adding AES support is as easy as declaring the OID… and adding test cases.

@zvolin
Copy link
Contributor

zvolin commented May 16, 2023

Hi!
Tried your suggestion by only declaring the OIDs however I ended up debugging some segfault all the yesterday's evening 😅 . Will try to look more into it tho, however I'm not so familiar with the project

@jethrogb
Copy link

@zvolin and I were discussing the mbedtls_pkcs5_pbes2 API and it's not clear to us how to use it safely. What are the requirements on the output buffer size and what is the actual size used on return?

@jethrogb
Copy link

mbedtls_pkcs5_pbes2 calls mbedtls_cipher_crypt internally. mbedtls_cipher_crypt specifies input and output should be different memory ranges. mbedtls_pkcs5_pbes2 passes these directly from its own arguments data and output. The only MbedTLS-internal use of mbedtls_pkcs5_pbes2 is in pkparse.c where it passes p and buf right after a statement buf = p.

@gilles-peskine-arm
Copy link
Contributor Author

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 good-first-issue Good for newcomers size-s Estimated task size: small (~2d)
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants