Chapter 183. Test Programs
Table of Contents
183.1. Test Programs
Some Mbed TLS specific tests are built and can be used to verify correct operation of the Mbed TLS library.
selftest
This test executes the internal Mbed TLS sanity tests to verify correct operation of the various features.
cpp_dummy_build
This is a simple sanity test that the Mbed TLS headers can be included in C++ compilations.
lb_ssl
When an eCos network configuration is available (lwIP or FreeBSD) then this test will perform a client/server local loopback SSL connection using certificates. This is a complete test of a secure
HTTPS
connection using BSD style sockets. To make it easier to work with either the client or the server side the source for the test is split into multiple files, with the client and server side implementations being in their own source files. The relevant client and server side sources are, lightly modified for eCos, versions of the original Mbed TLS source files found respectively inmbedtls-mbedtls-2.28.5/programs/ssl/ssl_client1.c
andmbedtls-mbedtls-2.28.5/programs/ssl/ssl_server.c
.The following is example output from a run of the test:
Example 183.1. lb_ssl test run
INFO:<code from 0x60000008 -> 0x6006d524, CRC 601c> INFO:<SSL certificate based connection test using mbedTLS v2.24.0> INFO:<Target time OK for X.509 verification> INFO:<Initialising network interfaces> lwIP i/f[e0] (default): (hwaddr 12:34:DA:A5:69:F9) IP 192.168.1.226 lwIP i/f driver state NOT initialised lwIP i/f[lo]: (No hwaddr) IP 127.0.0.1 INFO:<Waiting for server to start> . Loading the server cert. and key... ok . Bind on https://localhost:4433/ ... ok . Seeding the random number generator... ok . Setting up the SSL data.... ok . Waiting for a remote connection ... . Seeding the random number generator... ok . Loading the CA root certificate ... ok (0 skipped) . Connecting to tcp/localhost/4433... ok . Performing the SSL/TLS handshake... ok . Setting up the SSL/TLS structure... ok . Performing the SSL/TLS handshake... ok < Read from client: ok . Verifying peer X.509 certificate... ok > Write to server: 18 bytes read GET / HTTP/1.0 > Write to client: 156 bytes written HTTP/1.0 200 OK Content-Type: text/html <h2>mbed TLS Test Server</h2> <p>Successful connection using: TLS-ECDHE-RSA-WITH-CHACHA20-POLY1305-SHA256</p> . Closing the connection... ok . Waiting for a remote connection ... 18 bytes written GET / HTTP/1.0 < Read from server: 156 bytes read HTTP/1.0 200 OK Content-Type: text/html <h2>mbed TLS Test Server</h2> <p>Successful connection using: TLS-ECDHE-RSA-WITH-CHACHA20-POLY1305-SHA256</p> PASS:<SSL certificate based client/server test> PASS:<Done> EXIT:<done>
2024-12-10 | Apache 2.0 License |