-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
mbedtls: fix possible false success in mbedtls_cipher_check_tag() #6381
Conversation
We should report a error when the security check of the security tag was not made. In the other case false success is possible and is not observable by the software. Technically this could lead to a security flaw. Signed-off-by: Denis V. Lunev <dlunev@gmail.com>
…icated alg Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
* MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA, but at the time I write this our | ||
* unit tests assume 0. */ | ||
ret = 0; | ||
/* Status to return on a non-authenticated algorithm. */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While the removed text suggests using MBEDTLS_ERR_CIPHER_INVALID_CONTEXT
or MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA
, the original PR uses MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE
as recommended by Gilles in a comment
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
1f7838b
to
51a0163
Compare
FYI CI is failing |
…bedtls_cipher_mode_t Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
* Calling AEAD tag-specific functions for non-AEAD algorithms (which should not | ||
be done - they are documented for use only by AES-GCM and ChaCha20+Poly1305) | ||
now returns MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE instead of success (0). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* Calling AEAD tag-specific functions for non-AEAD algorithms (which should not | |
be done - they are documented for use only by AES-GCM and ChaCha20+Poly1305) | |
now returns MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE instead of success (0). | |
* Calling AEAD tag-specific functions for non-AEAD algorithms (which should | |
not be done - they are documented for use only by AES-GCM and | |
ChaCha20+Poly1305) now returns MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE | |
instead of success (0). |
Fix line length
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did wonder about this, but the slightly longer line length makes the right margin much less ragged (I'm sure TeX would approve!)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes
* Calling AEAD tag-specific functions for non-AEAD algorithms (which should n
ot
be done - they are documented for use only by AES-GCM and ChaCha20+Poly1305
)
now returns MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE instead of success (0).
The margin may not be ragged, but having not
split like this is not easy to read. Please privilege readability over aesthetics.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
which to my eye the first is definitely superior
The first is impossible on my system. What's currently in the file looks like what I posted above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved (but needs trivial fix to Changelog line length)
There's still one issue to fix with the changelog. |
Does the ChangeLog absolutely need a maximum of 80 chars per line? Im my view it's much neater with the only very slightly longer lines, and we already have lines > 80 chars in that file. |
More than 80 characters per line won't break any automated system, but it's not neat.
|
here, this is the difference between
and
which to my eye the first is definitely superior |
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
0f0b548
CI previously passed; only a ChangeLog entry change; only OpenCI is failing with
so "something weird happened" on OpenCI - same job on internal CI passes |
Internal CI has passed - failures are OpenCI |
Originally this was PR #2164 - creating a new PR as that was based off user's
development
branchI've taken the commit in the original PR, fixed the conflict, and updated the tests to reflect the new return values in the "you shouldn't call these functions in this mode" cases.
This is not a bug fix - calling AEAD-specific functions on non-AEAD algorithms is misuse of the library - rather, this is a change of library behaviour to help badly-written calling code fail safe. Both the previous behaviour and this new behaviour comply with the documentation of these functions. Accordingly I don't think it needs a backport.
Original description:
We should report a error when the security check of the security
tag was not made. In the other case false success is possible and
is not observable by the software.
Technically this could lead to a security flaw.
Signed-off-by: Denis V. Lunev den@openvz.org
Gatekeeper checklist