mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-08-08 17:42:09 +03:00
Test ssl_server
Test ssl_server with both TLS 1.2 and TLS 1.3. Test against both OpenSSL and GnuTLS. Clean up compile-time requirements in ssl_server.c: any certificate-based key exchange is ok, so don't insist on built-in RSA. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
@@ -9,18 +9,15 @@
|
|||||||
|
|
||||||
#include "mbedtls/platform.h"
|
#include "mbedtls/platform.h"
|
||||||
|
|
||||||
#if !defined(MBEDTLS_BIGNUM_C) || !defined(MBEDTLS_PEM_PARSE_C) || \
|
#if !defined(MBEDTLS_ENTROPY_C) || !defined(MBEDTLS_CTR_DRBG_C) || \
|
||||||
!defined(MBEDTLS_ENTROPY_C) || !defined(MBEDTLS_SSL_TLS_C) || \
|
!defined(MBEDTLS_NET_C) || !defined(MBEDTLS_SSL_SRV_C) || \
|
||||||
!defined(MBEDTLS_SSL_SRV_C) || !defined(MBEDTLS_NET_C) || \
|
!defined(MBEDTLS_PEM_PARSE_C) || !defined(MBEDTLS_X509_CRT_PARSE_C)
|
||||||
!defined(MBEDTLS_RSA_C) || !defined(MBEDTLS_CTR_DRBG_C) || \
|
|
||||||
!defined(MBEDTLS_X509_CRT_PARSE_C) || !defined(MBEDTLS_FS_IO)
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
mbedtls_printf("MBEDTLS_BIGNUM_C and/or MBEDTLS_ENTROPY_C "
|
mbedtls_printf("MBEDTLS_ENTROPY_C and/or MBEDTLS_CTR_DRBG_C and/or "
|
||||||
"and/or MBEDTLS_SSL_TLS_C and/or MBEDTLS_SSL_SRV_C and/or "
|
"MBEDTLS_NET_C and/or MBEDTLS_SSL_SRV_C and/or "
|
||||||
"MBEDTLS_NET_C and/or MBEDTLS_RSA_C and/or "
|
"MBEDTLS_PEM_PARSE_C and/or MBEDTLS_X509_CRT_PARSE_C "
|
||||||
"MBEDTLS_CTR_DRBG_C and/or MBEDTLS_X509_CRT_PARSE_C "
|
"not defined.\n");
|
||||||
"and/or MBEDTLS_PEM_PARSE_C not defined.\n");
|
|
||||||
mbedtls_exit(0);
|
mbedtls_exit(0);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
@@ -356,7 +353,5 @@ exit:
|
|||||||
|
|
||||||
mbedtls_exit(ret);
|
mbedtls_exit(ret);
|
||||||
}
|
}
|
||||||
#endif /* MBEDTLS_BIGNUM_C && MBEDTLS_ENTROPY_C &&
|
|
||||||
MBEDTLS_SSL_TLS_C && MBEDTLS_SSL_SRV_C && MBEDTLS_NET_C &&
|
#endif /* configuration allows running this program */
|
||||||
MBEDTLS_RSA_C && MBEDTLS_CTR_DRBG_C && MBEDTLS_X509_CRT_PARSE_C
|
|
||||||
&& MBEDTLS_FS_IO && MBEDTLS_PEM_PARSE_C */
|
|
||||||
|
@@ -74,3 +74,47 @@ run_test "Sample: dtls_client, gnutls server, DTLS 1.2" \
|
|||||||
-c "[1-9][0-9]* bytes read" \
|
-c "[1-9][0-9]* bytes read" \
|
||||||
-S "Error" \
|
-S "Error" \
|
||||||
-C "error"
|
-C "error"
|
||||||
|
|
||||||
|
requires_protocol_version tls12
|
||||||
|
run_test "Sample: ssl_server, openssl client, TLS 1.2" \
|
||||||
|
-P 4433 \
|
||||||
|
"$PROGRAMS_DIR/ssl_server" \
|
||||||
|
"$O_CLI -tls1_2" \
|
||||||
|
0 \
|
||||||
|
-s "Successful connection using: TLS-" \
|
||||||
|
-c "New, TLSv1.2, Cipher is" \
|
||||||
|
-S "error" \
|
||||||
|
-C "ERROR"
|
||||||
|
|
||||||
|
requires_protocol_version tls12
|
||||||
|
run_test "Sample: ssl_server, gnutls client, TLS 1.2" \
|
||||||
|
-P 4433 \
|
||||||
|
"$PROGRAMS_DIR/ssl_server" \
|
||||||
|
"$G_CLI --priority=NORMAL:-VERS-TLS-ALL:+VERS-TLS1.2 localhost" \
|
||||||
|
0 \
|
||||||
|
-s "Successful connection using: TLS-" \
|
||||||
|
-c "Description:.*TLS1.2" \
|
||||||
|
-S "error" \
|
||||||
|
-C "ERROR"
|
||||||
|
|
||||||
|
requires_protocol_version tls13
|
||||||
|
run_test "Sample: ssl_server, openssl client, TLS 1.3" \
|
||||||
|
-P 4433 \
|
||||||
|
"$PROGRAMS_DIR/ssl_server" \
|
||||||
|
"$O_CLI -tls1_3" \
|
||||||
|
0 \
|
||||||
|
-s "Successful connection using: TLS1-3-" \
|
||||||
|
-c "New, TLSv1.3, Cipher is" \
|
||||||
|
-S "error" \
|
||||||
|
-C "ERROR"
|
||||||
|
|
||||||
|
requires_protocol_version tls13
|
||||||
|
run_test "Sample: ssl_server, gnutls client, TLS 1.3" \
|
||||||
|
-P 4433 \
|
||||||
|
"$PROGRAMS_DIR/ssl_server" \
|
||||||
|
"$G_CLI --priority=NORMAL:-VERS-TLS-ALL:+VERS-TLS1.3 localhost" \
|
||||||
|
0 \
|
||||||
|
-s "Successful connection using: TLS1-3-" \
|
||||||
|
-c "Description:.*TLS1.3" \
|
||||||
|
-S "error" \
|
||||||
|
-C "ERROR"
|
||||||
|
@@ -500,6 +500,13 @@ detect_required_features() {
|
|||||||
requires_config_enabled MBEDTLS_SSL_CLI_C
|
requires_config_enabled MBEDTLS_SSL_CLI_C
|
||||||
requires_certificate_authentication
|
requires_certificate_authentication
|
||||||
;;
|
;;
|
||||||
|
*"programs/ssl/ssl_server "*)
|
||||||
|
requires_config_enabled MBEDTLS_CTR_DRBG_C
|
||||||
|
requires_config_enabled MBEDTLS_ENTROPY_C
|
||||||
|
requires_config_enabled MBEDTLS_PEM_PARSE_C
|
||||||
|
requires_config_enabled MBEDTLS_SSL_SRV_C
|
||||||
|
requires_certificate_authentication
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
case "$CMD_LINE" in
|
case "$CMD_LINE" in
|
||||||
|
Reference in New Issue
Block a user