Allow compile-time configuration of authentication mode

Introduces MBEDTLS_SSL_CONF_AUTHMODE to fix the authentication
mode (none, optional, mandatory) at compile-time.

Impact on code-size:

|  | GCC | ARMC5 | ARMC6 |
| --- | --- | --- | --- |
| `libmbedtls.a` before | 23487 | 24025 | 27885 |
| `libmbedtls.a` after  | 23379 | 23929 | 27727 |
| gain in Bytes | 108 | 96 | 157 |
This commit is contained in:
Hanno Becker 2019-06-12 16:40:50 +01:00
parent de67154658
commit acd4fc0ac9
10 changed files with 82 additions and 8 deletions

View file

@ -529,6 +529,20 @@ check_cmdline_param_compat() {
fi
}
check_cmdline_authmode_compat() {
__VAL="$( get_config_value_or_default "MBEDTLS_SSL_CONF_AUTHMODE" )"
if [ ! -z "$__VAL" ]; then
extract_cmdline_argument "auth_mode"
if [ "$__ARG" = "none" ] && [ "$__VAL" != "0" ]; then
SKIP_NEXT="YES";
elif [ "$__ARG" = "optional" ] && [ "$__VAL" != "1" ]; then
SKIP_NEXT="YES"
elif [ "$__ARG" = "required" ] && [ "$__VAL" != "2" ]; then
SKIP_NEXT="YES"
fi
fi
}
# Go through all options that can be hardcoded at compile-time and
# detect whether the command line configures them in a conflicting
# way. If so, skip the test. Otherwise, remove the corresponding
@ -552,6 +566,9 @@ check_cmdline_compat() {
# DTLS bad MAC limit
check_cmdline_param_compat "badmac_limit" \
"MBEDTLS_SSL_CONF_BADMAC_LIMIT"
# Authentication mode
check_cmdline_authmode_compat
}
# Usage: run_test name [-p proxy_cmd] srv_cmd cli_cmd cli_exit [option [...]]