Chapter 187. Test Programs

Table of Contents

187.1. Test Programs

187.1. Test Programs

Some Mbed TLS specific tests are built and can be used to verify correct operation of the Mbed TLS library.

  1. selftest

    This test executes the internal Mbed TLS sanity tests to verify correct operation of the various features.

  2. cpp_dummy_build

    This is a simple sanity test that the Mbed TLS headers can be included in C++ compilations.

  3. 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 from the original Mbed TLS source release are lightly modified for eCos. The original versions of the Mbed TLS sources can be found in the original release distribution, respectively mbedtls-3.6.0/programs/ssl/ssl_client1.c and mbedtls-3.6.0/programs/ssl/ssl_server.c.

    The following is example output from a run of the test:

    Example 187.1. lb_ssl test run

    INFO:<code from 0x80000018 -> 0x80091b18, CRC 1038>
    INFO:<SSL certificate based connection test using mbedTLS v3.6.0>
    INFO:<Target time OK for X.509 verification>
    INFO:<Initialising network interfaces>
    lwIP i/f[e0] (default): (hwaddr 54:27:8D:C1:3F:3A) IP 192.168.1.237
    lwIP i/f driver state NOT initialised
    lwIP i/f[lo]: (No hwaddr) IP 127.0.0.1
    INFO:<Waiting for server to start>
      . Seeding the random number generator... ok
    
      . Loading the server cert. and key... ok
      . Bind on https://localhost:4433/ ... 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
      . Verifying peer X.509 certificate... ok
      > Write to server: 18 bytes written
    
    GET / HTTP/1.0
    
      < Read from server: ok
      < Read from client: 18 bytes read
    
    GET / HTTP/1.0
    
      > Write to client: 144 bytes written
    
    HTTP/1.0 200 OK
    Content-Type: text/html
    
    <h2>Mbed TLS Test Server</h2>
    <p>Successful connection using: TLS1-3-CHACHA20-POLY1305-SHA256</p>
    
      . Closing the connection... ok
      . Waiting for a remote connection ... 144 bytes read
    
    HTTP/1.0 200 OK
    Content-Type: text/html
    
    <h2>Mbed TLS Test Server</h2>
    <p>Successful connection using: TLS1-3-CHACHA20-POLY1305-SHA256</p>
    PASS:<SSL certificate based client/server test>
    PASS:<Done>
    EXIT:<done>
    

  4. crypto_examples

    Simple example of PSA cryptographic operations.

  5. aead_demo

    This application provides examples of using the (legacy) cipher approach and the PSA API for multi-part AEAD computations.

  6. showconfig

    This application displays the Mbed TLS configuration options enabled for the configured build.

  7. benchmark

    [Note]Note

    This test application is only built if the configuration option CYGPKG_MBEDTLS3_EXTRA_TESTS is enabled. This is due to the test taking a long time to complete, especially for non-optimised builds.

    The benchmark application calculates the performance of various cryptographic components for the current configuration.