Preparation for PolarSSL 1.4.0
diff --git a/doxygen/input/doc_mainpage.h b/doxygen/input/doc_mainpage.h
index 426c1f3..12f3f8e 100644
--- a/doxygen/input/doc_mainpage.h
+++ b/doxygen/input/doc_mainpage.h
@@ -4,7 +4,7 @@
  */
 
 /**
- * @mainpage PolarSSL v1.3.9 source code documentation
+ * @mainpage PolarSSL v1.4.0 source code documentation
  *
  * This documentation describes the internal structure of PolarSSL.  It was
  * automatically generated from specially formatted comment blocks in
diff --git a/doxygen/polarssl.doxyfile b/doxygen/polarssl.doxyfile
index 374197c..96515c3 100644
--- a/doxygen/polarssl.doxyfile
+++ b/doxygen/polarssl.doxyfile
@@ -28,7 +28,7 @@
 # identify the project. Note that if you do not use Doxywizard you need
 # to put quotes around the project name if it contains spaces.
 
-PROJECT_NAME           = "PolarSSL v1.3.9"
+PROJECT_NAME           = "PolarSSL v1.4.0"
 
 # The PROJECT_NUMBER tag can be used to enter a project or revision number.
 # This could be handy for archiving the generated documentation or
diff --git a/include/polarssl/version.h b/include/polarssl/version.h
index b00687f..24b1dec 100644
--- a/include/polarssl/version.h
+++ b/include/polarssl/version.h
@@ -42,17 +42,17 @@
  * Major, Minor, Patchlevel
  */
 #define POLARSSL_VERSION_MAJOR  1
-#define POLARSSL_VERSION_MINOR  3
-#define POLARSSL_VERSION_PATCH  9
+#define POLARSSL_VERSION_MINOR  4
+#define POLARSSL_VERSION_PATCH  0
 
 /**
  * The single version number has the following structure:
  *    MMNNPP00
  *    Major version | Minor version | Patch version
  */
-#define POLARSSL_VERSION_NUMBER         0x01030900
-#define POLARSSL_VERSION_STRING         "1.3.9"
-#define POLARSSL_VERSION_STRING_FULL    "PolarSSL 1.3.9"
+#define POLARSSL_VERSION_NUMBER         0x01040000
+#define POLARSSL_VERSION_STRING         "1.4.0"
+#define POLARSSL_VERSION_STRING_FULL    "PolarSSL 1.4.0"
 
 #if defined(POLARSSL_VERSION_C)
 
diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt
index d01a8a7..340f562 100644
--- a/library/CMakeLists.txt
+++ b/library/CMakeLists.txt
@@ -119,7 +119,7 @@
 
 if(USE_SHARED_POLARSSL_LIBRARY)
 	add_library(polarssl SHARED ${src})
-	set_target_properties(polarssl PROPERTIES VERSION 1.3.9 SOVERSION 7)
+	set_target_properties(polarssl PROPERTIES VERSION 1.4.0 SOVERSION 8)
 
 	target_link_libraries(polarssl ${libs})
 
diff --git a/library/Makefile b/library/Makefile
index 44bc00c..d93f9ca 100644
--- a/library/Makefile
+++ b/library/Makefile
@@ -22,9 +22,9 @@
 CFLAGS += -fPIC
 endif
 
-SONAME=libpolarssl.so.7
+SONAME=libpolarssl.so.8
 
-DLEXT=so.7
+DLEXT=so.8
 # OSX shared library extension:
 # DLEXT=dylib
 
diff --git a/library/version_features.c b/library/version_features.c
index 1023198..8b91aab 100644
--- a/library/version_features.c
+++ b/library/version_features.c
@@ -303,9 +303,21 @@
 #if defined(POLARSSL_SSL_PROTO_TLS1_2)
     "POLARSSL_SSL_PROTO_TLS1_2",
 #endif /* POLARSSL_SSL_PROTO_TLS1_2 */
+#if defined(POLARSSL_SSL_PROTO_DTLS)
+    "POLARSSL_SSL_PROTO_DTLS",
+#endif /* POLARSSL_SSL_PROTO_DTLS */
 #if defined(POLARSSL_SSL_ALPN)
     "POLARSSL_SSL_ALPN",
 #endif /* POLARSSL_SSL_ALPN */
+#if defined(POLARSSL_SSL_DTLS_ANTI_REPLAY)
+    "POLARSSL_SSL_DTLS_ANTI_REPLAY",
+#endif /* POLARSSL_SSL_DTLS_ANTI_REPLAY */
+#if defined(POLARSSL_SSL_DTLS_HELLO_VERIFY)
+    "POLARSSL_SSL_DTLS_HELLO_VERIFY",
+#endif /* POLARSSL_SSL_DTLS_HELLO_VERIFY */
+#if defined(POLARSSL_SSL_DTLS_BADMAC_LIMIT)
+    "POLARSSL_SSL_DTLS_BADMAC_LIMIT",
+#endif /* POLARSSL_SSL_DTLS_BADMAC_LIMIT */
 #if defined(POLARSSL_SSL_SESSION_TICKETS)
     "POLARSSL_SSL_SESSION_TICKETS",
 #endif /* POLARSSL_SSL_SESSION_TICKETS */
@@ -492,6 +504,9 @@
 #if defined(POLARSSL_SSL_CACHE_C)
     "POLARSSL_SSL_CACHE_C",
 #endif /* POLARSSL_SSL_CACHE_C */
+#if defined(POLARSSL_SSL_COOKIE_C)
+    "POLARSSL_SSL_COOKIE_C",
+#endif /* POLARSSL_SSL_COOKIE_C */
 #if defined(POLARSSL_SSL_CLI_C)
     "POLARSSL_SSL_CLI_C",
 #endif /* POLARSSL_SSL_CLI_C */
diff --git a/tests/suites/test_suite_version.data b/tests/suites/test_suite_version.data
index 4c205e6..be9c59e 100644
--- a/tests/suites/test_suite_version.data
+++ b/tests/suites/test_suite_version.data
@@ -1,8 +1,8 @@
 Check compiletime library version
-check_compiletime_version:"1.3.9"
+check_compiletime_version:"1.4.0"
 
 Check runtime library version
-check_runtime_version:"1.3.9"
+check_runtime_version:"1.4.0"
 
 Check for POLARSSL_VERSION_C
 check_feature:"POLARSSL_VERSION_C":0
diff --git a/visualc/VS2010/PolarSSL.sln b/visualc/VS2010/PolarSSL.sln
index c46a91a..6bb7e58 100644
--- a/visualc/VS2010/PolarSSL.sln
+++ b/visualc/VS2010/PolarSSL.sln
@@ -128,6 +128,16 @@
 		{46CF2D25-6A36-4189-B59C-E4815388E554} = {46CF2D25-6A36-4189-B59C-E4815388E554}

 	EndProjectSection

 EndProject

+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dtls_client", "dtls_client.vcxproj", "{F8E1C9AD-5DE7-E71C-B840-FC77D1DB2943}"

+	ProjectSection(ProjectDependencies) = postProject

+		{46CF2D25-6A36-4189-B59C-E4815388E554} = {46CF2D25-6A36-4189-B59C-E4815388E554}

+	EndProjectSection

+EndProject

+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dtls_server", "dtls_server.vcxproj", "{25FEA939-437B-99C7-D11B-4814FB67426B}"

+	ProjectSection(ProjectDependencies) = postProject

+		{46CF2D25-6A36-4189-B59C-E4815388E554} = {46CF2D25-6A36-4189-B59C-E4815388E554}

+	EndProjectSection

+EndProject

 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ssl_client1", "ssl_client1.vcxproj", "{CE90D346-EBC0-D292-6D68-24717DB3F510}"

 	ProjectSection(ProjectDependencies) = postProject

 		{46CF2D25-6A36-4189-B59C-E4815388E554} = {46CF2D25-6A36-4189-B59C-E4815388E554}

@@ -193,6 +203,11 @@
 		{46CF2D25-6A36-4189-B59C-E4815388E554} = {46CF2D25-6A36-4189-B59C-E4815388E554}

 	EndProjectSection

 EndProject

+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "udp_proxy", "udp_proxy.vcxproj", "{1F590A67-6E2F-046A-09B6-6FCA1C6B4078}"

+	ProjectSection(ProjectDependencies) = postProject

+		{46CF2D25-6A36-4189-B59C-E4815388E554} = {46CF2D25-6A36-4189-B59C-E4815388E554}

+	EndProjectSection

+EndProject

 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pem2der", "pem2der.vcxproj", "{ACFFE3C9-3628-9B99-E0C9-36CF95F86B5F}"

 	ProjectSection(ProjectDependencies) = postProject

 		{46CF2D25-6A36-4189-B59C-E4815388E554} = {46CF2D25-6A36-4189-B59C-E4815388E554}

@@ -434,6 +449,22 @@
 		{DAD91B2F-DEC8-E94F-8D9A-66B6E237AF07}.Release|Win32.Build.0 = Release|Win32

 		{DAD91B2F-DEC8-E94F-8D9A-66B6E237AF07}.Release|x64.ActiveCfg = Release|x64

 		{DAD91B2F-DEC8-E94F-8D9A-66B6E237AF07}.Release|x64.Build.0 = Release|x64

+		{F8E1C9AD-5DE7-E71C-B840-FC77D1DB2943}.Debug|Win32.ActiveCfg = Debug|Win32

+		{F8E1C9AD-5DE7-E71C-B840-FC77D1DB2943}.Debug|Win32.Build.0 = Debug|Win32

+		{F8E1C9AD-5DE7-E71C-B840-FC77D1DB2943}.Debug|x64.ActiveCfg = Debug|x64

+		{F8E1C9AD-5DE7-E71C-B840-FC77D1DB2943}.Debug|x64.Build.0 = Debug|x64

+		{F8E1C9AD-5DE7-E71C-B840-FC77D1DB2943}.Release|Win32.ActiveCfg = Release|Win32

+		{F8E1C9AD-5DE7-E71C-B840-FC77D1DB2943}.Release|Win32.Build.0 = Release|Win32

+		{F8E1C9AD-5DE7-E71C-B840-FC77D1DB2943}.Release|x64.ActiveCfg = Release|x64

+		{F8E1C9AD-5DE7-E71C-B840-FC77D1DB2943}.Release|x64.Build.0 = Release|x64

+		{25FEA939-437B-99C7-D11B-4814FB67426B}.Debug|Win32.ActiveCfg = Debug|Win32

+		{25FEA939-437B-99C7-D11B-4814FB67426B}.Debug|Win32.Build.0 = Debug|Win32

+		{25FEA939-437B-99C7-D11B-4814FB67426B}.Debug|x64.ActiveCfg = Debug|x64

+		{25FEA939-437B-99C7-D11B-4814FB67426B}.Debug|x64.Build.0 = Debug|x64

+		{25FEA939-437B-99C7-D11B-4814FB67426B}.Release|Win32.ActiveCfg = Release|Win32

+		{25FEA939-437B-99C7-D11B-4814FB67426B}.Release|Win32.Build.0 = Release|Win32

+		{25FEA939-437B-99C7-D11B-4814FB67426B}.Release|x64.ActiveCfg = Release|x64

+		{25FEA939-437B-99C7-D11B-4814FB67426B}.Release|x64.Build.0 = Release|x64

 		{CE90D346-EBC0-D292-6D68-24717DB3F510}.Debug|Win32.ActiveCfg = Debug|Win32

 		{CE90D346-EBC0-D292-6D68-24717DB3F510}.Debug|Win32.Build.0 = Debug|Win32

 		{CE90D346-EBC0-D292-6D68-24717DB3F510}.Debug|x64.ActiveCfg = Debug|x64

@@ -538,6 +569,14 @@
 		{0FC4D326-CF64-AB19-B037-3E3D06EA6798}.Release|Win32.Build.0 = Release|Win32

 		{0FC4D326-CF64-AB19-B037-3E3D06EA6798}.Release|x64.ActiveCfg = Release|x64

 		{0FC4D326-CF64-AB19-B037-3E3D06EA6798}.Release|x64.Build.0 = Release|x64

+		{1F590A67-6E2F-046A-09B6-6FCA1C6B4078}.Debug|Win32.ActiveCfg = Debug|Win32

+		{1F590A67-6E2F-046A-09B6-6FCA1C6B4078}.Debug|Win32.Build.0 = Debug|Win32

+		{1F590A67-6E2F-046A-09B6-6FCA1C6B4078}.Debug|x64.ActiveCfg = Debug|x64

+		{1F590A67-6E2F-046A-09B6-6FCA1C6B4078}.Debug|x64.Build.0 = Debug|x64

+		{1F590A67-6E2F-046A-09B6-6FCA1C6B4078}.Release|Win32.ActiveCfg = Release|Win32

+		{1F590A67-6E2F-046A-09B6-6FCA1C6B4078}.Release|Win32.Build.0 = Release|Win32

+		{1F590A67-6E2F-046A-09B6-6FCA1C6B4078}.Release|x64.ActiveCfg = Release|x64

+		{1F590A67-6E2F-046A-09B6-6FCA1C6B4078}.Release|x64.Build.0 = Release|x64

 		{ACFFE3C9-3628-9B99-E0C9-36CF95F86B5F}.Debug|Win32.ActiveCfg = Debug|Win32

 		{ACFFE3C9-3628-9B99-E0C9-36CF95F86B5F}.Debug|Win32.Build.0 = Debug|Win32

 		{ACFFE3C9-3628-9B99-E0C9-36CF95F86B5F}.Debug|x64.ActiveCfg = Debug|x64

diff --git a/visualc/VS2010/PolarSSL.vcxproj b/visualc/VS2010/PolarSSL.vcxproj
index 5ea5b15..4d3395f 100644
--- a/visualc/VS2010/PolarSSL.vcxproj
+++ b/visualc/VS2010/PolarSSL.vcxproj
@@ -199,6 +199,7 @@
     <ClInclude Include="..\..\include\polarssl\ssl.h" />

     <ClInclude Include="..\..\include\polarssl\ssl_cache.h" />

     <ClInclude Include="..\..\include\polarssl\ssl_ciphersuites.h" />

+    <ClInclude Include="..\..\include\polarssl\ssl_cookie.h" />

     <ClInclude Include="..\..\include\polarssl\threading.h" />

     <ClInclude Include="..\..\include\polarssl\timing.h" />

     <ClInclude Include="..\..\include\polarssl\version.h" />

@@ -263,6 +264,7 @@
     <ClCompile Include="..\..\library\ssl_cache.c" />

     <ClCompile Include="..\..\library\ssl_ciphersuites.c" />

     <ClCompile Include="..\..\library\ssl_cli.c" />

+    <ClCompile Include="..\..\library\ssl_cookie.c" />

     <ClCompile Include="..\..\library\ssl_srv.c" />

     <ClCompile Include="..\..\library\ssl_tls.c" />

     <ClCompile Include="..\..\library\threading.c" />

diff --git a/visualc/VS6/polarssl.dsp b/visualc/VS6/polarssl.dsp
index 17e9e70..5e1f05d 100644
--- a/visualc/VS6/polarssl.dsp
+++ b/visualc/VS6/polarssl.dsp
@@ -301,6 +301,10 @@
 # End Source File

 # Begin Source File

 

+SOURCE=..\..\library\ssl_cookie.c

+# End Source File

+# Begin Source File

+

 SOURCE=..\..\library\ssl_srv.c

 # End Source File

 # Begin Source File

@@ -589,6 +593,10 @@
 # End Source File

 # Begin Source File

 

+SOURCE=..\..\include\polarssl\ssl_cookie.h

+# End Source File

+# Begin Source File

+

 SOURCE=..\..\include\polarssl\threading.h

 # End Source File

 # Begin Source File

diff --git a/visualc/VS6/polarssl.dsw b/visualc/VS6/polarssl.dsw
index 105e604..abc7a00 100644
--- a/visualc/VS6/polarssl.dsw
+++ b/visualc/VS6/polarssl.dsw
@@ -378,6 +378,36 @@
 

 ###############################################################################

 

+Project: "dtls_client"=.\dtls_client.dsp - Package Owner=<4>

+

+Package=<5>

+{{{

+}}}

+

+Package=<4>

+{{{

+    Begin Project Dependency

+    Project_Dep_Name polarssl

+    End Project Dependency

+}}}

+

+###############################################################################

+

+Project: "dtls_server"=.\dtls_server.dsp - Package Owner=<4>

+

+Package=<5>

+{{{

+}}}

+

+Package=<4>

+{{{

+    Begin Project Dependency

+    Project_Dep_Name polarssl

+    End Project Dependency

+}}}

+

+###############################################################################

+

 Project: "ssl_client1"=.\ssl_client1.dsp - Package Owner=<4>

 

 Package=<5>

@@ -573,6 +603,21 @@
 

 ###############################################################################

 

+Project: "udp_proxy"=.\udp_proxy.dsp - Package Owner=<4>

+

+Package=<5>

+{{{

+}}}

+

+Package=<4>

+{{{

+    Begin Project Dependency

+    Project_Dep_Name polarssl

+    End Project Dependency

+}}}

+

+###############################################################################

+

 Project: "pem2der"=.\pem2der.dsp - Package Owner=<4>

 

 Package=<5>