'OpenSSL'에 해당되는 글 2건

  1. 2009.02.03 Building curl 17.19.3 with OpenSSL and zlib on MSVC 2 by Dansoonie
  2. 2009.02.02 Building openSSL 0.9.8j on Windows 2 by Dansoonie
I needed the ssl features in the curl library. The latest version of curl package with ssl for windows being distributed is 7.15.0. I could have used that version, but my coworkers and I insisted on using the most recent version. So, I had to build curl for myself. Here is how I did it.

How I Built Curl 17.19.3 with OpenSSL and zlib
on Visual C++ 2005 Express
* Download the Compressed Project file to skip everything and simply extract and build.

* For building zlib on Windows with MSVC is straightforward download zlib source from http://www.zlib.net/. Extract files to a certain folder. Open (zlib source folder)\projects\visualc6\zlib.dsw and build.
* For building OpenSSL on Windows with MSVC, refer to previous post.


1. Download and Extraction
Download the curl source files from http://curl.haxx.se/download.html.
Extract the files to a certain folder. I used D:\work\curl-7.19.3


2. Add libraries
Create the following folders in the curl folder
libraries\include\zlib
libraries\include\openssl
Copy zlib.h and zconf.h to (curl source folder)\libraries\include\zlib
Copy (openssl source folder)\include\openssl\*.h to (curl source folder)\libraries\include\zlib

Create the following folders in the curl folder
libraries\lib
Copy libeay32.lib, ssleay32.lib from the OpenSSL build result, and zlib1.lib from the zlib build result to (curl source folder)\libraries\lib


3. Open solution
Among the extracted files, there should be vc6curl.dsw. Visual C++ 2005 Express will complain that the file is no longer supported. Let it update the file to the solution file with the sln file extension and stuff...


4. Change Project Settings
Right click on curllib project and select properties to change curllib's project settings.
Select the appropriate Project Configuration that you are willing to make changes to.
(Probably you would like to change both DLL-Debug and DLL-Release)

Add the following to Configuration Properties -> C/C++ -> General -> Additional Include Directories:
..\libraries\include
..\libraries\include\zlib

Add the following to Configuration Properties -> C/C++ -> Preprocessor -> Preprocessor Definitions:
USE_OPENSSL
USE_SSLEAY
HAVE_ZLIB_H

Add the following to Configuration Properties -> Linker -> General -> Additional Library Directories:
..\libraries\lib

Add the following to Configuration Properties -> Linker -> Input -> Additional Dependencies:
zlib1.lib
libeay32.lib
ssleay32.lib


5. Build Solution
Try Ctrl + Alt + F7 and see what happens.





Posted by Dansoonie
** This post is based on http://crowback.tistory.com/entry/openssl-098i-버전-윈도우-환경하에서-컴파일하기 and INSTALL.W32 (plain text file that comes with the openSSL source)

I had to build openSSL on Windows platform at work. Since it's not something that will work simply as opening a solution file on visual studio and building it, I'm keeping a record on how I did it. Not that this is something really difficult, I hope this information can become handy for the ones who really need it.

The requirements...
- cl (Microsoft c/c++ compiler)
- ml (MASM - Microsoft macro assember)
- perl

My build evironment...
- cl: Visual C++ 2005 express (can download here)
- ml: Microsoft macro assember 8 (can download MASM here)
- perl: v5.10.0 built for cygwin-thread-multi-64int (can download cygwin here)
* Prior to building openSSL, check if cl and ml can be executed from command prompt by simply typing 'cl' and 'ml'. If cl and ml is properly executed, you can see the version and usage of cl or ml you are executing. If it seems like cl and ml is not being executed properly, refer to the following by extending "더보기".

1. Downloading Source Files and Extracting it
Download  Openssl-0.9.8j.tar.gz from http://www.openssl.org/source/ and extract it to a dedicated folder. In my case D:\Work\openssl-0.9.8j.
(tar.gz files open beautifully with 7-zip, which is a freeware that supports unpacking almost every compression format widely used these days)


2. Configure
Execute "Configure" perl script by typing the following in the command prompt, where the prefix argument specifies where openSSL will be installed. In my case c:\openssl.
> perl Configure VC-WIN32 --prefix=c:\openssl


3. Add Assembly Functions
Add assembly functions (really don't know what it means at the moment) by typing the following from the command prompt.
> ms\do_masm


4. Make the following modifications to files
4-1. in crypto\cversion.c line 105
return "OPENSSLDIR: \"" OPENSSLDIR "\"";

return "OPENSSLDIR: \" OPENSSLDIR \"";

4-2. in crypto\cryptlib.c line 84~86
#define X509_CERT_DIR  OPENSSLDIR "/certs"
#define X509_CERT_FILE  OPENSSLDIR "/cert.pem"
#define X509_PRIVATE_DIR OPENSSLDIR "/private"

#define X509_CERT_DIR  OPENSSLDIR "\\certs"
#define X509_CERT_FILE  OPENSSLDIR "\\cert.pem"
#define X509_PRIVATE_DIR OPENSSLDIR "\\private"

4-3. in crypto\opensslconf.h line 107~108
(the dir path may differ depending on the argument used for prefix when configuring)
#define ENGINESDIR "c:\openssl/lib/engines"
#define OPENSSLDIR "c:\openssl/ssl"

#define ENGINESDIR "c:\\openssl\\lib\\engines"
#define OPENSSLDIR "c:\\openssl\\ssl"


5. Build, Test, Install
> nmake -f ms\ntdll.mak <- to build
> nmake -f ms\ntdll.mak test <- to test if build was successful
> nmake -f ms\ntdll.mak install <- to install openSSL






Posted by Dansoonie