-
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
Remove MBEDTLS_CHECK_PARAMS #4313
Labels
component-platform
Portability layer and build scripts
enhancement
size-s
Estimated task size: small (~2d)
Comments
gilles-peskine-arm
added
enhancement
needs-design-approval
component-platform
Portability layer and build scripts
mbedtls-3
size-s
Estimated task size: small (~2d)
labels
Apr 7, 2021
I would just like to add for consideration that reading from 0x0 is a valid operation on (at least some) ARM systems. Writing however is not., so at some places this might lead to garbage data instead of crashes. |
There has been no objection on the list or elsewhere, so I'm marking this as approved. |
3 tasks
3 tasks
Note: add to the 3.x follow-ups: find a better solution for ronald-cron-arm@fdf6fc2 |
6 tasks
This was referenced Jul 12, 2022
This was referenced Jul 20, 2022
3 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
component-platform
Portability layer and build scripts
enhancement
size-s
Estimated task size: small (~2d)
Context
The option
MBEDTLS_CHECK_PARAMS
(disabled by default) enables certain kinds of “parameter validation”. It covers two kinds of validations:The default reaction to a failed check is to call a function
mbedtls_param_failed
which the application must provide. If this function returns, its caller returns an errorMBEDTLS_ERR_xxx_BAD_INPUT_DATA
.This feature is only used in some classic (non-PSA) cryptography modules. It is not used in X.509, TLS or in PSA crypto, and it has not been implemented in all classic crypto modules.
Proposal
Remove
MBEDTLS_CHECK_PARAMS
and all dependent features. Keep the validation of enum values, but remove the null pointer checks. This means changing code that does something like this:to something like this:
Rationale
Maintenance burden: Every compilation option has a testing cost. Beyond this general observation,
MBEDTLS_CHECK_PARAMS
has a major impact on the design of our test framework and scripts because it requires applications to provide their own implementation ofmbedtls_check_params
(unlike other platform functions for which the library provides a sensible default which applications can override).Limited benefits:
Misleading documentation: In some modules, the documentation mentions “parameter validation” (or “parameter-verification failure”), which should mean that the function validates all of its parameters, but this in fact refers specifically to null pointer check and enum-like value checks. Some of these functions omit checks that are more important such as buffer sizes.
Inconsistent use: not all modules have this form of “parameter validation”, and this is solely for historical reasons.
Statistics
(From d520037, which is
development
as of a few days ago.)False positives: definitions of auxiliary macros; MPS.
Allowing for whitespace variations, a cast of the pointer, and
allowing null for a length of 0.
Work items for 3.0
(size:S)
MBEDTLS_CHECK_PARAMS
,MBEDTLS_CHECK_PARAMS_ASSERT
andMBEDTLS_PARAM_FAILED
fromconfig.h
.MBEDTLS_CHECK_PARAMS
.component_test_check_params*
fromall.sh
.Work items for 3.x
(size:L)
Mailing list discussion
https://lists.trustedfirmware.org/pipermail/mbed-tls/2021-April/000326.html
The text was updated successfully, but these errors were encountered: