diff --git a/scripts/data_files/vs2010-main-template.vcxproj b/scripts/data_files/vs2010-main-template.vcxproj
new file mode 100644
index 000000000..20d3de583
--- /dev/null
+++ b/scripts/data_files/vs2010-main-template.vcxproj
@@ -0,0 +1,153 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ Win32
+
+
+ Release
+ x64
+
+
+
+ {46CF2D25-6A36-4189-B59C-E4815388E554}
+ Win32Proj
+ PolarSSL
+
+
+
+ StaticLibrary
+ true
+ Unicode
+
+
+ StaticLibrary
+ true
+ Unicode
+
+
+ StaticLibrary
+ false
+ true
+ Unicode
+
+
+ StaticLibrary
+ false
+ true
+ Unicode
+ Windows7.1SDK
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+ true
+
+
+ false
+
+
+ false
+
+
+
+
+
+ Level3
+ Disabled
+ WIN32;_DEBUG;_WINDOWS;_USRDLL;POLARSSL_EXPORTS;%(PreprocessorDefinitions)
+ ../../include
+ CompileAsC
+
+
+ Windows
+ true
+
+
+
+
+
+
+ Level3
+ Disabled
+ WIN32;_DEBUG;_WINDOWS;_USRDLL;POLARSSL_EXPORTS;%(PreprocessorDefinitions)
+ ../../include
+ CompileAsC
+
+
+ Windows
+ true
+
+
+
+
+ Level3
+
+
+ MaxSpeed
+ true
+ true
+ WIN32;NDEBUG;_WINDOWS;_USRDLL;POLARSSL_EXPORTS;%(PreprocessorDefinitions)
+ ../../include
+
+
+ Windows
+ true
+ true
+ true
+
+
+
+
+ Level3
+
+
+ MaxSpeed
+ true
+ true
+ WIN64;NDEBUG;_WINDOWS;_USRDLL;POLARSSL_EXPORTS;%(PreprocessorDefinitions)
+ ../../include
+
+
+ Windows
+ true
+ true
+ true
+
+
+
+HEADER_ENTRIES
+
+
+SOURCE_ENTRIES
+
+
+
+
+
diff --git a/scripts/data_files/vs6-main-template.dsp b/scripts/data_files/vs6-main-template.dsp
new file mode 100644
index 000000000..af4901f3b
--- /dev/null
+++ b/scripts/data_files/vs6-main-template.dsp
@@ -0,0 +1,94 @@
+# Microsoft Developer Studio Project File - Name="polarssl" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Static Library" 0x0104
+
+CFG=polarssl - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "polarssl.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "polarssl.mak" CFG="polarssl - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "polarssl - Win32 Release" (based on "Win32 (x86) Static Library")
+!MESSAGE "polarssl - Win32 Debug" (based on "Win32 (x86) Static Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "polarssl - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir ""
+# PROP BASE Intermediate_Dir "temp"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "temp"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
+# ADD CPP /nologo /W3 /GX /O2 /I "../../include" /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /YX /FD /c
+# ADD BASE RSC /l 0x40c /d "NDEBUG"
+# ADD RSC /l 0x40c /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+
+!ELSEIF "$(CFG)" == "polarssl - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir ""
+# PROP BASE Intermediate_Dir "temp"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "temp"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
+# ADD CPP /nologo /W3 /GX /Z7 /Od /I "../../include" /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
+# ADD BASE RSC /l 0x40c /d "_DEBUG"
+# ADD RSC /l 0x40c /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+
+!ENDIF
+
+# Begin Target
+
+# Name "polarssl - Win32 Release"
+# Name "polarssl - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+SOURCE_ENTRIES
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+HEADER_ENTRIES
+# End Group
+# End Target
+# End Project
diff --git a/scripts/update_vs_apps.pl b/scripts/update_vs_apps.pl
index 3607c80e0..2861241a0 100755
--- a/scripts/update_vs_apps.pl
+++ b/scripts/update_vs_apps.pl
@@ -12,18 +12,41 @@ use strict;
my $vs6_dir = "visualc/VS6";
my $vs6_ext = "dsp";
my $vs6_app_tpl_file = "scripts/data_files/vs6-app-template.$vs6_ext";
+my $vs6_main_tpl_file = "scripts/data_files/vs6-main-template.$vs6_ext";
+my $vs6_main_file = "$vs6_dir/polarssl.$vs6_ext";
my $vsx_dir = "visualc/VS2010";
my $vsx_ext = "vcxproj";
my $vsx_app_tpl_file = "scripts/data_files/vs2010-app-template.$vsx_ext";
+my $vsx_main_tpl_file = "scripts/data_files/vs2010-main-template.$vsx_ext";
+my $vsx_main_file = "$vsx_dir/PolarSSL.$vsx_ext";
my $programs_dir = 'programs';
+my $header_dir = 'include/polarssl';
+my $source_dir = 'library';
+
+# Need windows line endings!
+my $vs6_file_tpl = <\r
+EOT
+my $vsx_src_tpl = <\r
+EOT
exit( main() );
sub check_dirs {
return -d $vs6_dir
&& -d $vsx_dir
+ && -d $header_dir
+ && -d $source_dir
&& -d $programs_dir;
}
@@ -61,23 +84,67 @@ sub get_app_list {
}
sub gen_app_files {
+ my @app_list = @_;
+
my $vs6_tpl = slurp_file( $vs6_app_tpl_file );
my $vsx_tpl = slurp_file( $vsx_app_tpl_file );
- for my $app ( get_app_list() ) {
+ for my $app ( @app_list ) {
gen_app( $app, $vs6_tpl, $vs6_dir, $vs6_ext );
gen_app( $app, $vsx_tpl, $vsx_dir, $vsx_ext );
}
}
+sub gen_entry_list {
+ my ($tpl, @files) = @_;
+
+ my $entries;
+ for my $file (@files) {
+ (my $entry = $tpl) =~ s/{FILE}/$file/;
+ $entries .= $entry;
+ }
+
+ return $entries;
+}
+
+sub gen_main_file {
+ my ($headers, $sources, $hdr_tpl, $src_tpl, $main_tpl, $main_out) = @_;
+
+ my $header_entries = gen_entry_list( $hdr_tpl, @$headers );
+ my $source_entries = gen_entry_list( $src_tpl, @$sources );
+
+ my $out = slurp_file( $main_tpl );
+ $out =~ s/SOURCE_ENTRIES\r\n/$source_entries/m;
+ $out =~ s/HEADER_ENTRIES\r\n/$header_entries/m;
+
+ open my $fh, '>', $main_out or die;
+ print $fh $out;
+ close $fh;
+}
+
sub main {
if( ! check_dirs() ) {
chdir '..' or die;
check_dirs or die "Must but run from PolarSSL root or scripts dir\n";
}
- print "Generating apps files: ";
- gen_app_files();
+ my @app_list = get_app_list();
+ my @headers = <$header_dir/*.h>;
+ my @sources = <$source_dir/*.c>;
+ map { s!/!\\!g } @headers;
+ map { s!/!\\!g } @sources;
+
+ print "Generating apps files... ";
+ gen_app_files( @app_list );
+ print "done.\n";
+
+ print "Generating main files... ";
+ gen_main_file( \@headers, \@sources,
+ $vs6_file_tpl, $vs6_file_tpl,
+ $vs6_main_tpl_file, $vs6_main_file );
+ gen_main_file( \@headers, \@sources,
+ $vsx_hdr_tpl, $vsx_src_tpl,
+ $vsx_main_tpl_file, $vsx_main_file );
print "done.\n";
return 0;
diff --git a/visualc/VS2010/PolarSSL.vcxproj b/visualc/VS2010/PolarSSL.vcxproj
index 529794adb..f06b28065 100644
--- a/visualc/VS2010/PolarSSL.vcxproj
+++ b/visualc/VS2010/PolarSSL.vcxproj
@@ -153,10 +153,11 @@
+
+
-
@@ -170,10 +171,10 @@
+
-
@@ -183,27 +184,27 @@
+
+
-
-
+
-
+
-
@@ -233,10 +234,10 @@
+
-
@@ -245,11 +246,11 @@
+
-
diff --git a/visualc/VS6/polarssl.dsp b/visualc/VS6/polarssl.dsp
index 71dfd7f12..45f5dde3e 100644
--- a/visualc/VS6/polarssl.dsp
+++ b/visualc/VS6/polarssl.dsp
@@ -74,7 +74,7 @@ LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
-!ENDIF
+!ENDIF
# Begin Target
@@ -189,6 +189,10 @@ SOURCE=..\..\library\hmac_drbg.c
# End Source File
# Begin Source File
+SOURCE=..\..\library\md.c
+# End Source File
+# Begin Source File
+
SOURCE=..\..\library\md2.c
# End Source File
# Begin Source File
@@ -201,10 +205,6 @@ SOURCE=..\..\library\md5.c
# End Source File
# Begin Source File
-SOURCE=..\..\library\md.c
-# End Source File
-# Begin Source File
-
SOURCE=..\..\library\md_wrap.c
# End Source File
# Begin Source File
@@ -237,6 +237,10 @@ SOURCE=..\..\library\pk.c
# End Source File
# Begin Source File
+SOURCE=..\..\library\pk_wrap.c
+# End Source File
+# Begin Source File
+
SOURCE=..\..\library\pkcs11.c
# End Source File
# Begin Source File
@@ -253,10 +257,6 @@ SOURCE=..\..\library\pkparse.c
# End Source File
# Begin Source File
-SOURCE=..\..\library\pk_wrap.c
-# End Source File
-# Begin Source File
-
SOURCE=..\..\library\pkwrite.c
# End Source File
# Begin Source File
@@ -329,10 +329,6 @@ SOURCE=..\..\library\x509_create.c
# End Source File
# Begin Source File
-SOURCE=..\..\library\x509_create.c
-# End Source File
-# Begin Source File
-
SOURCE=..\..\library\x509_crl.c
# End Source File
# Begin Source File
@@ -405,6 +401,10 @@ SOURCE=..\..\include\polarssl\certs.h
# End Source File
# Begin Source File
+SOURCE=..\..\include\polarssl\check_config.h
+# End Source File
+# Begin Source File
+
SOURCE=..\..\include\polarssl\cipher.h
# End Source File
# Begin Source File
@@ -413,11 +413,11 @@ SOURCE=..\..\include\polarssl\cipher_wrap.h
# End Source File
# Begin Source File
-SOURCE=..\..\include\polarssl\config.h
+SOURCE=..\..\include\polarssl\compat-1.2.h
# End Source File
# Begin Source File
-SOURCE=..\..\include\polarssl\check_config.h
+SOURCE=..\..\include\polarssl\config.h
# End Source File
# Begin Source File
@@ -473,6 +473,10 @@ SOURCE=..\..\include\polarssl\hmac_drbg.h
# End Source File
# Begin Source File
+SOURCE=..\..\include\polarssl\md.h
+# End Source File
+# Begin Source File
+
SOURCE=..\..\include\polarssl\md2.h
# End Source File
# Begin Source File
@@ -485,19 +489,15 @@ SOURCE=..\..\include\polarssl\md5.h
# End Source File
# Begin Source File
-SOURCE=..\..\include\polarssl\md.h
-# End Source File
-# Begin Source File
-
SOURCE=..\..\include\polarssl\md_wrap.h
# End Source File
# Begin Source File
-SOURCE=..\..\include\polarssl\memory_buffer_alloc.h
+SOURCE=..\..\include\polarssl\memory.h
# End Source File
# Begin Source File
-SOURCE=..\..\include\polarssl\memory.h
+SOURCE=..\..\include\polarssl\memory_buffer_alloc.h
# End Source File
# Begin Source File
@@ -525,6 +525,14 @@ SOURCE=..\..\include\polarssl\pem.h
# End Source File
# Begin Source File
+SOURCE=..\..\include\polarssl\pk.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\polarssl\pk_wrap.h
+# End Source File
+# Begin Source File
+
SOURCE=..\..\include\polarssl\pkcs11.h
# End Source File
# Begin Source File
@@ -537,14 +545,6 @@ SOURCE=..\..\include\polarssl\pkcs5.h
# End Source File
# Begin Source File
-SOURCE=..\..\include\polarssl\pk.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\include\polarssl\pk_wrap.h
-# End Source File
-# Begin Source File
-
SOURCE=..\..\include\polarssl\platform.h
# End Source File
# Begin Source File
@@ -569,6 +569,10 @@ SOURCE=..\..\include\polarssl\sha512.h
# End Source File
# Begin Source File
+SOURCE=..\..\include\polarssl\ssl.h
+# End Source File
+# Begin Source File
+
SOURCE=..\..\include\polarssl\ssl_cache.h
# End Source File
# Begin Source File
@@ -577,10 +581,6 @@ SOURCE=..\..\include\polarssl\ssl_ciphersuites.h
# End Source File
# Begin Source File
-SOURCE=..\..\include\polarssl\ssl.h
-# End Source File
-# Begin Source File
-
SOURCE=..\..\include\polarssl\threading.h
# End Source File
# Begin Source File
@@ -593,6 +593,10 @@ SOURCE=..\..\include\polarssl\version.h
# End Source File
# Begin Source File
+SOURCE=..\..\include\polarssl\x509.h
+# End Source File
+# Begin Source File
+
SOURCE=..\..\include\polarssl\x509_crl.h
# End Source File
# Begin Source File
@@ -605,10 +609,6 @@ SOURCE=..\..\include\polarssl\x509_csr.h
# End Source File
# Begin Source File
-SOURCE=..\..\include\polarssl\x509.h
-# End Source File
-# Begin Source File
-
SOURCE=..\..\include\polarssl\xtea.h
# End Source File
# End Group