mbed TLS upgraded to 2.6.0

Fork of mbedtls by Mark Radbourne

Committer:
Jasper Wallace
Date:
Fri Sep 29 19:50:30 2017 +0100
Revision:
2:bbdeda018a3c
Parent:
0:cdf462088d13
Update to mbedtls 2.6.0, many changes.

Changes to mbedtls sources made:

in include/mbedtls/config.h comment out:

#define MBEDTLS_FS_IO
#define MBEDTLS_NET_C
#define MBEDTLS_TIMING_C

uncomment:

#define MBEDTLS_NO_PLATFORM_ENTROPY

remove the following directorys:

programs
yotta
visualc

Who changed what in which revision?

UserRevisionLine numberNew contents of line
markrad 0:cdf462088d13 1 set(libs
markrad 0:cdf462088d13 2 mbedtls
markrad 0:cdf462088d13 3 )
markrad 0:cdf462088d13 4
markrad 0:cdf462088d13 5 if(USE_PKCS11_HELPER_LIBRARY)
markrad 0:cdf462088d13 6 set(libs ${libs} pkcs11-helper)
markrad 0:cdf462088d13 7 endif(USE_PKCS11_HELPER_LIBRARY)
markrad 0:cdf462088d13 8
markrad 0:cdf462088d13 9 if(ENABLE_ZLIB_SUPPORT)
markrad 0:cdf462088d13 10 set(libs ${libs} ${ZLIB_LIBRARIES})
markrad 0:cdf462088d13 11 endif(ENABLE_ZLIB_SUPPORT)
markrad 0:cdf462088d13 12
markrad 0:cdf462088d13 13 find_package(Perl)
markrad 0:cdf462088d13 14 if(NOT PERL_FOUND)
markrad 0:cdf462088d13 15 message(FATAL_ERROR "Cannot build test suites without Perl")
markrad 0:cdf462088d13 16 endif()
markrad 0:cdf462088d13 17
markrad 0:cdf462088d13 18 function(add_test_suite suite_name)
markrad 0:cdf462088d13 19 if(ARGV1)
markrad 0:cdf462088d13 20 set(data_name ${ARGV1})
markrad 0:cdf462088d13 21 else()
markrad 0:cdf462088d13 22 set(data_name ${suite_name})
markrad 0:cdf462088d13 23 endif()
markrad 0:cdf462088d13 24
markrad 0:cdf462088d13 25 add_custom_command(
markrad 0:cdf462088d13 26 OUTPUT test_suite_${data_name}.c
markrad 0:cdf462088d13 27 COMMAND ${PERL_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/scripts/generate_code.pl ${CMAKE_CURRENT_SOURCE_DIR}/suites test_suite_${suite_name} test_suite_${data_name}
markrad 0:cdf462088d13 28 DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/scripts/generate_code.pl mbedtls suites/helpers.function suites/main_test.function suites/test_suite_${suite_name}.function suites/test_suite_${data_name}.data
markrad 0:cdf462088d13 29 )
markrad 0:cdf462088d13 30
markrad 0:cdf462088d13 31 include_directories(${CMAKE_CURRENT_SOURCE_DIR})
markrad 0:cdf462088d13 32 add_executable(test_suite_${data_name} test_suite_${data_name}.c)
markrad 0:cdf462088d13 33 target_link_libraries(test_suite_${data_name} ${libs})
markrad 0:cdf462088d13 34 add_test(${data_name}-suite test_suite_${data_name})
markrad 0:cdf462088d13 35 endfunction(add_test_suite)
markrad 0:cdf462088d13 36
markrad 0:cdf462088d13 37 if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG)
markrad 0:cdf462088d13 38 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-function")
markrad 0:cdf462088d13 39 endif(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG)
markrad 0:cdf462088d13 40
markrad 0:cdf462088d13 41 if(MSVC)
markrad 0:cdf462088d13 42 # If a warning level has been defined, suppress all warnings for test code
markrad 0:cdf462088d13 43 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W0")
markrad 0:cdf462088d13 44 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX-")
markrad 0:cdf462088d13 45 endif(MSVC)
markrad 0:cdf462088d13 46
markrad 0:cdf462088d13 47 add_test_suite(aes aes.ecb)
markrad 0:cdf462088d13 48 add_test_suite(aes aes.cbc)
markrad 0:cdf462088d13 49 add_test_suite(aes aes.cfb)
markrad 0:cdf462088d13 50 add_test_suite(aes aes.rest)
markrad 0:cdf462088d13 51 add_test_suite(arc4)
markrad 0:cdf462088d13 52 add_test_suite(asn1write)
markrad 0:cdf462088d13 53 add_test_suite(base64)
markrad 0:cdf462088d13 54 add_test_suite(blowfish)
markrad 0:cdf462088d13 55 add_test_suite(camellia)
markrad 0:cdf462088d13 56 add_test_suite(ccm)
markrad 0:cdf462088d13 57 add_test_suite(cipher cipher.aes)
markrad 0:cdf462088d13 58 add_test_suite(cipher cipher.arc4)
markrad 0:cdf462088d13 59 add_test_suite(cipher cipher.blowfish)
markrad 0:cdf462088d13 60 add_test_suite(cipher cipher.camellia)
markrad 0:cdf462088d13 61 add_test_suite(cipher cipher.ccm)
markrad 0:cdf462088d13 62 add_test_suite(cipher cipher.des)
markrad 0:cdf462088d13 63 add_test_suite(cipher cipher.gcm)
markrad 0:cdf462088d13 64 add_test_suite(cipher cipher.null)
markrad 0:cdf462088d13 65 add_test_suite(cipher cipher.padding)
markrad 0:cdf462088d13 66 add_test_suite(cmac)
markrad 0:cdf462088d13 67 add_test_suite(ctr_drbg)
markrad 0:cdf462088d13 68 add_test_suite(debug)
markrad 0:cdf462088d13 69 add_test_suite(des)
markrad 0:cdf462088d13 70 add_test_suite(dhm)
markrad 0:cdf462088d13 71 add_test_suite(ecdh)
markrad 0:cdf462088d13 72 add_test_suite(ecdsa)
markrad 0:cdf462088d13 73 add_test_suite(ecjpake)
markrad 0:cdf462088d13 74 add_test_suite(ecp)
markrad 0:cdf462088d13 75 add_test_suite(entropy)
markrad 0:cdf462088d13 76 add_test_suite(error)
markrad 0:cdf462088d13 77 add_test_suite(gcm gcm.aes128_en)
markrad 0:cdf462088d13 78 add_test_suite(gcm gcm.aes192_en)
markrad 0:cdf462088d13 79 add_test_suite(gcm gcm.aes256_en)
markrad 0:cdf462088d13 80 add_test_suite(gcm gcm.aes128_de)
markrad 0:cdf462088d13 81 add_test_suite(gcm gcm.aes192_de)
markrad 0:cdf462088d13 82 add_test_suite(gcm gcm.aes256_de)
markrad 0:cdf462088d13 83 add_test_suite(gcm gcm.camellia)
markrad 0:cdf462088d13 84 add_test_suite(hmac_drbg hmac_drbg.misc)
markrad 0:cdf462088d13 85 add_test_suite(hmac_drbg hmac_drbg.no_reseed)
markrad 0:cdf462088d13 86 add_test_suite(hmac_drbg hmac_drbg.nopr)
markrad 0:cdf462088d13 87 add_test_suite(hmac_drbg hmac_drbg.pr)
markrad 0:cdf462088d13 88 add_test_suite(md)
markrad 0:cdf462088d13 89 add_test_suite(mdx)
markrad 0:cdf462088d13 90 add_test_suite(memory_buffer_alloc)
markrad 0:cdf462088d13 91 add_test_suite(mpi)
markrad 0:cdf462088d13 92 add_test_suite(pem)
markrad 0:cdf462088d13 93 add_test_suite(pkcs1_v15)
markrad 0:cdf462088d13 94 add_test_suite(pkcs1_v21)
markrad 0:cdf462088d13 95 add_test_suite(pkcs5)
markrad 0:cdf462088d13 96 add_test_suite(pk)
markrad 0:cdf462088d13 97 add_test_suite(pkparse)
markrad 0:cdf462088d13 98 add_test_suite(pkwrite)
markrad 0:cdf462088d13 99 add_test_suite(shax)
markrad 0:cdf462088d13 100 add_test_suite(ssl)
markrad 0:cdf462088d13 101 add_test_suite(timing)
markrad 0:cdf462088d13 102 add_test_suite(rsa)
markrad 0:cdf462088d13 103 add_test_suite(version)
markrad 0:cdf462088d13 104 add_test_suite(xtea)
markrad 0:cdf462088d13 105 add_test_suite(x509parse)
markrad 0:cdf462088d13 106 add_test_suite(x509write)
markrad 0:cdf462088d13 107
markrad 0:cdf462088d13 108 # Make data_files available in an out-of-source build
markrad 0:cdf462088d13 109 if (NOT ${CMAKE_CURRENT_BINARY_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
markrad 0:cdf462088d13 110 # Get OS dependent path to use in `execute_process`
markrad 0:cdf462088d13 111 file(TO_NATIVE_PATH "${CMAKE_CURRENT_BINARY_DIR}/data_files" link)
markrad 0:cdf462088d13 112 file(TO_NATIVE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/data_files" target)
markrad 0:cdf462088d13 113
markrad 0:cdf462088d13 114 if (NOT EXISTS ${link})
markrad 0:cdf462088d13 115 if (CMAKE_HOST_UNIX)
markrad 0:cdf462088d13 116 set(command ln -s ${target} ${link})
markrad 0:cdf462088d13 117 else()
markrad 0:cdf462088d13 118 set(command cmd.exe /c mklink /j ${link} ${target})
markrad 0:cdf462088d13 119 endif()
markrad 0:cdf462088d13 120
markrad 0:cdf462088d13 121 execute_process(COMMAND ${command}
markrad 0:cdf462088d13 122 RESULT_VARIABLE result
markrad 0:cdf462088d13 123 ERROR_VARIABLE output)
markrad 0:cdf462088d13 124
markrad 0:cdf462088d13 125 if (NOT ${result} EQUAL 0)
markrad 0:cdf462088d13 126 message(FATAL_ERROR "Could not create symbolic link for: ${target} --> ${output}")
markrad 0:cdf462088d13 127 endif()
markrad 0:cdf462088d13 128 endif()
markrad 0:cdf462088d13 129 endif()
markrad 0:cdf462088d13 130