C++ Based OPC UA Client/Server SDK  1.5.5.355
Compiling OpenSSL with Visual Studio

The following sections descibe how to compile OpenSSL for Visual Studio 2008 and higher without patented algorithms.

Requirements

You will need tar to unpack the OpenSSL source package. Download and install Cygwin from https://cygwin.com/install.html. The default installation includes tar.

Additionally, Perl is required. You can use the package provided by Cygwin. Note that Perl is not part of a standard Cygwin installation but has to be selected manually.

To use Perl in a Visual Studio Command Prompt, it is necessary to add the directory <cygwin_install_dir>\bin (e.g. c:\cygwin64\bin) to the PATH environment variable.

Debug and Release

The actions described in the following steps may differ depending on the libraries to be compiled for debug or release mode. This will be noted in each step below if applicable.

Furthermore, it is described what files to modify to append a “d” to the filename for debug mode if you inted to use debug and release libraries side by side.

Download and Unpack OpenSSL

Download the most recent version of OpenSSL from http://www.openssl.org/source/. Start a cygwin terminal, navigate to the folder containing the downloaded archive and unpack it:

tar –xvzf openssl-<version>.tar.gz

Configure

Still in the Cygwin terminal, change to the OpenSSL folder extracted in the previous step.

Enter the following command to create Makefiles without patented algorithms (replace VC-WIN32 with VC-WIN64I on IA-64 systems and VC-WIN64A on AMD-64 systems):

perl Configure no-idea no-mdc2 no-rc5 no-asm no-ssl2 no-ssl3 VC-WIN32

To create a debug library, open the file do_ms.bat in the subfolder ms. Replace the following lines

perl util\mk1mf.pl no-asm VC-WIN32 >ms\nt.mak
perl util\mk1mf.pl dll no-asm VC-WIN32 >ms\ntdll.mak

with

perl util\mk1mf.pl debug no-asm VC-WIN32 >ms\nt.mak
perl util\mk1mf.pl debug dll no-asm VC-WIN32 >ms\ntdll.mak

On 64 bit systems, edit the respective lines in the file do_win64a.bat or do_win64i.bat.

Create Makefiles

Start a Visual Studio Command Prompt (there’s a shortcut inside the Visual Studio Start Menu entry, the exact name depends on your Visual Studio version) and change to the recently extracted openssl folder.

Then call the batch file to create Makefiles (on 64 bit systems call do_win64a.bat or do_win64i.bat).

ms\do_ms.bat

If the operation succeeds, you can find the Makefiles nt.mak and ntdll.mak in the folder ms.

If you want the debug libraries to have an additional “d” at the end of the filename, open the file libeay32.def and replace the line

LIBRARY LIBEAY32

with

LIBRARY LIBEAY32d

and in the file ssleay32.def the line

LIBRARY SSLEAY32

with

LIBRARY SSLEAY32d

Then open the files ntdll.mak and nt.mak and edit the variables CRYPTO and SSL as shown below:

SSL=ssleay32d
CRYPTO=libeay32d

Compile

Now we are ready to compile the libraries. For dynamically linked libraries, enter

nmake -f ms\ntdll.mak

For static libraries, enter

nmake -f ms\nt.mak

Further information about how to compile OpenSSL can be found in the files INSTALL.W32 and INSTALL.W64 respectively.

Copy the Libraries to the SDK Folder Structure

Finally, it is necessary to copy the files to the SDK folder structure. Create a folder named
<SDK Installation Directory>\third-party\win<32/64>\vs<version>\openssl

A similarly named folder, containing the precompiled OpenSSL binaries shipped with the SDK, should already exist below third-party.

  • Copy the complete inc32 directory to the newly created folder.
  • When using dynamic linked libraries, copy the following files (preserving the folder structure):
    • out32dll\libeay32.dll
      out32dll\libeay32.lib
      out32dll\ssleay32.dll
      out32dll\ssleay32.lib
    • out32dll.dbg\libeay32d.dll
      out32dll.dbg\libeay32d.lib
      out32dll.dbg\libeay32d.pdb
      out32dll.dbg\ssleay32d.dll
      out32dll.dbg\ssleay32.lib
      out32dll.dbg\ssleay32d.pdb
  • When using static libraries, copy the following files (preserving the folder structure):
    • out32\libeay32.lib
      out32\ssleay32.lib
    • out32.dbg\libeay32d.lib
      out32.dbg\ssleay32d.lib