Merge pull request #3091 from Tilka/mbedtls

Update mbed TLS (PolarSSL)
This commit is contained in:
shuffle2
2015-10-03 18:00:58 -07:00
268 changed files with 64052 additions and 58418 deletions

View File

@ -0,0 +1,23 @@
find_path(MBEDTLS_INCLUDE_DIR mbedtls/ssl.h)
find_library(MBEDTLS_LIBRARY mbedtls)
find_library(MBEDX509_LIBRARY mbedx509)
find_library(MBEDCRYPTO_LIBRARY mbedcrypto)
set(MBEDTLS_INCLUDE_DIRS ${MBEDTLS_INCLUDE_DIR})
set(MBEDTLS_LIBRARIES ${MBEDTLS_LIBRARY} ${MBEDX509_LIBRARY} ${MBEDCRYPTO_LIBRARY})
set(CMAKE_REQUIRED_INCLUDES ${MBEDTLS_INCLUDE_DIRS})
check_cxx_source_compiles("
#include <mbedtls/version.h>
#if MBEDTLS_VERSION_NUMBER < 0x02010100
#error \"Your mbed TLS version is too old.\"
#endif
int main() {}"
MBEDTLS_VERSION_OK)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(MBEDTLS DEFAULT_MSG
MBEDTLS_INCLUDE_DIR MBEDTLS_LIBRARY MBEDX509_LIBRARY MBEDCRYPTO_LIBRARY MBEDTLS_VERSION_OK)
mark_as_advanced(MBEDTLS_INCLUDE_DIR MBEDTLS_LIBRARY MBEDX509_LIBRARY MBEDCRYPTO_LIBRARY)

View File

@ -1,83 +0,0 @@
# Locate polarssl library
# This module defines
# POLARSSL_FOUND
# POLARSSL_LIBRARY
# POLARSSL_INCLUDE_DIR
# POLARSSL_WORKS, this is true if polarssl is found and contains the methods
# needed by dolphin-emu
# validate cached values (but use them as hints)
set(POLARSSL_INCLUDE_DIR_HINT POLARSSL_INCLUDE_DIR)
set(POLARSSL_LIBRARY_HINT POLARSSL_LIBRARY)
unset(POLARSSL_INCLUDE_DIR CACHE)
unset(POLARSSL_LIBRARY CACHE)
find_path(POLARSSL_INCLUDE_DIR polarssl/ssl.h HINTS ${POLARSSL_INCLUDE_DIR_HINT})
find_library(POLARSSL_LIBRARY polarssl HINTS ${POLARSSL_LIBRARY_HINT})
if(POLARSSL_INCLUDE_DIR STREQUAL POLARSSL_INCLUDE_DIR_HINT AND
POLARSSL_LIBRARY STREQUAL POLARSSL_LIBRARY_HINT)
# using cached values, be silent
set(POLARSSL_FIND_QUIETLY TRUE)
endif()
if (POLARSSL_INCLUDE_DIR AND POLARSSL_LIBRARY)
set (POLARSSL_FOUND TRUE)
endif ()
if (POLARSSL_FOUND)
if (NOT POLARSSL_FIND_QUIETLY)
message (STATUS "Found the polarssl libraries at ${POLARSSL_LIBRARY}")
message (STATUS "Found the polarssl headers at ${POLARSSL_INCLUDE_DIR}")
endif (NOT POLARSSL_FIND_QUIETLY)
set(CMAKE_REQUIRED_INCLUDES ${POLARSSL_INCLUDE_DIR})
set(CMAKE_REQUIRED_LIBRARIES ${POLARSSL_LIBRARY})
unset(POLARSSL_WORKS CACHE)
check_cxx_source_compiles("
#include <cstring>
#include <polarssl/ctr_drbg.h>
#include <polarssl/entropy.h>
#include <polarssl/net.h>
#include <polarssl/ssl.h>
#include <polarssl/version.h>
#if POLARSSL_VERSION_NUMBER < 0x01030000
#error \"Shared PolarSSL version is too old\"
#endif
int main()
{
ssl_context ctx;
ssl_session session;
entropy_context entropy;
ctr_drbg_context ctr_drbg;
x509_crt cacert;
x509_crt clicert;
pk_context pk;
ssl_init(&ctx);
entropy_init(&entropy);
const char* pers = \"dolphin-emu\";
ctr_drbg_init(&ctr_drbg, entropy_func,
&entropy,
(const unsigned char*)pers,
strlen(pers));
ssl_set_rng(&ctx, ctr_drbg_random, &ctr_drbg);
ssl_set_session(&ctx, &session);
ssl_close_notify(&ctx);
ssl_session_free(&session);
ssl_free(&ctx);
entropy_free(&entropy);
return 0;
}"
POLARSSL_WORKS)
else ()
message (STATUS "Could not find polarssl")
endif ()
mark_as_advanced(POLARSSL_INCLUDE_DIR POLARSSL_LIBRARY)