Commit 8da2984f authored by johan's avatar johan

Backward compatibility with polarssl1.3.4 and above

parent 4e5279a6
......@@ -57,6 +57,9 @@ if(ENABLE_POLARSSL AND NOT MBEDTLS_FOUND)
find_package(PolarSSL REQUIRED)
if(POLARSSL_FOUND)
message("Use polarSSL")
if(CTR_DRBG_FREE)
set(HAVE_CTR_DRGB_FREE 1)
endif()
endif()
endif()
......
......@@ -65,10 +65,7 @@ return 0;
}"
X509PARSE_CRTPATH_OK)
check_symbol_exists(ssl_get_dtls_srtp_protection_profile "polarssl/ssl.h" HAVE_SSL_GET_DTLS_SRTP_PROTECTION_PROFILE)
check_symbol_exists(ctr_drbg_free "polarssl/ctr_drbg.h" HAVE_CTR_DRBG_FREE)
if (NOT HAVE_CTR_DRBG_FREE)
message(FATAL_ERROR "Requires polarssl/mbedtls version >=1.3.8")
endif()
check_symbol_exists(ctr_drbg_free "polarssl/ctr_drbg.h" CTR_DRBG_FREE)
cmake_pop_check_state()
endif()
......@@ -78,4 +75,4 @@ find_package_handle_standard_args(PolarSSL
POLARSSL_INCLUDE_DIRS POLARSSL_LIBRARIES HAVE_POLARSSL_SSL_H
)
mark_as_advanced(POLARSSL_INCLUDE_DIRS POLARSSL_LIBRARIES HAVE_POLARSSL_SSL_H X509PARSE_CRTPATH_OK HAVE_SSL_GET_DTLS_SRTP_PROTECTION_PROFILE)
mark_as_advanced(POLARSSL_INCLUDE_DIRS POLARSSL_LIBRARIES HAVE_POLARSSL_SSL_H X509PARSE_CRTPATH_OK CTR_DRGB_FREE HAVE_SSL_GET_DTLS_SRTP_PROTECTION_PROFILE)
......@@ -30,3 +30,4 @@
#cmakedefine VERSION "@VERSION@"
#cmakedefine HAVE_DTLS_SRTP
#cmakedefine HAVE_CTR_DRGB_FREE
......@@ -112,7 +112,10 @@ int32_t bctoolbox_rng_get(bctoolbox_rng_context_t *context, unsigned char*output
}
void bctoolbox_rng_context_free(bctoolbox_rng_context_t *context) {
/* ctr_drg_free function is available from polarssl1.3.8 but we want to support previous versions */
#ifdef HAVE_CTR_DRGB_FREE
ctr_drbg_free(&(context->ctr_drbg));
#endif
entropy_free(&(context->entropy));
bctoolbox_free(context);
}
......@@ -315,7 +318,10 @@ int32_t bctoolbox_x509_certificate_generate_selfsigned(const char *subject, bcto
}
x509write_crt_free(&crt);
/* ctr_drg_free function is available from polarssl1.3.8 but we want to support previous versions */
#ifdef HAVE_CTR_DRGB_FREE
ctr_drbg_free(&ctr_drbg);
#endif
entropy_free(&entropy);
/* copy the key+cert in pem format into the given buffer */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment