1. Download openssl
https://www.openssl.org/source/
2. Download & install Perl
https://www.perl.org/get.html
3. Set vs build env(eg: vs2019 64bit)
execute C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvars64.bat
4. Configure
cd openssl source folder
perl Configure debug-VC-WIN32 no-asm --prefix="c:\openssl"
--prefix point to installation path
release version use VC-WIN32
5.Generate .mak file
ms\do_ms.bat or ms\do_ms64a.bat
7. build and install static/dynamic library
nmake -f ms\nt.mak
nmake -f ms\nt.mak install
nmake -f ms\ntdll.mak
nmake -f ms\ntdll.mak install
8. Possible error when compile
error LNK2001: unresolved external symbol OPENSSL_rdtsc
Fix: OPENSSL_rdtsc is only relevant on some platforms, and isn't present on others which is why this problem occurs. Perhaps later Visual Studio versions are more tolerant of this? Removing the entry from util/libeay.num is fine as a workaround for now, and won't cause any adverse impacts.
fatal error LNK1181: cannot open input file 'out32dll\libeay32.lib'
Fix: copy relative .lib file in prefix installation file to out32dll folder