OpenSSL for Windows

September 7, 2007 – 10:13 am

OpenSSL is an standard library of cryptographic functions for us. Compiling OpenSSL in Windows is a bit hard. Fortunately there is a good site which distribute its related libraries for Windows:
http://www.slproweb.com/products/Win32OpenSSL.html

But it lacks some functions such as MDC2 because of IBM’s patents. So if we need these functions, above site won’t help.

Here is the quick how to for compiling OpenSSL by using VC 2005.

1- Download latest source from http://www.openssl.org/source/

2- extract it in a partition that your VC compiler is installed.
3- Download Perl from http://www.activestate.com/Products/ActivePerl/?_x=1
4- open “Configure” file of your OpenSSL package and edit the below lines

my %disabled = ( # “what” => “comment”
“camellia” => “default”,
“gmp” => “default”,
#”mdc2″ => “enable-mdc2″,
#”rc5″ => “enable-rc5″,
“rfc3779″ => “default”,
“shared” => “default”,
“zlib” => “default”,
“zlib-dynamic” => “default”
);

5- now open command prompt of Windows and > cd where_your_opensll_is_extarcted
6- > perl Configure VC-WIN32
Note: VC-WIN32 is case sensitive
7- > ms\do_ms
8- Then from the Visual Studio 2005 Command Prompt > cd where_your_opensll_is_extarcted
9- > nmake -f ms\nt.mak
It will make static libraries of OpenSSL for you. If you want its dynamic libraries, run the following command:
> nmake -f ms\ntdll.mak
Note: after each nmake it’s better to delete output folders.

That’s All!

Some notes:
If you open nt.mak file, you will see this configuration by default
CFLAG= /MD /Ox /O2 …

These are Microsoft C/C++ options:
/MT

means compile code to link with LIBCMT.LIB, the static multi-threaded version of the C run time library

/MD

means compile code to link with MSVCRT.LIB, the import library for the multi-threaded DLL version of the C run time library

If you don’t want to distribute VC runtimes with your packages, you have to compile OpenSSL with /MT switch.
CFLAG= /MT /Ox /O2 …

with /MD switch

with /MT switch which needs the following configuration too

Now delete .obj files and do the job from the beginning!

Here is my final compilation which can save your day!
download

  1. 3 Responses to “OpenSSL for Windows”

  2. hi vahid
    tanx . please explain more about OpenSSL or give me article to teach it .
    tanx and be happy .

    By mehdigh on Sep 14, 2007

  3. Here is the nice tutorial about it
    h++p://mindspawn.unl.edu/?page_id=14

    By Vahid on Sep 14, 2007

  4. tanx vahid

    By mehdigh on Sep 14, 2007

Sorry, comments for this entry are closed at this time.