]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
upgrade polarssl to 1.1.2
authorPeter van Dijk <peter.van.dijk@netherlabs.nl>
Sat, 28 Apr 2012 14:30:16 +0000 (14:30 +0000)
committerPeter van Dijk <peter.van.dijk@netherlabs.nl>
Sat, 28 Apr 2012 14:30:16 +0000 (14:30 +0000)
git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@2586 d19b8d6e-7fed-0310-83ef-9ca221ded41b

86 files changed:
pdns/Makefile.am
pdns/backends/bind/Makefile.am
pdns/dnssecinfra.cc
pdns/ext/polarssl-1.1.2/ChangeLog [moved from pdns/ext/polarssl-1.1.1/ChangeLog with 98% similarity]
pdns/ext/polarssl-1.1.2/LICENSE [moved from pdns/ext/polarssl-1.1.1/LICENSE with 100% similarity]
pdns/ext/polarssl-1.1.2/Makefile [moved from pdns/ext/polarssl-1.1.1/Makefile with 100% similarity]
pdns/ext/polarssl-1.1.2/README [moved from pdns/ext/polarssl-1.1.1/README with 100% similarity]
pdns/ext/polarssl-1.1.2/include/CMakeLists.txt [moved from pdns/ext/polarssl-1.1.1/include/CMakeLists.txt with 100% similarity]
pdns/ext/polarssl-1.1.2/include/polarssl/aes.h [moved from pdns/ext/polarssl-1.1.1/include/polarssl/aes.h with 100% similarity]
pdns/ext/polarssl-1.1.2/include/polarssl/arc4.h [moved from pdns/ext/polarssl-1.1.1/include/polarssl/arc4.h with 100% similarity]
pdns/ext/polarssl-1.1.2/include/polarssl/asn1.h [moved from pdns/ext/polarssl-1.1.1/include/polarssl/asn1.h with 100% similarity]
pdns/ext/polarssl-1.1.2/include/polarssl/base64.h [moved from pdns/ext/polarssl-1.1.1/include/polarssl/base64.h with 100% similarity]
pdns/ext/polarssl-1.1.2/include/polarssl/bignum.h [moved from pdns/ext/polarssl-1.1.1/include/polarssl/bignum.h with 100% similarity]
pdns/ext/polarssl-1.1.2/include/polarssl/bn_mul.h [moved from pdns/ext/polarssl-1.1.1/include/polarssl/bn_mul.h with 100% similarity]
pdns/ext/polarssl-1.1.2/include/polarssl/camellia.h [moved from pdns/ext/polarssl-1.1.1/include/polarssl/camellia.h with 100% similarity]
pdns/ext/polarssl-1.1.2/include/polarssl/certs.h [moved from pdns/ext/polarssl-1.1.1/include/polarssl/certs.h with 100% similarity]
pdns/ext/polarssl-1.1.2/include/polarssl/cipher.h [moved from pdns/ext/polarssl-1.1.1/include/polarssl/cipher.h with 100% similarity]
pdns/ext/polarssl-1.1.2/include/polarssl/cipher_wrap.h [moved from pdns/ext/polarssl-1.1.1/include/polarssl/cipher_wrap.h with 100% similarity]
pdns/ext/polarssl-1.1.2/include/polarssl/config.h [moved from pdns/ext/polarssl-1.1.1/include/polarssl/config.h with 100% similarity]
pdns/ext/polarssl-1.1.2/include/polarssl/ctr_drbg.h [moved from pdns/ext/polarssl-1.1.1/include/polarssl/ctr_drbg.h with 100% similarity]
pdns/ext/polarssl-1.1.2/include/polarssl/debug.h [moved from pdns/ext/polarssl-1.1.1/include/polarssl/debug.h with 100% similarity]
pdns/ext/polarssl-1.1.2/include/polarssl/des.h [moved from pdns/ext/polarssl-1.1.1/include/polarssl/des.h with 100% similarity]
pdns/ext/polarssl-1.1.2/include/polarssl/dhm.h [moved from pdns/ext/polarssl-1.1.1/include/polarssl/dhm.h with 98% similarity]
pdns/ext/polarssl-1.1.2/include/polarssl/entropy.h [moved from pdns/ext/polarssl-1.1.1/include/polarssl/entropy.h with 100% similarity]
pdns/ext/polarssl-1.1.2/include/polarssl/entropy_poll.h [moved from pdns/ext/polarssl-1.1.1/include/polarssl/entropy_poll.h with 100% similarity]
pdns/ext/polarssl-1.1.2/include/polarssl/error.h [moved from pdns/ext/polarssl-1.1.1/include/polarssl/error.h with 100% similarity]
pdns/ext/polarssl-1.1.2/include/polarssl/havege.h [moved from pdns/ext/polarssl-1.1.1/include/polarssl/havege.h with 100% similarity]
pdns/ext/polarssl-1.1.2/include/polarssl/md.h [moved from pdns/ext/polarssl-1.1.1/include/polarssl/md.h with 100% similarity]
pdns/ext/polarssl-1.1.2/include/polarssl/md2.h [moved from pdns/ext/polarssl-1.1.1/include/polarssl/md2.h with 100% similarity]
pdns/ext/polarssl-1.1.2/include/polarssl/md4.h [moved from pdns/ext/polarssl-1.1.1/include/polarssl/md4.h with 100% similarity]
pdns/ext/polarssl-1.1.2/include/polarssl/md5.h [moved from pdns/ext/polarssl-1.1.1/include/polarssl/md5.h with 100% similarity]
pdns/ext/polarssl-1.1.2/include/polarssl/md_wrap.h [moved from pdns/ext/polarssl-1.1.1/include/polarssl/md_wrap.h with 100% similarity]
pdns/ext/polarssl-1.1.2/include/polarssl/net.h [moved from pdns/ext/polarssl-1.1.1/include/polarssl/net.h with 100% similarity]
pdns/ext/polarssl-1.1.2/include/polarssl/openssl.h [moved from pdns/ext/polarssl-1.1.1/include/polarssl/openssl.h with 100% similarity]
pdns/ext/polarssl-1.1.2/include/polarssl/padlock.h [moved from pdns/ext/polarssl-1.1.1/include/polarssl/padlock.h with 100% similarity]
pdns/ext/polarssl-1.1.2/include/polarssl/pem.h [moved from pdns/ext/polarssl-1.1.1/include/polarssl/pem.h with 100% similarity]
pdns/ext/polarssl-1.1.2/include/polarssl/pkcs11.h [moved from pdns/ext/polarssl-1.1.1/include/polarssl/pkcs11.h with 100% similarity]
pdns/ext/polarssl-1.1.2/include/polarssl/rsa.h [moved from pdns/ext/polarssl-1.1.1/include/polarssl/rsa.h with 100% similarity]
pdns/ext/polarssl-1.1.2/include/polarssl/sha1.h [moved from pdns/ext/polarssl-1.1.1/include/polarssl/sha1.h with 100% similarity]
pdns/ext/polarssl-1.1.2/include/polarssl/sha2.h [moved from pdns/ext/polarssl-1.1.1/include/polarssl/sha2.h with 100% similarity]
pdns/ext/polarssl-1.1.2/include/polarssl/sha4.h [moved from pdns/ext/polarssl-1.1.1/include/polarssl/sha4.h with 100% similarity]
pdns/ext/polarssl-1.1.2/include/polarssl/ssl.h [moved from pdns/ext/polarssl-1.1.1/include/polarssl/ssl.h with 100% similarity]
pdns/ext/polarssl-1.1.2/include/polarssl/timing.h [moved from pdns/ext/polarssl-1.1.1/include/polarssl/timing.h with 100% similarity]
pdns/ext/polarssl-1.1.2/include/polarssl/version.h [moved from pdns/ext/polarssl-1.1.1/include/polarssl/version.h with 92% similarity]
pdns/ext/polarssl-1.1.2/include/polarssl/x509.h [moved from pdns/ext/polarssl-1.1.1/include/polarssl/x509.h with 100% similarity]
pdns/ext/polarssl-1.1.2/include/polarssl/xtea.h [moved from pdns/ext/polarssl-1.1.1/include/polarssl/xtea.h with 100% similarity]
pdns/ext/polarssl-1.1.2/library/CMakeLists.txt [moved from pdns/ext/polarssl-1.1.1/library/CMakeLists.txt with 100% similarity]
pdns/ext/polarssl-1.1.2/library/Makefile [moved from pdns/ext/polarssl-1.1.1/library/Makefile with 100% similarity]
pdns/ext/polarssl-1.1.2/library/aes.c [moved from pdns/ext/polarssl-1.1.1/library/aes.c with 100% similarity]
pdns/ext/polarssl-1.1.2/library/arc4.c [moved from pdns/ext/polarssl-1.1.1/library/arc4.c with 100% similarity]
pdns/ext/polarssl-1.1.2/library/asn1parse.c [moved from pdns/ext/polarssl-1.1.1/library/asn1parse.c with 100% similarity]
pdns/ext/polarssl-1.1.2/library/base64.c [moved from pdns/ext/polarssl-1.1.1/library/base64.c with 100% similarity]
pdns/ext/polarssl-1.1.2/library/bignum.c [moved from pdns/ext/polarssl-1.1.1/library/bignum.c with 99% similarity]
pdns/ext/polarssl-1.1.2/library/camellia.c [moved from pdns/ext/polarssl-1.1.1/library/camellia.c with 100% similarity]
pdns/ext/polarssl-1.1.2/library/certs.c [moved from pdns/ext/polarssl-1.1.1/library/certs.c with 100% similarity]
pdns/ext/polarssl-1.1.2/library/cipher.c [moved from pdns/ext/polarssl-1.1.1/library/cipher.c with 99% similarity]
pdns/ext/polarssl-1.1.2/library/cipher_wrap.c [moved from pdns/ext/polarssl-1.1.1/library/cipher_wrap.c with 100% similarity]
pdns/ext/polarssl-1.1.2/library/ctr_drbg.c [moved from pdns/ext/polarssl-1.1.1/library/ctr_drbg.c with 100% similarity]
pdns/ext/polarssl-1.1.2/library/debug.c [moved from pdns/ext/polarssl-1.1.1/library/debug.c with 100% similarity]
pdns/ext/polarssl-1.1.2/library/des.c [moved from pdns/ext/polarssl-1.1.1/library/des.c with 100% similarity]
pdns/ext/polarssl-1.1.2/library/dhm.c [moved from pdns/ext/polarssl-1.1.1/library/dhm.c with 87% similarity]
pdns/ext/polarssl-1.1.2/library/entropy.c [moved from pdns/ext/polarssl-1.1.1/library/entropy.c with 100% similarity]
pdns/ext/polarssl-1.1.2/library/entropy_poll.c [moved from pdns/ext/polarssl-1.1.1/library/entropy_poll.c with 100% similarity]
pdns/ext/polarssl-1.1.2/library/error.c [moved from pdns/ext/polarssl-1.1.1/library/error.c with 100% similarity]
pdns/ext/polarssl-1.1.2/library/havege.c [moved from pdns/ext/polarssl-1.1.1/library/havege.c with 100% similarity]
pdns/ext/polarssl-1.1.2/library/md.c [moved from pdns/ext/polarssl-1.1.1/library/md.c with 98% similarity]
pdns/ext/polarssl-1.1.2/library/md2.c [moved from pdns/ext/polarssl-1.1.1/library/md2.c with 100% similarity]
pdns/ext/polarssl-1.1.2/library/md4.c [moved from pdns/ext/polarssl-1.1.1/library/md4.c with 100% similarity]
pdns/ext/polarssl-1.1.2/library/md5.c [moved from pdns/ext/polarssl-1.1.1/library/md5.c with 100% similarity]
pdns/ext/polarssl-1.1.2/library/md_wrap.c [moved from pdns/ext/polarssl-1.1.1/library/md_wrap.c with 100% similarity]
pdns/ext/polarssl-1.1.2/library/net.c [moved from pdns/ext/polarssl-1.1.1/library/net.c with 100% similarity]
pdns/ext/polarssl-1.1.2/library/padlock.c [moved from pdns/ext/polarssl-1.1.1/library/padlock.c with 100% similarity]
pdns/ext/polarssl-1.1.2/library/pem.c [moved from pdns/ext/polarssl-1.1.1/library/pem.c with 100% similarity]
pdns/ext/polarssl-1.1.2/library/pkcs11.c [moved from pdns/ext/polarssl-1.1.1/library/pkcs11.c with 100% similarity]
pdns/ext/polarssl-1.1.2/library/rsa.c [moved from pdns/ext/polarssl-1.1.1/library/rsa.c with 100% similarity]
pdns/ext/polarssl-1.1.2/library/sha1.c [moved from pdns/ext/polarssl-1.1.1/library/sha1.c with 100% similarity]
pdns/ext/polarssl-1.1.2/library/sha2.c [moved from pdns/ext/polarssl-1.1.1/library/sha2.c with 100% similarity]
pdns/ext/polarssl-1.1.2/library/sha4.c [moved from pdns/ext/polarssl-1.1.1/library/sha4.c with 100% similarity]
pdns/ext/polarssl-1.1.2/library/ssl_cli.c [moved from pdns/ext/polarssl-1.1.1/library/ssl_cli.c with 100% similarity]
pdns/ext/polarssl-1.1.2/library/ssl_srv.c [moved from pdns/ext/polarssl-1.1.1/library/ssl_srv.c with 100% similarity]
pdns/ext/polarssl-1.1.2/library/ssl_tls.c [moved from pdns/ext/polarssl-1.1.1/library/ssl_tls.c with 99% similarity]
pdns/ext/polarssl-1.1.2/library/timing.c [moved from pdns/ext/polarssl-1.1.1/library/timing.c with 100% similarity]
pdns/ext/polarssl-1.1.2/library/version.c [moved from pdns/ext/polarssl-1.1.1/library/version.c with 100% similarity]
pdns/ext/polarssl-1.1.2/library/x509parse.c [moved from pdns/ext/polarssl-1.1.1/library/x509parse.c with 100% similarity]
pdns/ext/polarssl-1.1.2/library/xtea.c [moved from pdns/ext/polarssl-1.1.1/library/xtea.c with 100% similarity]
pdns/polarrsakeyinfra.cc

index bd86935b5f8b185ebaec3e31cbf737fc1950a340..88715c39887979715449a2855849e9c80b6612e0 100644 (file)
@@ -1,4 +1,4 @@
-AM_CXXFLAGS=-DSYSCONFDIR=\"@sysconfdir@\" -DLIBDIR=\"@libdir@\" -DLOCALSTATEDIR=\"@socketdir@\" -Ibackends/bind @THREADFLAGS@ $(LUA_CFLAGS) $(SQLITE3_CFLAGS) -Iext/polarssl-1.1.1/include
+AM_CXXFLAGS=-DSYSCONFDIR=\"@sysconfdir@\" -DLIBDIR=\"@libdir@\" -DLOCALSTATEDIR=\"@socketdir@\" -Ibackends/bind @THREADFLAGS@ $(LUA_CFLAGS) $(SQLITE3_CFLAGS) -Iext/polarssl-1.1.2/include
 AM_CPPFLAGS=-Ibackends/bind $(BOOST_CPPFLAGS) @THREADFLAGS@
 
 EXTRA_DIST = dnslabeltext.rl dnslabeltext.cc mtasker.cc inflighter.cc docs/pdns_control.8  \
@@ -7,7 +7,7 @@ EXTRA_DIST = dnslabeltext.rl dnslabeltext.cc mtasker.cc inflighter.cc docs/pdns_
        no-dnssec.schema.mysql.sql no-dnssec.schema.pgsql.sql no-dnssec.schema.sqlite3.sql \
        bind-dnssec.schema.sqlite3.sql
 
-SUBDIRS= ext/polarssl-1.1.1 backends 
+SUBDIRS= ext/polarssl-1.1.2 backends 
 
 BUILT_SOURCES=bind-dnssec.schema.sqlite3.sql.h
 
@@ -52,7 +52,7 @@ ednssubnet.cc ednssubnet.hh cachecleaner.hh dnslabel.hh dnslabel.cc
 
 #
 pdns_server_LDFLAGS=@moduleobjects@ @modulelibs@ @DYNLINKFLAGS@ @LIBDL@ @THREADFLAGS@  $(BOOST_SERIALIZATION_LDFLAGS)  -rdynamic
-pdns_server_LDADD= ext/polarssl-1.1.1/library/libpolarssl.a $(BOOST_SERIALIZATION_LIBS) $(LUA_LIBS) $(SQLITE3_LIBS)
+pdns_server_LDADD= ext/polarssl-1.1.2/library/libpolarssl.a $(BOOST_SERIALIZATION_LIBS) $(LUA_LIBS) $(SQLITE3_LIBS)
 
 
 if BOTAN110
@@ -87,7 +87,7 @@ pdnssec_SOURCES=pdnssec.cc dbdnsseckeeper.cc sstuff.hh dnsparser.cc dnsparser.hh
 
 
 pdnssec_LDFLAGS=@moduleobjects@ @modulelibs@ @DYNLINKFLAGS@ @LIBDL@ @THREADFLAGS@  $(BOOST_PROGRAM_OPTIONS_LDFLAGS) $(BOOST_SERIALIZATION_LDFLAGS)
-pdnssec_LDADD= ext/polarssl-1.1.1/library/libpolarssl.a $(BOOST_PROGRAM_OPTIONS_LIBS) $(BOOST_SERIALIZATION_LIBS) $(SQLITE3_LIBS)
+pdnssec_LDADD= ext/polarssl-1.1.2/library/libpolarssl.a $(BOOST_PROGRAM_OPTIONS_LIBS) $(BOOST_SERIALIZATION_LIBS) $(SQLITE3_LIBS)
 
 if BOTAN110
 pdnssec_SOURCES += botan110signers.cc botansigners.cc
@@ -130,7 +130,7 @@ tsig_tests_SOURCES=tsig-tests.cc sstuff.hh dnsparser.cc dnsparser.hh dnsrecords.
        aes/aescrypt.c aes/aes.h aes/aeskey.c aes/aes_modes.c aes/aesopt.h \
        aes/aestab.c aes/aestab.h aes/brg_endian.h aes/brg_types.h aes/dns_random.cc \
        randomhelper.cc dns.cc
-tsig_tests_LDFLAGS= -Lext/polarssl-1.1.1/library       
+tsig_tests_LDFLAGS= -Lext/polarssl-1.1.2/library       
 tsig_tests_LDADD= -lpolarssl
 
 
index 88ca91917815886fabdfbd3a4f997d6c4a3ec76c..462bd200aed38795db11c205de0fb803feb7baff 100644 (file)
@@ -34,10 +34,10 @@ zone2ldap_SOURCES=bindparser.yy bindlexer.l bind-dnssec.schema.sqlite3.sql.h \
 ../../nsecrecords.cc ../../dnssecinfra.cc  ../../base32.cc ../../md5.cc # ../../dbdnsseckeeper.cc
 
 zone2ldap_LDFLAGS=@THREADFLAGS@  
-zone2ldap_LDADD= ../../ext/polarssl-1.1.1/library/libpolarssl.a
+zone2ldap_LDADD= ../../ext/polarssl-1.1.2/library/libpolarssl.a
 
 zone2sql_LDFLAGS=@THREADFLAGS@  
-zone2sql_LDADD= ../../ext/polarssl-1.1.1/library/libpolarssl.a 
+zone2sql_LDADD= ../../ext/polarssl-1.1.2/library/libpolarssl.a 
 
 AM_LFLAGS = -s -i
 AM_YFLAGS = -d --verbose --debug
index 7b22c3fffc32a6f43b8f819c0fb4a580f971f8b7..fd7757ba71dd6c738d989cf7d9901be63ae433c4 100644 (file)
@@ -9,7 +9,7 @@
 #include <boost/algorithm/string.hpp>
 #include "dnssecinfra.hh" 
 #include "dnsseckeeper.hh"
-#include "ext/polarssl-1.1.1/include/polarssl/sha1.h"
+#include "ext/polarssl-1.1.2/include/polarssl/sha1.h"
 #include <boost/assign/std/vector.hpp> // for 'operator+=()'
 #include <boost/assign/list_inserter.hpp>
 #include "base64.hh"
similarity index 98%
rename from pdns/ext/polarssl-1.1.1/ChangeLog
rename to pdns/ext/polarssl-1.1.2/ChangeLog
index b331aa04e214bd05ea448ee346a1c758b664f4c4..bb475e3065ec7c440833b1d38f2450e45c52d0dd 100644 (file)
@@ -1,5 +1,16 @@
 PolarSSL ChangeLog
 
+= Version 1.1.2 released on 2012-04-26
+Bugfix
+   * Fixed handling error in mpi_cmp_mpi() on longer B values (found by
+     Hui Dong)
+
+Security
+   * Fixed potential memory corruption on miscrafted client messages (found by
+     Frama-C team at CEA LIST)
+   * Fixed generation of DHM parameters to correct length (found by Ruslan
+     Yushchenko)
+
 = Version 1.1.1 released on 2012-01-23
 Bugfix
    * Check for failed malloc() in ssl_set_hostname() and x509_get_entries()
similarity index 98%
rename from pdns/ext/polarssl-1.1.1/include/polarssl/dhm.h
rename to pdns/ext/polarssl-1.1.2/include/polarssl/dhm.h
index 52b0bf94a3f04afd750e9c9419fab335a72953fd..0c8dd55ed8fc0bccc1463260a299edc4011c59b1 100644 (file)
@@ -36,7 +36,7 @@
 #define POLARSSL_ERR_DHM_READ_PARAMS_FAILED                -0x3100  /**< Reading of the DHM parameters failed. */
 #define POLARSSL_ERR_DHM_MAKE_PARAMS_FAILED                -0x3180  /**< Making of the DHM parameters failed. */
 #define POLARSSL_ERR_DHM_READ_PUBLIC_FAILED                -0x3200  /**< Reading of the public values failed. */
-#define POLARSSL_ERR_DHM_MAKE_PUBLIC_FAILED                -0x3280  /**< Makeing of the public value failed. */
+#define POLARSSL_ERR_DHM_MAKE_PUBLIC_FAILED                -0x3280  /**< Making of the public value failed. */
 #define POLARSSL_ERR_DHM_CALC_SECRET_FAILED                -0x3300  /**< Calculation of the DHM secret failed. */
 
 /**
@@ -109,7 +109,7 @@ int dhm_read_public( dhm_context *ctx,
  * \brief          Create own private value X and export G^X
  *
  * \param ctx      DHM context
- * \param x_size   private value size in bits
+ * \param x_size   private value size in bytes
  * \param output   destination buffer
  * \param olen     must be equal to ctx->P.len
  * \param f_rng    RNG function
similarity index 92%
rename from pdns/ext/polarssl-1.1.1/include/polarssl/version.h
rename to pdns/ext/polarssl-1.1.2/include/polarssl/version.h
index 98eb0b3f15f7814410a5007f168668de1f32f789..1ea35a190f0dc8309f0402415d417cc57ff8636c 100644 (file)
  */
 #define POLARSSL_VERSION_MAJOR  1
 #define POLARSSL_VERSION_MINOR  1
-#define POLARSSL_VERSION_PATCH  1
+#define POLARSSL_VERSION_PATCH  2
 
 /**
  * The single version number has the following structure:
  *    MMNNPP00
  *    Major version | Minor version | Patch version
  */
-#define POLARSSL_VERSION_NUMBER         0x01010100
-#define POLARSSL_VERSION_STRING         "1.1.1"
-#define POLARSSL_VERSION_STRING_FULL    "PolarSSL 1.1.1"
+#define POLARSSL_VERSION_NUMBER         0x01010200
+#define POLARSSL_VERSION_STRING         "1.1.2"
+#define POLARSSL_VERSION_STRING_FULL    "PolarSSL 1.1.2"
 
 #if defined(POLARSSL_VERSION_C)
 
similarity index 99%
rename from pdns/ext/polarssl-1.1.1/library/bignum.c
rename to pdns/ext/polarssl-1.1.2/library/bignum.c
index 9dff9914deb15f43e23930dd1c68ffac4caae10e..e2cc06f24d7d5690c4306c9031683f0975abed5b 100644 (file)
@@ -687,7 +687,7 @@ int mpi_cmp_mpi( const mpi *X, const mpi *Y )
         return( 0 );
 
     if( i > j ) return(  X->s );
-    if( j > i ) return( -X->s );
+    if( j > i ) return( -Y->s );
 
     if( X->s > 0 && Y->s < 0 ) return(  1 );
     if( Y->s > 0 && X->s < 0 ) return( -1 );
@@ -1813,7 +1813,7 @@ int mpi_is_prime( mpi *X,
         /*
          * pick a random A, 1 < A < |X| - 1
          */
-        MPI_CHK( mpi_fill_random( &A, X->n, f_rng, p_rng ) );
+        MPI_CHK( mpi_fill_random( &A, X->n * ciL, f_rng, p_rng ) );
 
         if( mpi_cmp_mpi( &A, &W ) >= 0 )
         {
@@ -1885,7 +1885,7 @@ int mpi_gen_prime( mpi *X, size_t nbits, int dh_flag,
 
     n = BITS_TO_LIMBS( nbits );
 
-    MPI_CHK( mpi_fill_random( X, n, f_rng, p_rng ) );
+    MPI_CHK( mpi_fill_random( X, n * ciL, f_rng, p_rng ) );
 
     k = mpi_msb( X );
     if( k < nbits ) MPI_CHK( mpi_shift_l( X, nbits - k ) );
similarity index 99%
rename from pdns/ext/polarssl-1.1.1/library/cipher.c
rename to pdns/ext/polarssl-1.1.2/library/cipher.c
index 485a09bc01f274aa69c1f9b32e093e6ba9db22fb..0e1224c1f0bde0d539cac03ac169fa0023e75330 100644 (file)
@@ -245,7 +245,7 @@ int cipher_init_ctx( cipher_context_t *ctx, const cipher_info_t *cipher_info )
     if( NULL == cipher_info || NULL == ctx )
         return POLARSSL_ERR_CIPHER_BAD_INPUT_DATA;
 
-    memset( ctx, 0, sizeof( ctx ) );
+    memset( ctx, 0, sizeof( cipher_context_t ) );
 
     if( NULL == ( ctx->cipher_ctx = cipher_info->base->ctx_alloc_func() ) )
         return POLARSSL_ERR_CIPHER_ALLOC_FAILED;
similarity index 87%
rename from pdns/ext/polarssl-1.1.1/library/dhm.c
rename to pdns/ext/polarssl-1.1.2/library/dhm.c
index bddd076d16bca476a3ebb2f02fd568857a690eba..e399f42bee416060a55ed9f7c5864aea60ede9c3 100644 (file)
@@ -61,15 +61,15 @@ static int dhm_read_bignum( mpi *X,
 }
 
 /*
- * Verify sanity of public parameter with regards to P
+ * Verify sanity of parameter with regards to P
  *
- * Public parameter should be: 2 <= public_param <= P - 2
+ * Parameter should be: 2 <= public_param <= P - 2
  *
  * For more information on the attack, see:
  *  http://www.cl.cam.ac.uk/~rja14/Papers/psandqs.pdf
  *  http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2005-2643
  */
-static int dhm_check_range( const mpi *public_param, const mpi *P )
+static int dhm_check_range( const mpi *param, const mpi *P )
 {
     mpi L, U;
     int ret = POLARSSL_ERR_DHM_BAD_INPUT_DATA;
@@ -78,8 +78,8 @@ static int dhm_check_range( const mpi *public_param, const mpi *P )
     mpi_lset( &L, 2 );
     mpi_sub_int( &U, P, 2 );
 
-    if( mpi_cmp_mpi( public_param, &L ) >= 0 &&
-        mpi_cmp_mpi( public_param, &U ) <= 0 )
+    if( mpi_cmp_mpi( param, &L ) >= 0 &&
+        mpi_cmp_mpi( param, &U ) <= 0 )
     {
         ret = 0;
     }
@@ -130,19 +130,24 @@ int dhm_make_params( dhm_context *ctx, int x_size,
                      int (*f_rng)(void *, unsigned char *, size_t),
                      void *p_rng )
 {
-    int ret, n;
+    int ret, count = 0;
     size_t n1, n2, n3;
     unsigned char *p;
 
     /*
      * Generate X as large as possible ( < P )
      */
-    n = x_size / sizeof( t_uint ) + 1;
+    do
+    {
+        mpi_fill_random( &ctx->X, x_size, f_rng, p_rng );
 
-    mpi_fill_random( &ctx->X, n, f_rng, p_rng );
+        while( mpi_cmp_mpi( &ctx->X, &ctx->P ) >= 0 )
+            mpi_shift_r( &ctx->X, 1 );
 
-    while( mpi_cmp_mpi( &ctx->X, &ctx->P ) >= 0 )
-           mpi_shift_r( &ctx->X, 1 );
+        if( count++ > 10 )
+            return( POLARSSL_ERR_DHM_MAKE_PARAMS_FAILED );
+    }
+    while( dhm_check_range( &ctx->X, &ctx->P ) != 0 );
 
     /*
      * Calculate GX = G^X mod P
@@ -207,7 +212,7 @@ int dhm_make_public( dhm_context *ctx, int x_size,
                      int (*f_rng)(void *, unsigned char *, size_t),
                      void *p_rng )
 {
-    int ret, n;
+    int ret, count = 0;
 
     if( ctx == NULL || olen < 1 || olen > ctx->len )
         return( POLARSSL_ERR_DHM_BAD_INPUT_DATA );
@@ -215,12 +220,17 @@ int dhm_make_public( dhm_context *ctx, int x_size,
     /*
      * generate X and calculate GX = G^X mod P
      */
-    n = x_size / sizeof( t_uint ) + 1;
+    do
+    {
+        mpi_fill_random( &ctx->X, x_size, f_rng, p_rng );
 
-    mpi_fill_random( &ctx->X, n, f_rng, p_rng );
+        while( mpi_cmp_mpi( &ctx->X, &ctx->P ) >= 0 )
+            mpi_shift_r( &ctx->X, 1 );
 
-    while( mpi_cmp_mpi( &ctx->X, &ctx->P ) >= 0 )
-           mpi_shift_r( &ctx->X, 1 );
+        if( count++ > 10 )
+            return( POLARSSL_ERR_DHM_MAKE_PUBLIC_FAILED );
+    }
+    while( dhm_check_range( &ctx->X, &ctx->P ) != 0 );
 
     MPI_CHK( mpi_exp_mod( &ctx->GX, &ctx->G, &ctx->X,
                           &ctx->P , &ctx->RP ) );
similarity index 98%
rename from pdns/ext/polarssl-1.1.1/library/md.c
rename to pdns/ext/polarssl-1.1.2/library/md.c
index d15bf1dcab21f03fee3c345736b5bc4e2500a46e..96065c95f066f2b2986efc0f7d37b1c4c121f74a 100644 (file)
@@ -152,11 +152,10 @@ const md_info_t *md_info_from_type( md_type_t md_type )
 
 int md_init_ctx( md_context_t *ctx, const md_info_t *md_info )
 {
-    if( md_info == NULL )
+    if( md_info == NULL || ctx == NULL )
         return POLARSSL_ERR_MD_BAD_INPUT_DATA;
 
-    if( ctx == NULL || ctx->md_ctx != NULL )
-        return POLARSSL_ERR_MD_BAD_INPUT_DATA;
+    memset( ctx, 0, sizeof( md_context_t ) );
 
     if( ( ctx->md_ctx = md_info->ctx_alloc_func() ) == NULL )
         return POLARSSL_ERR_MD_ALLOC_FAILED;
similarity index 99%
rename from pdns/ext/polarssl-1.1.1/library/ssl_tls.c
rename to pdns/ext/polarssl-1.1.2/library/ssl_tls.c
index 44e972cf97e7480237bfe80e4f7261748b1261e7..89333559b56e4a61ca717d629ba4a5a825d67b1e 100644 (file)
@@ -785,6 +785,13 @@ static int ssl_decrypt_buf( ssl_context *ssl )
     /*
      * Always compute the MAC (RFC4346, CBCTIME).
      */
+    if( ssl->in_msglen <= ssl->maclen + padlen )
+    {
+        SSL_DEBUG_MSG( 1, ( "msglen (%d) < maclen (%d) + padlen (%d)",
+                    ssl->in_msglen, ssl->maclen, padlen ) );
+        return( POLARSSL_ERR_SSL_INVALID_MAC );
+    }
+
     ssl->in_msglen -= ( ssl->maclen + padlen );
 
     ssl->in_hdr[3] = (unsigned char)( ssl->in_msglen >> 8 );
index 0784164ade442d659d54f971c36b3629de84144a..1f3d06f71b615698b983de6fdcb0c63495dd1241 100644 (file)
@@ -1,9 +1,9 @@
-#include "ext/polarssl-1.1.1/include/polarssl/rsa.h"
-#include "ext/polarssl-1.1.1/include/polarssl/base64.h"
-#include "ext/polarssl-1.1.1/include/polarssl/sha1.h"
-#include "ext/polarssl-1.1.1/include/polarssl/sha2.h"
-#include "ext/polarssl-1.1.1/include/polarssl/sha4.h"
-#include "ext/polarssl-1.1.1/include/polarssl/havege.h"
+#include "ext/polarssl-1.1.2/include/polarssl/rsa.h"
+#include "ext/polarssl-1.1.2/include/polarssl/base64.h"
+#include "ext/polarssl-1.1.2/include/polarssl/sha1.h"
+#include "ext/polarssl-1.1.2/include/polarssl/sha2.h"
+#include "ext/polarssl-1.1.2/include/polarssl/sha4.h"
+#include "ext/polarssl-1.1.2/include/polarssl/havege.h"
 #include <boost/assign/std/vector.hpp> // for 'operator+=()'
 #include <boost/foreach.hpp>
 #include "dnssecinfra.hh"