]> granicus.if.org Git - transmission/commitdiff
Lower minimum PolarSSL version required down to 1.2
authorMike Gelfand <mikedld@mikedld.com>
Wed, 7 Jan 2015 13:41:22 +0000 (13:41 +0000)
committerMike Gelfand <mikedld@mikedld.com>
Wed, 7 Jan 2015 13:41:22 +0000 (13:41 +0000)
CMakeLists.txt
configure.ac
libtransmission/crypto-utils-polarssl.c

index 04f20f7efb101d3739c2a64b41605d1ed82e3533..768d9ef0849b238551e049dce9de265feac92e47 100644 (file)
@@ -96,7 +96,7 @@ set(CURL_MINIMUM            7.15.4)
 set(EVENT2_MINIMUM          2.0.10)
 set(OPENSSL_MINIMUM         0.9.4)
 set(CYASSL_MINIMUM          3.0)
-set(POLARSSL_MINIMUM        1.3)
+set(POLARSSL_MINIMUM        1.2)
 set(ZLIB_MINIMUM            1.2.3)
 set(GTK_MINIMUM             3.4.0)
 set(GLIB_MINIMUM            2.32.0)
index d619c47033db942c7bcb452b3a4b3cfb58a3df76..e994988daa0c2c07505884fc8e75593f7c3a9902 100644 (file)
@@ -50,7 +50,7 @@ OPENSSL_MINIMUM=0.9.4
 AC_SUBST(OPENSSL_MINIMUM)
 CYASSL_MINIMUM=3.0
 AC_SUBST(CYASSL_MINIMUM)
-POLARSSL_MINIMUM=0x01030000 # 1.3
+POLARSSL_MINIMUM=0x01020000 # 1.2
 AC_SUBST(POLARSSL_MINIMUM)
 
 ##
index ac6fb538b2f78941fd5684fdd1675ea1d73cb734..8e5583a1de38a0ebfc8090ed108c6b71f03c819e 100644 (file)
@@ -15,6 +15,7 @@
 #include <polarssl/dhm.h>
 #include <polarssl/error.h>
 #include <polarssl/sha1.h>
+#include <polarssl/version.h>
 
 #include "transmission.h"
 #include "crypto-utils.h"
@@ -110,7 +111,12 @@ get_rng_lock (void)
 tr_sha1_ctx_t
 tr_sha1_init (void)
 {
-  sha1_context * handle = tr_new (sha1_context, 1);
+  sha1_context * handle = tr_new0 (sha1_context, 1);
+
+#if POLARSSL_VERSION_NUMBER >= 0x01030800
+  sha1_init (handle);
+#endif
+
   sha1_starts (handle);
   return handle;
 }
@@ -142,6 +148,10 @@ tr_sha1_final (tr_sha1_ctx_t   handle,
       sha1_finish (handle, hash);
     }
 
+#if POLARSSL_VERSION_NUMBER >= 0x01030800
+  sha1_free (handle);
+#endif
+
   tr_free (handle);
   return true;
 }
@@ -153,12 +163,22 @@ tr_sha1_final (tr_sha1_ctx_t   handle,
 tr_rc4_ctx_t
 tr_rc4_new (void)
 {
-  return tr_new0 (arc4_context, 1);
+  arc4_context * handle = tr_new0 (arc4_context, 1);
+
+#if POLARSSL_VERSION_NUMBER >= 0x01030800
+  arc4_init (handle);
+#endif
+
+  return handle;
 }
 
 void
 tr_rc4_free (tr_rc4_ctx_t handle)
 {
+#if POLARSSL_VERSION_NUMBER >= 0x01030800
+  arc4_free (handle);
+#endif
+
   tr_free (handle);
 }
 
@@ -205,7 +225,9 @@ tr_dh_new (const uint8_t * prime_num,
   assert (prime_num != NULL);
   assert (generator_num != NULL);
 
+#if POLARSSL_VERSION_NUMBER >= 0x01030800
   dhm_init (handle);
+#endif
 
   if (!check_result (mpi_read_binary (&handle->P, prime_num, prime_num_length)) ||
       !check_result (mpi_read_binary (&handle->G, generator_num, generator_num_length)))