Further adjustments to support PolarSSL 1.2

This commit is contained in:
Mike Gelfand 2015-01-07 14:05:58 +00:00
parent 30690fcf99
commit fe47350656
2 changed files with 11 additions and 1 deletions

View File

@ -150,7 +150,7 @@ AS_IF([test "x$want_crypto" = "xauto" -o "x$want_crypto" = "xpolarssl"], [
#if defined (POLARSSL_VERSION_NUMBER) && POLARSSL_VERSION_NUMBER >= $POLARSSL_MINIMUM
version_ok
#endif],
[AC_CHECK_LIB([polarssl], [dhm_init],
[AC_CHECK_LIB([polarssl], [dhm_calc_secret],
[want_crypto="polarssl"; CRYPTO_PKG="polarssl"; CRYPTO_CFLAGS=""; CRYPTO_LIBS="-lpolarssl"],
[AS_IF([test "x$want_crypto" = "xpolarssl"],
[AC_MSG_ERROR([PolarSSL support requested, but library not found.])]

View File

@ -40,7 +40,13 @@ log_polarssl_error (int error_code,
if (tr_logLevelIsActive (TR_LOG_ERROR))
{
char error_message[256];
#if POLARSSL_VERSION_NUMBER >= 0x01030000
polarssl_strerror (error_code, error_message, sizeof (error_message));
#else
error_strerror (error_code, error_message, sizeof (error_message));
#endif
tr_logAddMessage (file, line, TR_LOG_ERROR, MY_NAME, "PolarSSL error: %s", error_message);
}
}
@ -288,8 +294,12 @@ tr_dh_agree (tr_dh_ctx_t raw_handle,
secret_key_length = handle->len;
#if POLARSSL_VERSION_NUMBER >= 0x01030000
if (!check_result (dhm_calc_secret (handle, ret->key,
&secret_key_length, my_rand, NULL)))
#else
if (!check_result (dhm_calc_secret (handle, ret->key, &secret_key_length)))
#endif
{
tr_dh_secret_free (ret);
return NULL;