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))
 {
  Console.WriteLine(filename);
  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 ms\do_masm nmake -f ms\ntdll.mak nmake -f ms\ntdll.mak test nmake -f ms\ntdll.mak install

Happy OpenSSL’ing!

This entry was posted on Monday, April 21st, 2008 at 18:29 and is filed under Free Software. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

3 Responses to “Build OpenSSL with Visual Studio 2008”

  1. YKY says:

    Newbie in OpenSSL :)
    Sorry for asking, could you tell me where to patch the code?

  2. Ken says:

    Thanks for the information! I’ve got struggled with this stuff yesterday now I think I can resolve this problem thanks to you.

  3. Ken says:

    thanks for the information. now I think I can resolve the problem I faced yesterday.