This document describes process of building both 32-bit and 64-bit versions of SoftHSM2 on 64-bit Windows 8.1 machine. Either OpenSSL or Botan can be used as the crypto backend.
- Visual Studio (2015 Community)
- GNU Privacy Guard for Windows (2.2.5)
- 7-zip (9.20)
- Strawberry Perl (5.22.0.1)
- The Netwide Assembler (2.11.08)
- Python (3.4.2)
mkdir C:\build\bin\
mkdir C:\build\src\
Download OpenSSL 1.0.2d with its signature into C:\build\src\
directory and verify signature of the downloaded archive:
cd C:\build\src\
gpg --keyserver pgp.mit.edu --recv-keys 0E604491
gpg --verify openssl-1.0.2d.tar.gz.asc openssl-1.0.2d.tar.gz
Extract archive openssl-1.0.2d.tar.gz
into C:\build\src\openssl-1.0.2d-x86
directory:
cd C:\build\src\
"C:\Program Files\7-Zip\7z" x openssl-1.0.2d.tar.gz
"C:\Program Files\7-Zip\7z" x openssl-1.0.2d.tar
rename openssl-1.0.2d openssl-1.0.2d-x86
del openssl-1.0.2d.tar*
In a new command line window build OpenSSL and install it into C:\build\bin\openssl-1.0.2d-x86
directory:
cd C:\build\src\openssl-1.0.2d-x86
set PATH=%PATH%;C:\nasm
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"
perl Configure VC-WIN32 --prefix=C:\build\bin\openssl-1.0.2d-x86 enable-static-engine
ms\do_nasm
nmake /f ms\nt.mak
nmake /f ms\nt.mak test
nmake /f ms\nt.mak install
Extract archive openssl-1.0.2d.tar.gz
into C:\build\src\openssl-1.0.2d-x64
directory:
cd C:\build\src\
"C:\Program Files\7-Zip\7z" x openssl-1.0.2d.tar.gz
"C:\Program Files\7-Zip\7z" x openssl-1.0.2d.tar
rename openssl-1.0.2d openssl-1.0.2d-x64
del openssl-1.0.2d.tar*
In a new command line window build OpenSSL and install it into C:\build\bin\openssl-1.0.2d-x64
directory:
cd C:\build\src\openssl-1.0.2d-x64
set PATH=%PATH%;C:\nasm
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
perl Configure VC-WIN64A --prefix=C:\build\bin\openssl-1.0.2d-x64 enable-static-engine
ms\do_win64a
nmake /f ms\nt.mak
nmake /f ms\nt.mak test
nmake /f ms\nt.mak install
Download Botan 1.10.10 with its signature into C:\build\src\
directory and verify signature of the downloaded archive:
cd C:\build\src\
gpg --keyserver pgp.mit.edu --recv-keys EFBADFBC
gpg --verify Botan-1.10.10.tgz.asc Botan-1.10.10.tgz
Extract archive Botan-1.10.10.tgz
into C:\build\src\botan-1.10.10-x86
directory:
cd C:\build\src\
rename Botan-1.10.10.tgz Botan-1.10.10.tar.gz
"C:\Program Files\7-Zip\7z" x Botan-1.10.10.tar.gz
"C:\Program Files\7-Zip\7z" x Botan-1.10.10.tgz
rename Botan-1.10.10 botan-1.10.10-x86
del Botan-1.10.10.t*
In a new command line window as admin build Botan and install it into C:\build\bin\botan-1.10.10-x86
directory. Need to run the configure script as admin so it can link objects:
cd C:\build\src\botan-1.10.10-x86
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"
python configure.py --cc=msvc --cpu=x86 --prefix=C:\build\bin\botan-1.10.10-x86
nmake
nmake check
check.exe --validate
nmake install
Extract archive Botan-1.10.10.tgz
into C:\build\src\botan-1.10.10-x64
directory:
cd C:\build\src\
rename Botan-1.10.10.tgz Botan-1.10.10.tar.gz
"C:\Program Files\7-Zip\7z" x Botan-1.10.10.tar.gz
"C:\Program Files\7-Zip\7z" x Botan-1.10.10.tgz
rename Botan-1.10.10 botan-1.10.10-x64
del Botan-1.10.10.t*
In a new command line window as admin build Botan and install it into C:\build\bin\botan-1.10.10-x64
directory. Need to run the configure script as admin so it can link objects:
cd C:\build\src\botan-1.10.10-x64
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
python configure.py --cc=msvc --cpu=x64 --prefix=C:\build\bin\botan-1.10.10-x64
nmake
nmake check
check.exe --validate
nmake install
Download CppUnit 1.13.2 into C:\build\src\
directory.
Extract archive cppunit-1.13.2.tar.gz
into C:\build\src\cppunit-1.13.2-x86
directory:
cd C:\build\src\
"C:\Program Files\7-Zip\7z" x cppunit-1.13.2.tar.gz
"C:\Program Files\7-Zip\7z" x cppunit-1.13.2.tar
rename cppunit-1.13.2 cppunit-1.13.2-x86
del cppunit-1.13.2.tar*
Open solution C:\build\src\cppunit-1.13.2-x86\src\CppUnitLibraries2010.sln
in Visual Studio and rebuild the source with Release Unicode\Win32
solution configuration.
Copy the results into C:\build\bin\cppunit-1.13.2-x86
directory:
mkdir C:\build\bin\cppunit-1.13.2-x86\lib
xcopy C:\build\src\cppunit-1.13.2-x86\lib C:\build\bin\cppunit-1.13.2-x86\lib /E
mkdir C:\build\bin\cppunit-1.13.2-x86\include
xcopy C:\build\src\cppunit-1.13.2-x86\include C:\build\bin\cppunit-1.13.2-x86\include /E
Extract archive cppunit-1.13.2.tar.gz
into C:\build\src\cppunit-1.13.2-x64
directory:
cd C:\build\src\
"C:\Program Files\7-Zip\7z" x cppunit-1.13.2.tar.gz
"C:\Program Files\7-Zip\7z" x cppunit-1.13.2.tar
rename cppunit-1.13.2 cppunit-1.13.2-x64
del cppunit-1.13.2.tar*
Open solution C:\build\src\cppunit-1.13.2-x64\src\CppUnitLibraries2010.sln
in Visual Studio and rebuild the source with Release Unicode\x64
solution configuration.
Copy the results into C:\build\bin\cppunit-1.13.2-x64
directory:
mkdir C:\build\bin\cppunit-1.13.2-x64\lib
xcopy C:\build\src\cppunit-1.13.2-x64\lib C:\build\bin\cppunit-1.13.2-x64\lib /E
mkdir C:\build\bin\cppunit-1.13.2-x64\include
xcopy C:\build\src\cppunit-1.13.2-x64\include C:\build\bin\cppunit-1.13.2-x64\include /E
Download the latest version of SoftHSMv2 with its signature into C:\build\src\
directory and verify signature of the downloaded archive:
cd C:\build\src\
gpg --keyserver pgp.mit.edu --recv-keys 4EE17CD2
gpg --verify softhsm-2.x.y.tar.gz.sig softhsm-2.x.y.tar.gz
"C:\Program Files\7-Zip\7z" x softhsm-2.x.y.tar.gz
"C:\Program Files\7-Zip\7z" x softhsm-2.x.y.tar
rename softhsm-2.x.y SoftHSMv2
del softhsm-2.x.y.tar*
Or clone the source code from GitHub:
cd C:\build\src\
git clone https://github.com/opendnssec/SoftHSMv2.git
Configure build process in a new command line window:
cd C:\build\src\SoftHSMv2\win32\
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"
OpenSSL or Botan crypto backend:
perl Configure.pl disable-debug with-crypto-backend=openssl with-openssl=C:\build\bin\openssl-1.0.2d-x86\ with-cppunit=C:\build\bin\cppunit-1.13.2-x86\
perl Configure.pl disable-debug with-crypto-backend=botan with-botan=C:\build\bin\botan-1.10.10-x86\ with-cppunit=C:\build\bin\cppunit-1.13.2-x86\
Open solution C:\build\src\SoftHSMv2\win32\softhsm2.sln
in Visual Studio and rebuild the source with Release\Win32
solution configuration.
Verify the build by running the test programs:
C:\build\src\SoftHSMv2\win32\Release\cryptotest.exe
C:\build\src\SoftHSMv2\win32\Release\datamgrtest.exe
C:\build\src\SoftHSMv2\win32\Release\handlemgrtest.exe
C:\build\src\SoftHSMv2\win32\Release\objstoretest.exe
C:\build\src\SoftHSMv2\win32\Release\p11test.exe
C:\build\src\SoftHSMv2\win32\Release\sessionmgrtest.exe
C:\build\src\SoftHSMv2\win32\Release\slotmgrtest.exe
Copy the results into C:\build\bin\SoftHSMv2-x86
directory:
mkdir C:\build\bin\SoftHSMv2-x86
mkdir C:\build\bin\SoftHSMv2-x86\tokens
copy C:\build\src\SoftHSMv2\win32\Release\softhsm2.dll C:\build\bin\SoftHSMv2-x86\
copy C:\build\src\SoftHSMv2\win32\Release\softhsm2-dump-file.exe C:\build\bin\SoftHSMv2-x86\
copy C:\build\src\SoftHSMv2\win32\Release\softhsm2-keyconv.exe C:\build\bin\SoftHSMv2-x86\
copy C:\build\src\SoftHSMv2\win32\Release\softhsm2-util.exe C:\build\bin\SoftHSMv2-x86\
copy C:\build\src\SoftHSMv2\src\lib\common\softhsm2.conf.in C:\build\bin\SoftHSMv2-x86\softhsm2.conf
Replace @softhsmtokendir@
with C:\build\bin\SoftHSMv2-x86\tokens
in the file C:\build\bin\SoftHSMv2-x86\softhsm2.conf
Set the environment variable SOFTHSM2_CONF to C:\build\bin\SoftHSMv2-x86\softhsm2.conf
Configure build process in a new command line window:
cd C:\build\src\SoftHSMv2\win32\
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
OpenSSL or Botan crypto backend:
perl Configure.pl enable-64bit disable-debug with-crypto-backend=openssl with-openssl=C:\build\bin\openssl-1.0.2d-x64\ with-cppunit=C:\build\bin\cppunit-1.13.2-x64\
perl Configure.pl enable-64bit disable-debug with-crypto-backend=botan with-botan=C:\build\bin\botan-1.10.10-x64\ with-cppunit=C:\build\bin\cppunit-1.13.2-x64\
Open solution C:\build\src\SoftHSMv2\win32\softhsm2.sln
in Visual Studio and rebuild the source with Release\x64
solution configuration.
Verify the build by running the test programs:
C:\build\src\SoftHSMv2\win32\x64\Release\cryptotest.exe
C:\build\src\SoftHSMv2\win32\x64\Release\datamgrtest.exe
C:\build\src\SoftHSMv2\win32\x64\Release\handlemgrtest.exe
C:\build\src\SoftHSMv2\win32\x64\Release\objstoretest.exe
C:\build\src\SoftHSMv2\win32\x64\Release\p11test.exe
C:\build\src\SoftHSMv2\win32\x64\Release\sessionmgrtest.exe
C:\build\src\SoftHSMv2\win32\x64\Release\slotmgrtest.exe
Copy the results into C:\build\bin\SoftHSMv2-x64
directory:
mkdir C:\build\bin\SoftHSMv2-x64
mkdir C:\build\bin\SoftHSMv2-x64\tokens
copy C:\build\src\SoftHSMv2\win32\x64\Release\softhsm2.dll C:\build\bin\SoftHSMv2-x64\
copy C:\build\src\SoftHSMv2\win32\x64\Release\softhsm2-dump-file.exe C:\build\bin\SoftHSMv2-x64\
copy C:\build\src\SoftHSMv2\win32\x64\Release\softhsm2-keyconv.exe C:\build\bin\SoftHSMv2-x64\
copy C:\build\src\SoftHSMv2\win32\x64\Release\softhsm2-util.exe C:\build\bin\SoftHSMv2-x64\
copy C:\build\src\SoftHSMv2\src\lib\common\softhsm2.conf.in C:\build\bin\SoftHSMv2-x64\softhsm2.conf
Replace @softhsmtokendir@
with C:\build\bin\SoftHSMv2-x64\tokens
in the file C:\build\bin\SoftHSMv2-x64\softhsm2.conf
Set the environment variable SOFTHSM2_CONF to C:\build\bin\SoftHSMv2-x64\softhsm2.conf