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

wrong RSA_PRV_DER_MAX_BYTES for odd MBEDTLS_MPI_MAX_SIZE #4094

Merged
merged 4 commits into from
Feb 2, 2021

Conversation

d-otte
Copy link
Contributor

@d-otte d-otte commented Feb 1, 2021

This is the PR for issue #4093

Description

It adds parenthesis to fix the computation of RSA_PRV_DER_MAX_BYTES and also adds parenthesis to other macros to make them safer to use.

…MAX_SIZE is odd.

if MBEDTLS_MPI_MAX_SIZE is odd then RSA_PRV_DER_MAX_BYTES will be two less than expected, since the macros are lacking parentheses.


Signed-off-by: Daniel Otte <d.otte@wut.de>
…ble mistakes in usage.

Signed-off-by: Daniel Otte <d.otte@wut.de>
@chris-jones-arm chris-jones-arm linked an issue Feb 1, 2021 that may be closed by this pull request
@chris-jones-arm chris-jones-arm added bug Community component-crypto Crypto primitives and low-level interfaces needs-backports Backports are missing or are pending review and approval. needs-review Every commit must be reviewed by at least two team members, needs-reviewer This PR needs someone to pick it up for review labels Feb 1, 2021
yanesca
yanesca previously approved these changes Feb 1, 2021
Copy link
Contributor

@yanesca yanesca left a comment

Choose a reason for hiding this comment

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

Looks good to me.

Copy link
Contributor

@chris-jones-arm chris-jones-arm left a comment

Choose a reason for hiding this comment

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

Hi @d-otte, thanks for the well written bug report and subsequent PR. I'm generally happy with this PR apart from a few minor house-keeping points shown below.

Also as you mentioned in your issue, this bug exists in the 2.16 branch as well as the 2.7 branch. Could you please provide backports for both of these branches along with the changelog entry (mentioned below).

library/pkwrite.c Show resolved Hide resolved
library/pkwrite.c Show resolved Hide resolved
@chris-jones-arm chris-jones-arm removed the needs-review Every commit must be reviewed by at least two team members, label Feb 1, 2021
Signed-off-by: Daniel Otte <d.otte@wut.de>
@chris-jones-arm
Copy link
Contributor

Thanks for adding the changelog @d-otte! Unfortunately it now seems to be failing CI (trailing whitespace and missing newline in the changelog). Could you please fix these errors and also rename the changelog entry to "Security" as opposed to "Bugfix" as I think this constitutes a security risk due to the potential buffer overflow. Sorry if my earlier wording was not clear on this.

Signed-off-by: Daniel Otte <d.otte@wut.de>
Copy link
Contributor

@chris-jones-arm chris-jones-arm left a comment

Choose a reason for hiding this comment

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

I'm happy with this now, thanks for making the changes.

@chris-jones-arm chris-jones-arm removed the needs-ci Needs to pass CI tests label Feb 2, 2021
Copy link
Contributor

@yanesca yanesca left a comment

Choose a reason for hiding this comment

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

Looks good to me.

@d-otte Thank you for your contribution!

@yanesca yanesca added approved Design and code approved - may be waiting for CI or backports and removed needs-backports Backports are missing or are pending review and approval. needs-reviewer This PR needs someone to pick it up for review labels Feb 2, 2021
@yanesca yanesca merged commit 6a32ad8 into Mbed-TLS:development Feb 2, 2021
OBSOLETE - PLEASE SEE https://github.com/orgs/Mbed-TLS/projects/2 automation moved this from Has Approval to Done Feb 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Design and code approved - may be waiting for CI or backports bug component-crypto Crypto primitives and low-level interfaces
Projects
None yet
Development

Successfully merging this pull request may close these issues.

wrong RSA_PRV_DER_MAX_BYTES for odd MBEDTLS_MPI_MAX_SIZE
4 participants