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

tpm2: Do not call EVP_PKEY_CTX_set0_rsa_oaep_label() for label of size 0 (OSSL 3) #294

Conversation

JuergenReppSIT
Copy link
Contributor

Openssl 3.0 did return an error if EVP_PKEY_CTX_set0_rsa_oaep_label was called
with label size 0. The function should only be called if the size of the label
is greater 0.
With this fix TPM2_RSA_Encrypt/Decrypt did work with OpenSSL 1.1 and 3.0
for encryption without label.

Signed-off-by: Juergen Repp juergen.repp@sit.fraunhofer.de

@coveralls
Copy link

coveralls commented Feb 19, 2022

Pull Request Test Coverage Report for Build 2427

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.008%) to 77.467%

Totals Coverage Status
Change from base Build 2421: 0.008%
Covered Lines: 29212
Relevant Lines: 37709

💛 - Coveralls

src/tpm2/crypto/openssl/CryptRsa.c Outdated Show resolved Hide resolved
@stefanberger
Copy link
Owner

FYI: This here is the OpenSSL 1.1.1 that still allowed label to be NULL: https://github.com/openssl/openssl/blob/OpenSSL_1_1_1-stable/crypto/rsa/rsa_pmeth.c#L545-L550

@stefanberger
Copy link
Owner

Can you also please adjust the title of the patch to something like tpm2: Do not call EVP_PKEY_CTX_set0_rsa_oaep_label() for label of size 0 (OSSL 3)

…e 0 (OSSL 3)

Openssl 3.0 did return an error if EVP_PKEY_CTX_set0_rsa_oaep_label was called
with label size 0. The function should only be called if the size of the label
is greater 0.
With this fix TPM2_RSA_Encrypt/Decrypt did work with OpenSSL 1.1 and 3.0
for encryption without label.

Signed-off-by: Juergen Repp <juergen.repp@sit.fraunhofer.de>
@JuergenReppSIT JuergenReppSIT changed the title RSA encrypt fix set label for OpenSSL 3.0 tpm2: Do not call EVP_PKEY_CTX_set0_rsa_oaep_label() for label of size 0 (OSSL 3) Mar 2, 2022
@JuergenReppSIT
Copy link
Contributor Author

FYI: This here is the OpenSSL 1.1.1 that still allowed label to be NULL: https://github.com/openssl/openssl/blob/OpenSSL_1_1_1-stable/crypto/rsa/rsa_pmeth.c#L545-L550
@stefanberger Thank you for the info. Yes in our CI for tss we have three test cases with label size 0 which did always work. During the first tests with Ubuntu 22.04 using libtpms installed via apt the errors did occur.

@stefanberger stefanberger merged commit e426198 into stefanberger:master Mar 2, 2022
@stefanberger
Copy link
Owner

Thanks!

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.

None yet

3 participants