-
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
config.pl full
or just turning on MBEDTLS_CHECK_PARAMS breaks the build
#2671
Comments
What reasons might we not want to provide a default implementation of |
I agree, it makes perfect sense to me to provide a default implementation that is an |
I'm a little bit confused. The default definition of Is config.pl not setting this properly? |
That's not a default definition, that's a suggested definition that a human can enable. By default, since My preferred resolution is to uncomment the line |
Yes, preserving the current behaviour would be normally the only responsible choice. However there are two circumstances that might change this and makes worth considering to choose the easier and cleaner way:
|
Defining a weakly linked Another alternative would be to extend |
In #2684, I went with Jaeden's second solution: extend |
Introduce a new configuration option MBEDTLS_CHECK_PARAMS_ASSERT, which is disabled by default. When this option is enabled, MBEDTLS_PARAM_FAILED defaults to assert rather than to a call to mbedtls_param_failed, and <assert.h> is included. This fixes Mbed-TLS#2671 (no easy way to make MBEDTLS_PARAM_FAILED assert) without breaking backward compatibility. With this change, `config.pl full` runs tests with MBEDTLS_PARAM_FAILED set to assert, so the tests will fail if a validation check fails, and programs don't need to provide their own definition of mbedtls_param_failed().
Introduce a new configuration option MBEDTLS_CHECK_PARAMS_ASSERT, which is disabled by default. When this option is enabled, MBEDTLS_PARAM_FAILED defaults to assert rather than to a call to mbedtls_param_failed, and <assert.h> is included. This fixes Mbed-TLS#2671 (no easy way to make MBEDTLS_PARAM_FAILED assert) without breaking backward compatibility. With this change, `config.pl full` runs tests with MBEDTLS_PARAM_FAILED set to assert, so the tests will fail if a validation check fails, and programs don't need to provide their own definition of mbedtls_param_failed().
Description
The
full
configuration breaks normal programs. We don't explicitly document this configuration, and it's intended for testing mbedtls rather than for production. I certainly wouldn't want to assert that this configuration is good for security, for example. Nonetheless, I would not expect this configuration to break perfectly valid programs so much that they don't compile.Specifically, the problem is that
config.pl full
enablesMBEDTLS_CHECK_PARAMS
, but with the default setting ofMBEDTLS_PARAM_FAILED
, which calls a function (mbedtls_param_failed
) that the user must supply. This is not a sensible default.Justification for severity: breaks perfectly sensible code such as 3cd7a32 (CI run [internal link]: https://jenkins-internal.mbed.com/job/mbedtls-pr-multibranch/job/PR-1622-head/4/execution/node/819/log).
Steps to reproduce (from an mbedtls checkout, e.g. at 7be9b4e which is the head of
development
right now):Expected behavior: successful build.
Actual behavior:
I don't know what the best remedy is. We could simply keep
MBEDTLS_CHECK_PARAMS
off in thefull
config. I thinkMBEDTLS_CHECK_PARAMS
is not useful, so this solution is attractive to me, but doing this breaks the expectation thatconfig.pl full
turns out everything that the library can do and that isn't contradictory with something else. Furthermore, beyondconfig.pl full
, there is the problem that the default behavior of just turning on the option isn't sensible: I think the default implementation ofMBEDTLS_PARAM_FAILED
, if you just turn onMBEDTLS_CHECK_PARAMS
without any other related configuration changes, should beassert
.The text was updated successfully, but these errors were encountered: