Tim Van Wassenhove

Passionate geek, interested in Technology. Proud father of two

21 Apr 2008

Build OpenSSL with Visual Studio 2008

These days building OpenSSL with Visual Studio 2008 has become really easy. I don’t like to edit .cnf files so i decided to patch the code a little so that the default configuration file becomes openssl.config

string basePath = @"C:\src\openssl-0.9.8g";

string originalConfigfile = "openssl.cnf";
string updatedConfigfile = "openssl.config";
foreach (string filename in Directory.GetFiles(basePath, "\*.\*", SearchOption.AllDirectories))
	string contents = File.ReadAllText(filename);
	if (contents.Contains(originalConfigfile))
		File.WriteAllText(filename, contents.Replace(originalConfigfile, updatedConfigfile));

File.WriteAllText(basePath + @"\apps\" + updatedConfigfile, File.ReadAllText(basePath + @"\apps\" + originalConfigfile));

Open a Visual Studio 2008 Command prompt and add references to the Microsoft SDK as following

SET PATH=%PATH%;C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin
SET LIB=%LIB%;C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib
SET INCLUDE=%INCLUDE%;C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include

Now we simply have to follow the tasks listed in INSTALL.W32:

perl Configure VC-WIN32 --prefix=c:/openssl
nmake -f ms\ntdll.mak
nmake -f ms\ntdll.mak test
nmake -f ms\ntdll.mak install

Happy OpenSSL’ing!