Skip to content

Use the same encryption growth macro consistently#19622

Closed
mattcaswell wants to merge 1 commit intoopenssl:masterfrom
mattcaswell:fix-encryption-growth2
Closed

Use the same encryption growth macro consistently#19622
mattcaswell wants to merge 1 commit intoopenssl:masterfrom
mattcaswell:fix-encryption-growth2

Conversation

@mattcaswell
Copy link
Member

We had two different macros for calculating the potential growth due to encryption. The macro we use for allocating the underlying buffer should be the same one that we use for reserving bytes for encryption growth.

Also if we are adding the MAC independently of the cipher algorithm then the encryption growth will not include that MAC so we should remove it from the amount of bytes that we reserve for that growth. Otherwise we might exceed our buffer size and the WPACKET_reserve operation will fail.

This is urgent because it was included as part of #19516 which I over-enthusiastically merged when unfortunately there was a CI failure (unfortunately ready-to-merge was automatically applied anyway). There will need to be a backport because #19517 was previously merged to 3.0/3.1.

We had two different macros for calculating the potential growth due to
encryption. The macro we use for allocating the underlying buffer should be
the same one that we use for reserving bytes for encryption growth.

Also if we are adding the MAC independently of the cipher algorithm then
the encryption growth will not include that MAC so we should remove it
from the amount of bytes that we reserve for that growth. Otherwise we
might exceed our buffer size and the WPACKET_reserve operation will
fail.
@mattcaswell mattcaswell added branch: master Applies to master branch approval: review pending This pull request needs review by a committer approval: otc review pending severity: urgent Fixes an urgent issue (exempt from 24h grace period) labels Nov 7, 2022
@t8m t8m added the triaged: bug The issue/pr is/fixes a bug label Nov 7, 2022
@t8m
Copy link
Member

t8m commented Nov 7, 2022

OK with urgent

@mattcaswell
Copy link
Member Author

3.1/3.0 backport in #19624

@mattcaswell
Copy link
Member Author

Ping @openssl/committers. This is causing CI failures in PRs...

Copy link
Member

@hlandau hlandau left a comment

Choose a reason for hiding this comment

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

Agree urgent

@hlandau hlandau added approval: done This pull request has the required number of approvals and removed approval: review pending This pull request needs review by a committer labels Nov 7, 2022
@mattcaswell mattcaswell added approval: ready to merge The 24 hour grace period has passed, ready to merge and removed approval: done This pull request has the required number of approvals labels Nov 7, 2022
@mattcaswell
Copy link
Member Author

Pushed. Thanks.

@mattcaswell mattcaswell closed this Nov 7, 2022
openssl-machine pushed a commit that referenced this pull request Nov 7, 2022
We had two different macros for calculating the potential growth due to
encryption. The macro we use for allocating the underlying buffer should be
the same one that we use for reserving bytes for encryption growth.

Also if we are adding the MAC independently of the cipher algorithm then
the encryption growth will not include that MAC so we should remove it
from the amount of bytes that we reserve for that growth. Otherwise we
might exceed our buffer size and the WPACKET_reserve operation will
fail.

Reviewed-by: Hugo Landau <[email protected]>
Reviewed-by: Tomas Mraz <[email protected]>
(Merged from #19622)
beldmit pushed a commit to beldmit/openssl that referenced this pull request Dec 26, 2022
We had two different macros for calculating the potential growth due to
encryption. The macro we use for allocating the underlying buffer should be
the same one that we use for reserving bytes for encryption growth.

Also if we are adding the MAC independently of the cipher algorithm then
the encryption growth will not include that MAC so we should remove it
from the amount of bytes that we reserve for that growth. Otherwise we
might exceed our buffer size and the WPACKET_reserve operation will
fail.

Reviewed-by: Hugo Landau <[email protected]>
Reviewed-by: Tomas Mraz <[email protected]>
(Merged from openssl#19622)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approval: ready to merge The 24 hour grace period has passed, ready to merge branch: master Applies to master branch severity: urgent Fixes an urgent issue (exempt from 24h grace period) triaged: bug The issue/pr is/fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants