mbedtls/programs/ssl
Hanno Becker 7ac83f91bf Print X.509 verify info strings even if MBEDTLS_X509_REMOVE_INFO
The new compile-time option MBEDTLS_X509_REMOVE_INFO removes various
X.509 debugging strings and functionality, including

```
  mbedtls_x509_crt_verify_info()
```

which ssl_client2.c and ssl_server2.c use to print human readable
descriptions of X.509 verification failure conditions. Those
conditions are also grepped for in numerous ssl-opt.sh tests.

Instead of disabling those tests if MBEDTLS_X509_REMOVE_INFO is set,
this commit essentially moves mbedtls_x509_crt_verify_info() to
ssl_client2.c and ssl_server2.c. However, instead of just copy-pasting
the code from x509_crt.c, the following approach is used:

A macro MBEDTLS_X509_CRT_ERROR_INFO_LIST is introduced which for each
verification failure condition invokes a user-defined macro X509_CRT_ERROR_INFO
with (a) the numerical error code, (b) the string presentation of the
corresponding error macro, (c) the info string for the error condition.
This macro can thus be used to generate code which somehow iterates over
the verifiation failure conditions, but the list of error conditions and
information strings is nowhere duplicated.

This is then used to re-implement mbedtls_x509_crt_verify_info() in
x509_crt.c and to provide a functionally equivalent (yet slightly different)
version in ssl_client2.c and ssl_server2.c in case MBEDTLS_X509_REMOVE_INFO
is set.

This way, little changes to ssl-opt.sh will be necessary in case
MBEDTLS_X509_REMOVE_INFO is set because the info strings for the
verification failure conditions will be printed regardless of whether
MBEDTLS_X509_REMOVE_INFO is set or not.

Signed-off-by: Hanno Becker <hanno.becker@arm.com>
2021-04-27 17:20:56 +01:00
..
CMakeLists.txt Remove PKCS#11 library wrapper. 2021-04-21 11:05:00 +02:00
dtls_client.c Rename MBEDTLS_X509_INFO to !MBEDTLS_X509_REMOVE_INFO 2021-04-27 17:18:52 +01:00
dtls_server.c Merge remote-tracking branch 'origin/development' into development_new 2021-04-07 16:31:09 +01:00
mini_client.c Update copyright notices to use Linux Foundation guidance 2020-08-19 10:35:41 +02:00
ssl_client1.c Rename MBEDTLS_X509_INFO to !MBEDTLS_X509_REMOVE_INFO 2021-04-27 17:18:52 +01:00
ssl_client2.c Print X.509 verify info strings even if MBEDTLS_X509_REMOVE_INFO 2021-04-27 17:20:56 +01:00
ssl_context_info.c Remove internal file references in programs/ 2021-03-11 17:44:43 +00:00
ssl_fork_server.c Remove certs module from mbedtls. 2021-03-16 15:51:25 +01:00
ssl_mail_client.c Rename MBEDTLS_X509_INFO to !MBEDTLS_X509_REMOVE_INFO 2021-04-27 17:18:52 +01:00
ssl_pthread_server.c Merge remote-tracking branch 'origin/development' into development_new 2021-04-07 16:31:09 +01:00
ssl_server.c Remove certs module from mbedtls. 2021-03-16 15:51:25 +01:00
ssl_server2.c Print X.509 verify info strings even if MBEDTLS_X509_REMOVE_INFO 2021-04-27 17:20:56 +01:00
ssl_test_common_source.c ssl_test_lib: move common functions and variables 2021-01-06 10:25:35 +01:00
ssl_test_lib.c Detect and report mutex usage errors in SSL test programs 2021-02-22 19:24:03 +01:00
ssl_test_lib.h Merge remote-tracking branch 'origin/development' into development_new 2021-04-07 16:31:09 +01:00