aboutsummaryrefslogtreecommitdiff
path: root/lib/mbedtls-2.27.0/programs/test
diff options
context:
space:
mode:
Diffstat (limited to 'lib/mbedtls-2.27.0/programs/test')
-rw-r--r--lib/mbedtls-2.27.0/programs/test/CMakeLists.txt48
-rw-r--r--lib/mbedtls-2.27.0/programs/test/benchmark.c1113
-rw-r--r--lib/mbedtls-2.27.0/programs/test/cmake_subproject/.gitignore3
-rw-r--r--lib/mbedtls-2.27.0/programs/test/cmake_subproject/CMakeLists.txt23
-rw-r--r--lib/mbedtls-2.27.0/programs/test/cmake_subproject/cmake_subproject.c54
-rw-r--r--lib/mbedtls-2.27.0/programs/test/cpp_dummy_build.cpp123
-rw-r--r--lib/mbedtls-2.27.0/programs/test/query_compile_time_config.c54
-rw-r--r--lib/mbedtls-2.27.0/programs/test/query_config.c2827
-rw-r--r--lib/mbedtls-2.27.0/programs/test/query_config.h42
-rw-r--r--lib/mbedtls-2.27.0/programs/test/selftest.c502
-rw-r--r--lib/mbedtls-2.27.0/programs/test/udp_proxy.c1024
-rwxr-xr-xlib/mbedtls-2.27.0/programs/test/udp_proxy_wrapper.sh132
-rw-r--r--lib/mbedtls-2.27.0/programs/test/zeroize.c98
13 files changed, 0 insertions, 6043 deletions
diff --git a/lib/mbedtls-2.27.0/programs/test/CMakeLists.txt b/lib/mbedtls-2.27.0/programs/test/CMakeLists.txt
deleted file mode 100644
index 2b1e61e..0000000
--- a/lib/mbedtls-2.27.0/programs/test/CMakeLists.txt
+++ /dev/null
@@ -1,48 +0,0 @@
-set(libs
- ${mbedtls_target}
-)
-
-if(USE_PKCS11_HELPER_LIBRARY)
- set(libs ${libs} pkcs11-helper)
-endif(USE_PKCS11_HELPER_LIBRARY)
-
-if(ENABLE_ZLIB_SUPPORT)
- set(libs ${libs} ${ZLIB_LIBRARIES})
-endif(ENABLE_ZLIB_SUPPORT)
-
-set(executables_libs
- selftest
- udp_proxy
-)
-
-set(executables_mbedcrypto
- benchmark
- query_compile_time_config
- zeroize
-)
-
-if(TEST_CPP)
- list(APPEND executables_mbedcrypto cpp_dummy_build)
-endif()
-
-foreach(exe IN LISTS executables_libs executables_mbedcrypto)
- set(extra_sources "")
- if(exe STREQUAL "query_compile_time_config")
- list(APPEND extra_sources
- ${CMAKE_CURRENT_SOURCE_DIR}/query_config.c)
- endif()
- add_executable(${exe} ${exe}.c $<TARGET_OBJECTS:mbedtls_test>
- ${extra_sources})
-
- # This emulates "if ( ... IN_LIST ... )" which becomes available in CMake 3.3
- list(FIND executables_libs ${exe} exe_index)
- if (${exe_index} GREATER -1)
- target_link_libraries(${exe} ${libs})
- else()
- target_link_libraries(${exe} ${mbedcrypto_target})
- endif()
-endforeach()
-
-install(TARGETS ${executables_libs} ${executables_mbedcrypto}
- DESTINATION "bin"
- PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
diff --git a/lib/mbedtls-2.27.0/programs/test/benchmark.c b/lib/mbedtls-2.27.0/programs/test/benchmark.c
deleted file mode 100644
index 9c5911b..0000000
--- a/lib/mbedtls-2.27.0/programs/test/benchmark.c
+++ /dev/null
@@ -1,1113 +0,0 @@
-/*
- * Benchmark demonstration program
- *
- * Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#if !defined(MBEDTLS_CONFIG_FILE)
-#include "mbedtls/config.h"
-#else
-#include MBEDTLS_CONFIG_FILE
-#endif
-
-#include "mbedtls/platform.h"
-#if !defined(MBEDTLS_PLATFORM_C)
-#include <stdio.h>
-#include <stdlib.h>
-#define mbedtls_exit exit
-#define mbedtls_printf printf
-#define mbedtls_free free
-#endif
-
-#if !defined(MBEDTLS_TIMING_C)
-int main( void )
-{
- mbedtls_printf("MBEDTLS_TIMING_C not defined.\n");
- mbedtls_exit( 0 );
-}
-#else
-
-#include <string.h>
-#include <stdlib.h>
-
-#include "mbedtls/timing.h"
-
-#include "mbedtls/md4.h"
-#include "mbedtls/md5.h"
-#include "mbedtls/ripemd160.h"
-#include "mbedtls/sha1.h"
-#include "mbedtls/sha256.h"
-#include "mbedtls/sha512.h"
-
-#include "mbedtls/arc4.h"
-#include "mbedtls/des.h"
-#include "mbedtls/aes.h"
-#include "mbedtls/aria.h"
-#include "mbedtls/blowfish.h"
-#include "mbedtls/camellia.h"
-#include "mbedtls/chacha20.h"
-#include "mbedtls/gcm.h"
-#include "mbedtls/ccm.h"
-#include "mbedtls/chachapoly.h"
-#include "mbedtls/cmac.h"
-#include "mbedtls/poly1305.h"
-
-#include "mbedtls/havege.h"
-#include "mbedtls/ctr_drbg.h"
-#include "mbedtls/hmac_drbg.h"
-
-#include "mbedtls/rsa.h"
-#include "mbedtls/dhm.h"
-#include "mbedtls/ecdsa.h"
-#include "mbedtls/ecdh.h"
-
-#include "mbedtls/error.h"
-
-#if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C)
-#include "mbedtls/memory_buffer_alloc.h"
-#endif
-
-/*
- * For heap usage estimates, we need an estimate of the overhead per allocated
- * block. ptmalloc2/3 (used in gnu libc for instance) uses 2 size_t per block,
- * so use that as our baseline.
- */
-#define MEM_BLOCK_OVERHEAD ( 2 * sizeof( size_t ) )
-
-/*
- * Size to use for the alloc buffer if MEMORY_BUFFER_ALLOC_C is defined.
- */
-#define HEAP_SIZE (1u << 16) /* 64k */
-
-#define BUFSIZE 1024
-#define HEADER_FORMAT " %-24s : "
-#define TITLE_LEN 25
-
-#define OPTIONS \
- "md4, md5, ripemd160, sha1, sha256, sha512,\n" \
- "arc4, des3, des, camellia, blowfish, chacha20,\n" \
- "aes_cbc, aes_gcm, aes_ccm, aes_xts, chachapoly,\n" \
- "aes_cmac, des3_cmac, poly1305\n" \
- "havege, ctr_drbg, hmac_drbg\n" \
- "rsa, dhm, ecdsa, ecdh.\n"
-
-#if defined(MBEDTLS_ERROR_C)
-#define PRINT_ERROR \
- mbedtls_strerror( ret, ( char * )tmp, sizeof( tmp ) ); \
- mbedtls_printf( "FAILED: %s\n", tmp );
-#else
-#define PRINT_ERROR \
- mbedtls_printf( "FAILED: -0x%04x\n", (unsigned int) -ret );
-#endif
-
-#define TIME_AND_TSC( TITLE, CODE ) \
-do { \
- unsigned long ii, jj, tsc; \
- int ret = 0; \
- \
- mbedtls_printf( HEADER_FORMAT, TITLE ); \
- fflush( stdout ); \
- \
- mbedtls_set_alarm( 1 ); \
- for( ii = 1; ret == 0 && ! mbedtls_timing_alarmed; ii++ ) \
- { \
- ret = CODE; \
- } \
- \
- tsc = mbedtls_timing_hardclock(); \
- for( jj = 0; ret == 0 && jj < 1024; jj++ ) \
- { \
- ret = CODE; \
- } \
- \
- if( ret != 0 ) \
- { \
- PRINT_ERROR; \
- } \
- else \
- { \
- mbedtls_printf( "%9lu KiB/s, %9lu cycles/byte\n", \
- ii * BUFSIZE / 1024, \
- ( mbedtls_timing_hardclock() - tsc ) \
- / ( jj * BUFSIZE ) ); \
- } \
-} while( 0 )
-
-#if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C) && defined(MBEDTLS_MEMORY_DEBUG)
-
-/* How much space to reserve for the title when printing heap usage results.
- * Updated manually as the output of the following command:
- *
- * sed -n 's/.*[T]IME_PUBLIC.*"\(.*\)",/\1/p' programs/test/benchmark.c |
- * awk '{print length+2}' | sort -rn | head -n1
- *
- * This computes the maximum length of a title +2 (because we appends "/s").
- * (If the value is too small, the only consequence is poor alignement.) */
-#define TITLE_SPACE 16
-
-#define MEMORY_MEASURE_INIT \
- size_t max_used, max_blocks, max_bytes; \
- size_t prv_used, prv_blocks; \
- mbedtls_memory_buffer_alloc_cur_get( &prv_used, &prv_blocks ); \
- mbedtls_memory_buffer_alloc_max_reset( );
-
-#define MEMORY_MEASURE_PRINT( title_len ) \
- mbedtls_memory_buffer_alloc_max_get( &max_used, &max_blocks ); \
- ii = TITLE_SPACE > (title_len) ? TITLE_SPACE - (title_len) : 1; \
- while( ii-- ) mbedtls_printf( " " ); \
- max_used -= prv_used; \
- max_blocks -= prv_blocks; \
- max_bytes = max_used + MEM_BLOCK_OVERHEAD * max_blocks; \
- mbedtls_printf( "%6u heap bytes", (unsigned) max_bytes );
-
-#else
-#define MEMORY_MEASURE_INIT
-#define MEMORY_MEASURE_PRINT( title_len )
-#endif
-
-#define TIME_PUBLIC( TITLE, TYPE, CODE ) \
-do { \
- unsigned long ii; \
- int ret; \
- MEMORY_MEASURE_INIT; \
- \
- mbedtls_printf( HEADER_FORMAT, TITLE ); \
- fflush( stdout ); \
- mbedtls_set_alarm( 3 ); \
- \
- ret = 0; \
- for( ii = 1; ! mbedtls_timing_alarmed && ! ret ; ii++ ) \
- { \
- CODE; \
- } \
- \
- if( ret == MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED ) \
- { \
- mbedtls_printf( "Feature Not Supported. Skipping.\n" ); \
- ret = 0; \
- } \
- else if( ret != 0 ) \
- { \
- PRINT_ERROR; \
- } \
- else \
- { \
- mbedtls_printf( "%6lu " TYPE "/s", ii / 3 ); \
- MEMORY_MEASURE_PRINT( sizeof( TYPE ) + 1 ); \
- mbedtls_printf( "\n" ); \
- } \
-} while( 0 )
-
-static int myrand( void *rng_state, unsigned char *output, size_t len )
-{
- size_t use_len;
- int rnd;
-
- if( rng_state != NULL )
- rng_state = NULL;
-
- while( len > 0 )
- {
- use_len = len;
- if( use_len > sizeof(int) )
- use_len = sizeof(int);
-
- rnd = rand();
- memcpy( output, &rnd, use_len );
- output += use_len;
- len -= use_len;
- }
-
- return( 0 );
-}
-
-#define CHECK_AND_CONTINUE( R ) \
- { \
- int CHECK_AND_CONTINUE_ret = ( R ); \
- if( CHECK_AND_CONTINUE_ret == MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED ) { \
- mbedtls_printf( "Feature not supported. Skipping.\n" ); \
- continue; \
- } \
- else if( CHECK_AND_CONTINUE_ret != 0 ) { \
- mbedtls_exit( 1 ); \
- } \
- }
-
-/*
- * Clear some memory that was used to prepare the context
- */
-#if defined(MBEDTLS_ECP_C)
-void ecp_clear_precomputed( mbedtls_ecp_group *grp )
-{
- if( grp->T != NULL )
- {
- size_t i;
- for( i = 0; i < grp->T_size; i++ )
- mbedtls_ecp_point_free( &grp->T[i] );
- mbedtls_free( grp->T );
- }
- grp->T = NULL;
- grp->T_size = 0;
-}
-#else
-#define ecp_clear_precomputed( g )
-#endif
-
-#if defined(MBEDTLS_ECP_C)
-static int set_ecp_curve( const char *string, mbedtls_ecp_curve_info *curve )
-{
- const mbedtls_ecp_curve_info *found =
- mbedtls_ecp_curve_info_from_name( string );
- if( found != NULL )
- {
- *curve = *found;
- return( 1 );
- }
- else
- return( 0 );
-}
-#endif
-
-unsigned char buf[BUFSIZE];
-
-typedef struct {
- char md4, md5, ripemd160, sha1, sha256, sha512,
- arc4, des3, des,
- aes_cbc, aes_gcm, aes_ccm, aes_xts, chachapoly,
- aes_cmac, des3_cmac,
- aria, camellia, blowfish, chacha20,
- poly1305,
- havege, ctr_drbg, hmac_drbg,
- rsa, dhm, ecdsa, ecdh;
-} todo_list;
-
-
-int main( int argc, char *argv[] )
-{
- int i;
- unsigned char tmp[200];
- char title[TITLE_LEN];
- todo_list todo;
-#if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C)
- unsigned char alloc_buf[HEAP_SIZE] = { 0 };
-#endif
-#if defined(MBEDTLS_ECP_C)
- mbedtls_ecp_curve_info single_curve[2] = {
- { MBEDTLS_ECP_DP_NONE, 0, 0, NULL },
- { MBEDTLS_ECP_DP_NONE, 0, 0, NULL },
- };
- const mbedtls_ecp_curve_info *curve_list = mbedtls_ecp_curve_list( );
-#endif
-
-#if defined(MBEDTLS_ECP_C)
- (void) curve_list; /* Unused in some configurations where no benchmark uses ECC */
-#endif
-
- if( argc <= 1 )
- {
- memset( &todo, 1, sizeof( todo ) );
- }
- else
- {
- memset( &todo, 0, sizeof( todo ) );
-
- for( i = 1; i < argc; i++ )
- {
- if( strcmp( argv[i], "md4" ) == 0 )
- todo.md4 = 1;
- else if( strcmp( argv[i], "md5" ) == 0 )
- todo.md5 = 1;
- else if( strcmp( argv[i], "ripemd160" ) == 0 )
- todo.ripemd160 = 1;
- else if( strcmp( argv[i], "sha1" ) == 0 )
- todo.sha1 = 1;
- else if( strcmp( argv[i], "sha256" ) == 0 )
- todo.sha256 = 1;
- else if( strcmp( argv[i], "sha512" ) == 0 )
- todo.sha512 = 1;
- else if( strcmp( argv[i], "arc4" ) == 0 )
- todo.arc4 = 1;
- else if( strcmp( argv[i], "des3" ) == 0 )
- todo.des3 = 1;
- else if( strcmp( argv[i], "des" ) == 0 )
- todo.des = 1;
- else if( strcmp( argv[i], "aes_cbc" ) == 0 )
- todo.aes_cbc = 1;
- else if( strcmp( argv[i], "aes_xts" ) == 0 )
- todo.aes_xts = 1;
- else if( strcmp( argv[i], "aes_gcm" ) == 0 )
- todo.aes_gcm = 1;
- else if( strcmp( argv[i], "aes_ccm" ) == 0 )
- todo.aes_ccm = 1;
- else if( strcmp( argv[i], "chachapoly" ) == 0 )
- todo.chachapoly = 1;
- else if( strcmp( argv[i], "aes_cmac" ) == 0 )
- todo.aes_cmac = 1;
- else if( strcmp( argv[i], "des3_cmac" ) == 0 )
- todo.des3_cmac = 1;
- else if( strcmp( argv[i], "aria" ) == 0 )
- todo.aria = 1;
- else if( strcmp( argv[i], "camellia" ) == 0 )
- todo.camellia = 1;
- else if( strcmp( argv[i], "blowfish" ) == 0 )
- todo.blowfish = 1;
- else if( strcmp( argv[i], "chacha20" ) == 0 )
- todo.chacha20 = 1;
- else if( strcmp( argv[i], "poly1305" ) == 0 )
- todo.poly1305 = 1;
- else if( strcmp( argv[i], "havege" ) == 0 )
- todo.havege = 1;
- else if( strcmp( argv[i], "ctr_drbg" ) == 0 )
- todo.ctr_drbg = 1;
- else if( strcmp( argv[i], "hmac_drbg" ) == 0 )
- todo.hmac_drbg = 1;
- else if( strcmp( argv[i], "rsa" ) == 0 )
- todo.rsa = 1;
- else if( strcmp( argv[i], "dhm" ) == 0 )
- todo.dhm = 1;
- else if( strcmp( argv[i], "ecdsa" ) == 0 )
- todo.ecdsa = 1;
- else if( strcmp( argv[i], "ecdh" ) == 0 )
- todo.ecdh = 1;
-#if defined(MBEDTLS_ECP_C)
- else if( set_ecp_curve( argv[i], single_curve ) )
- curve_list = single_curve;
-#endif
- else
- {
- mbedtls_printf( "Unrecognized option: %s\n", argv[i] );
- mbedtls_printf( "Available options: " OPTIONS );
- }
- }
- }
-
- mbedtls_printf( "\n" );
-
-#if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C)
- mbedtls_memory_buffer_alloc_init( alloc_buf, sizeof( alloc_buf ) );
-#endif
- memset( buf, 0xAA, sizeof( buf ) );
- memset( tmp, 0xBB, sizeof( tmp ) );
-
-#if defined(MBEDTLS_MD4_C)
- if( todo.md4 )
- TIME_AND_TSC( "MD4", mbedtls_md4_ret( buf, BUFSIZE, tmp ) );
-#endif
-
-#if defined(MBEDTLS_MD5_C)
- if( todo.md5 )
- TIME_AND_TSC( "MD5", mbedtls_md5_ret( buf, BUFSIZE, tmp ) );
-#endif
-
-#if defined(MBEDTLS_RIPEMD160_C)
- if( todo.ripemd160 )
- TIME_AND_TSC( "RIPEMD160", mbedtls_ripemd160_ret( buf, BUFSIZE, tmp ) );
-#endif
-
-#if defined(MBEDTLS_SHA1_C)
- if( todo.sha1 )
- TIME_AND_TSC( "SHA-1", mbedtls_sha1_ret( buf, BUFSIZE, tmp ) );
-#endif
-
-#if defined(MBEDTLS_SHA256_C)
- if( todo.sha256 )
- TIME_AND_TSC( "SHA-256", mbedtls_sha256_ret( buf, BUFSIZE, tmp, 0 ) );
-#endif
-
-#if defined(MBEDTLS_SHA512_C)
- if( todo.sha512 )
- TIME_AND_TSC( "SHA-512", mbedtls_sha512_ret( buf, BUFSIZE, tmp, 0 ) );
-#endif
-
-#if defined(MBEDTLS_ARC4_C)
- if( todo.arc4 )
- {
- mbedtls_arc4_context arc4;
- mbedtls_arc4_init( &arc4 );
- mbedtls_arc4_setup( &arc4, tmp, 32 );
- TIME_AND_TSC( "ARC4", mbedtls_arc4_crypt( &arc4, BUFSIZE, buf, buf ) );
- mbedtls_arc4_free( &arc4 );
- }
-#endif
-
-#if defined(MBEDTLS_DES_C)
-#if defined(MBEDTLS_CIPHER_MODE_CBC)
- if( todo.des3 )
- {
- mbedtls_des3_context des3;
- mbedtls_des3_init( &des3 );
- mbedtls_des3_set3key_enc( &des3, tmp );
- TIME_AND_TSC( "3DES",
- mbedtls_des3_crypt_cbc( &des3, MBEDTLS_DES_ENCRYPT, BUFSIZE, tmp, buf, buf ) );
- mbedtls_des3_free( &des3 );
- }
-
- if( todo.des )
- {
- mbedtls_des_context des;
- mbedtls_des_init( &des );
- mbedtls_des_setkey_enc( &des, tmp );
- TIME_AND_TSC( "DES",
- mbedtls_des_crypt_cbc( &des, MBEDTLS_DES_ENCRYPT, BUFSIZE, tmp, buf, buf ) );
- mbedtls_des_free( &des );
- }
-
-#endif /* MBEDTLS_CIPHER_MODE_CBC */
-#if defined(MBEDTLS_CMAC_C)
- if( todo.des3_cmac )
- {
- unsigned char output[8];
- const mbedtls_cipher_info_t *cipher_info;
-
- memset( buf, 0, sizeof( buf ) );
- memset( tmp, 0, sizeof( tmp ) );
-
- cipher_info = mbedtls_cipher_info_from_type( MBEDTLS_CIPHER_DES_EDE3_ECB );
-
- TIME_AND_TSC( "3DES-CMAC",
- mbedtls_cipher_cmac( cipher_info, tmp, 192, buf,
- BUFSIZE, output ) );
- }
-#endif /* MBEDTLS_CMAC_C */
-#endif /* MBEDTLS_DES_C */
-
-#if defined(MBEDTLS_AES_C)
-#if defined(MBEDTLS_CIPHER_MODE_CBC)
- if( todo.aes_cbc )
- {
- int keysize;
- mbedtls_aes_context aes;
- mbedtls_aes_init( &aes );
- for( keysize = 128; keysize <= 256; keysize += 64 )
- {
- mbedtls_snprintf( title, sizeof( title ), "AES-CBC-%d", keysize );
-
- memset( buf, 0, sizeof( buf ) );
- memset( tmp, 0, sizeof( tmp ) );
- mbedtls_aes_setkey_enc( &aes, tmp, keysize );
-
- TIME_AND_TSC( title,
- mbedtls_aes_crypt_cbc( &aes, MBEDTLS_AES_ENCRYPT, BUFSIZE, tmp, buf, buf ) );
- }
- mbedtls_aes_free( &aes );
- }
-#endif
-#if defined(MBEDTLS_CIPHER_MODE_XTS)
- if( todo.aes_xts )
- {
- int keysize;
- mbedtls_aes_xts_context ctx;
-
- mbedtls_aes_xts_init( &ctx );
- for( keysize = 128; keysize <= 256; keysize += 128 )
- {
- mbedtls_snprintf( title, sizeof( title ), "AES-XTS-%d", keysize );
-
- memset( buf, 0, sizeof( buf ) );
- memset( tmp, 0, sizeof( tmp ) );
- mbedtls_aes_xts_setkey_enc( &ctx, tmp, keysize * 2 );
-
- TIME_AND_TSC( title,
- mbedtls_aes_crypt_xts( &ctx, MBEDTLS_AES_ENCRYPT, BUFSIZE,
- tmp, buf, buf ) );
-
- mbedtls_aes_xts_free( &ctx );
- }
- }
-#endif
-#if defined(MBEDTLS_GCM_C)
- if( todo.aes_gcm )
- {
- int keysize;
- mbedtls_gcm_context gcm;
-
- mbedtls_gcm_init( &gcm );
- for( keysize = 128; keysize <= 256; keysize += 64 )
- {
- mbedtls_snprintf( title, sizeof( title ), "AES-GCM-%d", keysize );
-
- memset( buf, 0, sizeof( buf ) );
- memset( tmp, 0, sizeof( tmp ) );
- mbedtls_gcm_setkey( &gcm, MBEDTLS_CIPHER_ID_AES, tmp, keysize );
-
- TIME_AND_TSC( title,
- mbedtls_gcm_crypt_and_tag( &gcm, MBEDTLS_GCM_ENCRYPT, BUFSIZE, tmp,
- 12, NULL, 0, buf, buf, 16, tmp ) );
-
- mbedtls_gcm_free( &gcm );
- }
- }
-#endif
-#if defined(MBEDTLS_CCM_C)
- if( todo.aes_ccm )
- {
- int keysize;
- mbedtls_ccm_context ccm;
-
- mbedtls_ccm_init( &ccm );
- for( keysize = 128; keysize <= 256; keysize += 64 )
- {
- mbedtls_snprintf( title, sizeof( title ), "AES-CCM-%d", keysize );
-
- memset( buf, 0, sizeof( buf ) );
- memset( tmp, 0, sizeof( tmp ) );
- mbedtls_ccm_setkey( &ccm, MBEDTLS_CIPHER_ID_AES, tmp, keysize );
-
- TIME_AND_TSC( title,
- mbedtls_ccm_encrypt_and_tag( &ccm, BUFSIZE, tmp,
- 12, NULL, 0, buf, buf, tmp, 16 ) );
-
- mbedtls_ccm_free( &ccm );
- }
- }
-#endif
-#if defined(MBEDTLS_CHACHAPOLY_C)
- if( todo.chachapoly )
- {
- mbedtls_chachapoly_context chachapoly;
-
- mbedtls_chachapoly_init( &chachapoly );
- memset( buf, 0, sizeof( buf ) );
- memset( tmp, 0, sizeof( tmp ) );
-
- mbedtls_snprintf( title, sizeof( title ), "ChaCha20-Poly1305" );
-
- mbedtls_chachapoly_setkey( &chachapoly, tmp );
-
- TIME_AND_TSC( title,
- mbedtls_chachapoly_encrypt_and_tag( &chachapoly,
- BUFSIZE, tmp, NULL, 0, buf, buf, tmp ) );
-
- mbedtls_chachapoly_free( &chachapoly );
- }
-#endif
-#if defined(MBEDTLS_CMAC_C)
- if( todo.aes_cmac )
- {
- unsigned char output[16];
- const mbedtls_cipher_info_t *cipher_info;
- mbedtls_cipher_type_t cipher_type;
- int keysize;
-
- for( keysize = 128, cipher_type = MBEDTLS_CIPHER_AES_128_ECB;
- keysize <= 256;
- keysize += 64, cipher_type++ )
- {
- mbedtls_snprintf( title, sizeof( title ), "AES-CMAC-%d", keysize );
-
- memset( buf, 0, sizeof( buf ) );
- memset( tmp, 0, sizeof( tmp ) );
-
- cipher_info = mbedtls_cipher_info_from_type( cipher_type );
-
- TIME_AND_TSC( title,
- mbedtls_cipher_cmac( cipher_info, tmp, keysize,
- buf, BUFSIZE, output ) );
- }
-
- memset( buf, 0, sizeof( buf ) );
- memset( tmp, 0, sizeof( tmp ) );
- TIME_AND_TSC( "AES-CMAC-PRF-128",
- mbedtls_aes_cmac_prf_128( tmp, 16, buf, BUFSIZE,
- output ) );
- }
-#endif /* MBEDTLS_CMAC_C */
-#endif /* MBEDTLS_AES_C */
-
-#if defined(MBEDTLS_ARIA_C) && defined(MBEDTLS_CIPHER_MODE_CBC)
- if( todo.aria )
- {
- int keysize;
- mbedtls_aria_context aria;
- mbedtls_aria_init( &aria );
- for( keysize = 128; keysize <= 256; keysize += 64 )
- {
- mbedtls_snprintf( title, sizeof( title ), "ARIA-CBC-%d", keysize );
-
- memset( buf, 0, sizeof( buf ) );
- memset( tmp, 0, sizeof( tmp ) );
- mbedtls_aria_setkey_enc( &aria, tmp, keysize );
-
- TIME_AND_TSC( title,
- mbedtls_aria_crypt_cbc( &aria, MBEDTLS_ARIA_ENCRYPT,
- BUFSIZE, tmp, buf, buf ) );
- }
- mbedtls_aria_free( &aria );
- }
-#endif
-
-#if defined(MBEDTLS_CAMELLIA_C) && defined(MBEDTLS_CIPHER_MODE_CBC)
- if( todo.camellia )
- {
- int keysize;
- mbedtls_camellia_context camellia;
- mbedtls_camellia_init( &camellia );
- for( keysize = 128; keysize <= 256; keysize += 64 )
- {
- mbedtls_snprintf( title, sizeof( title ), "CAMELLIA-CBC-%d", keysize );
-
- memset( buf, 0, sizeof( buf ) );
- memset( tmp, 0, sizeof( tmp ) );
- mbedtls_camellia_setkey_enc( &camellia, tmp, keysize );
-
- TIME_AND_TSC( title,
- mbedtls_camellia_crypt_cbc( &camellia, MBEDTLS_CAMELLIA_ENCRYPT,
- BUFSIZE, tmp, buf, buf ) );
- }
- mbedtls_camellia_free( &camellia );
- }
-#endif
-
-#if defined(MBEDTLS_CHACHA20_C)
- if ( todo.chacha20 )
- {
- TIME_AND_TSC( "ChaCha20", mbedtls_chacha20_crypt( buf, buf, 0U, BUFSIZE, buf, buf ) );
- }
-#endif
-
-#if defined(MBEDTLS_POLY1305_C)
- if ( todo.poly1305 )
- {
- TIME_AND_TSC( "Poly1305", mbedtls_poly1305_mac( buf, buf, BUFSIZE, buf ) );
- }
-#endif
-
-#if defined(MBEDTLS_BLOWFISH_C) && defined(MBEDTLS_CIPHER_MODE_CBC)
- if( todo.blowfish )
- {
- int keysize;
- mbedtls_blowfish_context blowfish;
- mbedtls_blowfish_init( &blowfish );
-
- for( keysize = 128; keysize <= 256; keysize += 64 )
- {
- mbedtls_snprintf( title, sizeof( title ), "BLOWFISH-CBC-%d", keysize );
-
- memset( buf, 0, sizeof( buf ) );
- memset( tmp, 0, sizeof( tmp ) );
- mbedtls_blowfish_setkey( &blowfish, tmp, keysize );
-
- TIME_AND_TSC( title,
- mbedtls_blowfish_crypt_cbc( &blowfish, MBEDTLS_BLOWFISH_ENCRYPT, BUFSIZE,
- tmp, buf, buf ) );
- }
-
- mbedtls_blowfish_free( &blowfish );
- }
-#endif
-
-#if defined(MBEDTLS_HAVEGE_C)
- if( todo.havege )
- {
- mbedtls_havege_state hs;
- mbedtls_havege_init( &hs );
- TIME_AND_TSC( "HAVEGE", mbedtls_havege_random( &hs, buf, BUFSIZE ) );
- mbedtls_havege_free( &hs );
- }
-#endif
-
-#if defined(MBEDTLS_CTR_DRBG_C)
- if( todo.ctr_drbg )
- {
- mbedtls_ctr_drbg_context ctr_drbg;
-
- mbedtls_ctr_drbg_init( &ctr_drbg );
- if( mbedtls_ctr_drbg_seed( &ctr_drbg, myrand, NULL, NULL, 0 ) != 0 )
- mbedtls_exit(1);
- TIME_AND_TSC( "CTR_DRBG (NOPR)",
- mbedtls_ctr_drbg_random( &ctr_drbg, buf, BUFSIZE ) );
- mbedtls_ctr_drbg_free( &ctr_drbg );
-
- mbedtls_ctr_drbg_init( &ctr_drbg );
- if( mbedtls_ctr_drbg_seed( &ctr_drbg, myrand, NULL, NULL, 0 ) != 0 )
- mbedtls_exit(1);
- mbedtls_ctr_drbg_set_prediction_resistance( &ctr_drbg, MBEDTLS_CTR_DRBG_PR_ON );
- TIME_AND_TSC( "CTR_DRBG (PR)",
- mbedtls_ctr_drbg_random( &ctr_drbg, buf, BUFSIZE ) );
- mbedtls_ctr_drbg_free( &ctr_drbg );
- }
-#endif
-
-#if defined(MBEDTLS_HMAC_DRBG_C)
- if( todo.hmac_drbg )
- {
- mbedtls_hmac_drbg_context hmac_drbg;
- const mbedtls_md_info_t *md_info;
-
- mbedtls_hmac_drbg_init( &hmac_drbg );
-
-#if defined(MBEDTLS_SHA1_C)
- if( ( md_info = mbedtls_md_info_from_type( MBEDTLS_MD_SHA1 ) ) == NULL )
- mbedtls_exit(1);
-
- if( mbedtls_hmac_drbg_seed( &hmac_drbg, md_info, myrand, NULL, NULL, 0 ) != 0 )
- mbedtls_exit(1);
- TIME_AND_TSC( "HMAC_DRBG SHA-1 (NOPR)",
- mbedtls_hmac_drbg_random( &hmac_drbg, buf, BUFSIZE ) );
-
- if( mbedtls_hmac_drbg_seed( &hmac_drbg, md_info, myrand, NULL, NULL, 0 ) != 0 )
- mbedtls_exit(1);
- mbedtls_hmac_drbg_set_prediction_resistance( &hmac_drbg,
- MBEDTLS_HMAC_DRBG_PR_ON );
- TIME_AND_TSC( "HMAC_DRBG SHA-1 (PR)",
- mbedtls_hmac_drbg_random( &hmac_drbg, buf, BUFSIZE ) );
-#endif
-
-#if defined(MBEDTLS_SHA256_C)
- if( ( md_info = mbedtls_md_info_from_type( MBEDTLS_MD_SHA256 ) ) == NULL )
- mbedtls_exit(1);
-
- if( mbedtls_hmac_drbg_seed( &hmac_drbg, md_info, myrand, NULL, NULL, 0 ) != 0 )
- mbedtls_exit(1);
- TIME_AND_TSC( "HMAC_DRBG SHA-256 (NOPR)",
- mbedtls_hmac_drbg_random( &hmac_drbg, buf, BUFSIZE ) );
-
- if( mbedtls_hmac_drbg_seed( &hmac_drbg, md_info, myrand, NULL, NULL, 0 ) != 0 )
- mbedtls_exit(1);
- mbedtls_hmac_drbg_set_prediction_resistance( &hmac_drbg,
- MBEDTLS_HMAC_DRBG_PR_ON );
- TIME_AND_TSC( "HMAC_DRBG SHA-256 (PR)",
- mbedtls_hmac_drbg_random( &hmac_drbg, buf, BUFSIZE ) );
-#endif
- mbedtls_hmac_drbg_free( &hmac_drbg );
- }
-#endif
-
-#if defined(MBEDTLS_RSA_C) && defined(MBEDTLS_GENPRIME)
- if( todo.rsa )
- {
- int keysize;
- mbedtls_rsa_context rsa;
- for( keysize = 2048; keysize <= 4096; keysize *= 2 )
- {
- mbedtls_snprintf( title, sizeof( title ), "RSA-%d", keysize );
-
- mbedtls_rsa_init( &rsa, MBEDTLS_RSA_PKCS_V15, 0 );
- mbedtls_rsa_gen_key( &rsa, myrand, NULL, keysize, 65537 );
-
- TIME_PUBLIC( title, " public",
- buf[0] = 0;
- ret = mbedtls_rsa_public( &rsa, buf, buf ) );
-
- TIME_PUBLIC( title, "private",
- buf[0] = 0;
- ret = mbedtls_rsa_private( &rsa, myrand, NULL, buf, buf ) );
-
- mbedtls_rsa_free( &rsa );
- }
- }
-#endif
-
-#if defined(MBEDTLS_DHM_C) && defined(MBEDTLS_BIGNUM_C)
- if( todo.dhm )
- {
- int dhm_sizes[] = { 2048, 3072 };
- static const unsigned char dhm_P_2048[] =
- MBEDTLS_DHM_RFC3526_MODP_2048_P_BIN;
- static const unsigned char dhm_P_3072[] =
- MBEDTLS_DHM_RFC3526_MODP_3072_P_BIN;
- static const unsigned char dhm_G_2048[] =
- MBEDTLS_DHM_RFC3526_MODP_2048_G_BIN;
- static const unsigned char dhm_G_3072[] =
- MBEDTLS_DHM_RFC3526_MODP_3072_G_BIN;
-
- const unsigned char *dhm_P[] = { dhm_P_2048, dhm_P_3072 };
- const size_t dhm_P_size[] = { sizeof( dhm_P_2048 ),
- sizeof( dhm_P_3072 ) };
-
- const unsigned char *dhm_G[] = { dhm_G_2048, dhm_G_3072 };
- const size_t dhm_G_size[] = { sizeof( dhm_G_2048 ),
- sizeof( dhm_G_3072 ) };
-
- mbedtls_dhm_context dhm;
- size_t olen;
- for( i = 0; (size_t) i < sizeof( dhm_sizes ) / sizeof( dhm_sizes[0] ); i++ )
- {
- mbedtls_dhm_init( &dhm );
-
- if( mbedtls_mpi_read_binary( &dhm.P, dhm_P[i],
- dhm_P_size[i] ) != 0 ||
- mbedtls_mpi_read_binary( &dhm.G, dhm_G[i],
- dhm_G_size[i] ) != 0 )
- {
- mbedtls_exit( 1 );
- }
-
- dhm.len = mbedtls_mpi_size( &dhm.P );
- mbedtls_dhm_make_public( &dhm, (int) dhm.len, buf, dhm.len, myrand, NULL );
- if( mbedtls_mpi_copy( &dhm.GY, &dhm.GX ) != 0 )
- mbedtls_exit( 1 );
-
- mbedtls_snprintf( title, sizeof( title ), "DHE-%d", dhm_sizes[i] );
- TIME_PUBLIC( title, "handshake",
- ret |= mbedtls_dhm_make_public( &dhm, (int) dhm.len, buf, dhm.len,
- myrand, NULL );
- ret |= mbedtls_dhm_calc_secret( &dhm, buf, sizeof( buf ), &olen, myrand, NULL ) );
-
- mbedtls_snprintf( title, sizeof( title ), "DH-%d", dhm_sizes[i] );
- TIME_PUBLIC( title, "handshake",
- ret |= mbedtls_dhm_calc_secret( &dhm, buf, sizeof( buf ), &olen, myrand, NULL ) );
-
- mbedtls_dhm_free( &dhm );
- }
- }
-#endif
-
-#if defined(MBEDTLS_ECDSA_C) && defined(MBEDTLS_SHA256_C)
- if( todo.ecdsa )
- {
- mbedtls_ecdsa_context ecdsa;
- const mbedtls_ecp_curve_info *curve_info;
- size_t sig_len;
-
- memset( buf, 0x2A, sizeof( buf ) );
-
- for( curve_info = curve_list;
- curve_info->grp_id != MBEDTLS_ECP_DP_NONE;
- curve_info++ )
- {
- if( ! mbedtls_ecdsa_can_do( curve_info->grp_id ) )
- continue;
-
- mbedtls_ecdsa_init( &ecdsa );
-
- if( mbedtls_ecdsa_genkey( &ecdsa, curve_info->grp_id, myrand, NULL ) != 0 )
- mbedtls_exit( 1 );
- ecp_clear_precomputed( &ecdsa.grp );
-
- mbedtls_snprintf( title, sizeof( title ), "ECDSA-%s",
- curve_info->name );
- TIME_PUBLIC( title, "sign",
- ret = mbedtls_ecdsa_write_signature( &ecdsa, MBEDTLS_MD_SHA256, buf, curve_info->bit_size,
- tmp, &sig_len, myrand, NULL ) );
-
- mbedtls_ecdsa_free( &ecdsa );
- }
-
- for( curve_info = curve_list;
- curve_info->grp_id != MBEDTLS_ECP_DP_NONE;
- curve_info++ )
- {
- if( ! mbedtls_ecdsa_can_do( curve_info->grp_id ) )
- continue;
-
- mbedtls_ecdsa_init( &ecdsa );
-
- if( mbedtls_ecdsa_genkey( &ecdsa, curve_info->grp_id, myrand, NULL ) != 0 ||
- mbedtls_ecdsa_write_signature( &ecdsa, MBEDTLS_MD_SHA256, buf, curve_info->bit_size,
- tmp, &sig_len, myrand, NULL ) != 0 )
- {
- mbedtls_exit( 1 );
- }
- ecp_clear_precomputed( &ecdsa.grp );
-
- mbedtls_snprintf( title, sizeof( title ), "ECDSA-%s",
- curve_info->name );
- TIME_PUBLIC( title, "verify",
- ret = mbedtls_ecdsa_read_signature( &ecdsa, buf, curve_info->bit_size,
- tmp, sig_len ) );
-
- mbedtls_ecdsa_free( &ecdsa );
- }
- }
-#endif
-
-#if defined(MBEDTLS_ECDH_C) && defined(MBEDTLS_ECDH_LEGACY_CONTEXT)
- if( todo.ecdh )
- {
- mbedtls_ecdh_context ecdh;
- mbedtls_mpi z;
- const mbedtls_ecp_curve_info montgomery_curve_list[] = {
-#if defined(MBEDTLS_ECP_DP_CURVE25519_ENABLED)
- { MBEDTLS_ECP_DP_CURVE25519, 0, 0, "Curve25519" },
-#endif
-#if defined(MBEDTLS_ECP_DP_CURVE448_ENABLED)
- { MBEDTLS_ECP_DP_CURVE448, 0, 0, "Curve448" },
-#endif
- { MBEDTLS_ECP_DP_NONE, 0, 0, 0 }
- };
- const mbedtls_ecp_curve_info *curve_info;
- size_t olen;
- const mbedtls_ecp_curve_info *selected_montgomery_curve_list =
- montgomery_curve_list;
-
- if( curve_list == (const mbedtls_ecp_curve_info*) &single_curve )
- {
- mbedtls_ecp_group grp;
- mbedtls_ecp_group_init( &grp );
- if( mbedtls_ecp_group_load( &grp, curve_list->grp_id ) != 0 )
- mbedtls_exit( 1 );
- if( mbedtls_ecp_get_type( &grp ) == MBEDTLS_ECP_TYPE_MONTGOMERY )
- selected_montgomery_curve_list = single_curve;
- else /* empty list */
- selected_montgomery_curve_list = single_curve + 1;
- mbedtls_ecp_group_free( &grp );
- }
-
- for( curve_info = curve_list;
- curve_info->grp_id != MBEDTLS_ECP_DP_NONE;
- curve_info++ )
- {
- if( ! mbedtls_ecdh_can_do( curve_info->grp_id ) )
- continue;
-
- mbedtls_ecdh_init( &ecdh );
-
- CHECK_AND_CONTINUE( mbedtls_ecp_group_load( &ecdh.grp, curve_info->grp_id ) );
- CHECK_AND_CONTINUE( mbedtls_ecdh_make_public( &ecdh, &olen, buf, sizeof( buf),
- myrand, NULL ) );
- CHECK_AND_CONTINUE( mbedtls_ecp_copy( &ecdh.Qp, &ecdh.Q ) );
- ecp_clear_precomputed( &ecdh.grp );
-
- mbedtls_snprintf( title, sizeof( title ), "ECDHE-%s",
- curve_info->name );
- TIME_PUBLIC( title, "handshake",
- CHECK_AND_CONTINUE( mbedtls_ecdh_make_public( &ecdh, &olen, buf, sizeof( buf),
- myrand, NULL ) );
- CHECK_AND_CONTINUE( mbedtls_ecdh_calc_secret( &ecdh, &olen, buf, sizeof( buf ),
- myrand, NULL ) ) );
- mbedtls_ecdh_free( &ecdh );
- }
-
- /* Montgomery curves need to be handled separately */
- for ( curve_info = selected_montgomery_curve_list;
- curve_info->grp_id != MBEDTLS_ECP_DP_NONE;
- curve_info++ )
- {
- mbedtls_ecdh_init( &ecdh );
- mbedtls_mpi_init( &z );
-
- CHECK_AND_CONTINUE( mbedtls_ecp_group_load( &ecdh.grp, curve_info->grp_id ) );
- CHECK_AND_CONTINUE( mbedtls_ecdh_gen_public( &ecdh.grp, &ecdh.d, &ecdh.Qp, myrand, NULL ) );
-
- mbedtls_snprintf( title, sizeof(title), "ECDHE-%s",
- curve_info->name );
- TIME_PUBLIC( title, "handshake",
- CHECK_AND_CONTINUE( mbedtls_ecdh_gen_public( &ecdh.grp, &ecdh.d, &ecdh.Q,
- myrand, NULL ) );
- CHECK_AND_CONTINUE( mbedtls_ecdh_compute_shared( &ecdh.grp, &z, &ecdh.Qp, &ecdh.d,
- myrand, NULL ) ) );
-
- mbedtls_ecdh_free( &ecdh );
- mbedtls_mpi_free( &z );
- }
-
- for( curve_info = curve_list;
- curve_info->grp_id != MBEDTLS_ECP_DP_NONE;
- curve_info++ )
- {
- if( ! mbedtls_ecdh_can_do( curve_info->grp_id ) )
- continue;
-
- mbedtls_ecdh_init( &ecdh );
-
- CHECK_AND_CONTINUE( mbedtls_ecp_group_load( &ecdh.grp, curve_info->grp_id ) );
- CHECK_AND_CONTINUE( mbedtls_ecdh_make_public( &ecdh, &olen, buf, sizeof( buf),
- myrand, NULL ) );
- CHECK_AND_CONTINUE( mbedtls_ecp_copy( &ecdh.Qp, &ecdh.Q ) );
- CHECK_AND_CONTINUE( mbedtls_ecdh_make_public( &ecdh, &olen, buf, sizeof( buf),
- myrand, NULL ) );
- ecp_clear_precomputed( &ecdh.grp );
-
- mbedtls_snprintf( title, sizeof( title ), "ECDH-%s",
- curve_info->name );
- TIME_PUBLIC( title, "handshake",
- CHECK_AND_CONTINUE( mbedtls_ecdh_calc_secret( &ecdh, &olen, buf, sizeof( buf ),
- myrand, NULL ) ) );
- mbedtls_ecdh_free( &ecdh );
- }
-
- /* Montgomery curves need to be handled separately */
- for ( curve_info = selected_montgomery_curve_list;
- curve_info->grp_id != MBEDTLS_ECP_DP_NONE;
- curve_info++)
- {
- mbedtls_ecdh_init( &ecdh );
- mbedtls_mpi_init( &z );
-
- CHECK_AND_CONTINUE( mbedtls_ecp_group_load( &ecdh.grp, curve_info->grp_id ) );
- CHECK_AND_CONTINUE( mbedtls_ecdh_gen_public( &ecdh.grp, &ecdh.d, &ecdh.Qp,
- myrand, NULL ) );
- CHECK_AND_CONTINUE( mbedtls_ecdh_gen_public( &ecdh.grp, &ecdh.d, &ecdh.Q, myrand, NULL ) );
-
- mbedtls_snprintf( title, sizeof(title), "ECDH-%s",
- curve_info->name );
- TIME_PUBLIC( title, "handshake",
- CHECK_AND_CONTINUE( mbedtls_ecdh_compute_shared( &ecdh.grp, &z, &ecdh.Qp, &ecdh.d,
- myrand, NULL ) ) );
-
- mbedtls_ecdh_free( &ecdh );
- mbedtls_mpi_free( &z );
- }
- }
-#endif
-
-#if defined(MBEDTLS_ECDH_C)
- if( todo.ecdh )
- {
- mbedtls_ecdh_context ecdh_srv, ecdh_cli;
- unsigned char buf_srv[BUFSIZE], buf_cli[BUFSIZE];
- const mbedtls_ecp_curve_info *curve_info;
- size_t olen;
-
- for( curve_info = curve_list;
- curve_info->grp_id != MBEDTLS_ECP_DP_NONE;
- curve_info++ )
- {
- if( ! mbedtls_ecdh_can_do( curve_info->grp_id ) )
- continue;
-
- mbedtls_ecdh_init( &ecdh_srv );
- mbedtls_ecdh_init( &ecdh_cli );
-
- mbedtls_snprintf( title, sizeof( title ), "ECDHE-%s", curve_info->name );
- TIME_PUBLIC( title, "full handshake",
- const unsigned char * p_srv = buf_srv;
-
- CHECK_AND_CONTINUE( mbedtls_ecdh_setup( &ecdh_srv, curve_info->grp_id ) );
- CHECK_AND_CONTINUE( mbedtls_ecdh_make_params( &ecdh_srv, &olen, buf_srv, sizeof( buf_srv ), myrand, NULL ) );
-
- CHECK_AND_CONTINUE( mbedtls_ecdh_read_params( &ecdh_cli, &p_srv, p_srv + olen ) );
- CHECK_AND_CONTINUE( mbedtls_ecdh_make_public( &ecdh_cli, &olen, buf_cli, sizeof( buf_cli ), myrand, NULL ) );
-
- CHECK_AND_CONTINUE( mbedtls_ecdh_read_public( &ecdh_srv, buf_cli, olen ) );
- CHECK_AND_CONTINUE( mbedtls_ecdh_calc_secret( &ecdh_srv, &olen, buf_srv, sizeof( buf_srv ), myrand, NULL ) );
-
- CHECK_AND_CONTINUE( mbedtls_ecdh_calc_secret( &ecdh_cli, &olen, buf_cli, sizeof( buf_cli ), myrand, NULL ) );
- mbedtls_ecdh_free( &ecdh_cli );
-
- mbedtls_ecdh_free( &ecdh_srv );
- );
-
- }
- }
-#endif
-
- mbedtls_printf( "\n" );
-
-#if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C)
- mbedtls_memory_buffer_alloc_free();
-#endif
-
-#if defined(_WIN32)
- mbedtls_printf( " Press Enter to exit this program.\n" );
- fflush( stdout ); getchar();
-#endif
-
- mbedtls_exit( 0 );
-}
-
-#endif /* MBEDTLS_TIMING_C */
diff --git a/lib/mbedtls-2.27.0/programs/test/cmake_subproject/.gitignore b/lib/mbedtls-2.27.0/programs/test/cmake_subproject/.gitignore
deleted file mode 100644
index 464833b..0000000
--- a/lib/mbedtls-2.27.0/programs/test/cmake_subproject/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-build
-Makefile
-cmake_subproject
diff --git a/lib/mbedtls-2.27.0/programs/test/cmake_subproject/CMakeLists.txt b/lib/mbedtls-2.27.0/programs/test/cmake_subproject/CMakeLists.txt
deleted file mode 100644
index a9fcfde..0000000
--- a/lib/mbedtls-2.27.0/programs/test/cmake_subproject/CMakeLists.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-cmake_minimum_required(VERSION 2.6)
-
-# Test the target renaming support by adding a prefix to the targets built
-set(MBEDTLS_TARGET_PREFIX subproject_test_)
-
-# We use the parent Mbed TLS directory as the MBEDTLS_DIR for this test. Other
-# projects that use Mbed TLS as a subproject are likely to add by their own
-# relative paths.
-set(MBEDTLS_DIR ../../../)
-
-# Add Mbed TLS as a subdirectory.
-add_subdirectory(${MBEDTLS_DIR} build)
-
-# Link against all the Mbed TLS libraries. Verifies that the targets have been
-# created using the specified prefix
-set(libs
- subproject_test_mbedcrypto
- subproject_test_mbedx509
- subproject_test_mbedtls
-)
-
-add_executable(cmake_subproject cmake_subproject.c)
-target_link_libraries(cmake_subproject ${libs})
diff --git a/lib/mbedtls-2.27.0/programs/test/cmake_subproject/cmake_subproject.c b/lib/mbedtls-2.27.0/programs/test/cmake_subproject/cmake_subproject.c
deleted file mode 100644
index 6d81830..0000000
--- a/lib/mbedtls-2.27.0/programs/test/cmake_subproject/cmake_subproject.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Simple program to test that CMake builds with Mbed TLS as a subdirectory
- * work correctly.
- *
- * Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#if !defined(MBEDTLS_CONFIG_FILE)
-#include "mbedtls/config.h"
-#else
-#include MBEDTLS_CONFIG_FILE
-#endif
-
-#if defined(MBEDTLS_PLATFORM_C)
-#include "mbedtls/platform.h"
-#else
-#include <stdio.h>
-#include <stdlib.h>
-#define mbedtls_fprintf fprintf
-#define mbedtls_printf printf
-#define mbedtls_exit exit
-#define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS
-#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE
-#endif /* MBEDTLS_PLATFORM_C */
-
-#include "mbedtls/version.h"
-
-/* The main reason to build this is for testing the CMake build, so the program
- * doesn't need to do very much. It calls a single library function to ensure
- * linkage works, but that is all. */
-int main()
-{
- /* This version string is 18 bytes long, as advised by version.h. */
- char version[18];
-
- mbedtls_version_get_string_full( version );
-
- mbedtls_printf( "Built against %s\n", version );
-
- return( 0 );
-}
diff --git a/lib/mbedtls-2.27.0/programs/test/cpp_dummy_build.cpp b/lib/mbedtls-2.27.0/programs/test/cpp_dummy_build.cpp
deleted file mode 100644
index d052682..0000000
--- a/lib/mbedtls-2.27.0/programs/test/cpp_dummy_build.cpp
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * This program is a dummy C++ program to ensure Mbed TLS library header files
- * can be included and built with a C++ compiler.
- *
- * Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#if !defined(MBEDTLS_CONFIG_FILE)
-#include "mbedtls/config.h"
-#else
-#include MBEDTLS_CONFIG_FILE
-#endif
-
-#include "mbedtls/aes.h"
-#include "mbedtls/aesni.h"
-#include "mbedtls/arc4.h"
-#include "mbedtls/aria.h"
-#include "mbedtls/asn1.h"
-#include "mbedtls/asn1write.h"
-#include "mbedtls/base64.h"
-#include "mbedtls/bignum.h"
-#include "mbedtls/blowfish.h"
-#include "mbedtls/bn_mul.h"
-#include "mbedtls/camellia.h"
-#include "mbedtls/ccm.h"
-#include "mbedtls/certs.h"
-#include "mbedtls/chacha20.h"
-#include "mbedtls/chachapoly.h"
-#include "mbedtls/check_config.h"
-#include "mbedtls/cipher.h"
-#include "mbedtls/cipher_internal.h"
-#include "mbedtls/cmac.h"
-#include "mbedtls/compat-1.3.h"
-#include "mbedtls/config_psa.h"
-#include "mbedtls/ctr_drbg.h"
-#include "mbedtls/debug.h"
-#include "mbedtls/des.h"
-#include "mbedtls/dhm.h"
-#include "mbedtls/ecdh.h"
-#include "mbedtls/ecdsa.h"
-#include "mbedtls/ecjpake.h"
-#include "mbedtls/ecp.h"
-#include "mbedtls/ecp_internal.h"
-#include "mbedtls/entropy.h"
-#include "mbedtls/entropy_poll.h"
-#include "mbedtls/error.h"
-#include "mbedtls/gcm.h"
-#include "mbedtls/havege.h"
-#include "mbedtls/hkdf.h"
-#include "mbedtls/hmac_drbg.h"
-#include "mbedtls/md.h"
-#include "mbedtls/md2.h"
-#include "mbedtls/md4.h"
-#include "mbedtls/md5.h"
-#include "mbedtls/md_internal.h"
-#include "mbedtls/net.h"
-#include "mbedtls/net_sockets.h"
-#include "mbedtls/nist_kw.h"
-#include "mbedtls/oid.h"
-#include "mbedtls/padlock.h"
-#include "mbedtls/pem.h"
-#include "mbedtls/pk.h"
-#include "mbedtls/pk_internal.h"
-#include "mbedtls/pkcs11.h"
-#include "mbedtls/pkcs12.h"
-#include "mbedtls/pkcs5.h"
-#include "mbedtls/platform_time.h"
-#include "mbedtls/platform_util.h"
-#include "mbedtls/poly1305.h"
-#include "mbedtls/psa_util.h"
-#include "mbedtls/ripemd160.h"
-#include "mbedtls/rsa.h"
-#include "mbedtls/rsa_internal.h"
-#include "mbedtls/sha1.h"
-#include "mbedtls/sha256.h"
-#include "mbedtls/sha512.h"
-#include "mbedtls/ssl.h"
-#include "mbedtls/ssl_cache.h"
-#include "mbedtls/ssl_ciphersuites.h"
-#include "mbedtls/ssl_cookie.h"
-#include "mbedtls/ssl_internal.h"
-#include "mbedtls/ssl_ticket.h"
-#include "mbedtls/threading.h"
-#include "mbedtls/timing.h"
-#include "mbedtls/version.h"
-#include "mbedtls/x509.h"
-#include "mbedtls/x509_crl.h"
-#include "mbedtls/x509_crt.h"
-#include "mbedtls/x509_csr.h"
-#include "mbedtls/xtea.h"
-
-#if defined(MBEDTLS_PLATFORM_C)
-#include "mbedtls/platform.h"
-#endif
-
-#if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C)
-#include "mbedtls/memory_buffer_alloc.h"
-#endif
-
-#include "psa/crypto.h"
-#include "psa/crypto_se_driver.h"
-#include "../library/psa_crypto_its.h"
-
-int main()
-{
- mbedtls_platform_context *ctx = NULL;
- mbedtls_platform_setup(ctx);
- mbedtls_printf("CPP Build test\n");
- mbedtls_platform_teardown(ctx);
-}
diff --git a/lib/mbedtls-2.27.0/programs/test/query_compile_time_config.c b/lib/mbedtls-2.27.0/programs/test/query_compile_time_config.c
deleted file mode 100644
index 0e356c8..0000000
--- a/lib/mbedtls-2.27.0/programs/test/query_compile_time_config.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Query the Mbed TLS compile time configuration
- *
- * Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#if !defined(MBEDTLS_CONFIG_FILE)
-#include "mbedtls/config.h"
-#else
-#include MBEDTLS_CONFIG_FILE
-#endif
-
-#if defined(MBEDTLS_PLATFORM_C)
-#include "mbedtls/platform.h"
-#else
-#include <stdio.h>
-#include <stdlib.h>
-#define mbedtls_printf printf
-#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE
-#endif
-
-#define USAGE \
- "usage: %s <MBEDTLS_CONFIG>\n\n" \
- "This program takes one command line argument which corresponds to\n" \
- "the string representation of a Mbed TLS compile time configuration.\n" \
- "The value 0 will be returned if this configuration is defined in the\n" \
- "Mbed TLS build and the macro expansion of that configuration will be\n" \
- "printed (if any). Otherwise, 1 will be returned.\n"
-
-#include "query_config.h"
-
-int main( int argc, char *argv[] )
-{
- if ( argc != 2 )
- {
- mbedtls_printf( USAGE, argv[0] );
- return( MBEDTLS_EXIT_FAILURE );
- }
-
- return( query_config( argv[1] ) );
-}
diff --git a/lib/mbedtls-2.27.0/programs/test/query_config.c b/lib/mbedtls-2.27.0/programs/test/query_config.c
deleted file mode 100644
index 9760f62..0000000
--- a/lib/mbedtls-2.27.0/programs/test/query_config.c
+++ /dev/null
@@ -1,2827 +0,0 @@
-/*
- * Query Mbed TLS compile time configurations from config.h
- *
- * Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#if !defined(MBEDTLS_CONFIG_FILE)
-#include "mbedtls/config.h"
-#else
-#include MBEDTLS_CONFIG_FILE
-#endif
-
-#include "query_config.h"
-
-#if defined(MBEDTLS_PLATFORM_C)
-#include "mbedtls/platform.h"
-#else
-#include <stdio.h>
-#define mbedtls_printf printf
-#endif /* MBEDTLS_PLATFORM_C */
-
-/*
- * Include all the headers with public APIs in case they define a macro to its
- * default value when that configuration is not set in the config.h.
- */
-#include "mbedtls/aes.h"
-#include "mbedtls/aesni.h"
-#include "mbedtls/arc4.h"
-#include "mbedtls/aria.h"
-#include "mbedtls/asn1.h"
-#include "mbedtls/asn1write.h"
-#include "mbedtls/base64.h"
-#include "mbedtls/bignum.h"
-#include "mbedtls/blowfish.h"
-#include "mbedtls/camellia.h"
-#include "mbedtls/ccm.h"
-#include "mbedtls/certs.h"
-#include "mbedtls/chacha20.h"
-#include "mbedtls/chachapoly.h"
-#include "mbedtls/cipher.h"
-#include "mbedtls/cmac.h"
-#include "mbedtls/ctr_drbg.h"
-#include "mbedtls/debug.h"
-#include "mbedtls/des.h"
-#include "mbedtls/dhm.h"
-#include "mbedtls/ecdh.h"
-#include "mbedtls/ecdsa.h"
-#include "mbedtls/ecjpake.h"
-#include "mbedtls/ecp.h"
-#include "mbedtls/entropy.h"
-#include "mbedtls/entropy_poll.h"
-#include "mbedtls/error.h"
-#include "mbedtls/gcm.h"
-#include "mbedtls/havege.h"
-#include "mbedtls/hkdf.h"
-#include "mbedtls/hmac_drbg.h"
-#include "mbedtls/md.h"
-#include "mbedtls/md2.h"
-#include "mbedtls/md4.h"
-#include "mbedtls/md5.h"
-#include "mbedtls/memory_buffer_alloc.h"
-#include "mbedtls/net_sockets.h"
-#include "mbedtls/nist_kw.h"
-#include "mbedtls/oid.h"
-#include "mbedtls/padlock.h"
-#include "mbedtls/pem.h"
-#include "mbedtls/pk.h"
-#include "mbedtls/pkcs11.h"
-#include "mbedtls/pkcs12.h"
-#include "mbedtls/pkcs5.h"
-#include "mbedtls/platform_time.h"
-#include "mbedtls/platform_util.h"
-#include "mbedtls/poly1305.h"
-#include "mbedtls/ripemd160.h"
-#include "mbedtls/rsa.h"
-#include "mbedtls/sha1.h"
-#include "mbedtls/sha256.h"
-#include "mbedtls/sha512.h"
-#include "mbedtls/ssl.h"
-#include "mbedtls/ssl_cache.h"
-#include "mbedtls/ssl_ciphersuites.h"
-#include "mbedtls/ssl_cookie.h"
-#include "mbedtls/ssl_internal.h"
-#include "mbedtls/ssl_ticket.h"
-#include "mbedtls/threading.h"
-#include "mbedtls/timing.h"
-#include "mbedtls/version.h"
-#include "mbedtls/x509.h"
-#include "mbedtls/x509_crl.h"
-#include "mbedtls/x509_crt.h"
-#include "mbedtls/x509_csr.h"
-#include "mbedtls/xtea.h"
-
-#include <string.h>
-
-/*
- * Helper macros to convert a macro or its expansion into a string
- * WARNING: This does not work for expanding function-like macros. However,
- * Mbed TLS does not currently have configuration options used in this fashion.
- */
-#define MACRO_EXPANSION_TO_STR(macro) MACRO_NAME_TO_STR(macro)
-#define MACRO_NAME_TO_STR(macro) \
- mbedtls_printf( "%s", strlen( #macro "" ) > 0 ? #macro "\n" : "" )
-
-#if defined(_MSC_VER)
-/*
- * Visual Studio throws the warning 4003 because many Mbed TLS feature macros
- * are defined empty. This means that from the preprocessor's point of view
- * the macro MBEDTLS_EXPANSION_TO_STR is being invoked without arguments as
- * some macros expand to nothing. We suppress that specific warning to get a
- * clean build and to ensure that tests treating warnings as errors do not
- * fail.
- */
-#pragma warning(push)
-#pragma warning(disable:4003)
-#endif /* _MSC_VER */
-
-int query_config( const char *config )
-{
-#if defined(MBEDTLS_HAVE_ASM)
- if( strcmp( "MBEDTLS_HAVE_ASM", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_HAVE_ASM );
- return( 0 );
- }
-#endif /* MBEDTLS_HAVE_ASM */
-
-#if defined(MBEDTLS_NO_UDBL_DIVISION)
- if( strcmp( "MBEDTLS_NO_UDBL_DIVISION", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_NO_UDBL_DIVISION );
- return( 0 );
- }
-#endif /* MBEDTLS_NO_UDBL_DIVISION */
-
-#if defined(MBEDTLS_NO_64BIT_MULTIPLICATION)
- if( strcmp( "MBEDTLS_NO_64BIT_MULTIPLICATION", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_NO_64BIT_MULTIPLICATION );
- return( 0 );
- }
-#endif /* MBEDTLS_NO_64BIT_MULTIPLICATION */
-
-#if defined(MBEDTLS_HAVE_SSE2)
- if( strcmp( "MBEDTLS_HAVE_SSE2", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_HAVE_SSE2 );
- return( 0 );
- }
-#endif /* MBEDTLS_HAVE_SSE2 */
-
-#if defined(MBEDTLS_HAVE_TIME)
- if( strcmp( "MBEDTLS_HAVE_TIME", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_HAVE_TIME );
- return( 0 );
- }
-#endif /* MBEDTLS_HAVE_TIME */
-
-#if defined(MBEDTLS_HAVE_TIME_DATE)
- if( strcmp( "MBEDTLS_HAVE_TIME_DATE", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_HAVE_TIME_DATE );
- return( 0 );
- }
-#endif /* MBEDTLS_HAVE_TIME_DATE */
-
-#if defined(MBEDTLS_PLATFORM_MEMORY)
- if( strcmp( "MBEDTLS_PLATFORM_MEMORY", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_PLATFORM_MEMORY );
- return( 0 );
- }
-#endif /* MBEDTLS_PLATFORM_MEMORY */
-
-#if defined(MBEDTLS_PLATFORM_NO_STD_FUNCTIONS)
- if( strcmp( "MBEDTLS_PLATFORM_NO_STD_FUNCTIONS", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_PLATFORM_NO_STD_FUNCTIONS );
- return( 0 );
- }
-#endif /* MBEDTLS_PLATFORM_NO_STD_FUNCTIONS */
-
-#if defined(MBEDTLS_PLATFORM_EXIT_ALT)
- if( strcmp( "MBEDTLS_PLATFORM_EXIT_ALT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_PLATFORM_EXIT_ALT );
- return( 0 );
- }
-#endif /* MBEDTLS_PLATFORM_EXIT_ALT */
-
-#if defined(MBEDTLS_PLATFORM_TIME_ALT)
- if( strcmp( "MBEDTLS_PLATFORM_TIME_ALT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_PLATFORM_TIME_ALT );
- return( 0 );
- }
-#endif /* MBEDTLS_PLATFORM_TIME_ALT */
-
-#if defined(MBEDTLS_PLATFORM_FPRINTF_ALT)
- if( strcmp( "MBEDTLS_PLATFORM_FPRINTF_ALT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_PLATFORM_FPRINTF_ALT );
- return( 0 );
- }
-#endif /* MBEDTLS_PLATFORM_FPRINTF_ALT */
-
-#if defined(MBEDTLS_PLATFORM_PRINTF_ALT)
- if( strcmp( "MBEDTLS_PLATFORM_PRINTF_ALT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_PLATFORM_PRINTF_ALT );
- return( 0 );
- }
-#endif /* MBEDTLS_PLATFORM_PRINTF_ALT */
-
-#if defined(MBEDTLS_PLATFORM_SNPRINTF_ALT)
- if( strcmp( "MBEDTLS_PLATFORM_SNPRINTF_ALT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_PLATFORM_SNPRINTF_ALT );
- return( 0 );
- }
-#endif /* MBEDTLS_PLATFORM_SNPRINTF_ALT */
-
-#if defined(MBEDTLS_PLATFORM_VSNPRINTF_ALT)
- if( strcmp( "MBEDTLS_PLATFORM_VSNPRINTF_ALT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_PLATFORM_VSNPRINTF_ALT );
- return( 0 );
- }
-#endif /* MBEDTLS_PLATFORM_VSNPRINTF_ALT */
-
-#if defined(MBEDTLS_PLATFORM_NV_SEED_ALT)
- if( strcmp( "MBEDTLS_PLATFORM_NV_SEED_ALT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_PLATFORM_NV_SEED_ALT );
- return( 0 );
- }
-#endif /* MBEDTLS_PLATFORM_NV_SEED_ALT */
-
-#if defined(MBEDTLS_PLATFORM_SETUP_TEARDOWN_ALT)
- if( strcmp( "MBEDTLS_PLATFORM_SETUP_TEARDOWN_ALT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_PLATFORM_SETUP_TEARDOWN_ALT );
- return( 0 );
- }
-#endif /* MBEDTLS_PLATFORM_SETUP_TEARDOWN_ALT */
-
-#if defined(MBEDTLS_DEPRECATED_WARNING)
- if( strcmp( "MBEDTLS_DEPRECATED_WARNING", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_DEPRECATED_WARNING );
- return( 0 );
- }
-#endif /* MBEDTLS_DEPRECATED_WARNING */
-
-#if defined(MBEDTLS_DEPRECATED_REMOVED)
- if( strcmp( "MBEDTLS_DEPRECATED_REMOVED", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_DEPRECATED_REMOVED );
- return( 0 );
- }
-#endif /* MBEDTLS_DEPRECATED_REMOVED */
-
-#if defined(MBEDTLS_CHECK_PARAMS)
- if( strcmp( "MBEDTLS_CHECK_PARAMS", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_CHECK_PARAMS );
- return( 0 );
- }
-#endif /* MBEDTLS_CHECK_PARAMS */
-
-#if defined(MBEDTLS_CHECK_PARAMS_ASSERT)
- if( strcmp( "MBEDTLS_CHECK_PARAMS_ASSERT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_CHECK_PARAMS_ASSERT );
- return( 0 );
- }
-#endif /* MBEDTLS_CHECK_PARAMS_ASSERT */
-
-#if defined(MBEDTLS_TIMING_ALT)
- if( strcmp( "MBEDTLS_TIMING_ALT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_TIMING_ALT );
- return( 0 );
- }
-#endif /* MBEDTLS_TIMING_ALT */
-
-#if defined(MBEDTLS_AES_ALT)
- if( strcmp( "MBEDTLS_AES_ALT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_AES_ALT );
- return( 0 );
- }
-#endif /* MBEDTLS_AES_ALT */
-
-#if defined(MBEDTLS_ARC4_ALT)
- if( strcmp( "MBEDTLS_ARC4_ALT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_ARC4_ALT );
- return( 0 );
- }
-#endif /* MBEDTLS_ARC4_ALT */
-
-#if defined(MBEDTLS_ARIA_ALT)
- if( strcmp( "MBEDTLS_ARIA_ALT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_ARIA_ALT );
- return( 0 );
- }
-#endif /* MBEDTLS_ARIA_ALT */
-
-#if defined(MBEDTLS_BLOWFISH_ALT)
- if( strcmp( "MBEDTLS_BLOWFISH_ALT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_BLOWFISH_ALT );
- return( 0 );
- }
-#endif /* MBEDTLS_BLOWFISH_ALT */
-
-#if defined(MBEDTLS_CAMELLIA_ALT)
- if( strcmp( "MBEDTLS_CAMELLIA_ALT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_CAMELLIA_ALT );
- return( 0 );
- }
-#endif /* MBEDTLS_CAMELLIA_ALT */
-
-#if defined(MBEDTLS_CCM_ALT)
- if( strcmp( "MBEDTLS_CCM_ALT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_CCM_ALT );
- return( 0 );
- }
-#endif /* MBEDTLS_CCM_ALT */
-
-#if defined(MBEDTLS_CHACHA20_ALT)
- if( strcmp( "MBEDTLS_CHACHA20_ALT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_CHACHA20_ALT );
- return( 0 );
- }
-#endif /* MBEDTLS_CHACHA20_ALT */
-
-#if defined(MBEDTLS_CHACHAPOLY_ALT)
- if( strcmp( "MBEDTLS_CHACHAPOLY_ALT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_CHACHAPOLY_ALT );
- return( 0 );
- }
-#endif /* MBEDTLS_CHACHAPOLY_ALT */
-
-#if defined(MBEDTLS_CMAC_ALT)
- if( strcmp( "MBEDTLS_CMAC_ALT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_CMAC_ALT );
- return( 0 );
- }
-#endif /* MBEDTLS_CMAC_ALT */
-
-#if defined(MBEDTLS_DES_ALT)
- if( strcmp( "MBEDTLS_DES_ALT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_DES_ALT );
- return( 0 );
- }
-#endif /* MBEDTLS_DES_ALT */
-
-#if defined(MBEDTLS_DHM_ALT)
- if( strcmp( "MBEDTLS_DHM_ALT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_DHM_ALT );
- return( 0 );
- }
-#endif /* MBEDTLS_DHM_ALT */
-
-#if defined(MBEDTLS_ECJPAKE_ALT)
- if( strcmp( "MBEDTLS_ECJPAKE_ALT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_ECJPAKE_ALT );
- return( 0 );
- }
-#endif /* MBEDTLS_ECJPAKE_ALT */
-
-#if defined(MBEDTLS_GCM_ALT)
- if( strcmp( "MBEDTLS_GCM_ALT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_GCM_ALT );
- return( 0 );
- }
-#endif /* MBEDTLS_GCM_ALT */
-
-#if defined(MBEDTLS_NIST_KW_ALT)
- if( strcmp( "MBEDTLS_NIST_KW_ALT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_NIST_KW_ALT );
- return( 0 );
- }
-#endif /* MBEDTLS_NIST_KW_ALT */
-
-#if defined(MBEDTLS_MD2_ALT)
- if( strcmp( "MBEDTLS_MD2_ALT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_MD2_ALT );
- return( 0 );
- }
-#endif /* MBEDTLS_MD2_ALT */
-
-#if defined(MBEDTLS_MD4_ALT)
- if( strcmp( "MBEDTLS_MD4_ALT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_MD4_ALT );
- return( 0 );
- }
-#endif /* MBEDTLS_MD4_ALT */
-
-#if defined(MBEDTLS_MD5_ALT)
- if( strcmp( "MBEDTLS_MD5_ALT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_MD5_ALT );
- return( 0 );
- }
-#endif /* MBEDTLS_MD5_ALT */
-
-#if defined(MBEDTLS_POLY1305_ALT)
- if( strcmp( "MBEDTLS_POLY1305_ALT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_POLY1305_ALT );
- return( 0 );
- }
-#endif /* MBEDTLS_POLY1305_ALT */
-
-#if defined(MBEDTLS_RIPEMD160_ALT)
- if( strcmp( "MBEDTLS_RIPEMD160_ALT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_RIPEMD160_ALT );
- return( 0 );
- }
-#endif /* MBEDTLS_RIPEMD160_ALT */
-
-#if defined(MBEDTLS_RSA_ALT)
- if( strcmp( "MBEDTLS_RSA_ALT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_RSA_ALT );
- return( 0 );
- }
-#endif /* MBEDTLS_RSA_ALT */
-
-#if defined(MBEDTLS_SHA1_ALT)
- if( strcmp( "MBEDTLS_SHA1_ALT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_SHA1_ALT );
- return( 0 );
- }
-#endif /* MBEDTLS_SHA1_ALT */
-
-#if defined(MBEDTLS_SHA256_ALT)
- if( strcmp( "MBEDTLS_SHA256_ALT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_SHA256_ALT );
- return( 0 );
- }
-#endif /* MBEDTLS_SHA256_ALT */
-
-#if defined(MBEDTLS_SHA512_ALT)
- if( strcmp( "MBEDTLS_SHA512_ALT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_SHA512_ALT );
- return( 0 );
- }
-#endif /* MBEDTLS_SHA512_ALT */
-
-#if defined(MBEDTLS_XTEA_ALT)
- if( strcmp( "MBEDTLS_XTEA_ALT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_XTEA_ALT );
- return( 0 );
- }
-#endif /* MBEDTLS_XTEA_ALT */
-
-#if defined(MBEDTLS_ECP_ALT)
- if( strcmp( "MBEDTLS_ECP_ALT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_ECP_ALT );
- return( 0 );
- }
-#endif /* MBEDTLS_ECP_ALT */
-
-#if defined(MBEDTLS_MD2_PROCESS_ALT)
- if( strcmp( "MBEDTLS_MD2_PROCESS_ALT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_MD2_PROCESS_ALT );
- return( 0 );
- }
-#endif /* MBEDTLS_MD2_PROCESS_ALT */
-
-#if defined(MBEDTLS_MD4_PROCESS_ALT)
- if( strcmp( "MBEDTLS_MD4_PROCESS_ALT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_MD4_PROCESS_ALT );
- return( 0 );
- }
-#endif /* MBEDTLS_MD4_PROCESS_ALT */
-
-#if defined(MBEDTLS_MD5_PROCESS_ALT)
- if( strcmp( "MBEDTLS_MD5_PROCESS_ALT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_MD5_PROCESS_ALT );
- return( 0 );
- }
-#endif /* MBEDTLS_MD5_PROCESS_ALT */
-
-#if defined(MBEDTLS_RIPEMD160_PROCESS_ALT)
- if( strcmp( "MBEDTLS_RIPEMD160_PROCESS_ALT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_RIPEMD160_PROCESS_ALT );
- return( 0 );
- }
-#endif /* MBEDTLS_RIPEMD160_PROCESS_ALT */
-
-#if defined(MBEDTLS_SHA1_PROCESS_ALT)
- if( strcmp( "MBEDTLS_SHA1_PROCESS_ALT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_SHA1_PROCESS_ALT );
- return( 0 );
- }
-#endif /* MBEDTLS_SHA1_PROCESS_ALT */
-
-#if defined(MBEDTLS_SHA256_PROCESS_ALT)
- if( strcmp( "MBEDTLS_SHA256_PROCESS_ALT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_SHA256_PROCESS_ALT );
- return( 0 );
- }
-#endif /* MBEDTLS_SHA256_PROCESS_ALT */
-
-#if defined(MBEDTLS_SHA512_PROCESS_ALT)
- if( strcmp( "MBEDTLS_SHA512_PROCESS_ALT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_SHA512_PROCESS_ALT );
- return( 0 );
- }
-#endif /* MBEDTLS_SHA512_PROCESS_ALT */
-
-#if defined(MBEDTLS_DES_SETKEY_ALT)
- if( strcmp( "MBEDTLS_DES_SETKEY_ALT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_DES_SETKEY_ALT );
- return( 0 );
- }
-#endif /* MBEDTLS_DES_SETKEY_ALT */
-
-#if defined(MBEDTLS_DES_CRYPT_ECB_ALT)
- if( strcmp( "MBEDTLS_DES_CRYPT_ECB_ALT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_DES_CRYPT_ECB_ALT );
- return( 0 );
- }
-#endif /* MBEDTLS_DES_CRYPT_ECB_ALT */
-
-#if defined(MBEDTLS_DES3_CRYPT_ECB_ALT)
- if( strcmp( "MBEDTLS_DES3_CRYPT_ECB_ALT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_DES3_CRYPT_ECB_ALT );
- return( 0 );
- }
-#endif /* MBEDTLS_DES3_CRYPT_ECB_ALT */
-
-#if defined(MBEDTLS_AES_SETKEY_ENC_ALT)
- if( strcmp( "MBEDTLS_AES_SETKEY_ENC_ALT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_AES_SETKEY_ENC_ALT );
- return( 0 );
- }
-#endif /* MBEDTLS_AES_SETKEY_ENC_ALT */
-
-#if defined(MBEDTLS_AES_SETKEY_DEC_ALT)
- if( strcmp( "MBEDTLS_AES_SETKEY_DEC_ALT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_AES_SETKEY_DEC_ALT );
- return( 0 );
- }
-#endif /* MBEDTLS_AES_SETKEY_DEC_ALT */
-
-#if defined(MBEDTLS_AES_ENCRYPT_ALT)
- if( strcmp( "MBEDTLS_AES_ENCRYPT_ALT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_AES_ENCRYPT_ALT );
- return( 0 );
- }
-#endif /* MBEDTLS_AES_ENCRYPT_ALT */
-
-#if defined(MBEDTLS_AES_DECRYPT_ALT)
- if( strcmp( "MBEDTLS_AES_DECRYPT_ALT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_AES_DECRYPT_ALT );
- return( 0 );
- }
-#endif /* MBEDTLS_AES_DECRYPT_ALT */
-
-#if defined(MBEDTLS_ECDH_GEN_PUBLIC_ALT)
- if( strcmp( "MBEDTLS_ECDH_GEN_PUBLIC_ALT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_ECDH_GEN_PUBLIC_ALT );
- return( 0 );
- }
-#endif /* MBEDTLS_ECDH_GEN_PUBLIC_ALT */
-
-#if defined(MBEDTLS_ECDH_COMPUTE_SHARED_ALT)
- if( strcmp( "MBEDTLS_ECDH_COMPUTE_SHARED_ALT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_ECDH_COMPUTE_SHARED_ALT );
- return( 0 );
- }
-#endif /* MBEDTLS_ECDH_COMPUTE_SHARED_ALT */
-
-#if defined(MBEDTLS_ECDSA_VERIFY_ALT)
- if( strcmp( "MBEDTLS_ECDSA_VERIFY_ALT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_ECDSA_VERIFY_ALT );
- return( 0 );
- }
-#endif /* MBEDTLS_ECDSA_VERIFY_ALT */
-
-#if defined(MBEDTLS_ECDSA_SIGN_ALT)
- if( strcmp( "MBEDTLS_ECDSA_SIGN_ALT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_ECDSA_SIGN_ALT );
- return( 0 );
- }
-#endif /* MBEDTLS_ECDSA_SIGN_ALT */
-
-#if defined(MBEDTLS_ECDSA_GENKEY_ALT)
- if( strcmp( "MBEDTLS_ECDSA_GENKEY_ALT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_ECDSA_GENKEY_ALT );
- return( 0 );
- }
-#endif /* MBEDTLS_ECDSA_GENKEY_ALT */
-
-#if defined(MBEDTLS_ECP_INTERNAL_ALT)
- if( strcmp( "MBEDTLS_ECP_INTERNAL_ALT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_ECP_INTERNAL_ALT );
- return( 0 );
- }
-#endif /* MBEDTLS_ECP_INTERNAL_ALT */
-
-#if defined(MBEDTLS_ECP_NO_FALLBACK)
- if( strcmp( "MBEDTLS_ECP_NO_FALLBACK", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_ECP_NO_FALLBACK );
- return( 0 );
- }
-#endif /* MBEDTLS_ECP_NO_FALLBACK */
-
-#if defined(MBEDTLS_ECP_RANDOMIZE_JAC_ALT)
- if( strcmp( "MBEDTLS_ECP_RANDOMIZE_JAC_ALT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_ECP_RANDOMIZE_JAC_ALT );
- return( 0 );
- }
-#endif /* MBEDTLS_ECP_RANDOMIZE_JAC_ALT */
-
-#if defined(MBEDTLS_ECP_ADD_MIXED_ALT)
- if( strcmp( "MBEDTLS_ECP_ADD_MIXED_ALT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_ECP_ADD_MIXED_ALT );
- return( 0 );
- }
-#endif /* MBEDTLS_ECP_ADD_MIXED_ALT */
-
-#if defined(MBEDTLS_ECP_DOUBLE_JAC_ALT)
- if( strcmp( "MBEDTLS_ECP_DOUBLE_JAC_ALT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_ECP_DOUBLE_JAC_ALT );
- return( 0 );
- }
-#endif /* MBEDTLS_ECP_DOUBLE_JAC_ALT */
-
-#if defined(MBEDTLS_ECP_NORMALIZE_JAC_MANY_ALT)
- if( strcmp( "MBEDTLS_ECP_NORMALIZE_JAC_MANY_ALT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_ECP_NORMALIZE_JAC_MANY_ALT );
- return( 0 );
- }
-#endif /* MBEDTLS_ECP_NORMALIZE_JAC_MANY_ALT */
-
-#if defined(MBEDTLS_ECP_NORMALIZE_JAC_ALT)
- if( strcmp( "MBEDTLS_ECP_NORMALIZE_JAC_ALT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_ECP_NORMALIZE_JAC_ALT );
- return( 0 );
- }
-#endif /* MBEDTLS_ECP_NORMALIZE_JAC_ALT */
-
-#if defined(MBEDTLS_ECP_DOUBLE_ADD_MXZ_ALT)
- if( strcmp( "MBEDTLS_ECP_DOUBLE_ADD_MXZ_ALT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_ECP_DOUBLE_ADD_MXZ_ALT );
- return( 0 );
- }
-#endif /* MBEDTLS_ECP_DOUBLE_ADD_MXZ_ALT */
-
-#if defined(MBEDTLS_ECP_RANDOMIZE_MXZ_ALT)
- if( strcmp( "MBEDTLS_ECP_RANDOMIZE_MXZ_ALT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_ECP_RANDOMIZE_MXZ_ALT );
- return( 0 );
- }
-#endif /* MBEDTLS_ECP_RANDOMIZE_MXZ_ALT */
-
-#if defined(MBEDTLS_ECP_NORMALIZE_MXZ_ALT)
- if( strcmp( "MBEDTLS_ECP_NORMALIZE_MXZ_ALT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_ECP_NORMALIZE_MXZ_ALT );
- return( 0 );
- }
-#endif /* MBEDTLS_ECP_NORMALIZE_MXZ_ALT */
-
-#if defined(MBEDTLS_TEST_NULL_ENTROPY)
- if( strcmp( "MBEDTLS_TEST_NULL_ENTROPY", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_TEST_NULL_ENTROPY );
- return( 0 );
- }
-#endif /* MBEDTLS_TEST_NULL_ENTROPY */
-
-#if defined(MBEDTLS_ENTROPY_HARDWARE_ALT)
- if( strcmp( "MBEDTLS_ENTROPY_HARDWARE_ALT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_ENTROPY_HARDWARE_ALT );
- return( 0 );
- }
-#endif /* MBEDTLS_ENTROPY_HARDWARE_ALT */
-
-#if defined(MBEDTLS_AES_ROM_TABLES)
- if( strcmp( "MBEDTLS_AES_ROM_TABLES", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_AES_ROM_TABLES );
- return( 0 );
- }
-#endif /* MBEDTLS_AES_ROM_TABLES */
-
-#if defined(MBEDTLS_AES_FEWER_TABLES)
- if( strcmp( "MBEDTLS_AES_FEWER_TABLES", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_AES_FEWER_TABLES );
- return( 0 );
- }
-#endif /* MBEDTLS_AES_FEWER_TABLES */
-
-#if defined(MBEDTLS_CAMELLIA_SMALL_MEMORY)
- if( strcmp( "MBEDTLS_CAMELLIA_SMALL_MEMORY", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_CAMELLIA_SMALL_MEMORY );
- return( 0 );
- }
-#endif /* MBEDTLS_CAMELLIA_SMALL_MEMORY */
-
-#if defined(MBEDTLS_CIPHER_MODE_CBC)
- if( strcmp( "MBEDTLS_CIPHER_MODE_CBC", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_CIPHER_MODE_CBC );
- return( 0 );
- }
-#endif /* MBEDTLS_CIPHER_MODE_CBC */
-
-#if defined(MBEDTLS_CIPHER_MODE_CFB)
- if( strcmp( "MBEDTLS_CIPHER_MODE_CFB", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_CIPHER_MODE_CFB );
- return( 0 );
- }
-#endif /* MBEDTLS_CIPHER_MODE_CFB */
-
-#if defined(MBEDTLS_CIPHER_MODE_CTR)
- if( strcmp( "MBEDTLS_CIPHER_MODE_CTR", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_CIPHER_MODE_CTR );
- return( 0 );
- }
-#endif /* MBEDTLS_CIPHER_MODE_CTR */
-
-#if defined(MBEDTLS_CIPHER_MODE_OFB)
- if( strcmp( "MBEDTLS_CIPHER_MODE_OFB", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_CIPHER_MODE_OFB );
- return( 0 );
- }
-#endif /* MBEDTLS_CIPHER_MODE_OFB */
-
-#if defined(MBEDTLS_CIPHER_MODE_XTS)
- if( strcmp( "MBEDTLS_CIPHER_MODE_XTS", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_CIPHER_MODE_XTS );
- return( 0 );
- }
-#endif /* MBEDTLS_CIPHER_MODE_XTS */
-
-#if defined(MBEDTLS_CIPHER_NULL_CIPHER)
- if( strcmp( "MBEDTLS_CIPHER_NULL_CIPHER", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_CIPHER_NULL_CIPHER );
- return( 0 );
- }
-#endif /* MBEDTLS_CIPHER_NULL_CIPHER */
-
-#if defined(MBEDTLS_CIPHER_PADDING_PKCS7)
- if( strcmp( "MBEDTLS_CIPHER_PADDING_PKCS7", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_CIPHER_PADDING_PKCS7 );
- return( 0 );
- }
-#endif /* MBEDTLS_CIPHER_PADDING_PKCS7 */
-
-#if defined(MBEDTLS_CIPHER_PADDING_ONE_AND_ZEROS)
- if( strcmp( "MBEDTLS_CIPHER_PADDING_ONE_AND_ZEROS", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_CIPHER_PADDING_ONE_AND_ZEROS );
- return( 0 );
- }
-#endif /* MBEDTLS_CIPHER_PADDING_ONE_AND_ZEROS */
-
-#if defined(MBEDTLS_CIPHER_PADDING_ZEROS_AND_LEN)
- if( strcmp( "MBEDTLS_CIPHER_PADDING_ZEROS_AND_LEN", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_CIPHER_PADDING_ZEROS_AND_LEN );
- return( 0 );
- }
-#endif /* MBEDTLS_CIPHER_PADDING_ZEROS_AND_LEN */
-
-#if defined(MBEDTLS_CIPHER_PADDING_ZEROS)
- if( strcmp( "MBEDTLS_CIPHER_PADDING_ZEROS", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_CIPHER_PADDING_ZEROS );
- return( 0 );
- }
-#endif /* MBEDTLS_CIPHER_PADDING_ZEROS */
-
-#if defined(MBEDTLS_CTR_DRBG_USE_128_BIT_KEY)
- if( strcmp( "MBEDTLS_CTR_DRBG_USE_128_BIT_KEY", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_CTR_DRBG_USE_128_BIT_KEY );
- return( 0 );
- }
-#endif /* MBEDTLS_CTR_DRBG_USE_128_BIT_KEY */
-
-#if defined(MBEDTLS_ENABLE_WEAK_CIPHERSUITES)
- if( strcmp( "MBEDTLS_ENABLE_WEAK_CIPHERSUITES", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_ENABLE_WEAK_CIPHERSUITES );
- return( 0 );
- }
-#endif /* MBEDTLS_ENABLE_WEAK_CIPHERSUITES */
-
-#if defined(MBEDTLS_REMOVE_ARC4_CIPHERSUITES)
- if( strcmp( "MBEDTLS_REMOVE_ARC4_CIPHERSUITES", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_REMOVE_ARC4_CIPHERSUITES );
- return( 0 );
- }
-#endif /* MBEDTLS_REMOVE_ARC4_CIPHERSUITES */
-
-#if defined(MBEDTLS_REMOVE_3DES_CIPHERSUITES)
- if( strcmp( "MBEDTLS_REMOVE_3DES_CIPHERSUITES", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_REMOVE_3DES_CIPHERSUITES );
- return( 0 );
- }
-#endif /* MBEDTLS_REMOVE_3DES_CIPHERSUITES */
-
-#if defined(MBEDTLS_ECP_DP_SECP192R1_ENABLED)
- if( strcmp( "MBEDTLS_ECP_DP_SECP192R1_ENABLED", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_ECP_DP_SECP192R1_ENABLED );
- return( 0 );
- }
-#endif /* MBEDTLS_ECP_DP_SECP192R1_ENABLED */
-
-#if defined(MBEDTLS_ECP_DP_SECP224R1_ENABLED)
- if( strcmp( "MBEDTLS_ECP_DP_SECP224R1_ENABLED", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_ECP_DP_SECP224R1_ENABLED );
- return( 0 );
- }
-#endif /* MBEDTLS_ECP_DP_SECP224R1_ENABLED */
-
-#if defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED)
- if( strcmp( "MBEDTLS_ECP_DP_SECP256R1_ENABLED", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_ECP_DP_SECP256R1_ENABLED );
- return( 0 );
- }
-#endif /* MBEDTLS_ECP_DP_SECP256R1_ENABLED */
-
-#if defined(MBEDTLS_ECP_DP_SECP384R1_ENABLED)
- if( strcmp( "MBEDTLS_ECP_DP_SECP384R1_ENABLED", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_ECP_DP_SECP384R1_ENABLED );
- return( 0 );
- }
-#endif /* MBEDTLS_ECP_DP_SECP384R1_ENABLED */
-
-#if defined(MBEDTLS_ECP_DP_SECP521R1_ENABLED)
- if( strcmp( "MBEDTLS_ECP_DP_SECP521R1_ENABLED", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_ECP_DP_SECP521R1_ENABLED );
- return( 0 );
- }
-#endif /* MBEDTLS_ECP_DP_SECP521R1_ENABLED */
-
-#if defined(MBEDTLS_ECP_DP_SECP192K1_ENABLED)
- if( strcmp( "MBEDTLS_ECP_DP_SECP192K1_ENABLED", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_ECP_DP_SECP192K1_ENABLED );
- return( 0 );
- }
-#endif /* MBEDTLS_ECP_DP_SECP192K1_ENABLED */
-
-#if defined(MBEDTLS_ECP_DP_SECP224K1_ENABLED)
- if( strcmp( "MBEDTLS_ECP_DP_SECP224K1_ENABLED", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_ECP_DP_SECP224K1_ENABLED );
- return( 0 );
- }
-#endif /* MBEDTLS_ECP_DP_SECP224K1_ENABLED */
-
-#if defined(MBEDTLS_ECP_DP_SECP256K1_ENABLED)
- if( strcmp( "MBEDTLS_ECP_DP_SECP256K1_ENABLED", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_ECP_DP_SECP256K1_ENABLED );
- return( 0 );
- }
-#endif /* MBEDTLS_ECP_DP_SECP256K1_ENABLED */
-
-#if defined(MBEDTLS_ECP_DP_BP256R1_ENABLED)
- if( strcmp( "MBEDTLS_ECP_DP_BP256R1_ENABLED", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_ECP_DP_BP256R1_ENABLED );
- return( 0 );
- }
-#endif /* MBEDTLS_ECP_DP_BP256R1_ENABLED */
-
-#if defined(MBEDTLS_ECP_DP_BP384R1_ENABLED)
- if( strcmp( "MBEDTLS_ECP_DP_BP384R1_ENABLED", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_ECP_DP_BP384R1_ENABLED );
- return( 0 );
- }
-#endif /* MBEDTLS_ECP_DP_BP384R1_ENABLED */
-
-#if defined(MBEDTLS_ECP_DP_BP512R1_ENABLED)
- if( strcmp( "MBEDTLS_ECP_DP_BP512R1_ENABLED", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_ECP_DP_BP512R1_ENABLED );
- return( 0 );
- }
-#endif /* MBEDTLS_ECP_DP_BP512R1_ENABLED */
-
-#if defined(MBEDTLS_ECP_DP_CURVE25519_ENABLED)
- if( strcmp( "MBEDTLS_ECP_DP_CURVE25519_ENABLED", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_ECP_DP_CURVE25519_ENABLED );
- return( 0 );
- }
-#endif /* MBEDTLS_ECP_DP_CURVE25519_ENABLED */
-
-#if defined(MBEDTLS_ECP_DP_CURVE448_ENABLED)
- if( strcmp( "MBEDTLS_ECP_DP_CURVE448_ENABLED", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_ECP_DP_CURVE448_ENABLED );
- return( 0 );
- }
-#endif /* MBEDTLS_ECP_DP_CURVE448_ENABLED */
-
-#if defined(MBEDTLS_ECP_NIST_OPTIM)
- if( strcmp( "MBEDTLS_ECP_NIST_OPTIM", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_ECP_NIST_OPTIM );
- return( 0 );
- }
-#endif /* MBEDTLS_ECP_NIST_OPTIM */
-
-#if defined(MBEDTLS_ECP_NO_INTERNAL_RNG)
- if( strcmp( "MBEDTLS_ECP_NO_INTERNAL_RNG", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_ECP_NO_INTERNAL_RNG );
- return( 0 );
- }
-#endif /* MBEDTLS_ECP_NO_INTERNAL_RNG */
-
-#if defined(MBEDTLS_ECP_RESTARTABLE)
- if( strcmp( "MBEDTLS_ECP_RESTARTABLE", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_ECP_RESTARTABLE );
- return( 0 );
- }
-#endif /* MBEDTLS_ECP_RESTARTABLE */
-
-#if defined(MBEDTLS_ECDH_LEGACY_CONTEXT)
- if( strcmp( "MBEDTLS_ECDH_LEGACY_CONTEXT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_ECDH_LEGACY_CONTEXT );
- return( 0 );
- }
-#endif /* MBEDTLS_ECDH_LEGACY_CONTEXT */
-
-#if defined(MBEDTLS_ECDSA_DETERMINISTIC)
- if( strcmp( "MBEDTLS_ECDSA_DETERMINISTIC", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_ECDSA_DETERMINISTIC );
- return( 0 );
- }
-#endif /* MBEDTLS_ECDSA_DETERMINISTIC */
-
-#if defined(MBEDTLS_KEY_EXCHANGE_PSK_ENABLED)
- if( strcmp( "MBEDTLS_KEY_EXCHANGE_PSK_ENABLED", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_KEY_EXCHANGE_PSK_ENABLED );
- return( 0 );
- }
-#endif /* MBEDTLS_KEY_EXCHANGE_PSK_ENABLED */
-
-#if defined(MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED)
- if( strcmp( "MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED );
- return( 0 );
- }
-#endif /* MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED */
-
-#if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED)
- if( strcmp( "MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED );
- return( 0 );
- }
-#endif /* MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED */
-
-#if defined(MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED)
- if( strcmp( "MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED );
- return( 0 );
- }
-#endif /* MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED */
-
-#if defined(MBEDTLS_KEY_EXCHANGE_RSA_ENABLED)
- if( strcmp( "MBEDTLS_KEY_EXCHANGE_RSA_ENABLED", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_KEY_EXCHANGE_RSA_ENABLED );
- return( 0 );
- }
-#endif /* MBEDTLS_KEY_EXCHANGE_RSA_ENABLED */
-
-#if defined(MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED)
- if( strcmp( "MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED );
- return( 0 );
- }
-#endif /* MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED */
-
-#if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED)
- if( strcmp( "MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED );
- return( 0 );
- }
-#endif /* MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED */
-
-#if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED)
- if( strcmp( "MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED );
- return( 0 );
- }
-#endif /* MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED */
-
-#if defined(MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED)
- if( strcmp( "MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED );
- return( 0 );
- }
-#endif /* MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED */
-
-#if defined(MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED)
- if( strcmp( "MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED );
- return( 0 );
- }
-#endif /* MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED */
-
-#if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)
- if( strcmp( "MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED );
- return( 0 );
- }
-#endif /* MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED */
-
-#if defined(MBEDTLS_PK_PARSE_EC_EXTENDED)
- if( strcmp( "MBEDTLS_PK_PARSE_EC_EXTENDED", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_PK_PARSE_EC_EXTENDED );
- return( 0 );
- }
-#endif /* MBEDTLS_PK_PARSE_EC_EXTENDED */
-
-#if defined(MBEDTLS_ERROR_STRERROR_DUMMY)
- if( strcmp( "MBEDTLS_ERROR_STRERROR_DUMMY", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_ERROR_STRERROR_DUMMY );
- return( 0 );
- }
-#endif /* MBEDTLS_ERROR_STRERROR_DUMMY */
-
-#if defined(MBEDTLS_GENPRIME)
- if( strcmp( "MBEDTLS_GENPRIME", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_GENPRIME );
- return( 0 );
- }
-#endif /* MBEDTLS_GENPRIME */
-
-#if defined(MBEDTLS_FS_IO)
- if( strcmp( "MBEDTLS_FS_IO", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_FS_IO );
- return( 0 );
- }
-#endif /* MBEDTLS_FS_IO */
-
-#if defined(MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES)
- if( strcmp( "MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES );
- return( 0 );
- }
-#endif /* MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES */
-
-#if defined(MBEDTLS_NO_PLATFORM_ENTROPY)
- if( strcmp( "MBEDTLS_NO_PLATFORM_ENTROPY", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_NO_PLATFORM_ENTROPY );
- return( 0 );
- }
-#endif /* MBEDTLS_NO_PLATFORM_ENTROPY */
-
-#if defined(MBEDTLS_ENTROPY_FORCE_SHA256)
- if( strcmp( "MBEDTLS_ENTROPY_FORCE_SHA256", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_ENTROPY_FORCE_SHA256 );
- return( 0 );
- }
-#endif /* MBEDTLS_ENTROPY_FORCE_SHA256 */
-
-#if defined(MBEDTLS_ENTROPY_NV_SEED)
- if( strcmp( "MBEDTLS_ENTROPY_NV_SEED", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_ENTROPY_NV_SEED );
- return( 0 );
- }
-#endif /* MBEDTLS_ENTROPY_NV_SEED */
-
-#if defined(MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER)
- if( strcmp( "MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER );
- return( 0 );
- }
-#endif /* MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER */
-
-#if defined(MBEDTLS_MEMORY_DEBUG)
- if( strcmp( "MBEDTLS_MEMORY_DEBUG", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_MEMORY_DEBUG );
- return( 0 );
- }
-#endif /* MBEDTLS_MEMORY_DEBUG */
-
-#if defined(MBEDTLS_MEMORY_BACKTRACE)
- if( strcmp( "MBEDTLS_MEMORY_BACKTRACE", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_MEMORY_BACKTRACE );
- return( 0 );
- }
-#endif /* MBEDTLS_MEMORY_BACKTRACE */
-
-#if defined(MBEDTLS_PK_RSA_ALT_SUPPORT)
- if( strcmp( "MBEDTLS_PK_RSA_ALT_SUPPORT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_PK_RSA_ALT_SUPPORT );
- return( 0 );
- }
-#endif /* MBEDTLS_PK_RSA_ALT_SUPPORT */
-
-#if defined(MBEDTLS_PKCS1_V15)
- if( strcmp( "MBEDTLS_PKCS1_V15", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_PKCS1_V15 );
- return( 0 );
- }
-#endif /* MBEDTLS_PKCS1_V15 */
-
-#if defined(MBEDTLS_PKCS1_V21)
- if( strcmp( "MBEDTLS_PKCS1_V21", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_PKCS1_V21 );
- return( 0 );
- }
-#endif /* MBEDTLS_PKCS1_V21 */
-
-#if defined(MBEDTLS_PSA_CRYPTO_BUILTIN_KEYS)
- if( strcmp( "MBEDTLS_PSA_CRYPTO_BUILTIN_KEYS", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_PSA_CRYPTO_BUILTIN_KEYS );
- return( 0 );
- }
-#endif /* MBEDTLS_PSA_CRYPTO_BUILTIN_KEYS */
-
-#if defined(MBEDTLS_PSA_CRYPTO_CLIENT)
- if( strcmp( "MBEDTLS_PSA_CRYPTO_CLIENT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_PSA_CRYPTO_CLIENT );
- return( 0 );
- }
-#endif /* MBEDTLS_PSA_CRYPTO_CLIENT */
-
-#if defined(MBEDTLS_PSA_CRYPTO_DRIVERS)
- if( strcmp( "MBEDTLS_PSA_CRYPTO_DRIVERS", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_PSA_CRYPTO_DRIVERS );
- return( 0 );
- }
-#endif /* MBEDTLS_PSA_CRYPTO_DRIVERS */
-
-#if defined(MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG)
- if( strcmp( "MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG );
- return( 0 );
- }
-#endif /* MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG */
-
-#if defined(MBEDTLS_PSA_CRYPTO_SPM)
- if( strcmp( "MBEDTLS_PSA_CRYPTO_SPM", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_PSA_CRYPTO_SPM );
- return( 0 );
- }
-#endif /* MBEDTLS_PSA_CRYPTO_SPM */
-
-#if defined(MBEDTLS_PSA_INJECT_ENTROPY)
- if( strcmp( "MBEDTLS_PSA_INJECT_ENTROPY", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_PSA_INJECT_ENTROPY );
- return( 0 );
- }
-#endif /* MBEDTLS_PSA_INJECT_ENTROPY */
-
-#if defined(MBEDTLS_RSA_NO_CRT)
- if( strcmp( "MBEDTLS_RSA_NO_CRT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_RSA_NO_CRT );
- return( 0 );
- }
-#endif /* MBEDTLS_RSA_NO_CRT */
-
-#if defined(MBEDTLS_SELF_TEST)
- if( strcmp( "MBEDTLS_SELF_TEST", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_SELF_TEST );
- return( 0 );
- }
-#endif /* MBEDTLS_SELF_TEST */
-
-#if defined(MBEDTLS_SHA256_SMALLER)
- if( strcmp( "MBEDTLS_SHA256_SMALLER", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_SHA256_SMALLER );
- return( 0 );
- }
-#endif /* MBEDTLS_SHA256_SMALLER */
-
-#if defined(MBEDTLS_SHA512_SMALLER)
- if( strcmp( "MBEDTLS_SHA512_SMALLER", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_SHA512_SMALLER );
- return( 0 );
- }
-#endif /* MBEDTLS_SHA512_SMALLER */
-
-#if defined(MBEDTLS_SHA512_NO_SHA384)
- if( strcmp( "MBEDTLS_SHA512_NO_SHA384", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_SHA512_NO_SHA384 );
- return( 0 );
- }
-#endif /* MBEDTLS_SHA512_NO_SHA384 */
-
-#if defined(MBEDTLS_SSL_ALL_ALERT_MESSAGES)
- if( strcmp( "MBEDTLS_SSL_ALL_ALERT_MESSAGES", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_SSL_ALL_ALERT_MESSAGES );
- return( 0 );
- }
-#endif /* MBEDTLS_SSL_ALL_ALERT_MESSAGES */
-
-#if defined(MBEDTLS_SSL_RECORD_CHECKING)
- if( strcmp( "MBEDTLS_SSL_RECORD_CHECKING", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_SSL_RECORD_CHECKING );
- return( 0 );
- }
-#endif /* MBEDTLS_SSL_RECORD_CHECKING */
-
-#if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID)
- if( strcmp( "MBEDTLS_SSL_DTLS_CONNECTION_ID", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_SSL_DTLS_CONNECTION_ID );
- return( 0 );
- }
-#endif /* MBEDTLS_SSL_DTLS_CONNECTION_ID */
-
-#if defined(MBEDTLS_SSL_ASYNC_PRIVATE)
- if( strcmp( "MBEDTLS_SSL_ASYNC_PRIVATE", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_SSL_ASYNC_PRIVATE );
- return( 0 );
- }
-#endif /* MBEDTLS_SSL_ASYNC_PRIVATE */
-
-#if defined(MBEDTLS_SSL_CONTEXT_SERIALIZATION)
- if( strcmp( "MBEDTLS_SSL_CONTEXT_SERIALIZATION", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_SSL_CONTEXT_SERIALIZATION );
- return( 0 );
- }
-#endif /* MBEDTLS_SSL_CONTEXT_SERIALIZATION */
-
-#if defined(MBEDTLS_SSL_DEBUG_ALL)
- if( strcmp( "MBEDTLS_SSL_DEBUG_ALL", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_SSL_DEBUG_ALL );
- return( 0 );
- }
-#endif /* MBEDTLS_SSL_DEBUG_ALL */
-
-#if defined(MBEDTLS_SSL_ENCRYPT_THEN_MAC)
- if( strcmp( "MBEDTLS_SSL_ENCRYPT_THEN_MAC", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_SSL_ENCRYPT_THEN_MAC );
- return( 0 );
- }
-#endif /* MBEDTLS_SSL_ENCRYPT_THEN_MAC */
-
-#if defined(MBEDTLS_SSL_EXTENDED_MASTER_SECRET)
- if( strcmp( "MBEDTLS_SSL_EXTENDED_MASTER_SECRET", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_SSL_EXTENDED_MASTER_SECRET );
- return( 0 );
- }
-#endif /* MBEDTLS_SSL_EXTENDED_MASTER_SECRET */
-
-#if defined(MBEDTLS_SSL_FALLBACK_SCSV)
- if( strcmp( "MBEDTLS_SSL_FALLBACK_SCSV", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_SSL_FALLBACK_SCSV );
- return( 0 );
- }
-#endif /* MBEDTLS_SSL_FALLBACK_SCSV */
-
-#if defined(MBEDTLS_SSL_KEEP_PEER_CERTIFICATE)
- if( strcmp( "MBEDTLS_SSL_KEEP_PEER_CERTIFICATE", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_SSL_KEEP_PEER_CERTIFICATE );
- return( 0 );
- }
-#endif /* MBEDTLS_SSL_KEEP_PEER_CERTIFICATE */
-
-#if defined(MBEDTLS_SSL_HW_RECORD_ACCEL)
- if( strcmp( "MBEDTLS_SSL_HW_RECORD_ACCEL", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_SSL_HW_RECORD_ACCEL );
- return( 0 );
- }
-#endif /* MBEDTLS_SSL_HW_RECORD_ACCEL */
-
-#if defined(MBEDTLS_SSL_CBC_RECORD_SPLITTING)
- if( strcmp( "MBEDTLS_SSL_CBC_RECORD_SPLITTING", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_SSL_CBC_RECORD_SPLITTING );
- return( 0 );
- }
-#endif /* MBEDTLS_SSL_CBC_RECORD_SPLITTING */
-
-#if defined(MBEDTLS_SSL_RENEGOTIATION)
- if( strcmp( "MBEDTLS_SSL_RENEGOTIATION", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_SSL_RENEGOTIATION );
- return( 0 );
- }
-#endif /* MBEDTLS_SSL_RENEGOTIATION */
-
-#if defined(MBEDTLS_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO)
- if( strcmp( "MBEDTLS_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO );
- return( 0 );
- }
-#endif /* MBEDTLS_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO */
-
-#if defined(MBEDTLS_SSL_SRV_RESPECT_CLIENT_PREFERENCE)
- if( strcmp( "MBEDTLS_SSL_SRV_RESPECT_CLIENT_PREFERENCE", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_SSL_SRV_RESPECT_CLIENT_PREFERENCE );
- return( 0 );
- }
-#endif /* MBEDTLS_SSL_SRV_RESPECT_CLIENT_PREFERENCE */
-
-#if defined(MBEDTLS_SSL_MAX_FRAGMENT_LENGTH)
- if( strcmp( "MBEDTLS_SSL_MAX_FRAGMENT_LENGTH", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_SSL_MAX_FRAGMENT_LENGTH );
- return( 0 );
- }
-#endif /* MBEDTLS_SSL_MAX_FRAGMENT_LENGTH */
-
-#if defined(MBEDTLS_SSL_PROTO_SSL3)
- if( strcmp( "MBEDTLS_SSL_PROTO_SSL3", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_SSL_PROTO_SSL3 );
- return( 0 );
- }
-#endif /* MBEDTLS_SSL_PROTO_SSL3 */
-
-#if defined(MBEDTLS_SSL_PROTO_TLS1)
- if( strcmp( "MBEDTLS_SSL_PROTO_TLS1", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_SSL_PROTO_TLS1 );
- return( 0 );
- }
-#endif /* MBEDTLS_SSL_PROTO_TLS1 */
-
-#if defined(MBEDTLS_SSL_PROTO_TLS1_1)
- if( strcmp( "MBEDTLS_SSL_PROTO_TLS1_1", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_SSL_PROTO_TLS1_1 );
- return( 0 );
- }
-#endif /* MBEDTLS_SSL_PROTO_TLS1_1 */
-
-#if defined(MBEDTLS_SSL_PROTO_TLS1_2)
- if( strcmp( "MBEDTLS_SSL_PROTO_TLS1_2", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_SSL_PROTO_TLS1_2 );
- return( 0 );
- }
-#endif /* MBEDTLS_SSL_PROTO_TLS1_2 */
-
-#if defined(MBEDTLS_SSL_PROTO_TLS1_3_EXPERIMENTAL)
- if( strcmp( "MBEDTLS_SSL_PROTO_TLS1_3_EXPERIMENTAL", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_SSL_PROTO_TLS1_3_EXPERIMENTAL );
- return( 0 );
- }
-#endif /* MBEDTLS_SSL_PROTO_TLS1_3_EXPERIMENTAL */
-
-#if defined(MBEDTLS_SSL_PROTO_DTLS)
- if( strcmp( "MBEDTLS_SSL_PROTO_DTLS", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_SSL_PROTO_DTLS );
- return( 0 );
- }
-#endif /* MBEDTLS_SSL_PROTO_DTLS */
-
-#if defined(MBEDTLS_SSL_ALPN)
- if( strcmp( "MBEDTLS_SSL_ALPN", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_SSL_ALPN );
- return( 0 );
- }
-#endif /* MBEDTLS_SSL_ALPN */
-
-#if defined(MBEDTLS_SSL_DTLS_ANTI_REPLAY)
- if( strcmp( "MBEDTLS_SSL_DTLS_ANTI_REPLAY", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_SSL_DTLS_ANTI_REPLAY );
- return( 0 );
- }
-#endif /* MBEDTLS_SSL_DTLS_ANTI_REPLAY */
-
-#if defined(MBEDTLS_SSL_DTLS_HELLO_VERIFY)
- if( strcmp( "MBEDTLS_SSL_DTLS_HELLO_VERIFY", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_SSL_DTLS_HELLO_VERIFY );
- return( 0 );
- }
-#endif /* MBEDTLS_SSL_DTLS_HELLO_VERIFY */
-
-#if defined(MBEDTLS_SSL_DTLS_SRTP)
- if( strcmp( "MBEDTLS_SSL_DTLS_SRTP", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_SSL_DTLS_SRTP );
- return( 0 );
- }
-#endif /* MBEDTLS_SSL_DTLS_SRTP */
-
-#if defined(MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE)
- if( strcmp( "MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE );
- return( 0 );
- }
-#endif /* MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE */
-
-#if defined(MBEDTLS_SSL_DTLS_BADMAC_LIMIT)
- if( strcmp( "MBEDTLS_SSL_DTLS_BADMAC_LIMIT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_SSL_DTLS_BADMAC_LIMIT );
- return( 0 );
- }
-#endif /* MBEDTLS_SSL_DTLS_BADMAC_LIMIT */
-
-#if defined(MBEDTLS_SSL_SESSION_TICKETS)
- if( strcmp( "MBEDTLS_SSL_SESSION_TICKETS", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_SSL_SESSION_TICKETS );
- return( 0 );
- }
-#endif /* MBEDTLS_SSL_SESSION_TICKETS */
-
-#if defined(MBEDTLS_SSL_EXPORT_KEYS)
- if( strcmp( "MBEDTLS_SSL_EXPORT_KEYS", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_SSL_EXPORT_KEYS );
- return( 0 );
- }
-#endif /* MBEDTLS_SSL_EXPORT_KEYS */
-
-#if defined(MBEDTLS_SSL_SERVER_NAME_INDICATION)
- if( strcmp( "MBEDTLS_SSL_SERVER_NAME_INDICATION", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_SSL_SERVER_NAME_INDICATION );
- return( 0 );
- }
-#endif /* MBEDTLS_SSL_SERVER_NAME_INDICATION */
-
-#if defined(MBEDTLS_SSL_TRUNCATED_HMAC)
- if( strcmp( "MBEDTLS_SSL_TRUNCATED_HMAC", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_SSL_TRUNCATED_HMAC );
- return( 0 );
- }
-#endif /* MBEDTLS_SSL_TRUNCATED_HMAC */
-
-#if defined(MBEDTLS_SSL_TRUNCATED_HMAC_COMPAT)
- if( strcmp( "MBEDTLS_SSL_TRUNCATED_HMAC_COMPAT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_SSL_TRUNCATED_HMAC_COMPAT );
- return( 0 );
- }
-#endif /* MBEDTLS_SSL_TRUNCATED_HMAC_COMPAT */
-
-#if defined(MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH)
- if( strcmp( "MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH );
- return( 0 );
- }
-#endif /* MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH */
-
-#if defined(MBEDTLS_TEST_CONSTANT_FLOW_MEMSAN)
- if( strcmp( "MBEDTLS_TEST_CONSTANT_FLOW_MEMSAN", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_TEST_CONSTANT_FLOW_MEMSAN );
- return( 0 );
- }
-#endif /* MBEDTLS_TEST_CONSTANT_FLOW_MEMSAN */
-
-#if defined(MBEDTLS_TEST_CONSTANT_FLOW_VALGRIND)
- if( strcmp( "MBEDTLS_TEST_CONSTANT_FLOW_VALGRIND", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_TEST_CONSTANT_FLOW_VALGRIND );
- return( 0 );
- }
-#endif /* MBEDTLS_TEST_CONSTANT_FLOW_VALGRIND */
-
-#if defined(MBEDTLS_TEST_HOOKS)
- if( strcmp( "MBEDTLS_TEST_HOOKS", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_TEST_HOOKS );
- return( 0 );
- }
-#endif /* MBEDTLS_TEST_HOOKS */
-
-#if defined(MBEDTLS_THREADING_ALT)
- if( strcmp( "MBEDTLS_THREADING_ALT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_THREADING_ALT );
- return( 0 );
- }
-#endif /* MBEDTLS_THREADING_ALT */
-
-#if defined(MBEDTLS_THREADING_PTHREAD)
- if( strcmp( "MBEDTLS_THREADING_PTHREAD", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_THREADING_PTHREAD );
- return( 0 );
- }
-#endif /* MBEDTLS_THREADING_PTHREAD */
-
-#if defined(MBEDTLS_USE_PSA_CRYPTO)
- if( strcmp( "MBEDTLS_USE_PSA_CRYPTO", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_USE_PSA_CRYPTO );
- return( 0 );
- }
-#endif /* MBEDTLS_USE_PSA_CRYPTO */
-
-#if defined(MBEDTLS_PSA_CRYPTO_CONFIG)
- if( strcmp( "MBEDTLS_PSA_CRYPTO_CONFIG", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_PSA_CRYPTO_CONFIG );
- return( 0 );
- }
-#endif /* MBEDTLS_PSA_CRYPTO_CONFIG */
-
-#if defined(MBEDTLS_VERSION_FEATURES)
- if( strcmp( "MBEDTLS_VERSION_FEATURES", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_VERSION_FEATURES );
- return( 0 );
- }
-#endif /* MBEDTLS_VERSION_FEATURES */
-
-#if defined(MBEDTLS_X509_ALLOW_EXTENSIONS_NON_V3)
- if( strcmp( "MBEDTLS_X509_ALLOW_EXTENSIONS_NON_V3", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_X509_ALLOW_EXTENSIONS_NON_V3 );
- return( 0 );
- }
-#endif /* MBEDTLS_X509_ALLOW_EXTENSIONS_NON_V3 */
-
-#if defined(MBEDTLS_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION)
- if( strcmp( "MBEDTLS_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION );
- return( 0 );
- }
-#endif /* MBEDTLS_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION */
-
-#if defined(MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK)
- if( strcmp( "MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK );
- return( 0 );
- }
-#endif /* MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK */
-
-#if defined(MBEDTLS_X509_CHECK_KEY_USAGE)
- if( strcmp( "MBEDTLS_X509_CHECK_KEY_USAGE", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_X509_CHECK_KEY_USAGE );
- return( 0 );
- }
-#endif /* MBEDTLS_X509_CHECK_KEY_USAGE */
-
-#if defined(MBEDTLS_X509_CHECK_EXTENDED_KEY_USAGE)
- if( strcmp( "MBEDTLS_X509_CHECK_EXTENDED_KEY_USAGE", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_X509_CHECK_EXTENDED_KEY_USAGE );
- return( 0 );
- }
-#endif /* MBEDTLS_X509_CHECK_EXTENDED_KEY_USAGE */
-
-#if defined(MBEDTLS_X509_RSASSA_PSS_SUPPORT)
- if( strcmp( "MBEDTLS_X509_RSASSA_PSS_SUPPORT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_X509_RSASSA_PSS_SUPPORT );
- return( 0 );
- }
-#endif /* MBEDTLS_X509_RSASSA_PSS_SUPPORT */
-
-#if defined(MBEDTLS_ZLIB_SUPPORT)
- if( strcmp( "MBEDTLS_ZLIB_SUPPORT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_ZLIB_SUPPORT );
- return( 0 );
- }
-#endif /* MBEDTLS_ZLIB_SUPPORT */
-
-#if defined(MBEDTLS_AESNI_C)
- if( strcmp( "MBEDTLS_AESNI_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_AESNI_C );
- return( 0 );
- }
-#endif /* MBEDTLS_AESNI_C */
-
-#if defined(MBEDTLS_AES_C)
- if( strcmp( "MBEDTLS_AES_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_AES_C );
- return( 0 );
- }
-#endif /* MBEDTLS_AES_C */
-
-#if defined(MBEDTLS_ARC4_C)
- if( strcmp( "MBEDTLS_ARC4_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_ARC4_C );
- return( 0 );
- }
-#endif /* MBEDTLS_ARC4_C */
-
-#if defined(MBEDTLS_ASN1_PARSE_C)
- if( strcmp( "MBEDTLS_ASN1_PARSE_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_ASN1_PARSE_C );
- return( 0 );
- }
-#endif /* MBEDTLS_ASN1_PARSE_C */
-
-#if defined(MBEDTLS_ASN1_WRITE_C)
- if( strcmp( "MBEDTLS_ASN1_WRITE_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_ASN1_WRITE_C );
- return( 0 );
- }
-#endif /* MBEDTLS_ASN1_WRITE_C */
-
-#if defined(MBEDTLS_BASE64_C)
- if( strcmp( "MBEDTLS_BASE64_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_BASE64_C );
- return( 0 );
- }
-#endif /* MBEDTLS_BASE64_C */
-
-#if defined(MBEDTLS_BIGNUM_C)
- if( strcmp( "MBEDTLS_BIGNUM_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_BIGNUM_C );
- return( 0 );
- }
-#endif /* MBEDTLS_BIGNUM_C */
-
-#if defined(MBEDTLS_BLOWFISH_C)
- if( strcmp( "MBEDTLS_BLOWFISH_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_BLOWFISH_C );
- return( 0 );
- }
-#endif /* MBEDTLS_BLOWFISH_C */
-
-#if defined(MBEDTLS_CAMELLIA_C)
- if( strcmp( "MBEDTLS_CAMELLIA_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_CAMELLIA_C );
- return( 0 );
- }
-#endif /* MBEDTLS_CAMELLIA_C */
-
-#if defined(MBEDTLS_ARIA_C)
- if( strcmp( "MBEDTLS_ARIA_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_ARIA_C );
- return( 0 );
- }
-#endif /* MBEDTLS_ARIA_C */
-
-#if defined(MBEDTLS_CCM_C)
- if( strcmp( "MBEDTLS_CCM_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_CCM_C );
- return( 0 );
- }
-#endif /* MBEDTLS_CCM_C */
-
-#if defined(MBEDTLS_CERTS_C)
- if( strcmp( "MBEDTLS_CERTS_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_CERTS_C );
- return( 0 );
- }
-#endif /* MBEDTLS_CERTS_C */
-
-#if defined(MBEDTLS_CHACHA20_C)
- if( strcmp( "MBEDTLS_CHACHA20_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_CHACHA20_C );
- return( 0 );
- }
-#endif /* MBEDTLS_CHACHA20_C */
-
-#if defined(MBEDTLS_CHACHAPOLY_C)
- if( strcmp( "MBEDTLS_CHACHAPOLY_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_CHACHAPOLY_C );
- return( 0 );
- }
-#endif /* MBEDTLS_CHACHAPOLY_C */
-
-#if defined(MBEDTLS_CIPHER_C)
- if( strcmp( "MBEDTLS_CIPHER_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_CIPHER_C );
- return( 0 );
- }
-#endif /* MBEDTLS_CIPHER_C */
-
-#if defined(MBEDTLS_CMAC_C)
- if( strcmp( "MBEDTLS_CMAC_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_CMAC_C );
- return( 0 );
- }
-#endif /* MBEDTLS_CMAC_C */
-
-#if defined(MBEDTLS_CTR_DRBG_C)
- if( strcmp( "MBEDTLS_CTR_DRBG_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_CTR_DRBG_C );
- return( 0 );
- }
-#endif /* MBEDTLS_CTR_DRBG_C */
-
-#if defined(MBEDTLS_DEBUG_C)
- if( strcmp( "MBEDTLS_DEBUG_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_DEBUG_C );
- return( 0 );
- }
-#endif /* MBEDTLS_DEBUG_C */
-
-#if defined(MBEDTLS_DES_C)
- if( strcmp( "MBEDTLS_DES_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_DES_C );
- return( 0 );
- }
-#endif /* MBEDTLS_DES_C */
-
-#if defined(MBEDTLS_DHM_C)
- if( strcmp( "MBEDTLS_DHM_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_DHM_C );
- return( 0 );
- }
-#endif /* MBEDTLS_DHM_C */
-
-#if defined(MBEDTLS_ECDH_C)
- if( strcmp( "MBEDTLS_ECDH_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_ECDH_C );
- return( 0 );
- }
-#endif /* MBEDTLS_ECDH_C */
-
-#if defined(MBEDTLS_ECDSA_C)
- if( strcmp( "MBEDTLS_ECDSA_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_ECDSA_C );
- return( 0 );
- }
-#endif /* MBEDTLS_ECDSA_C */
-
-#if defined(MBEDTLS_ECJPAKE_C)
- if( strcmp( "MBEDTLS_ECJPAKE_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_ECJPAKE_C );
- return( 0 );
- }
-#endif /* MBEDTLS_ECJPAKE_C */
-
-#if defined(MBEDTLS_ECP_C)
- if( strcmp( "MBEDTLS_ECP_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_ECP_C );
- return( 0 );
- }
-#endif /* MBEDTLS_ECP_C */
-
-#if defined(MBEDTLS_ENTROPY_C)
- if( strcmp( "MBEDTLS_ENTROPY_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_ENTROPY_C );
- return( 0 );
- }
-#endif /* MBEDTLS_ENTROPY_C */
-
-#if defined(MBEDTLS_ERROR_C)
- if( strcmp( "MBEDTLS_ERROR_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_ERROR_C );
- return( 0 );
- }
-#endif /* MBEDTLS_ERROR_C */
-
-#if defined(MBEDTLS_GCM_C)
- if( strcmp( "MBEDTLS_GCM_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_GCM_C );
- return( 0 );
- }
-#endif /* MBEDTLS_GCM_C */
-
-#if defined(MBEDTLS_HAVEGE_C)
- if( strcmp( "MBEDTLS_HAVEGE_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_HAVEGE_C );
- return( 0 );
- }
-#endif /* MBEDTLS_HAVEGE_C */
-
-#if defined(MBEDTLS_HKDF_C)
- if( strcmp( "MBEDTLS_HKDF_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_HKDF_C );
- return( 0 );
- }
-#endif /* MBEDTLS_HKDF_C */
-
-#if defined(MBEDTLS_HMAC_DRBG_C)
- if( strcmp( "MBEDTLS_HMAC_DRBG_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_HMAC_DRBG_C );
- return( 0 );
- }
-#endif /* MBEDTLS_HMAC_DRBG_C */
-
-#if defined(MBEDTLS_NIST_KW_C)
- if( strcmp( "MBEDTLS_NIST_KW_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_NIST_KW_C );
- return( 0 );
- }
-#endif /* MBEDTLS_NIST_KW_C */
-
-#if defined(MBEDTLS_MD_C)
- if( strcmp( "MBEDTLS_MD_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_MD_C );
- return( 0 );
- }
-#endif /* MBEDTLS_MD_C */
-
-#if defined(MBEDTLS_MD2_C)
- if( strcmp( "MBEDTLS_MD2_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_MD2_C );
- return( 0 );
- }
-#endif /* MBEDTLS_MD2_C */
-
-#if defined(MBEDTLS_MD4_C)
- if( strcmp( "MBEDTLS_MD4_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_MD4_C );
- return( 0 );
- }
-#endif /* MBEDTLS_MD4_C */
-
-#if defined(MBEDTLS_MD5_C)
- if( strcmp( "MBEDTLS_MD5_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_MD5_C );
- return( 0 );
- }
-#endif /* MBEDTLS_MD5_C */
-
-#if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C)
- if( strcmp( "MBEDTLS_MEMORY_BUFFER_ALLOC_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_MEMORY_BUFFER_ALLOC_C );
- return( 0 );
- }
-#endif /* MBEDTLS_MEMORY_BUFFER_ALLOC_C */
-
-#if defined(MBEDTLS_NET_C)
- if( strcmp( "MBEDTLS_NET_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_NET_C );
- return( 0 );
- }
-#endif /* MBEDTLS_NET_C */
-
-#if defined(MBEDTLS_OID_C)
- if( strcmp( "MBEDTLS_OID_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_OID_C );
- return( 0 );
- }
-#endif /* MBEDTLS_OID_C */
-
-#if defined(MBEDTLS_PADLOCK_C)
- if( strcmp( "MBEDTLS_PADLOCK_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_PADLOCK_C );
- return( 0 );
- }
-#endif /* MBEDTLS_PADLOCK_C */
-
-#if defined(MBEDTLS_PEM_PARSE_C)
- if( strcmp( "MBEDTLS_PEM_PARSE_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_PEM_PARSE_C );
- return( 0 );
- }
-#endif /* MBEDTLS_PEM_PARSE_C */
-
-#if defined(MBEDTLS_PEM_WRITE_C)
- if( strcmp( "MBEDTLS_PEM_WRITE_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_PEM_WRITE_C );
- return( 0 );
- }
-#endif /* MBEDTLS_PEM_WRITE_C */
-
-#if defined(MBEDTLS_PK_C)
- if( strcmp( "MBEDTLS_PK_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_PK_C );
- return( 0 );
- }
-#endif /* MBEDTLS_PK_C */
-
-#if defined(MBEDTLS_PK_PARSE_C)
- if( strcmp( "MBEDTLS_PK_PARSE_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_PK_PARSE_C );
- return( 0 );
- }
-#endif /* MBEDTLS_PK_PARSE_C */
-
-#if defined(MBEDTLS_PK_WRITE_C)
- if( strcmp( "MBEDTLS_PK_WRITE_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_PK_WRITE_C );
- return( 0 );
- }
-#endif /* MBEDTLS_PK_WRITE_C */
-
-#if defined(MBEDTLS_PKCS5_C)
- if( strcmp( "MBEDTLS_PKCS5_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_PKCS5_C );
- return( 0 );
- }
-#endif /* MBEDTLS_PKCS5_C */
-
-#if defined(MBEDTLS_PKCS11_C)
- if( strcmp( "MBEDTLS_PKCS11_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_PKCS11_C );
- return( 0 );
- }
-#endif /* MBEDTLS_PKCS11_C */
-
-#if defined(MBEDTLS_PKCS12_C)
- if( strcmp( "MBEDTLS_PKCS12_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_PKCS12_C );
- return( 0 );
- }
-#endif /* MBEDTLS_PKCS12_C */
-
-#if defined(MBEDTLS_PLATFORM_C)
- if( strcmp( "MBEDTLS_PLATFORM_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_PLATFORM_C );
- return( 0 );
- }
-#endif /* MBEDTLS_PLATFORM_C */
-
-#if defined(MBEDTLS_POLY1305_C)
- if( strcmp( "MBEDTLS_POLY1305_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_POLY1305_C );
- return( 0 );
- }
-#endif /* MBEDTLS_POLY1305_C */
-
-#if defined(MBEDTLS_PSA_CRYPTO_C)
- if( strcmp( "MBEDTLS_PSA_CRYPTO_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_PSA_CRYPTO_C );
- return( 0 );
- }
-#endif /* MBEDTLS_PSA_CRYPTO_C */
-
-#if defined(MBEDTLS_PSA_CRYPTO_SE_C)
- if( strcmp( "MBEDTLS_PSA_CRYPTO_SE_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_PSA_CRYPTO_SE_C );
- return( 0 );
- }
-#endif /* MBEDTLS_PSA_CRYPTO_SE_C */
-
-#if defined(MBEDTLS_PSA_CRYPTO_STORAGE_C)
- if( strcmp( "MBEDTLS_PSA_CRYPTO_STORAGE_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_PSA_CRYPTO_STORAGE_C );
- return( 0 );
- }
-#endif /* MBEDTLS_PSA_CRYPTO_STORAGE_C */
-
-#if defined(MBEDTLS_PSA_ITS_FILE_C)
- if( strcmp( "MBEDTLS_PSA_ITS_FILE_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_PSA_ITS_FILE_C );
- return( 0 );
- }
-#endif /* MBEDTLS_PSA_ITS_FILE_C */
-
-#if defined(MBEDTLS_RIPEMD160_C)
- if( strcmp( "MBEDTLS_RIPEMD160_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_RIPEMD160_C );
- return( 0 );
- }
-#endif /* MBEDTLS_RIPEMD160_C */
-
-#if defined(MBEDTLS_RSA_C)
- if( strcmp( "MBEDTLS_RSA_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_RSA_C );
- return( 0 );
- }
-#endif /* MBEDTLS_RSA_C */
-
-#if defined(MBEDTLS_SHA1_C)
- if( strcmp( "MBEDTLS_SHA1_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_SHA1_C );
- return( 0 );
- }
-#endif /* MBEDTLS_SHA1_C */
-
-#if defined(MBEDTLS_SHA256_C)
- if( strcmp( "MBEDTLS_SHA256_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_SHA256_C );
- return( 0 );
- }
-#endif /* MBEDTLS_SHA256_C */
-
-#if defined(MBEDTLS_SHA512_C)
- if( strcmp( "MBEDTLS_SHA512_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_SHA512_C );
- return( 0 );
- }
-#endif /* MBEDTLS_SHA512_C */
-
-#if defined(MBEDTLS_SSL_CACHE_C)
- if( strcmp( "MBEDTLS_SSL_CACHE_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_SSL_CACHE_C );
- return( 0 );
- }
-#endif /* MBEDTLS_SSL_CACHE_C */
-
-#if defined(MBEDTLS_SSL_COOKIE_C)
- if( strcmp( "MBEDTLS_SSL_COOKIE_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_SSL_COOKIE_C );
- return( 0 );
- }
-#endif /* MBEDTLS_SSL_COOKIE_C */
-
-#if defined(MBEDTLS_SSL_TICKET_C)
- if( strcmp( "MBEDTLS_SSL_TICKET_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_SSL_TICKET_C );
- return( 0 );
- }
-#endif /* MBEDTLS_SSL_TICKET_C */
-
-#if defined(MBEDTLS_SSL_CLI_C)
- if( strcmp( "MBEDTLS_SSL_CLI_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_SSL_CLI_C );
- return( 0 );
- }
-#endif /* MBEDTLS_SSL_CLI_C */
-
-#if defined(MBEDTLS_SSL_SRV_C)
- if( strcmp( "MBEDTLS_SSL_SRV_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_SSL_SRV_C );
- return( 0 );
- }
-#endif /* MBEDTLS_SSL_SRV_C */
-
-#if defined(MBEDTLS_SSL_TLS_C)
- if( strcmp( "MBEDTLS_SSL_TLS_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_SSL_TLS_C );
- return( 0 );
- }
-#endif /* MBEDTLS_SSL_TLS_C */
-
-#if defined(MBEDTLS_THREADING_C)
- if( strcmp( "MBEDTLS_THREADING_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_THREADING_C );
- return( 0 );
- }
-#endif /* MBEDTLS_THREADING_C */
-
-#if defined(MBEDTLS_TIMING_C)
- if( strcmp( "MBEDTLS_TIMING_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_TIMING_C );
- return( 0 );
- }
-#endif /* MBEDTLS_TIMING_C */
-
-#if defined(MBEDTLS_VERSION_C)
- if( strcmp( "MBEDTLS_VERSION_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_VERSION_C );
- return( 0 );
- }
-#endif /* MBEDTLS_VERSION_C */
-
-#if defined(MBEDTLS_X509_USE_C)
- if( strcmp( "MBEDTLS_X509_USE_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_X509_USE_C );
- return( 0 );
- }
-#endif /* MBEDTLS_X509_USE_C */
-
-#if defined(MBEDTLS_X509_CRT_PARSE_C)
- if( strcmp( "MBEDTLS_X509_CRT_PARSE_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_X509_CRT_PARSE_C );
- return( 0 );
- }
-#endif /* MBEDTLS_X509_CRT_PARSE_C */
-
-#if defined(MBEDTLS_X509_CRL_PARSE_C)
- if( strcmp( "MBEDTLS_X509_CRL_PARSE_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_X509_CRL_PARSE_C );
- return( 0 );
- }
-#endif /* MBEDTLS_X509_CRL_PARSE_C */
-
-#if defined(MBEDTLS_X509_CSR_PARSE_C)
- if( strcmp( "MBEDTLS_X509_CSR_PARSE_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_X509_CSR_PARSE_C );
- return( 0 );
- }
-#endif /* MBEDTLS_X509_CSR_PARSE_C */
-
-#if defined(MBEDTLS_X509_CREATE_C)
- if( strcmp( "MBEDTLS_X509_CREATE_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_X509_CREATE_C );
- return( 0 );
- }
-#endif /* MBEDTLS_X509_CREATE_C */
-
-#if defined(MBEDTLS_X509_CRT_WRITE_C)
- if( strcmp( "MBEDTLS_X509_CRT_WRITE_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_X509_CRT_WRITE_C );
- return( 0 );
- }
-#endif /* MBEDTLS_X509_CRT_WRITE_C */
-
-#if defined(MBEDTLS_X509_CSR_WRITE_C)
- if( strcmp( "MBEDTLS_X509_CSR_WRITE_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_X509_CSR_WRITE_C );
- return( 0 );
- }
-#endif /* MBEDTLS_X509_CSR_WRITE_C */
-
-#if defined(MBEDTLS_XTEA_C)
- if( strcmp( "MBEDTLS_XTEA_C", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_XTEA_C );
- return( 0 );
- }
-#endif /* MBEDTLS_XTEA_C */
-
-#if defined(MBEDTLS_MPI_WINDOW_SIZE)
- if( strcmp( "MBEDTLS_MPI_WINDOW_SIZE", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_MPI_WINDOW_SIZE );
- return( 0 );
- }
-#endif /* MBEDTLS_MPI_WINDOW_SIZE */
-
-#if defined(MBEDTLS_MPI_MAX_SIZE)
- if( strcmp( "MBEDTLS_MPI_MAX_SIZE", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_MPI_MAX_SIZE );
- return( 0 );
- }
-#endif /* MBEDTLS_MPI_MAX_SIZE */
-
-#if defined(MBEDTLS_CTR_DRBG_ENTROPY_LEN)
- if( strcmp( "MBEDTLS_CTR_DRBG_ENTROPY_LEN", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_CTR_DRBG_ENTROPY_LEN );
- return( 0 );
- }
-#endif /* MBEDTLS_CTR_DRBG_ENTROPY_LEN */
-
-#if defined(MBEDTLS_CTR_DRBG_RESEED_INTERVAL)
- if( strcmp( "MBEDTLS_CTR_DRBG_RESEED_INTERVAL", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_CTR_DRBG_RESEED_INTERVAL );
- return( 0 );
- }
-#endif /* MBEDTLS_CTR_DRBG_RESEED_INTERVAL */
-
-#if defined(MBEDTLS_CTR_DRBG_MAX_INPUT)
- if( strcmp( "MBEDTLS_CTR_DRBG_MAX_INPUT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_CTR_DRBG_MAX_INPUT );
- return( 0 );
- }
-#endif /* MBEDTLS_CTR_DRBG_MAX_INPUT */
-
-#if defined(MBEDTLS_CTR_DRBG_MAX_REQUEST)
- if( strcmp( "MBEDTLS_CTR_DRBG_MAX_REQUEST", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_CTR_DRBG_MAX_REQUEST );
- return( 0 );
- }
-#endif /* MBEDTLS_CTR_DRBG_MAX_REQUEST */
-
-#if defined(MBEDTLS_CTR_DRBG_MAX_SEED_INPUT)
- if( strcmp( "MBEDTLS_CTR_DRBG_MAX_SEED_INPUT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_CTR_DRBG_MAX_SEED_INPUT );
- return( 0 );
- }
-#endif /* MBEDTLS_CTR_DRBG_MAX_SEED_INPUT */
-
-#if defined(MBEDTLS_HMAC_DRBG_RESEED_INTERVAL)
- if( strcmp( "MBEDTLS_HMAC_DRBG_RESEED_INTERVAL", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_HMAC_DRBG_RESEED_INTERVAL );
- return( 0 );
- }
-#endif /* MBEDTLS_HMAC_DRBG_RESEED_INTERVAL */
-
-#if defined(MBEDTLS_HMAC_DRBG_MAX_INPUT)
- if( strcmp( "MBEDTLS_HMAC_DRBG_MAX_INPUT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_HMAC_DRBG_MAX_INPUT );
- return( 0 );
- }
-#endif /* MBEDTLS_HMAC_DRBG_MAX_INPUT */
-
-#if defined(MBEDTLS_HMAC_DRBG_MAX_REQUEST)
- if( strcmp( "MBEDTLS_HMAC_DRBG_MAX_REQUEST", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_HMAC_DRBG_MAX_REQUEST );
- return( 0 );
- }
-#endif /* MBEDTLS_HMAC_DRBG_MAX_REQUEST */
-
-#if defined(MBEDTLS_HMAC_DRBG_MAX_SEED_INPUT)
- if( strcmp( "MBEDTLS_HMAC_DRBG_MAX_SEED_INPUT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_HMAC_DRBG_MAX_SEED_INPUT );
- return( 0 );
- }
-#endif /* MBEDTLS_HMAC_DRBG_MAX_SEED_INPUT */
-
-#if defined(MBEDTLS_ECP_MAX_BITS)
- if( strcmp( "MBEDTLS_ECP_MAX_BITS", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_ECP_MAX_BITS );
- return( 0 );
- }
-#endif /* MBEDTLS_ECP_MAX_BITS */
-
-#if defined(MBEDTLS_ECP_WINDOW_SIZE)
- if( strcmp( "MBEDTLS_ECP_WINDOW_SIZE", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_ECP_WINDOW_SIZE );
- return( 0 );
- }
-#endif /* MBEDTLS_ECP_WINDOW_SIZE */
-
-#if defined(MBEDTLS_ECP_FIXED_POINT_OPTIM)
- if( strcmp( "MBEDTLS_ECP_FIXED_POINT_OPTIM", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_ECP_FIXED_POINT_OPTIM );
- return( 0 );
- }
-#endif /* MBEDTLS_ECP_FIXED_POINT_OPTIM */
-
-#if defined(MBEDTLS_ENTROPY_MAX_SOURCES)
- if( strcmp( "MBEDTLS_ENTROPY_MAX_SOURCES", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_ENTROPY_MAX_SOURCES );
- return( 0 );
- }
-#endif /* MBEDTLS_ENTROPY_MAX_SOURCES */
-
-#if defined(MBEDTLS_ENTROPY_MAX_GATHER)
- if( strcmp( "MBEDTLS_ENTROPY_MAX_GATHER", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_ENTROPY_MAX_GATHER );
- return( 0 );
- }
-#endif /* MBEDTLS_ENTROPY_MAX_GATHER */
-
-#if defined(MBEDTLS_ENTROPY_MIN_HARDWARE)
- if( strcmp( "MBEDTLS_ENTROPY_MIN_HARDWARE", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_ENTROPY_MIN_HARDWARE );
- return( 0 );
- }
-#endif /* MBEDTLS_ENTROPY_MIN_HARDWARE */
-
-#if defined(MBEDTLS_MEMORY_ALIGN_MULTIPLE)
- if( strcmp( "MBEDTLS_MEMORY_ALIGN_MULTIPLE", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_MEMORY_ALIGN_MULTIPLE );
- return( 0 );
- }
-#endif /* MBEDTLS_MEMORY_ALIGN_MULTIPLE */
-
-#if defined(MBEDTLS_PLATFORM_STD_MEM_HDR)
- if( strcmp( "MBEDTLS_PLATFORM_STD_MEM_HDR", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_PLATFORM_STD_MEM_HDR );
- return( 0 );
- }
-#endif /* MBEDTLS_PLATFORM_STD_MEM_HDR */
-
-#if defined(MBEDTLS_PLATFORM_STD_CALLOC)
- if( strcmp( "MBEDTLS_PLATFORM_STD_CALLOC", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_PLATFORM_STD_CALLOC );
- return( 0 );
- }
-#endif /* MBEDTLS_PLATFORM_STD_CALLOC */
-
-#if defined(MBEDTLS_PLATFORM_STD_FREE)
- if( strcmp( "MBEDTLS_PLATFORM_STD_FREE", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_PLATFORM_STD_FREE );
- return( 0 );
- }
-#endif /* MBEDTLS_PLATFORM_STD_FREE */
-
-#if defined(MBEDTLS_PLATFORM_STD_EXIT)
- if( strcmp( "MBEDTLS_PLATFORM_STD_EXIT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_PLATFORM_STD_EXIT );
- return( 0 );
- }
-#endif /* MBEDTLS_PLATFORM_STD_EXIT */
-
-#if defined(MBEDTLS_PLATFORM_STD_TIME)
- if( strcmp( "MBEDTLS_PLATFORM_STD_TIME", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_PLATFORM_STD_TIME );
- return( 0 );
- }
-#endif /* MBEDTLS_PLATFORM_STD_TIME */
-
-#if defined(MBEDTLS_PLATFORM_STD_FPRINTF)
- if( strcmp( "MBEDTLS_PLATFORM_STD_FPRINTF", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_PLATFORM_STD_FPRINTF );
- return( 0 );
- }
-#endif /* MBEDTLS_PLATFORM_STD_FPRINTF */
-
-#if defined(MBEDTLS_PLATFORM_STD_PRINTF)
- if( strcmp( "MBEDTLS_PLATFORM_STD_PRINTF", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_PLATFORM_STD_PRINTF );
- return( 0 );
- }
-#endif /* MBEDTLS_PLATFORM_STD_PRINTF */
-
-#if defined(MBEDTLS_PLATFORM_STD_SNPRINTF)
- if( strcmp( "MBEDTLS_PLATFORM_STD_SNPRINTF", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_PLATFORM_STD_SNPRINTF );
- return( 0 );
- }
-#endif /* MBEDTLS_PLATFORM_STD_SNPRINTF */
-
-#if defined(MBEDTLS_PLATFORM_STD_EXIT_SUCCESS)
- if( strcmp( "MBEDTLS_PLATFORM_STD_EXIT_SUCCESS", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_PLATFORM_STD_EXIT_SUCCESS );
- return( 0 );
- }
-#endif /* MBEDTLS_PLATFORM_STD_EXIT_SUCCESS */
-
-#if defined(MBEDTLS_PLATFORM_STD_EXIT_FAILURE)
- if( strcmp( "MBEDTLS_PLATFORM_STD_EXIT_FAILURE", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_PLATFORM_STD_EXIT_FAILURE );
- return( 0 );
- }
-#endif /* MBEDTLS_PLATFORM_STD_EXIT_FAILURE */
-
-#if defined(MBEDTLS_PLATFORM_STD_NV_SEED_READ)
- if( strcmp( "MBEDTLS_PLATFORM_STD_NV_SEED_READ", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_PLATFORM_STD_NV_SEED_READ );
- return( 0 );
- }
-#endif /* MBEDTLS_PLATFORM_STD_NV_SEED_READ */
-
-#if defined(MBEDTLS_PLATFORM_STD_NV_SEED_WRITE)
- if( strcmp( "MBEDTLS_PLATFORM_STD_NV_SEED_WRITE", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_PLATFORM_STD_NV_SEED_WRITE );
- return( 0 );
- }
-#endif /* MBEDTLS_PLATFORM_STD_NV_SEED_WRITE */
-
-#if defined(MBEDTLS_PLATFORM_STD_NV_SEED_FILE)
- if( strcmp( "MBEDTLS_PLATFORM_STD_NV_SEED_FILE", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_PLATFORM_STD_NV_SEED_FILE );
- return( 0 );
- }
-#endif /* MBEDTLS_PLATFORM_STD_NV_SEED_FILE */
-
-#if defined(MBEDTLS_PLATFORM_CALLOC_MACRO)
- if( strcmp( "MBEDTLS_PLATFORM_CALLOC_MACRO", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_PLATFORM_CALLOC_MACRO );
- return( 0 );
- }
-#endif /* MBEDTLS_PLATFORM_CALLOC_MACRO */
-
-#if defined(MBEDTLS_PLATFORM_FREE_MACRO)
- if( strcmp( "MBEDTLS_PLATFORM_FREE_MACRO", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_PLATFORM_FREE_MACRO );
- return( 0 );
- }
-#endif /* MBEDTLS_PLATFORM_FREE_MACRO */
-
-#if defined(MBEDTLS_PLATFORM_EXIT_MACRO)
- if( strcmp( "MBEDTLS_PLATFORM_EXIT_MACRO", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_PLATFORM_EXIT_MACRO );
- return( 0 );
- }
-#endif /* MBEDTLS_PLATFORM_EXIT_MACRO */
-
-#if defined(MBEDTLS_PLATFORM_TIME_MACRO)
- if( strcmp( "MBEDTLS_PLATFORM_TIME_MACRO", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_PLATFORM_TIME_MACRO );
- return( 0 );
- }
-#endif /* MBEDTLS_PLATFORM_TIME_MACRO */
-
-#if defined(MBEDTLS_PLATFORM_TIME_TYPE_MACRO)
- if( strcmp( "MBEDTLS_PLATFORM_TIME_TYPE_MACRO", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_PLATFORM_TIME_TYPE_MACRO );
- return( 0 );
- }
-#endif /* MBEDTLS_PLATFORM_TIME_TYPE_MACRO */
-
-#if defined(MBEDTLS_PLATFORM_FPRINTF_MACRO)
- if( strcmp( "MBEDTLS_PLATFORM_FPRINTF_MACRO", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_PLATFORM_FPRINTF_MACRO );
- return( 0 );
- }
-#endif /* MBEDTLS_PLATFORM_FPRINTF_MACRO */
-
-#if defined(MBEDTLS_PLATFORM_PRINTF_MACRO)
- if( strcmp( "MBEDTLS_PLATFORM_PRINTF_MACRO", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_PLATFORM_PRINTF_MACRO );
- return( 0 );
- }
-#endif /* MBEDTLS_PLATFORM_PRINTF_MACRO */
-
-#if defined(MBEDTLS_PLATFORM_SNPRINTF_MACRO)
- if( strcmp( "MBEDTLS_PLATFORM_SNPRINTF_MACRO", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_PLATFORM_SNPRINTF_MACRO );
- return( 0 );
- }
-#endif /* MBEDTLS_PLATFORM_SNPRINTF_MACRO */
-
-#if defined(MBEDTLS_PLATFORM_VSNPRINTF_MACRO)
- if( strcmp( "MBEDTLS_PLATFORM_VSNPRINTF_MACRO", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_PLATFORM_VSNPRINTF_MACRO );
- return( 0 );
- }
-#endif /* MBEDTLS_PLATFORM_VSNPRINTF_MACRO */
-
-#if defined(MBEDTLS_PLATFORM_NV_SEED_READ_MACRO)
- if( strcmp( "MBEDTLS_PLATFORM_NV_SEED_READ_MACRO", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_PLATFORM_NV_SEED_READ_MACRO );
- return( 0 );
- }
-#endif /* MBEDTLS_PLATFORM_NV_SEED_READ_MACRO */
-
-#if defined(MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO)
- if( strcmp( "MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO );
- return( 0 );
- }
-#endif /* MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO */
-
-#if defined(MBEDTLS_PSA_HMAC_DRBG_MD_TYPE)
- if( strcmp( "MBEDTLS_PSA_HMAC_DRBG_MD_TYPE", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_PSA_HMAC_DRBG_MD_TYPE );
- return( 0 );
- }
-#endif /* MBEDTLS_PSA_HMAC_DRBG_MD_TYPE */
-
-#if defined(MBEDTLS_PSA_KEY_SLOT_COUNT)
- if( strcmp( "MBEDTLS_PSA_KEY_SLOT_COUNT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_PSA_KEY_SLOT_COUNT );
- return( 0 );
- }
-#endif /* MBEDTLS_PSA_KEY_SLOT_COUNT */
-
-#if defined(MBEDTLS_SSL_CACHE_DEFAULT_TIMEOUT)
- if( strcmp( "MBEDTLS_SSL_CACHE_DEFAULT_TIMEOUT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_SSL_CACHE_DEFAULT_TIMEOUT );
- return( 0 );
- }
-#endif /* MBEDTLS_SSL_CACHE_DEFAULT_TIMEOUT */
-
-#if defined(MBEDTLS_SSL_CACHE_DEFAULT_MAX_ENTRIES)
- if( strcmp( "MBEDTLS_SSL_CACHE_DEFAULT_MAX_ENTRIES", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_SSL_CACHE_DEFAULT_MAX_ENTRIES );
- return( 0 );
- }
-#endif /* MBEDTLS_SSL_CACHE_DEFAULT_MAX_ENTRIES */
-
-#if defined(MBEDTLS_SSL_MAX_CONTENT_LEN)
- if( strcmp( "MBEDTLS_SSL_MAX_CONTENT_LEN", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_SSL_MAX_CONTENT_LEN );
- return( 0 );
- }
-#endif /* MBEDTLS_SSL_MAX_CONTENT_LEN */
-
-#if defined(MBEDTLS_SSL_IN_CONTENT_LEN)
- if( strcmp( "MBEDTLS_SSL_IN_CONTENT_LEN", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_SSL_IN_CONTENT_LEN );
- return( 0 );
- }
-#endif /* MBEDTLS_SSL_IN_CONTENT_LEN */
-
-#if defined(MBEDTLS_SSL_CID_IN_LEN_MAX)
- if( strcmp( "MBEDTLS_SSL_CID_IN_LEN_MAX", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_SSL_CID_IN_LEN_MAX );
- return( 0 );
- }
-#endif /* MBEDTLS_SSL_CID_IN_LEN_MAX */
-
-#if defined(MBEDTLS_SSL_CID_OUT_LEN_MAX)
- if( strcmp( "MBEDTLS_SSL_CID_OUT_LEN_MAX", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_SSL_CID_OUT_LEN_MAX );
- return( 0 );
- }
-#endif /* MBEDTLS_SSL_CID_OUT_LEN_MAX */
-
-#if defined(MBEDTLS_SSL_CID_PADDING_GRANULARITY)
- if( strcmp( "MBEDTLS_SSL_CID_PADDING_GRANULARITY", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_SSL_CID_PADDING_GRANULARITY );
- return( 0 );
- }
-#endif /* MBEDTLS_SSL_CID_PADDING_GRANULARITY */
-
-#if defined(MBEDTLS_SSL_TLS1_3_PADDING_GRANULARITY)
- if( strcmp( "MBEDTLS_SSL_TLS1_3_PADDING_GRANULARITY", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_SSL_TLS1_3_PADDING_GRANULARITY );
- return( 0 );
- }
-#endif /* MBEDTLS_SSL_TLS1_3_PADDING_GRANULARITY */
-
-#if defined(MBEDTLS_SSL_OUT_CONTENT_LEN)
- if( strcmp( "MBEDTLS_SSL_OUT_CONTENT_LEN", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_SSL_OUT_CONTENT_LEN );
- return( 0 );
- }
-#endif /* MBEDTLS_SSL_OUT_CONTENT_LEN */
-
-#if defined(MBEDTLS_SSL_DTLS_MAX_BUFFERING)
- if( strcmp( "MBEDTLS_SSL_DTLS_MAX_BUFFERING", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_SSL_DTLS_MAX_BUFFERING );
- return( 0 );
- }
-#endif /* MBEDTLS_SSL_DTLS_MAX_BUFFERING */
-
-#if defined(MBEDTLS_SSL_DEFAULT_TICKET_LIFETIME)
- if( strcmp( "MBEDTLS_SSL_DEFAULT_TICKET_LIFETIME", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_SSL_DEFAULT_TICKET_LIFETIME );
- return( 0 );
- }
-#endif /* MBEDTLS_SSL_DEFAULT_TICKET_LIFETIME */
-
-#if defined(MBEDTLS_PSK_MAX_LEN)
- if( strcmp( "MBEDTLS_PSK_MAX_LEN", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_PSK_MAX_LEN );
- return( 0 );
- }
-#endif /* MBEDTLS_PSK_MAX_LEN */
-
-#if defined(MBEDTLS_SSL_COOKIE_TIMEOUT)
- if( strcmp( "MBEDTLS_SSL_COOKIE_TIMEOUT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_SSL_COOKIE_TIMEOUT );
- return( 0 );
- }
-#endif /* MBEDTLS_SSL_COOKIE_TIMEOUT */
-
-#if defined(MBEDTLS_X509_MAX_INTERMEDIATE_CA)
- if( strcmp( "MBEDTLS_X509_MAX_INTERMEDIATE_CA", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_X509_MAX_INTERMEDIATE_CA );
- return( 0 );
- }
-#endif /* MBEDTLS_X509_MAX_INTERMEDIATE_CA */
-
-#if defined(MBEDTLS_X509_MAX_FILE_PATH_LEN)
- if( strcmp( "MBEDTLS_X509_MAX_FILE_PATH_LEN", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_X509_MAX_FILE_PATH_LEN );
- return( 0 );
- }
-#endif /* MBEDTLS_X509_MAX_FILE_PATH_LEN */
-
-#if defined(MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_CERTIFICATES)
- if( strcmp( "MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_CERTIFICATES", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_CERTIFICATES );
- return( 0 );
- }
-#endif /* MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_CERTIFICATES */
-
-#if defined(MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_KEY_EXCHANGE)
- if( strcmp( "MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_KEY_EXCHANGE", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_KEY_EXCHANGE );
- return( 0 );
- }
-#endif /* MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_KEY_EXCHANGE */
-
-#if defined(MBEDTLS_PLATFORM_ZEROIZE_ALT)
- if( strcmp( "MBEDTLS_PLATFORM_ZEROIZE_ALT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_PLATFORM_ZEROIZE_ALT );
- return( 0 );
- }
-#endif /* MBEDTLS_PLATFORM_ZEROIZE_ALT */
-
-#if defined(MBEDTLS_PLATFORM_GMTIME_R_ALT)
- if( strcmp( "MBEDTLS_PLATFORM_GMTIME_R_ALT", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_PLATFORM_GMTIME_R_ALT );
- return( 0 );
- }
-#endif /* MBEDTLS_PLATFORM_GMTIME_R_ALT */
-
-#if defined(MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED)
- if( strcmp( "MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED", config ) == 0 )
- {
- MACRO_EXPANSION_TO_STR( MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED );
- return( 0 );
- }
-#endif /* MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED */
-
- /* If the symbol is not found, return an error */
- return( 1 );
-}
-
-#if defined(_MSC_VER)
-#pragma warning(pop)
-#endif /* _MSC_VER */
diff --git a/lib/mbedtls-2.27.0/programs/test/query_config.h b/lib/mbedtls-2.27.0/programs/test/query_config.h
deleted file mode 100644
index 23009c4..0000000
--- a/lib/mbedtls-2.27.0/programs/test/query_config.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Query Mbed TLS compile time configurations from config.h
- *
- * Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef MBEDTLS_PROGRAMS_TEST_QUERY_CONFIG_H
-#define MBEDTLS_PROGRAMS_TEST_QUERY_CONFIG_H
-
-#if !defined(MBEDTLS_CONFIG_FILE)
-#include "mbedtls/config.h"
-#else
-#include MBEDTLS_CONFIG_FILE
-#endif
-
-/** Check whether a given configuration symbol is enabled.
- *
- * \param config The symbol to query (e.g. "MBEDTLS_RSA_C").
- * \return \c 0 if the symbol was defined at compile time
- * (in MBEDTLS_CONFIG_FILE or config.h),
- * \c 1 otherwise.
- *
- * \note This function is defined in `programs/test/query_config.c`
- * which is automatically generated by
- * `scripts/generate_query_config.pl`.
- */
-int query_config( const char *config );
-
-#endif /* MBEDTLS_PROGRAMS_TEST_QUERY_CONFIG_H */
diff --git a/lib/mbedtls-2.27.0/programs/test/selftest.c b/lib/mbedtls-2.27.0/programs/test/selftest.c
deleted file mode 100644
index 41d7040..0000000
--- a/lib/mbedtls-2.27.0/programs/test/selftest.c
+++ /dev/null
@@ -1,502 +0,0 @@
-/*
- * Self-test demonstration program
- *
- * Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#if !defined(MBEDTLS_CONFIG_FILE)
-#include "mbedtls/config.h"
-#else
-#include MBEDTLS_CONFIG_FILE
-#endif
-
-#include "mbedtls/entropy.h"
-#include "mbedtls/entropy_poll.h"
-#include "mbedtls/hmac_drbg.h"
-#include "mbedtls/ctr_drbg.h"
-#include "mbedtls/dhm.h"
-#include "mbedtls/gcm.h"
-#include "mbedtls/ccm.h"
-#include "mbedtls/cmac.h"
-#include "mbedtls/md2.h"
-#include "mbedtls/md4.h"
-#include "mbedtls/md5.h"
-#include "mbedtls/ripemd160.h"
-#include "mbedtls/sha1.h"
-#include "mbedtls/sha256.h"
-#include "mbedtls/sha512.h"
-#include "mbedtls/arc4.h"
-#include "mbedtls/des.h"
-#include "mbedtls/aes.h"
-#include "mbedtls/camellia.h"
-#include "mbedtls/aria.h"
-#include "mbedtls/chacha20.h"
-#include "mbedtls/poly1305.h"
-#include "mbedtls/chachapoly.h"
-#include "mbedtls/base64.h"
-#include "mbedtls/bignum.h"
-#include "mbedtls/rsa.h"
-#include "mbedtls/x509.h"
-#include "mbedtls/xtea.h"
-#include "mbedtls/pkcs5.h"
-#include "mbedtls/ecp.h"
-#include "mbedtls/ecjpake.h"
-#include "mbedtls/timing.h"
-#include "mbedtls/nist_kw.h"
-
-#include <string.h>
-
-#if defined(MBEDTLS_PLATFORM_C)
-#include "mbedtls/platform.h"
-#else
-#include <stdio.h>
-#include <stdlib.h>
-#define mbedtls_calloc calloc
-#define mbedtls_free free
-#define mbedtls_printf printf
-#define mbedtls_snprintf snprintf
-#define mbedtls_exit exit
-#define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS
-#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE
-#endif
-
-#if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C)
-#include "mbedtls/memory_buffer_alloc.h"
-#endif
-
-
-#if defined MBEDTLS_SELF_TEST
-/* Sanity check for malloc. This is not expected to fail, and is rather
- * intended to display potentially useful information about the platform,
- * in particular the behavior of malloc(0). */
-static int calloc_self_test( int verbose )
-{
- int failures = 0;
- void *empty1 = mbedtls_calloc( 0, 1 );
- void *empty2 = mbedtls_calloc( 0, 1 );
- void *buffer1 = mbedtls_calloc( 1, 1 );
- void *buffer2 = mbedtls_calloc( 1, 1 );
- uintptr_t old_buffer1;
-
- if( empty1 == NULL && empty2 == NULL )
- {
- if( verbose )
- mbedtls_printf( " CALLOC(0): passed (NULL)\n" );
- }
- else if( empty1 == NULL || empty2 == NULL )
- {
- if( verbose )
- mbedtls_printf( " CALLOC(0): failed (mix of NULL and non-NULL)\n" );
- ++failures;
- }
- else if( empty1 == empty2 )
- {
- if( verbose )
- mbedtls_printf( " CALLOC(0): passed (same non-null)\n" );
- }
- else
- {
- if( verbose )
- mbedtls_printf( " CALLOC(0): passed (distinct non-null)\n" );
- }
-
- if( buffer1 == NULL || buffer2 == NULL )
- {
- if( verbose )
- mbedtls_printf( " CALLOC(1): failed (NULL)\n" );
- ++failures;
- }
- else if( buffer1 == buffer2 )
- {
- if( verbose )
- mbedtls_printf( " CALLOC(1): failed (same buffer twice)\n" );
- ++failures;
- }
- else
- {
- if( verbose )
- mbedtls_printf( " CALLOC(1): passed\n" );
- }
-
- old_buffer1 = (uintptr_t) buffer1;
- mbedtls_free( buffer1 );
- buffer1 = mbedtls_calloc( 1, 1 );
- if( buffer1 == NULL )
- {
- if( verbose )
- mbedtls_printf( " CALLOC(1 again): failed (NULL)\n" );
- ++failures;
- }
- else
- {
- if( verbose )
- mbedtls_printf( " CALLOC(1 again): passed (%s address)\n",
- (uintptr_t) old_buffer1 == (uintptr_t) buffer1 ?
- "same" : "different" );
- }
-
- if( verbose )
- mbedtls_printf( "\n" );
- mbedtls_free( empty1 );
- mbedtls_free( empty2 );
- mbedtls_free( buffer1 );
- mbedtls_free( buffer2 );
- return( failures );
-}
-#endif /* MBEDTLS_SELF_TEST */
-
-static int test_snprintf( size_t n, const char *ref_buf, int ref_ret )
-{
- int ret;
- char buf[10] = "xxxxxxxxx";
- const char ref[10] = "xxxxxxxxx";
-
- ret = mbedtls_snprintf( buf, n, "%s", "123" );
- if( ret < 0 || (size_t) ret >= n )
- ret = -1;
-
- if( strncmp( ref_buf, buf, sizeof( buf ) ) != 0 ||
- ref_ret != ret ||
- memcmp( buf + n, ref + n, sizeof( buf ) - n ) != 0 )
- {
- return( 1 );
- }
-
- return( 0 );
-}
-
-static int run_test_snprintf( void )
-{
- return( test_snprintf( 0, "xxxxxxxxx", -1 ) != 0 ||
- test_snprintf( 1, "", -1 ) != 0 ||
- test_snprintf( 2, "1", -1 ) != 0 ||
- test_snprintf( 3, "12", -1 ) != 0 ||
- test_snprintf( 4, "123", 3 ) != 0 ||
- test_snprintf( 5, "123", 3 ) != 0 );
-}
-
-/*
- * Check if a seed file is present, and if not create one for the entropy
- * self-test. If this fails, we attempt the test anyway, so no error is passed
- * back.
- */
-#if defined(MBEDTLS_SELF_TEST) && defined(MBEDTLS_ENTROPY_C)
-#if defined(MBEDTLS_ENTROPY_NV_SEED) && !defined(MBEDTLS_NO_PLATFORM_ENTROPY)
-static void create_entropy_seed_file( void )
-{
- int result;
- size_t output_len = 0;
- unsigned char seed_value[MBEDTLS_ENTROPY_BLOCK_SIZE];
-
- /* Attempt to read the entropy seed file. If this fails - attempt to write
- * to the file to ensure one is present. */
- result = mbedtls_platform_std_nv_seed_read( seed_value,
- MBEDTLS_ENTROPY_BLOCK_SIZE );
- if( 0 == result )
- return;
-
- result = mbedtls_platform_entropy_poll( NULL,
- seed_value,
- MBEDTLS_ENTROPY_BLOCK_SIZE,
- &output_len );
- if( 0 != result )
- return;
-
- if( MBEDTLS_ENTROPY_BLOCK_SIZE != output_len )
- return;
-
- mbedtls_platform_std_nv_seed_write( seed_value, MBEDTLS_ENTROPY_BLOCK_SIZE );
-}
-#endif
-
-int mbedtls_entropy_self_test_wrapper( int verbose )
-{
-#if defined(MBEDTLS_ENTROPY_NV_SEED) && !defined(MBEDTLS_NO_PLATFORM_ENTROPY)
- create_entropy_seed_file( );
-#endif
- return( mbedtls_entropy_self_test( verbose ) );
-}
-#endif
-
-#if defined(MBEDTLS_SELF_TEST)
-#if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C)
-int mbedtls_memory_buffer_alloc_free_and_self_test( int verbose )
-{
- if( verbose != 0 )
- {
-#if defined(MBEDTLS_MEMORY_DEBUG)
- mbedtls_memory_buffer_alloc_status( );
-#endif
- }
- mbedtls_memory_buffer_alloc_free( );
- return( mbedtls_memory_buffer_alloc_self_test( verbose ) );
-}
-#endif
-
-typedef struct
-{
- const char *name;
- int ( *function )( int );
-} selftest_t;
-
-const selftest_t selftests[] =
-{
- {"calloc", calloc_self_test},
-#if defined(MBEDTLS_MD2_C)
- {"md2", mbedtls_md2_self_test},
-#endif
-#if defined(MBEDTLS_MD4_C)
- {"md4", mbedtls_md4_self_test},
-#endif
-#if defined(MBEDTLS_MD5_C)
- {"md5", mbedtls_md5_self_test},
-#endif
-#if defined(MBEDTLS_RIPEMD160_C)
- {"ripemd160", mbedtls_ripemd160_self_test},
-#endif
-#if defined(MBEDTLS_SHA1_C)
- {"sha1", mbedtls_sha1_self_test},
-#endif
-#if defined(MBEDTLS_SHA256_C)
- {"sha256", mbedtls_sha256_self_test},
-#endif
-#if defined(MBEDTLS_SHA512_C)
- {"sha512", mbedtls_sha512_self_test},
-#endif
-#if defined(MBEDTLS_ARC4_C)
- {"arc4", mbedtls_arc4_self_test},
-#endif
-#if defined(MBEDTLS_DES_C)
- {"des", mbedtls_des_self_test},
-#endif
-#if defined(MBEDTLS_AES_C)
- {"aes", mbedtls_aes_self_test},
-#endif
-#if defined(MBEDTLS_GCM_C) && defined(MBEDTLS_AES_C)
- {"gcm", mbedtls_gcm_self_test},
-#endif
-#if defined(MBEDTLS_CCM_C) && defined(MBEDTLS_AES_C)
- {"ccm", mbedtls_ccm_self_test},
-#endif
-#if defined(MBEDTLS_NIST_KW_C) && defined(MBEDTLS_AES_C)
- {"nist_kw", mbedtls_nist_kw_self_test},
-#endif
-#if defined(MBEDTLS_CMAC_C)
- {"cmac", mbedtls_cmac_self_test},
-#endif
-#if defined(MBEDTLS_CHACHA20_C)
- {"chacha20", mbedtls_chacha20_self_test},
-#endif
-#if defined(MBEDTLS_POLY1305_C)
- {"poly1305", mbedtls_poly1305_self_test},
-#endif
-#if defined(MBEDTLS_CHACHAPOLY_C)
- {"chacha20-poly1305", mbedtls_chachapoly_self_test},
-#endif
-#if defined(MBEDTLS_BASE64_C)
- {"base64", mbedtls_base64_self_test},
-#endif
-#if defined(MBEDTLS_BIGNUM_C)
- {"mpi", mbedtls_mpi_self_test},
-#endif
-#if defined(MBEDTLS_RSA_C)
- {"rsa", mbedtls_rsa_self_test},
-#endif
-#if defined(MBEDTLS_X509_USE_C)
- {"x509", mbedtls_x509_self_test},
-#endif
-#if defined(MBEDTLS_XTEA_C)
- {"xtea", mbedtls_xtea_self_test},
-#endif
-#if defined(MBEDTLS_CAMELLIA_C)
- {"camellia", mbedtls_camellia_self_test},
-#endif
-#if defined(MBEDTLS_ARIA_C)
- {"aria", mbedtls_aria_self_test},
-#endif
-#if defined(MBEDTLS_CTR_DRBG_C)
- {"ctr_drbg", mbedtls_ctr_drbg_self_test},
-#endif
-#if defined(MBEDTLS_HMAC_DRBG_C)
- {"hmac_drbg", mbedtls_hmac_drbg_self_test},
-#endif
-#if defined(MBEDTLS_ECP_C)
- {"ecp", mbedtls_ecp_self_test},
-#endif
-#if defined(MBEDTLS_ECJPAKE_C)
- {"ecjpake", mbedtls_ecjpake_self_test},
-#endif
-#if defined(MBEDTLS_DHM_C)
- {"dhm", mbedtls_dhm_self_test},
-#endif
-#if defined(MBEDTLS_ENTROPY_C)
- {"entropy", mbedtls_entropy_self_test_wrapper},
-#endif
-#if defined(MBEDTLS_PKCS5_C)
- {"pkcs5", mbedtls_pkcs5_self_test},
-#endif
-/* Slower test after the faster ones */
-#if defined(MBEDTLS_TIMING_C)
- {"timing", mbedtls_timing_self_test},
-#endif
-/* Heap test comes last */
-#if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C)
- {"memory_buffer_alloc", mbedtls_memory_buffer_alloc_free_and_self_test},
-#endif
- {NULL, NULL}
-};
-#endif /* MBEDTLS_SELF_TEST */
-
-int main( int argc, char *argv[] )
-{
-#if defined(MBEDTLS_SELF_TEST)
- const selftest_t *test;
-#endif /* MBEDTLS_SELF_TEST */
- char **argp;
- int v = 1; /* v=1 for verbose mode */
- int exclude_mode = 0;
- int suites_tested = 0, suites_failed = 0;
-#if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C) && defined(MBEDTLS_SELF_TEST)
- unsigned char buf[1000000];
-#endif
- void *pointer;
-
- /*
- * The C standard doesn't guarantee that all-bits-0 is the representation
- * of a NULL pointer. We do however use that in our code for initializing
- * structures, which should work on every modern platform. Let's be sure.
- */
- memset( &pointer, 0, sizeof( void * ) );
- if( pointer != NULL )
- {
- mbedtls_printf( "all-bits-zero is not a NULL pointer\n" );
- mbedtls_exit( MBEDTLS_EXIT_FAILURE );
- }
-
- /*
- * Make sure we have a snprintf that correctly zero-terminates
- */
- if( run_test_snprintf() != 0 )
- {
- mbedtls_printf( "the snprintf implementation is broken\n" );
- mbedtls_exit( MBEDTLS_EXIT_FAILURE );
- }
-
- for( argp = argv + ( argc >= 1 ? 1 : argc ); *argp != NULL; ++argp )
- {
- if( strcmp( *argp, "--quiet" ) == 0 ||
- strcmp( *argp, "-q" ) == 0 )
- {
- v = 0;
- }
- else if( strcmp( *argp, "--exclude" ) == 0 ||
- strcmp( *argp, "-x" ) == 0 )
- {
- exclude_mode = 1;
- }
- else
- break;
- }
-
- if( v != 0 )
- mbedtls_printf( "\n" );
-
-#if defined(MBEDTLS_SELF_TEST)
-
-#if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C)
- mbedtls_memory_buffer_alloc_init( buf, sizeof(buf) );
-#endif
-
- if( *argp != NULL && exclude_mode == 0 )
- {
- /* Run the specified tests */
- for( ; *argp != NULL; argp++ )
- {
- for( test = selftests; test->name != NULL; test++ )
- {
- if( !strcmp( *argp, test->name ) )
- {
- if( test->function( v ) != 0 )
- {
- suites_failed++;
- }
- suites_tested++;
- break;
- }
- }
- if( test->name == NULL )
- {
- mbedtls_printf( " Test suite %s not available -> failed\n\n", *argp );
- suites_failed++;
- }
- }
- }
- else
- {
- /* Run all the tests except excluded ones */
- for( test = selftests; test->name != NULL; test++ )
- {
- if( exclude_mode )
- {
- char **excluded;
- for( excluded = argp; *excluded != NULL; ++excluded )
- {
- if( !strcmp( *excluded, test->name ) )
- break;
- }
- if( *excluded )
- {
- if( v )
- mbedtls_printf( " Skip: %s\n", test->name );
- continue;
- }
- }
- if( test->function( v ) != 0 )
- {
- suites_failed++;
- }
- suites_tested++;
- }
- }
-
-#else
- (void) exclude_mode;
- mbedtls_printf( " MBEDTLS_SELF_TEST not defined.\n" );
-#endif
-
- if( v != 0 )
- {
- mbedtls_printf( " Executed %d test suites\n\n", suites_tested );
-
- if( suites_failed > 0)
- {
- mbedtls_printf( " [ %d tests FAIL ]\n\n", suites_failed );
- }
- else
- {
- mbedtls_printf( " [ All tests PASS ]\n\n" );
- }
-#if defined(_WIN32)
- mbedtls_printf( " Press Enter to exit this program.\n" );
- fflush( stdout ); getchar();
-#endif
- }
-
- if( suites_failed > 0)
- mbedtls_exit( MBEDTLS_EXIT_FAILURE );
-
- mbedtls_exit( MBEDTLS_EXIT_SUCCESS );
-}
diff --git a/lib/mbedtls-2.27.0/programs/test/udp_proxy.c b/lib/mbedtls-2.27.0/programs/test/udp_proxy.c
deleted file mode 100644
index afe0118..0000000
--- a/lib/mbedtls-2.27.0/programs/test/udp_proxy.c
+++ /dev/null
@@ -1,1024 +0,0 @@
-/*
- * UDP proxy: emulate an unreliable UDP connexion for DTLS testing
- *
- * Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * Warning: this is an internal utility program we use for tests.
- * It does break some abstractions from the NET layer, and is thus NOT an
- * example of good general usage.
- */
-
-#if !defined(MBEDTLS_CONFIG_FILE)
-#include "mbedtls/config.h"
-#else
-#include MBEDTLS_CONFIG_FILE
-#endif
-
-#if defined(MBEDTLS_PLATFORM_C)
-#include "mbedtls/platform.h"
-#else
-#include <stdio.h>
-#include <stdlib.h>
-#include <time.h>
-#define mbedtls_time time
-#define mbedtls_time_t time_t
-#define mbedtls_printf printf
-#define mbedtls_calloc calloc
-#define mbedtls_free free
-#define mbedtls_exit exit
-#define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS
-#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE
-#endif /* MBEDTLS_PLATFORM_C */
-
-#if !defined(MBEDTLS_NET_C)
-int main( void )
-{
- mbedtls_printf( "MBEDTLS_NET_C not defined.\n" );
- mbedtls_exit( 0 );
-}
-#else
-
-#include "mbedtls/net_sockets.h"
-#include "mbedtls/error.h"
-#include "mbedtls/ssl.h"
-#include "mbedtls/timing.h"
-
-#include <string.h>
-
-/* For select() */
-#if (defined(_WIN32) || defined(_WIN32_WCE)) && !defined(EFIX64) && \
- !defined(EFI32)
-#include <winsock2.h>
-#include <windows.h>
-#if defined(_MSC_VER)
-#if defined(_WIN32_WCE)
-#pragma comment( lib, "ws2.lib" )
-#else
-#pragma comment( lib, "ws2_32.lib" )
-#endif
-#endif /* _MSC_VER */
-#else /* ( _WIN32 || _WIN32_WCE ) && !EFIX64 && !EFI32 */
-#include <sys/time.h>
-#include <sys/types.h>
-#include <unistd.h>
-#endif /* ( _WIN32 || _WIN32_WCE ) && !EFIX64 && !EFI32 */
-
-#define MAX_MSG_SIZE 16384 + 2048 /* max record/datagram size */
-
-#define DFL_SERVER_ADDR "localhost"
-#define DFL_SERVER_PORT "4433"
-#define DFL_LISTEN_ADDR "localhost"
-#define DFL_LISTEN_PORT "5556"
-#define DFL_PACK 0
-
-#if defined(MBEDTLS_TIMING_C)
-#define USAGE_PACK \
- " pack=%%d default: 0 (don't pack)\n" \
- " options: t > 0 (pack for t milliseconds)\n"
-#else
-#define USAGE_PACK
-#endif
-
-#define USAGE \
- "\n usage: udp_proxy param=<>...\n" \
- "\n acceptable parameters:\n" \
- " server_addr=%%s default: localhost\n" \
- " server_port=%%d default: 4433\n" \
- " listen_addr=%%s default: localhost\n" \
- " listen_port=%%d default: 4433\n" \
- "\n" \
- " duplicate=%%d default: 0 (no duplication)\n" \
- " duplicate about 1:N packets randomly\n" \
- " delay=%%d default: 0 (no delayed packets)\n" \
- " delay about 1:N packets randomly\n" \
- " delay_ccs=0/1 default: 0 (don't delay ChangeCipherSpec)\n" \
- " delay_cli=%%s Handshake message from client that should be\n"\
- " delayed. Possible values are 'ClientHello',\n" \
- " 'Certificate', 'CertificateVerify', and\n" \
- " 'ClientKeyExchange'.\n" \
- " May be used multiple times, even for the same\n"\
- " message, in which case the respective message\n"\
- " gets delayed multiple times.\n" \
- " delay_srv=%%s Handshake message from server that should be\n"\
- " delayed. Possible values are 'HelloRequest',\n"\
- " 'ServerHello', 'ServerHelloDone', 'Certificate'\n"\
- " 'ServerKeyExchange', 'NewSessionTicket',\n"\
- " 'HelloVerifyRequest' and ''CertificateRequest'.\n"\
- " May be used multiple times, even for the same\n"\
- " message, in which case the respective message\n"\
- " gets delayed multiple times.\n" \
- " drop=%%d default: 0 (no dropped packets)\n" \
- " drop about 1:N packets randomly\n" \
- " mtu=%%d default: 0 (unlimited)\n" \
- " drop packets larger than N bytes\n" \
- " bad_ad=0/1 default: 0 (don't add bad ApplicationData)\n" \
- " bad_cid=%%d default: 0 (don't corrupt Connection IDs)\n" \
- " duplicate 1:N packets containing a CID,\n" \
- " modifying CID in first instance of the packet.\n" \
- " protect_hvr=0/1 default: 0 (don't protect HelloVerifyRequest)\n" \
- " protect_len=%%d default: (don't protect packets of this size)\n" \
- " inject_clihlo=0/1 default: 0 (don't inject fake ClientHello)\n" \
- "\n" \
- " seed=%%d default: (use current time)\n" \
- USAGE_PACK \
- "\n"
-
-/*
- * global options
- */
-
-#define MAX_DELAYED_HS 10
-
-static struct options
-{
- const char *server_addr; /* address to forward packets to */
- const char *server_port; /* port to forward packets to */
- const char *listen_addr; /* address for accepting client connections */
- const char *listen_port; /* port for accepting client connections */
-
- int duplicate; /* duplicate 1 in N packets (none if 0) */
- int delay; /* delay 1 packet in N (none if 0) */
- int delay_ccs; /* delay ChangeCipherSpec */
- char* delay_cli[MAX_DELAYED_HS]; /* handshake types of messages from
- * client that should be delayed. */
- uint8_t delay_cli_cnt; /* Number of entries in delay_cli. */
- char* delay_srv[MAX_DELAYED_HS]; /* handshake types of messages from
- * server that should be delayed. */
- uint8_t delay_srv_cnt; /* Number of entries in delay_srv. */
- int drop; /* drop 1 packet in N (none if 0) */
- int mtu; /* drop packets larger than this */
- int bad_ad; /* inject corrupted ApplicationData record */
- unsigned bad_cid; /* inject corrupted CID record */
- int protect_hvr; /* never drop or delay HelloVerifyRequest */
- int protect_len; /* never drop/delay packet of the given size*/
- int inject_clihlo; /* inject fake ClientHello after handshake */
- unsigned pack; /* merge packets into single datagram for
- * at most \c merge milliseconds if > 0 */
- unsigned int seed; /* seed for "random" events */
-} opt;
-
-static void exit_usage( const char *name, const char *value )
-{
- if( value == NULL )
- mbedtls_printf( " unknown option or missing value: %s\n", name );
- else
- mbedtls_printf( " option %s: illegal value: %s\n", name, value );
-
- mbedtls_printf( USAGE );
- mbedtls_exit( 1 );
-}
-
-static void get_options( int argc, char *argv[] )
-{
- int i;
- char *p, *q;
-
- opt.server_addr = DFL_SERVER_ADDR;
- opt.server_port = DFL_SERVER_PORT;
- opt.listen_addr = DFL_LISTEN_ADDR;
- opt.listen_port = DFL_LISTEN_PORT;
- opt.pack = DFL_PACK;
- /* Other members default to 0 */
-
- opt.delay_cli_cnt = 0;
- opt.delay_srv_cnt = 0;
- memset( opt.delay_cli, 0, sizeof( opt.delay_cli ) );
- memset( opt.delay_srv, 0, sizeof( opt.delay_srv ) );
-
- for( i = 1; i < argc; i++ )
- {
- p = argv[i];
- if( ( q = strchr( p, '=' ) ) == NULL )
- exit_usage( p, NULL );
- *q++ = '\0';
-
- if( strcmp( p, "server_addr" ) == 0 )
- opt.server_addr = q;
- else if( strcmp( p, "server_port" ) == 0 )
- opt.server_port = q;
- else if( strcmp( p, "listen_addr" ) == 0 )
- opt.listen_addr = q;
- else if( strcmp( p, "listen_port" ) == 0 )
- opt.listen_port = q;
- else if( strcmp( p, "duplicate" ) == 0 )
- {
- opt.duplicate = atoi( q );
- if( opt.duplicate < 0 || opt.duplicate > 20 )
- exit_usage( p, q );
- }
- else if( strcmp( p, "delay" ) == 0 )
- {
- opt.delay = atoi( q );
- if( opt.delay < 0 || opt.delay > 20 || opt.delay == 1 )
- exit_usage( p, q );
- }
- else if( strcmp( p, "delay_ccs" ) == 0 )
- {
- opt.delay_ccs = atoi( q );
- if( opt.delay_ccs < 0 || opt.delay_ccs > 1 )
- exit_usage( p, q );
- }
- else if( strcmp( p, "delay_cli" ) == 0 ||
- strcmp( p, "delay_srv" ) == 0 )
- {
- uint8_t *delay_cnt;
- char **delay_list;
- size_t len;
- char *buf;
-
- if( strcmp( p, "delay_cli" ) == 0 )
- {
- delay_cnt = &opt.delay_cli_cnt;
- delay_list = opt.delay_cli;
- }
- else
- {
- delay_cnt = &opt.delay_srv_cnt;
- delay_list = opt.delay_srv;
- }
-
- if( *delay_cnt == MAX_DELAYED_HS )
- {
- mbedtls_printf( " too many uses of %s: only %d allowed\n",
- p, MAX_DELAYED_HS );
- exit_usage( p, NULL );
- }
-
- len = strlen( q );
- buf = mbedtls_calloc( 1, len + 1 );
- if( buf == NULL )
- {
- mbedtls_printf( " Allocation failure\n" );
- exit( 1 );
- }
- memcpy( buf, q, len + 1 );
-
- delay_list[ (*delay_cnt)++ ] = buf;
- }
- else if( strcmp( p, "drop" ) == 0 )
- {
- opt.drop = atoi( q );
- if( opt.drop < 0 || opt.drop > 20 || opt.drop == 1 )
- exit_usage( p, q );
- }
- else if( strcmp( p, "pack" ) == 0 )
- {
-#if defined(MBEDTLS_TIMING_C)
- opt.pack = (unsigned) atoi( q );
-#else
- mbedtls_printf( " option pack only defined if MBEDTLS_TIMING_C is enabled\n" );
- exit( 1 );
-#endif
- }
- else if( strcmp( p, "mtu" ) == 0 )
- {
- opt.mtu = atoi( q );
- if( opt.mtu < 0 || opt.mtu > MAX_MSG_SIZE )
- exit_usage( p, q );
- }
- else if( strcmp( p, "bad_ad" ) == 0 )
- {
- opt.bad_ad = atoi( q );
- if( opt.bad_ad < 0 || opt.bad_ad > 1 )
- exit_usage( p, q );
- }
-#if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID)
- else if( strcmp( p, "bad_cid" ) == 0 )
- {
- opt.bad_cid = (unsigned) atoi( q );
- }
-#endif /* MBEDTLS_SSL_DTLS_CONNECTION_ID */
- else if( strcmp( p, "protect_hvr" ) == 0 )
- {
- opt.protect_hvr = atoi( q );
- if( opt.protect_hvr < 0 || opt.protect_hvr > 1 )
- exit_usage( p, q );
- }
- else if( strcmp( p, "protect_len" ) == 0 )
- {
- opt.protect_len = atoi( q );
- if( opt.protect_len < 0 )
- exit_usage( p, q );
- }
- else if( strcmp( p, "inject_clihlo" ) == 0 )
- {
- opt.inject_clihlo = atoi( q );
- if( opt.inject_clihlo < 0 || opt.inject_clihlo > 1 )
- exit_usage( p, q );
- }
- else if( strcmp( p, "seed" ) == 0 )
- {
- opt.seed = atoi( q );
- if( opt.seed == 0 )
- exit_usage( p, q );
- }
- else
- exit_usage( p, NULL );
- }
-}
-
-static const char *msg_type( unsigned char *msg, size_t len )
-{
- if( len < 1 ) return( "Invalid" );
- switch( msg[0] )
- {
- case MBEDTLS_SSL_MSG_CHANGE_CIPHER_SPEC: return( "ChangeCipherSpec" );
- case MBEDTLS_SSL_MSG_ALERT: return( "Alert" );
- case MBEDTLS_SSL_MSG_APPLICATION_DATA: return( "ApplicationData" );
- case MBEDTLS_SSL_MSG_CID: return( "CID" );
- case MBEDTLS_SSL_MSG_HANDSHAKE: break; /* See below */
- default: return( "Unknown" );
- }
-
- if( len < 13 + 12 ) return( "Invalid handshake" );
-
- /*
- * Our handshake message are less than 2^16 bytes long, so they should
- * have 0 as the first byte of length, frag_offset and frag_length.
- * Otherwise, assume they are encrypted.
- */
- if( msg[14] || msg[19] || msg[22] ) return( "Encrypted handshake" );
-
- switch( msg[13] )
- {
- case MBEDTLS_SSL_HS_HELLO_REQUEST: return( "HelloRequest" );
- case MBEDTLS_SSL_HS_CLIENT_HELLO: return( "ClientHello" );
- case MBEDTLS_SSL_HS_SERVER_HELLO: return( "ServerHello" );
- case MBEDTLS_SSL_HS_HELLO_VERIFY_REQUEST: return( "HelloVerifyRequest" );
- case MBEDTLS_SSL_HS_NEW_SESSION_TICKET: return( "NewSessionTicket" );
- case MBEDTLS_SSL_HS_CERTIFICATE: return( "Certificate" );
- case MBEDTLS_SSL_HS_SERVER_KEY_EXCHANGE: return( "ServerKeyExchange" );
- case MBEDTLS_SSL_HS_CERTIFICATE_REQUEST: return( "CertificateRequest" );
- case MBEDTLS_SSL_HS_SERVER_HELLO_DONE: return( "ServerHelloDone" );
- case MBEDTLS_SSL_HS_CERTIFICATE_VERIFY: return( "CertificateVerify" );
- case MBEDTLS_SSL_HS_CLIENT_KEY_EXCHANGE: return( "ClientKeyExchange" );
- case MBEDTLS_SSL_HS_FINISHED: return( "Finished" );
- default: return( "Unknown handshake" );
- }
-}
-
-#if defined(MBEDTLS_TIMING_C)
-/* Return elapsed time in milliseconds since the first call */
-static unsigned ellapsed_time( void )
-{
- static int initialized = 0;
- static struct mbedtls_timing_hr_time hires;
-
- if( initialized == 0 )
- {
- (void) mbedtls_timing_get_timer( &hires, 1 );
- initialized = 1;
- return( 0 );
- }
-
- return( mbedtls_timing_get_timer( &hires, 0 ) );
-}
-
-typedef struct
-{
- mbedtls_net_context *ctx;
-
- const char *description;
-
- unsigned packet_lifetime;
- unsigned num_datagrams;
-
- unsigned char data[MAX_MSG_SIZE];
- size_t len;
-
-} ctx_buffer;
-
-static ctx_buffer outbuf[2];
-
-static int ctx_buffer_flush( ctx_buffer *buf )
-{
- int ret;
-
- mbedtls_printf( " %05u flush %s: %u bytes, %u datagrams, last %u ms\n",
- ellapsed_time(), buf->description,
- (unsigned) buf->len, buf->num_datagrams,
- ellapsed_time() - buf->packet_lifetime );
-
- ret = mbedtls_net_send( buf->ctx, buf->data, buf->len );
-
- buf->len = 0;
- buf->num_datagrams = 0;
-
- return( ret );
-}
-
-static unsigned ctx_buffer_time_remaining( ctx_buffer *buf )
-{
- unsigned const cur_time = ellapsed_time();
-
- if( buf->num_datagrams == 0 )
- return( (unsigned) -1 );
-
- if( cur_time - buf->packet_lifetime >= opt.pack )
- return( 0 );
-
- return( opt.pack - ( cur_time - buf->packet_lifetime ) );
-}
-
-static int ctx_buffer_append( ctx_buffer *buf,
- const unsigned char * data,
- size_t len )
-{
- int ret;
-
- if( len > (size_t) INT_MAX )
- return( -1 );
-
- if( len > sizeof( buf->data ) )
- {
- mbedtls_printf( " ! buffer size %u too large (max %u)\n",
- (unsigned) len, (unsigned) sizeof( buf->data ) );
- return( -1 );
- }
-
- if( sizeof( buf->data ) - buf->len < len )
- {
- if( ( ret = ctx_buffer_flush( buf ) ) <= 0 )
- {
- mbedtls_printf( "ctx_buffer_flush failed with -%#04x", (unsigned int) -ret );
- return( ret );
- }
- }
-
- memcpy( buf->data + buf->len, data, len );
-
- buf->len += len;
- if( ++buf->num_datagrams == 1 )
- buf->packet_lifetime = ellapsed_time();
-
- return( (int) len );
-}
-#endif /* MBEDTLS_TIMING_C */
-
-static int dispatch_data( mbedtls_net_context *ctx,
- const unsigned char * data,
- size_t len )
-{
- int ret;
-#if defined(MBEDTLS_TIMING_C)
- ctx_buffer *buf = NULL;
- if( opt.pack > 0 )
- {
- if( outbuf[0].ctx == ctx )
- buf = &outbuf[0];
- else if( outbuf[1].ctx == ctx )
- buf = &outbuf[1];
-
- if( buf == NULL )
- return( -1 );
-
- return( ctx_buffer_append( buf, data, len ) );
- }
-#endif /* MBEDTLS_TIMING_C */
-
- ret = mbedtls_net_send( ctx, data, len );
- if( ret < 0 )
- {
- mbedtls_printf( "net_send returned -%#04x\n", (unsigned int) -ret );
- }
- return( ret );
-}
-
-typedef struct
-{
- mbedtls_net_context *dst;
- const char *way;
- const char *type;
- unsigned len;
- unsigned char buf[MAX_MSG_SIZE];
-} packet;
-
-/* Print packet. Outgoing packets come with a reason (forward, dupl, etc.) */
-void print_packet( const packet *p, const char *why )
-{
-#if defined(MBEDTLS_TIMING_C)
- if( why == NULL )
- mbedtls_printf( " %05u dispatch %s %s (%u bytes)\n",
- ellapsed_time(), p->way, p->type, p->len );
- else
- mbedtls_printf( " %05u dispatch %s %s (%u bytes): %s\n",
- ellapsed_time(), p->way, p->type, p->len, why );
-#else
- if( why == NULL )
- mbedtls_printf( " dispatch %s %s (%u bytes)\n",
- p->way, p->type, p->len );
- else
- mbedtls_printf( " dispatch %s %s (%u bytes): %s\n",
- p->way, p->type, p->len, why );
-#endif
-
- fflush( stdout );
-}
-
-/*
- * In order to test the server's behaviour when receiving a ClientHello after
- * the connection is established (this could be a hard reset from the client,
- * but the server must not drop the existing connection before establishing
- * client reachability, see RFC 6347 Section 4.2.8), we memorize the first
- * ClientHello we see (which can't have a cookie), then replay it after the
- * first ApplicationData record - then we're done.
- *
- * This is controlled by the inject_clihlo option.
- *
- * We want an explicit state and a place to store the packet.
- */
-typedef enum {
- ICH_INIT, /* haven't seen the first ClientHello yet */
- ICH_CACHED, /* cached the initial ClientHello */
- ICH_INJECTED, /* ClientHello already injected, done */
-} inject_clihlo_state_t;
-
-static inject_clihlo_state_t inject_clihlo_state;
-static packet initial_clihlo;
-
-int send_packet( const packet *p, const char *why )
-{
- int ret;
- mbedtls_net_context *dst = p->dst;
-
- /* save initial ClientHello? */
- if( opt.inject_clihlo != 0 &&
- inject_clihlo_state == ICH_INIT &&
- strcmp( p->type, "ClientHello" ) == 0 )
- {
- memcpy( &initial_clihlo, p, sizeof( packet ) );
- inject_clihlo_state = ICH_CACHED;
- }
-
- /* insert corrupted CID record? */
- if( opt.bad_cid != 0 &&
- strcmp( p->type, "CID" ) == 0 &&
- ( rand() % opt.bad_cid ) == 0 )
- {
- unsigned char buf[MAX_MSG_SIZE];
- memcpy( buf, p->buf, p->len );
-
- /* The CID resides at offset 11 in the DTLS record header. */
- buf[11] ^= 1;
- print_packet( p, "modified CID" );
-
- if( ( ret = dispatch_data( dst, buf, p->len ) ) <= 0 )
- {
- mbedtls_printf( " ! dispatch returned %d\n", ret );
- return( ret );
- }
- }
-
- /* insert corrupted ApplicationData record? */
- if( opt.bad_ad &&
- strcmp( p->type, "ApplicationData" ) == 0 )
- {
- unsigned char buf[MAX_MSG_SIZE];
- memcpy( buf, p->buf, p->len );
-
- if( p->len <= 13 )
- {
- mbedtls_printf( " ! can't corrupt empty AD record" );
- }
- else
- {
- ++buf[13];
- print_packet( p, "corrupted" );
- }
-
- if( ( ret = dispatch_data( dst, buf, p->len ) ) <= 0 )
- {
- mbedtls_printf( " ! dispatch returned %d\n", ret );
- return( ret );
- }
- }
-
- print_packet( p, why );
- if( ( ret = dispatch_data( dst, p->buf, p->len ) ) <= 0 )
- {
- mbedtls_printf( " ! dispatch returned %d\n", ret );
- return( ret );
- }
-
- /* Don't duplicate Application Data, only handshake covered */
- if( opt.duplicate != 0 &&
- strcmp( p->type, "ApplicationData" ) != 0 &&
- rand() % opt.duplicate == 0 )
- {
- print_packet( p, "duplicated" );
-
- if( ( ret = dispatch_data( dst, p->buf, p->len ) ) <= 0 )
- {
- mbedtls_printf( " ! dispatch returned %d\n", ret );
- return( ret );
- }
- }
-
- /* Inject ClientHello after first ApplicationData */
- if( opt.inject_clihlo != 0 &&
- inject_clihlo_state == ICH_CACHED &&
- strcmp( p->type, "ApplicationData" ) == 0 )
- {
- print_packet( &initial_clihlo, "injected" );
-
- if( ( ret = dispatch_data( dst, initial_clihlo.buf,
- initial_clihlo.len ) ) <= 0 )
- {
- mbedtls_printf( " ! dispatch returned %d\n", ret );
- return( ret );
- }
-
- inject_clihlo_state = ICH_INJECTED;
- }
-
- return( 0 );
-}
-
-#define MAX_DELAYED_MSG 5
-static size_t prev_len;
-static packet prev[MAX_DELAYED_MSG];
-
-void clear_pending( void )
-{
- memset( &prev, 0, sizeof( prev ) );
- prev_len = 0;
-}
-
-void delay_packet( packet *delay )
-{
- if( prev_len == MAX_DELAYED_MSG )
- return;
-
- memcpy( &prev[prev_len++], delay, sizeof( packet ) );
-}
-
-int send_delayed()
-{
- uint8_t offset;
- int ret;
- for( offset = 0; offset < prev_len; offset++ )
- {
- ret = send_packet( &prev[offset], "delayed" );
- if( ret != 0 )
- return( ret );
- }
-
- clear_pending();
- return( 0 );
-}
-
-/*
- * Avoid dropping or delaying a packet that was already dropped twice: this
- * only results in uninteresting timeouts. We can't rely on type to identify
- * packets, since during renegotiation they're all encrypted. So, rely on
- * size mod 2048 (which is usually just size).
- */
-static unsigned char dropped[2048] = { 0 };
-#define DROP_MAX 2
-
-/* We only drop packets at the level of entire datagrams, not at the level
- * of records. In particular, if the peer changes the way it packs multiple
- * records into a single datagram, we don't necessarily count the number of
- * times a record has been dropped correctly. However, the only known reason
- * why a peer would change datagram packing is disabling the latter on
- * retransmission, in which case we'd drop involved records at most
- * DROP_MAX + 1 times. */
-void update_dropped( const packet *p )
-{
- size_t id = p->len % sizeof( dropped );
- ++dropped[id];
-}
-
-int handle_message( const char *way,
- mbedtls_net_context *dst,
- mbedtls_net_context *src )
-{
- int ret;
- packet cur;
- size_t id;
-
- uint8_t delay_idx;
- char ** delay_list;
- uint8_t delay_list_len;
-
- /* receive packet */
- if( ( ret = mbedtls_net_recv( src, cur.buf, sizeof( cur.buf ) ) ) <= 0 )
- {
- mbedtls_printf( " ! mbedtls_net_recv returned %d\n", ret );
- return( ret );
- }
-
- cur.len = ret;
- cur.type = msg_type( cur.buf, cur.len );
- cur.way = way;
- cur.dst = dst;
- print_packet( &cur, NULL );
-
- id = cur.len % sizeof( dropped );
-
- if( strcmp( way, "S <- C" ) == 0 )
- {
- delay_list = opt.delay_cli;
- delay_list_len = opt.delay_cli_cnt;
- }
- else
- {
- delay_list = opt.delay_srv;
- delay_list_len = opt.delay_srv_cnt;
- }
-
- /* Check if message type is in the list of messages
- * that should be delayed */
- for( delay_idx = 0; delay_idx < delay_list_len; delay_idx++ )
- {
- if( delay_list[ delay_idx ] == NULL )
- continue;
-
- if( strcmp( delay_list[ delay_idx ], cur.type ) == 0 )
- {
- /* Delay message */
- delay_packet( &cur );
-
- /* Remove entry from list */
- mbedtls_free( delay_list[delay_idx] );
- delay_list[delay_idx] = NULL;
-
- return( 0 );
- }
- }
-
- /* do we want to drop, delay, or forward it? */
- if( ( opt.mtu != 0 &&
- cur.len > (unsigned) opt.mtu ) ||
- ( opt.drop != 0 &&
- strcmp( cur.type, "CID" ) != 0 &&
- strcmp( cur.type, "ApplicationData" ) != 0 &&
- ! ( opt.protect_hvr &&
- strcmp( cur.type, "HelloVerifyRequest" ) == 0 ) &&
- cur.len != (size_t) opt.protect_len &&
- dropped[id] < DROP_MAX &&
- rand() % opt.drop == 0 ) )
- {
- update_dropped( &cur );
- }
- else if( ( opt.delay_ccs == 1 &&
- strcmp( cur.type, "ChangeCipherSpec" ) == 0 ) ||
- ( opt.delay != 0 &&
- strcmp( cur.type, "CID" ) != 0 &&
- strcmp( cur.type, "ApplicationData" ) != 0 &&
- ! ( opt.protect_hvr &&
- strcmp( cur.type, "HelloVerifyRequest" ) == 0 ) &&
- cur.len != (size_t) opt.protect_len &&
- dropped[id] < DROP_MAX &&
- rand() % opt.delay == 0 ) )
- {
- delay_packet( &cur );
- }
- else
- {
- /* forward and possibly duplicate */
- if( ( ret = send_packet( &cur, "forwarded" ) ) != 0 )
- return( ret );
-
- /* send previously delayed messages if any */
- ret = send_delayed();
- if( ret != 0 )
- return( ret );
- }
-
- return( 0 );
-}
-
-int main( int argc, char *argv[] )
-{
- int ret = 1;
- int exit_code = MBEDTLS_EXIT_FAILURE;
- uint8_t delay_idx;
-
- mbedtls_net_context listen_fd, client_fd, server_fd;
-
-#if defined( MBEDTLS_TIMING_C )
- struct timeval tm;
-#endif
-
- struct timeval *tm_ptr = NULL;
-
- int nb_fds;
- fd_set read_fds;
-
- mbedtls_net_init( &listen_fd );
- mbedtls_net_init( &client_fd );
- mbedtls_net_init( &server_fd );
-
- get_options( argc, argv );
-
- /*
- * Decisions to drop/delay/duplicate packets are pseudo-random: dropping
- * exactly 1 in N packets would lead to problems when a flight has exactly
- * N packets: the same packet would be dropped on every resend.
- *
- * In order to be able to reproduce problems reliably, the seed may be
- * specified explicitly.
- */
- if( opt.seed == 0 )
- {
- opt.seed = (unsigned int) time( NULL );
- mbedtls_printf( " . Pseudo-random seed: %u\n", opt.seed );
- }
-
- srand( opt.seed );
-
- /*
- * 0. "Connect" to the server
- */
- mbedtls_printf( " . Connect to server on UDP/%s/%s ...",
- opt.server_addr, opt.server_port );
- fflush( stdout );
-
- if( ( ret = mbedtls_net_connect( &server_fd, opt.server_addr, opt.server_port,
- MBEDTLS_NET_PROTO_UDP ) ) != 0 )
- {
- mbedtls_printf( " failed\n ! mbedtls_net_connect returned %d\n\n", ret );
- goto exit;
- }
-
- mbedtls_printf( " ok\n" );
-
- /*
- * 1. Setup the "listening" UDP socket
- */
- mbedtls_printf( " . Bind on UDP/%s/%s ...",
- opt.listen_addr, opt.listen_port );
- fflush( stdout );
-
- if( ( ret = mbedtls_net_bind( &listen_fd, opt.listen_addr, opt.listen_port,
- MBEDTLS_NET_PROTO_UDP ) ) != 0 )
- {
- mbedtls_printf( " failed\n ! mbedtls_net_bind returned %d\n\n", ret );
- goto exit;
- }
-
- mbedtls_printf( " ok\n" );
-
- /*
- * 2. Wait until a client connects
- */
-accept:
- mbedtls_net_free( &client_fd );
-
- mbedtls_printf( " . Waiting for a remote connection ..." );
- fflush( stdout );
-
- if( ( ret = mbedtls_net_accept( &listen_fd, &client_fd,
- NULL, 0, NULL ) ) != 0 )
- {
- mbedtls_printf( " failed\n ! mbedtls_net_accept returned %d\n\n", ret );
- goto exit;
- }
-
- mbedtls_printf( " ok\n" );
-
- /*
- * 3. Forward packets forever (kill the process to terminate it)
- */
- clear_pending();
- memset( dropped, 0, sizeof( dropped ) );
-
- nb_fds = client_fd.fd;
- if( nb_fds < server_fd.fd )
- nb_fds = server_fd.fd;
- if( nb_fds < listen_fd.fd )
- nb_fds = listen_fd.fd;
- ++nb_fds;
-
-#if defined(MBEDTLS_TIMING_C)
- if( opt.pack > 0 )
- {
- outbuf[0].ctx = &server_fd;
- outbuf[0].description = "S <- C";
- outbuf[0].num_datagrams = 0;
- outbuf[0].len = 0;
-
- outbuf[1].ctx = &client_fd;
- outbuf[1].description = "S -> C";
- outbuf[1].num_datagrams = 0;
- outbuf[1].len = 0;
- }
-#endif /* MBEDTLS_TIMING_C */
-
- while( 1 )
- {
-#if defined(MBEDTLS_TIMING_C)
- if( opt.pack > 0 )
- {
- unsigned max_wait_server, max_wait_client, max_wait;
- max_wait_server = ctx_buffer_time_remaining( &outbuf[0] );
- max_wait_client = ctx_buffer_time_remaining( &outbuf[1] );
-
- max_wait = (unsigned) -1;
-
- if( max_wait_server == 0 )
- ctx_buffer_flush( &outbuf[0] );
- else
- max_wait = max_wait_server;
-
- if( max_wait_client == 0 )
- ctx_buffer_flush( &outbuf[1] );
- else
- {
- if( max_wait_client < max_wait )
- max_wait = max_wait_client;
- }
-
- if( max_wait != (unsigned) -1 )
- {
- tm.tv_sec = max_wait / 1000;
- tm.tv_usec = ( max_wait % 1000 ) * 1000;
-
- tm_ptr = &tm;
- }
- else
- {
- tm_ptr = NULL;
- }
- }
-#endif /* MBEDTLS_TIMING_C */
-
- FD_ZERO( &read_fds );
- FD_SET( server_fd.fd, &read_fds );
- FD_SET( client_fd.fd, &read_fds );
- FD_SET( listen_fd.fd, &read_fds );
-
- if( ( ret = select( nb_fds, &read_fds, NULL, NULL, tm_ptr ) ) < 0 )
- {
- perror( "select" );
- goto exit;
- }
-
- if( FD_ISSET( listen_fd.fd, &read_fds ) )
- goto accept;
-
- if( FD_ISSET( client_fd.fd, &read_fds ) )
- {
- if( ( ret = handle_message( "S <- C",
- &server_fd, &client_fd ) ) != 0 )
- goto accept;
- }
-
- if( FD_ISSET( server_fd.fd, &read_fds ) )
- {
- if( ( ret = handle_message( "S -> C",
- &client_fd, &server_fd ) ) != 0 )
- goto accept;
- }
-
- }
-
- exit_code = MBEDTLS_EXIT_SUCCESS;
-
-exit:
-
-#ifdef MBEDTLS_ERROR_C
- if( exit_code != MBEDTLS_EXIT_SUCCESS )
- {
- char error_buf[100];
- mbedtls_strerror( ret, error_buf, 100 );
- mbedtls_printf( "Last error was: -0x%04X - %s\n\n", (unsigned int) -ret, error_buf );
- fflush( stdout );
- }
-#endif
-
- for( delay_idx = 0; delay_idx < MAX_DELAYED_HS; delay_idx++ )
- {
- mbedtls_free( opt.delay_cli[delay_idx] );
- mbedtls_free( opt.delay_srv[delay_idx] );
- }
-
- mbedtls_net_free( &client_fd );
- mbedtls_net_free( &server_fd );
- mbedtls_net_free( &listen_fd );
-
-#if defined(_WIN32)
- mbedtls_printf( " Press Enter to exit this program.\n" );
- fflush( stdout ); getchar();
-#endif
-
- mbedtls_exit( exit_code );
-}
-
-#endif /* MBEDTLS_NET_C */
diff --git a/lib/mbedtls-2.27.0/programs/test/udp_proxy_wrapper.sh b/lib/mbedtls-2.27.0/programs/test/udp_proxy_wrapper.sh
deleted file mode 100755
index 27de013..0000000
--- a/lib/mbedtls-2.27.0/programs/test/udp_proxy_wrapper.sh
+++ /dev/null
@@ -1,132 +0,0 @@
-#!/bin/sh
-# -*-sh-basic-offset: 4-*-
-# Usage: udp_proxy_wrapper.sh [PROXY_PARAM...] -- [SERVER_PARAM...]
-#
-# Copyright The Mbed TLS Contributors
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-set -u
-
-MBEDTLS_BASE="$(dirname -- "$0")/../.."
-TPXY_BIN="$MBEDTLS_BASE/programs/test/udp_proxy"
-SRV_BIN="$MBEDTLS_BASE/programs/ssl/ssl_server2"
-
-: ${VERBOSE:=0}
-
-stop_proxy() {
- if [ -n "${tpxy_pid:-}" ]; then
- echo
- echo " * Killing proxy (pid $tpxy_pid) ..."
- kill $tpxy_pid
- fi
-}
-
-stop_server() {
- if [ -n "${srv_pid:-}" ]; then
- echo
- echo " * Killing server (pid $srv_pid) ..."
- kill $srv_pid >/dev/null 2>/dev/null
- fi
-}
-
-cleanup() {
- stop_server
- stop_proxy
- exit 129
-}
-
-trap cleanup INT TERM HUP
-
-# Extract the proxy parameters
-tpxy_cmd_snippet='"$TPXY_BIN"'
-while [ $# -ne 0 ] && [ "$1" != "--" ]; do
- tail="$1" quoted=""
- while [ -n "$tail" ]; do
- case "$tail" in
- *\'*) quoted="${quoted}${tail%%\'*}'\\''" tail="${tail#*\'}";;
- *) quoted="${quoted}${tail}"; tail=; false;;
- esac
- done
- tpxy_cmd_snippet="$tpxy_cmd_snippet '$quoted'"
- shift
-done
-unset tail quoted
-if [ $# -eq 0 ]; then
- echo " * No server arguments (must be preceded by \" -- \") - exit"
- exit 3
-fi
-shift
-
-dtls_enabled=
-ipv6_in_use=
-server_port_orig=
-server_addr_orig=
-for param; do
- case "$param" in
- server_port=*) server_port_orig="${param#*=}";;
- server_addr=*:*) server_addr_orig="${param#*=}"; ipv6_in_use=1;;
- server_addr=*) server_addr_orig="${param#*=}";;
- dtls=[!0]*) dtls_enabled=1;;
- esac
-done
-
-if [ -z "$dtls_enabled" ] || [ -n "$ipv6_in_use" ]; then
- echo >&2 "$0: Couldn't find DTLS enabling, or IPv6 is in use - immediate fallback to server application..."
- if [ $VERBOSE -gt 0 ]; then
- echo "[ $SRV_BIN $* ]"
- fi
- exec "$SRV_BIN" "$@"
-fi
-
-if [ -z "$server_port_orig" ]; then
- server_port_orig=4433
-fi
-echo " * Server port: $server_port_orig"
-tpxy_cmd_snippet="$tpxy_cmd_snippet \"listen_port=\$server_port_orig\""
-tpxy_cmd_snippet="$tpxy_cmd_snippet \"server_port=\$server_port\""
-
-if [ -n "$server_addr_orig" ]; then
- echo " * Server address: $server_addr_orig"
- tpxy_cmd_snippet="$tpxy_cmd_snippet \"server_addr=\$server_addr_orig\""
- tpxy_cmd_snippet="$tpxy_cmd_snippet \"listen_addr=\$server_addr_orig\""
-fi
-
-server_port=$(( server_port_orig + 1 ))
-set -- "$@" "server_port=$server_port"
-echo " * Intermediate port: $server_port"
-
-echo " * Start proxy in background ..."
-if [ $VERBOSE -gt 0 ]; then
- echo "[ $tpxy_cmd_snippet ]"
-fi
-eval exec "$tpxy_cmd_snippet" >/dev/null 2>&1 &
-tpxy_pid=$!
-
-if [ $VERBOSE -gt 0 ]; then
- echo " * Proxy ID: $TPXY_PID"
-fi
-
-echo " * Starting server ..."
-if [ $VERBOSE -gt 0 ]; then
- echo "[ $SRV_BIN $* ]"
-fi
-
-exec "$SRV_BIN" "$@" >&2 &
-srv_pid=$!
-
-wait $srv_pid
-
-stop_proxy
-return 0
diff --git a/lib/mbedtls-2.27.0/programs/test/zeroize.c b/lib/mbedtls-2.27.0/programs/test/zeroize.c
deleted file mode 100644
index 5e6b58e..0000000
--- a/lib/mbedtls-2.27.0/programs/test/zeroize.c
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Zeroize application for debugger-driven testing
- *
- * This is a simple test application used for debugger-driven testing to check
- * whether calls to mbedtls_platform_zeroize() are being eliminated by compiler
- * optimizations. This application is used by the GDB script at
- * tests/scripts/test_zeroize.gdb: the script sets a breakpoint at the last
- * return statement in the main() function of this program. The debugger
- * facilities are then used to manually inspect the memory and verify that the
- * call to mbedtls_platform_zeroize() was not eliminated.
- *
- * Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#if !defined(MBEDTLS_CONFIG_FILE)
-#include "mbedtls/config.h"
-#else
-#include MBEDTLS_CONFIG_FILE
-#endif
-
-#include <stdio.h>
-
-#if defined(MBEDTLS_PLATFORM_C)
-#include "mbedtls/platform.h"
-#else
-#include <stdlib.h>
-#define mbedtls_printf printf
-#define mbedtls_exit exit
-#define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS
-#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE
-#endif
-
-#include "mbedtls/platform_util.h"
-
-#define BUFFER_LEN 1024
-
-void usage( void )
-{
- mbedtls_printf( "Zeroize is a simple program to assist with testing\n" );
- mbedtls_printf( "the mbedtls_platform_zeroize() function by using the\n" );
- mbedtls_printf( "debugger. This program takes a file as input and\n" );
- mbedtls_printf( "prints the first %d characters. Usage:\n\n", BUFFER_LEN );
- mbedtls_printf( " zeroize <FILE>\n" );
-}
-
-int main( int argc, char** argv )
-{
- int exit_code = MBEDTLS_EXIT_FAILURE;
- FILE *fp;
- char buf[BUFFER_LEN];
- char *p = buf;
- char *end = p + BUFFER_LEN;
- int c;
-
- if( argc != 2 )
- {
- mbedtls_printf( "This program takes exactly 1 agument\n" );
- usage();
- mbedtls_exit( exit_code );
- }
-
- fp = fopen( argv[1], "r" );
- if( fp == NULL )
- {
- mbedtls_printf( "Could not open file '%s'\n", argv[1] );
- mbedtls_exit( exit_code );
- }
-
- while( ( c = fgetc( fp ) ) != EOF && p < end - 1 )
- *p++ = (char)c;
- *p = '\0';
-
- if( p - buf != 0 )
- {
- mbedtls_printf( "%s\n", buf );
- exit_code = MBEDTLS_EXIT_SUCCESS;
- }
- else
- mbedtls_printf( "The file is empty!\n" );
-
- fclose( fp );
- mbedtls_platform_zeroize( buf, sizeof( buf ) );
-
- mbedtls_exit( exit_code ); // GDB_BREAK_HERE -- don't remove this comment!
-}