win10 vs2015 openssl-1.0.2j编译

windows环境下Perl circos的安装与使用 1.Perl 中的circos软件包常常被用来画基因组图形,生成的结果文件有png和svg。 由于在Linux环境下查看图形的不便,本文简要介绍在Windows环境下利用circos画图, 便于查看和调试。 2.软件的安装: 1).Perl的安装:安装ActivePerl http://downloads.activestate.com/ActivePerl/releases/5.24. 阅读详情

1 openssl编译基本信息

编译参考:https://github.com/openssl/openssl#build-and-install
https://github.com/openssl/openssl/blob/master/NOTES-Windows.txt

perl Configure VC-WIN32 [no-shared] [no-asm] [no-tests] [--debug] -D_WIN32_WINNT=0x0501 --prefix=c:/install/openssl-1.1.1/vs2019/lib/win32/release

perl Configure VC-WIN32 no-asm -D_WIN32_WINNT=0x0501 --prefix=c:/install/openssl-1.1.1/vs2019/lib/win32/release

1.1 openssl版本信息

openssl 官网:https://www.openssl.org/
稳定版本LTS版本:https://www.openssl.org/source/openssl-1.0.2j.tar.gz

官网上说1.0.2版本是支持到2019-12-31的长期支持版本。
官网版本说明:https://www.openssl.org/policies/releasestrat.html

•Version 1.1.0 will be supported until 2018-08-31.
•Version 1.0.2 will be supported until 2019-12-31 (LTS).
•Support for version 1.0.1 will cease on 2016-12-31. No further releases of 1.0.1 will be made after that date. Security fixes only will be applied to 1.0.1 until then.
•Version 1.0.0 is no longer supported. •Version 0.9.8 is no longer supported.

1.2 windows版本编译依赖

编译opensll windows 版本需要 perl,记得安装时设置perl的bin 目录到系统path环境变量中,是你在cmd窗口可以正常使用perl -version查看版本信息即可。
perl下载地址 http://www.activestate.com/activeperl/downloads
我使用的是ActivePerl-5.24.0.2400-MSWin32-x86-64int-300560.exe版本。x64为系统应该2个都可以。
ActivePerl-5.24.0.2400-MSWin32-x86-64int-300560.exe
ActivePerl-5.24.0.2400-MSWin32-x64-300558.exe

1.3 操作系统环境

windows 10 企业版本(10.0.14393)。vs2015 update3(14.0.25431.01)。如果编译其他vs版本,只要把vs2015换成对应visual studio版本即可。

1.4 源码下载

源码获取有3中方式:
A:在官网下载文档版本压缩包openssl-1.0.2j.tar.gz。(https://www.openssl.org/source/openssl-1.0.2j.tar.gz)
B:从openssl私有git仓库下载。https://www.openssl.org/source/gitrepo.html。

git clone git://git.openssl.org/openssl.git

C:github上opensll的代码仓库。建议使用github上的代码。
github地址:https://github.com/openssl/openssl

使用cmd命令窗口,进入d盘源码目录,进行如下操作:

cd d:\git
git clone https://github.com/openssl/openssl.git
cd d:\git\openssl
rem 迁出稳定版本1.0.2j,并建立自己本地分支b1.0.2j
git checkout OpenSSL_1_0_2j -b b1.0.2j

2 使用vs2015 编译openssl

直接把下面的对应vs版本的bat脚本拷贝到你的cmd窗口中运行,每个vs版本需要在单独的cmd窗口运行,
1 替换 Visual Studio 的路径为你自己的路径,
2 替换 d:/install/openssl-1.0.2j 为你自己的输出路径,
运行后,即可在d:/install/openssl-1.0.2j 下找到自己编译的8个版本openssl库 和 头文件。

rem 编译x86位参考INSTALL.W32说明文件
rem 如果你要编译不同的visualStudio版本,每个vs版本要单独开一个cmd窗口来操作,以免受到上一个vs版本环境变量的影响。
rem 使用vs2015 x86编译环境,运行下面这句话,就启用了vs2015的x86环境
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\vcvars32.bat"

rem 一定要注意INSTALL.W32的文档说明,win32 release 版本需要指定no-asm,并且使用ms\do_nasm.bat脚本
rem 生成win32/release静态库lib
nmake -f ms\nt.mak clean
rmdir /S /Q out32
rmdir /S /Q tmp32
perl Configure VC-WIN32 no-asm --prefix=d:/install/openssl-1.0.2j/vs2015/lib/win32/release
ms\do_nasm.bat
nmake -f ms\nt.mak install
rem 运行测试程序
cd out32
..\ms\test
cd ..

rem 生成win32/release动态库dll
nmake -f ms\ntdll.mak clean
rmdir /S /Q out32dll
rmdir /S /Q tmp32dll
perl Configure VC-WIN32 no-asm --prefix=d:/install/openssl-1.0.2j/vs2015/dll/win32/release
ms\do_nasm.bat
nmake -f ms\ntdll.mak install
rem 运行测试程序
cd out32dll
..\ms\test
cd ..

rem 生成win32/debug静态库lib
nmake -f ms\nt.mak clean
rmdir /S /Q out32.dbg
rmdir /S /Q tmp32.dbg
perl Configure debug-VC-WIN32 no-asm --prefix=d:/install/openssl-1.0.2j/vs2015/lib/win32/debug
ms\do_ms.bat
nmake -f ms\nt.mak install
rem 运行测试程序
cd out32.dbg
..\ms\test
cd ..

rem 生成win32/debug动态库dll
nmake -f ms\ntdll.mak clean
rmdir /S /Q out32dll.dbg
rmdir /S /Q tmp32dll.dbg
perl Configure debug-VC-WIN32 no-asm --prefix=d:/install/openssl-1.0.2j/vs2015/dll/win32/debug
ms\do_ms.bat
nmake -f ms\ntdll.mak install
rem 运行测试程序
cd out32dll.dbg
..\ms\test
cd ..

rem 编译x64位参考INSTALL.W64说明文件
rem 如果你要编译不同的visualStudio版本,每个vs版本要单独开一个cmd窗口来操作,以免受到上一个vs版本环境变量的影响。
rem 使用vs2015 x64编译环境,如果使用其他vs版本,只需修改这个运行环境
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\vcvars64.bat"

rem 生成win64/release静态库lib
nmake -f ms\nt.mak clean
rmdir /S /Q out32
rmdir /S /Q tmp32
perl Configure VC-WIN64A --prefix=d:/install/openssl-1.0.2j/vs2015/lib/win64/release
ms\do_win64a.bat
nmake -f ms\nt.mak install
rem 运行测试程序
cd out32
..\ms\test
cd ..

rem 生成win64/release动态库dll
nmake -f ms\ntdll.mak clean
rmdir /S /Q out32dll
rmdir /S /Q tmp32dll
perl Configure VC-WIN64A --prefix=d:/install/openssl-1.0.2j/vs2015/dll/win64/release
ms\do_win64a.bat
nmake -f ms\ntdll.mak install
rem 运行测试程序
cd out32dll
..\ms\test
cd ..

rem 生成win64/debug静态库lib
nmake -f ms\nt.mak clean
rmdir /S /Q out32.dbg
rmdir /S /Q tmp32.dbg
perl Configure debug-VC-WIN64A --prefix=d:/install/openssl-1.0.2j/vs2015/lib/win64/debug
ms\do_win64a.bat
nmake -f ms\nt.mak install
rem 运行测试程序
cd out32.dbg
..\ms\test
cd ..

rem 生成win64/debug动态库dll
nmake -f ms\ntdll.mak clean
rmdir /S /Q out32dll.dbg
rmdir /S /Q tmp32dll.dbg
perl Configure debug-VC-WIN64A --prefix=d:/install/openssl-1.0.2j/vs2015/dll/win64/debug
ms\do_win64a.bat
nmake -f ms\ntdll.mak install
rem 运行测试程序
cd out32dll.dbg
..\ms\test
cd ..

rem vs2015 生成的4个版本90MB+
rem 通常我们只需要生成的win32/release win64/release版本。
rem 其他版本只是调试使用

##3 使用vs2013 编译openssl

rem 编译x86位参考INSTALL.W32说明文件
rem 如果你要编译不同的visualStudio版本,每个vs版本要单独开一个cmd窗口来操作,以免受到上一个vs版本环境变量的影响。
rem 使用vs2013 x86编译环境 vs2013 update5 (12.0.40629.00)
"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\vcvars32.bat"

rem 一定要注意INSTALL.W32的文档说明,win32 release 版本需要指定no-asm,并且使用ms\do_nasm.bat脚本
rem 生成win32/release静态库lib
nmake -f ms\nt.mak clean
rmdir /S /Q out32
rmdir /S /Q tmp32
perl Configure VC-WIN32 no-asm --prefix=d:/install/openssl-1.0.2j/vs2013/lib/win32/release
ms\do_nasm.bat
nmake -f ms\nt.mak install
rem 运行测试程序
cd out32
..\ms\test
cd ..

rem 生成win32/release动态库dll
nmake -f ms\ntdll.mak clean
rmdir /S /Q out32dll
rmdir /S /Q tmp32dll
perl Configure VC-WIN32 no-asm --prefix=d:/install/openssl-1.0.2j/vs2013/dll/win32/release
ms\do_nasm.bat
nmake -f ms\ntdll.mak install
rem 运行测试程序
cd out32dll
..\ms\test
cd ..

rem 生成win32/debug静态库lib
nmake -f ms\nt.mak clean
rmdir /S /Q out32.dbg
rmdir /S /Q tmp32.dbg
perl Configure debug-VC-WIN32 no-asm --prefix=d:/install/openssl-1.0.2j/vs2013/lib/win32/debug
ms\do_ms.bat
nmake -f ms\nt.mak install
rem 运行测试程序
cd out32.dbg
..\ms\test
cd ..

rem 生成win32/debug动态库dll
nmake -f ms\ntdll.mak clean
rmdir /S /Q out32dll.dbg
rmdir /S /Q tmp32dll.dbg
perl Configure debug-VC-WIN32 no-asm --prefix=d:/install/openssl-1.0.2j/vs2013/dll/win32/debug
ms\do_ms.bat
nmake -f ms\ntdll.mak install
rem 运行测试程序
cd out32dll.dbg
..\ms\test
cd ..

rem 编译x64位参考INSTALL.W64说明文件
rem 使用vs2013 x64编译环境,如果使用其他vs版本,只需修改这个运行环境
"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\amd64\vcvars64.bat"

rem 生成win64/release静态库lib
nmake -f ms\nt.mak clean
rmdir /S /Q out32
rmdir /S /Q tmp32
perl Configure VC-WIN64A --prefix=d:/install/openssl-1.0.2j/vs2013/lib/win64/release
ms\do_win64a.bat
nmake -f ms\nt.mak install
rem 运行测试程序
cd out32
..\ms\test
cd ..

rem 生成win64/release动态库dll
nmake -f ms\ntdll.mak clean
rmdir /S /Q out32dll
rmdir /S /Q tmp32dll
perl Configure VC-WIN64A --prefix=d:/install/openssl-1.0.2j/vs2013/dll/win64/release
ms\do_win64a.bat
nmake -f ms\ntdll.mak install
rem 运行测试程序
cd out32dll
..\ms\test
cd ..

rem 生成win64/debug静态库lib
nmake -f ms\nt.mak clean
rmdir /S /Q out32.dbg
rmdir /S /Q tmp32.dbg
perl Configure debug-VC-WIN64A --prefix=d:/install/openssl-1.0.2j/vs2013/lib/win64/debug
ms\do_win64a.bat
nmake -f ms\nt.mak install
rem 运行测试程序
cd out32.dbg
..\ms\test
cd ..

rem 生成win64/debug动态库dll
nmake -f ms\ntdll.mak clean
rmdir /S /Q out32dll.dbg
rmdir /S /Q tmp32dll.dbg
perl Configure debug-VC-WIN64A --prefix=d:/install/openssl-1.0.2j/vs2013/dll/win64/debug
ms\do_win64a.bat
nmake -f ms\ntdll.mak install
rem 运行测试程序
cd out32dll.dbg
..\ms\test
cd ..

rem vs2013 生成的8个版本105MB
rem 通常我们只需要生成的win32/release win64/release版本。
rem 其他版本只是调试使用

##4 使用vs2012 编译openssl

rem 编译x86位参考INSTALL.W32说明文件
rem 如果你要编译不同的visualStudio版本,每个vs版本要单独开一个cmd窗口来操作,以免受到上一个vs版本环境变量的影响。
rem 使用vs2012 x86编译环境 vs2012 update5 (11.0.61219.00)
"C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\vcvars32.bat"

rem 一定要注意INSTALL.W32的文档说明,win32 release 版本需要指定no-asm,并且使用ms\do_nasm.bat脚本
rem 生成win32/release静态库lib
nmake -f ms\nt.mak clean
rmdir /S /Q out32
rmdir /S /Q tmp32
perl Configure VC-WIN32 no-asm --prefix=d:/install/openssl-1.0.2j/vs2012/lib/win32/release
ms\do_nasm.bat
nmake -f ms\nt.mak install
rem 运行测试程序
cd out32
..\ms\test
cd ..

rem 生成win32/release动态库dll
nmake -f ms\ntdll.mak clean
rmdir /S /Q out32dll
rmdir /S /Q tmp32dll
perl Configure VC-WIN32 no-asm --prefix=d:/install/openssl-1.0.2j/vs2012/dll/win32/release
ms\do_nasm.bat
nmake -f ms\ntdll.mak install
rem 运行测试程序
cd out32dll
..\ms\test
cd ..

rem 生成win32/debug静态库lib
nmake -f ms\nt.mak clean
rmdir /S /Q out32.dbg
rmdir /S /Q tmp32.dbg
perl Configure debug-VC-WIN32 no-asm --prefix=d:/install/openssl-1.0.2j/vs2012/lib/win32/debug
ms\do_ms.bat
nmake -f ms\nt.mak install
rem 运行测试程序
cd out32.dbg
..\ms\test
cd ..

rem 生成win32/debug动态库dll
nmake -f ms\ntdll.mak clean
rmdir /S /Q out32dll.dbg
rmdir /S /Q tmp32dll.dbg
perl Configure debug-VC-WIN32 no-asm --prefix=d:/install/openssl-1.0.2j/vs2012/dll/win32/debug
ms\do_ms.bat
nmake -f ms\ntdll.mak install
rem 运行测试程序
cd out32dll.dbg
..\ms\test
cd ..

rem 编译x64位参考INSTALL.W64说明文件
rem 如果你要编译不同的visualStudio版本,每个vs版本要单独开一个cmd窗口来操作,以免受到上一个vs版本环境变量的影响。
rem 使用vs2012 x64编译环境,如果使用其他vs版本,只需修改这个运行环境
"C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\amd64\vcvars64.bat"

rem 生成win64/release静态库lib
nmake -f ms\nt.mak clean
rmdir /S /Q out32
rmdir /S /Q tmp32
perl Configure VC-WIN64A --prefix=d:/install/openssl-1.0.2j/vs2012/lib/win64/release
ms\do_win64a.bat
nmake -f ms\nt.mak install
rem 运行测试程序
cd out32
..\ms\test
cd ..

rem 生成win64/release动态库dll
nmake -f ms\ntdll.mak clean
rmdir /S /Q out32dll
rmdir /S /Q tmp32dll
perl Configure VC-WIN64A --prefix=d:/install/openssl-1.0.2j/vs2012/dll/win64/release
ms\do_win64a.bat
nmake -f ms\ntdll.mak install
rem 运行测试程序
cd out32dll
..\ms\test
cd ..

rem 生成win64/debug静态库lib
nmake -f ms\nt.mak clean
rmdir /S /Q out32.dbg
rmdir /S /Q tmp32.dbg
perl Configure debug-VC-WIN64A --prefix=d:/install/openssl-1.0.2j/vs2012/lib/win64/debug
ms\do_win64a.bat
nmake -f ms\nt.mak install
rem 运行测试程序
cd out32.dbg
..\ms\test
cd ..

rem 生成win64/debug动态库dll
nmake -f ms\ntdll.mak clean
rmdir /S /Q out32dll.dbg
rmdir /S /Q tmp32dll.dbg
perl Configure debug-VC-WIN64A --prefix=d:/install/openssl-1.0.2j/vs2012/dll/win64/debug
ms\do_win64a.bat
nmake -f ms\ntdll.mak install
rem 运行测试程序
cd out32dll.dbg
..\ms\test
cd ..

rem vs2012 生成的8个版本105MB
rem 通常我们只需要生成的win32/release win64/release版本。
rem 其他版本只是调试使用

##5 使用vs2010 编译openssl

rem 编译x86位参考INSTALL.W32说明文件
rem 如果你要编译不同的visualStudio版本,每个vs版本要单独开一个cmd窗口来操作,以免受到上一个vs版本环境变量的影响。
rem 使用vs2010 x86编译环境 vs2010 SP1Rel (10.0.40219.00)
"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\vcvars32.bat"

rem 一定要注意INSTALL.W32的文档说明,win32 release 版本需要指定no-asm,并且使用ms\do_nasm.bat脚本
rem 生成win32/release静态库lib
nmake -f ms\nt.mak clean
rmdir /S /Q out32
rmdir /S /Q tmp32
perl Configure VC-WIN32 no-asm --prefix=d:/install/openssl-1.0.2j/vs2010/lib/win32/release
ms\do_nasm.bat
nmake -f ms\nt.mak install
rem 运行测试程序
cd out32
..\ms\test
cd ..

rem 生成win32/release动态库dll
nmake -f ms\ntdll.mak clean
rmdir /S /Q out32dll
rmdir /S /Q tmp32dll
perl Configure VC-WIN32 no-asm --prefix=d:/install/openssl-1.0.2j/vs2010/dll/win32/release
ms\do_nasm.bat
nmake -f ms\ntdll.mak install
rem 运行测试程序
cd out32dll
..\ms\test
cd ..

rem 生成win32/debug静态库lib
nmake -f ms\nt.mak clean
rmdir /S /Q out32.dbg
rmdir /S /Q tmp32.dbg
perl Configure debug-VC-WIN32 no-asm --prefix=d:/install/openssl-1.0.2j/vs2010/lib/win32/debug
ms\do_ms.bat
nmake -f ms\nt.mak install
rem 运行测试程序
cd out32.dbg
..\ms\test
cd ..

rem 生成win32/debug动态库dll
nmake -f ms\ntdll.mak clean
rmdir /S /Q out32dll.dbg
rmdir /S /Q tmp32dll.dbg
perl Configure debug-VC-WIN32 no-asm --prefix=d:/install/openssl-1.0.2j/vs2010/dll/win32/debug
ms\do_ms.bat
nmake -f ms\ntdll.mak install
rem 运行测试程序
cd out32dll.dbg
..\ms\test
cd ..

rem 编译x64位参考INSTALL.W64说明文件
rem 如果你要编译不同的visualStudio版本,每个vs版本要单独开一个cmd窗口来操作,以免受到上一个vs版本环境变量的影响。
rem 使用vs2010 x64编译环境,如果使用其他vs版本,只需修改这个运行环境
"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64\vcvars64.bat"

rem 生成win64/release静态库lib
nmake -f ms\nt.mak clean
rmdir /S /Q out32
rmdir /S /Q tmp32
perl Configure VC-WIN64A --prefix=d:/install/openssl-1.0.2j/vs2010/lib/win64/release
ms\do_win64a.bat
nmake -f ms\nt.mak install
rem 运行测试程序
cd out32
..\ms\test
cd ..

rem 生成win64/release动态库dll
nmake -f ms\ntdll.mak clean
rmdir /S /Q out32dll
rmdir /S /Q tmp32dll
perl Configure VC-WIN64A --prefix=d:/install/openssl-1.0.2j/vs2010/dll/win64/release
ms\do_win64a.bat
nmake -f ms\ntdll.mak install
rem 运行测试程序
cd out32dll
..\ms\test
cd ..

rem 生成win64/debug静态库lib
nmake -f ms\nt.mak clean
rmdir /S /Q out32.dbg
rmdir /S /Q tmp32.dbg
perl Configure debug-VC-WIN64A --prefix=d:/install/openssl-1.0.2j/vs2010/lib/win64/debug
ms\do_win64a.bat
nmake -f ms\nt.mak install
rem 运行测试程序
cd out32.dbg
..\ms\test
cd ..

rem 生成win64/debug动态库dll
nmake -f ms\ntdll.mak clean
rmdir /S /Q out32dll.dbg
rmdir /S /Q tmp32dll.dbg
perl Configure debug-VC-WIN64A --prefix=d:/install/openssl-1.0.2j/vs2010/dll/win64/debug
ms\do_win64a.bat
nmake -f ms\ntdll.mak install
rem 运行测试程序
cd out32dll.dbg
..\ms\test
cd ..

rem vs2010 生成的8个版本101MB
rem 通常我们只需要生成的win32/release win64/release版本。
rem 其他版本只是调试使用

##6 使用vs2008 编译openssl

rem 编译x86位参考INSTALL.W32说明文件
rem 如果你要编译不同的visualStudio版本,每个vs版本要单独开一个cmd窗口来操作,以免受到上一个vs版本环境变量的影响。
rem 使用vs2008 x86编译环境 vs2008 SP (9.0.30729.1)
"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\vcvars32.bat"

rem 一定要注意INSTALL.W32的文档说明,win32 release 版本需要指定no-asm,并且使用ms\do_nasm.bat脚本
rem 生成win32/release静态库lib
nmake -f ms\nt.mak clean
rmdir /S /Q out32
rmdir /S /Q tmp32
perl Configure VC-WIN32 no-asm --prefix=d:/install/openssl-1.0.2j/vs2008/lib/win32/release
ms\do_nasm.bat
nmake -f ms\nt.mak install
rem 运行测试程序
cd out32
..\ms\test
cd ..

rem 生成win32/release动态库dll
nmake -f ms\ntdll.mak clean
rmdir /S /Q out32dll
rmdir /S /Q tmp32dll
perl Configure VC-WIN32 no-asm --prefix=d:/install/openssl-1.0.2j/vs2008/dll/win32/release
ms\do_nasm.bat
nmake -f ms\ntdll.mak install
rem 运行测试程序
cd out32dll
..\ms\test
cd ..

rem 生成win32/debug静态库lib
nmake -f ms\nt.mak clean
rmdir /S /Q out32.dbg
rmdir /S /Q tmp32.dbg
perl Configure debug-VC-WIN32 no-asm --prefix=d:/install/openssl-1.0.2j/vs2008/lib/win32/debug
ms\do_ms.bat
nmake -f ms\nt.mak install
rem 运行测试程序
cd out32.dbg
..\ms\test
cd ..

rem 生成win32/debug动态库dll
nmake -f ms\ntdll.mak clean
rmdir /S /Q out32dll.dbg
rmdir /S /Q tmp32dll.dbg
perl Configure debug-VC-WIN32 no-asm --prefix=d:/install/openssl-1.0.2j/vs2008/dll/win32/debug
ms\do_ms.bat
nmake -f ms\ntdll.mak install
rem 运行测试程序
cd out32dll.dbg
..\ms\test
cd ..

rem 编译x64位参考INSTALL.W64说明文件
rem 如果你要编译不同的visualStudio版本,每个vs版本要单独开一个cmd窗口来操作,以免受到上一个vs版本环境变量的影响。
rem 使用vs2008 x64编译环境,如果使用其他vs版本,只需修改这个运行环境
"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\amd64\vcvarsamd64.bat"

rem 生成win64/release静态库lib
nmake -f ms\nt.mak clean
rmdir /S /Q out32
rmdir /S /Q tmp32
perl Configure VC-WIN64A --prefix=d:/install/openssl-1.0.2j/vs2008/lib/win64/release
ms\do_win64a.bat
nmake -f ms\nt.mak install
rem 运行测试程序
cd out32
..\ms\test
cd ..

rem 生成win64/release动态库dll
nmake -f ms\ntdll.mak clean
rmdir /S /Q out32dll
rmdir /S /Q tmp32dll
perl Configure VC-WIN64A --prefix=d:/install/openssl-1.0.2j/vs2008/dll/win64/release
ms\do_win64a.bat
nmake -f ms\ntdll.mak install
rem 运行测试程序
cd out32dll
..\ms\test
cd ..

rem 生成win64/debug静态库lib
nmake -f ms\nt.mak clean
rmdir /S /Q out32.dbg
rmdir /S /Q tmp32.dbg
perl Configure debug-VC-WIN64A --prefix=d:/install/openssl-1.0.2j/vs2008/lib/win64/debug
ms\do_win64a.bat
nmake -f ms\nt.mak install
rem 运行测试程序
cd out32.dbg
..\ms\test
cd ..

rem 生成win64/debug动态库dll
nmake -f ms\ntdll.mak clean
rmdir /S /Q out32dll.dbg
rmdir /S /Q tmp32dll.dbg
perl Configure debug-VC-WIN64A --prefix=d:/install/openssl-1.0.2j/vs2008/dll/win64/debug
ms\do_win64a.bat
nmake -f ms\ntdll.mak install
rem 运行测试程序
cd out32dll.dbg
..\ms\test
cd ..

rem vs2008 生成的8个版本99.5MB
rem 通常我们只需要生成的win32/release win64/release版本。
rem 其他版本只是调试使用

##7 使用vs2005 编译openssl

rem 编译x86位参考INSTALL.W32说明文件
rem 如果你要编译不同的visualStudio版本,每个vs版本要单独开一个cmd窗口来操作,以免受到上一个vs版本环境变量的影响。
rem 使用vs2005 x86编译环境 vs2005 (8.0.50727.4039)
"C:\Program Files (x86)\Microsoft Visual Studio 8\VC\bin\vcvars32.bat"

rem 一定要注意INSTALL.W32的文档说明,win32 release 版本需要指定no-asm,并且使用ms\do_nasm.bat脚本
rem 生成win32/release静态库lib
nmake -f ms\nt.mak clean
rmdir /S /Q out32
rmdir /S /Q tmp32
perl Configure VC-WIN32 no-asm --prefix=d:/install/openssl-1.0.2j/vs2005/lib/win32/release
ms\do_nasm.bat
nmake -f ms\nt.mak install
rem 运行测试程序
cd out32
..\ms\test
cd ..

rem 生成win32/release动态库dll
nmake -f ms\ntdll.mak clean
rmdir /S /Q out32dll
rmdir /S /Q tmp32dll
perl Configure VC-WIN32 no-asm --prefix=d:/install/openssl-1.0.2j/vs2005/dll/win32/release
ms\do_nasm.bat
nmake -f ms\ntdll.mak install
rem 运行测试程序
cd out32dll
..\ms\test
cd ..

rem 生成win32/debug静态库lib
nmake -f ms\nt.mak clean
rmdir /S /Q out32.dbg
rmdir /S /Q tmp32.dbg
perl Configure debug-VC-WIN32 no-asm --prefix=d:/install/openssl-1.0.2j/vs2005/lib/win32/debug
ms\do_ms.bat
nmake -f ms\nt.mak install
rem 运行测试程序
cd out32.dbg
..\ms\test
cd ..

rem 生成win32/debug动态库dll
nmake -f ms\ntdll.mak clean
rmdir /S /Q out32dll.dbg
rmdir /S /Q tmp32dll.dbg
perl Configure debug-VC-WIN32 no-asm --prefix=d:/install/openssl-1.0.2j/vs2005/dll/win32/debug
ms\do_ms.bat
nmake -f ms\ntdll.mak install
rem 运行测试程序
cd out32dll.dbg
..\ms\test
cd ..

rem 编译x64位参考INSTALL.W64说明文件
rem 如果你要编译不同的visualStudio版本,每个vs版本要单独开一个cmd窗口来操作,以免受到上一个vs版本环境变量的影响。
rem 使用vs2005 x64编译环境,如果使用其他vs版本,只需修改这个运行环境
"C:\Program Files (x86)\Microsoft Visual Studio 8\VC\bin\amd64\vcvarsamd64.bat"

rem 生成win64/release静态库lib
nmake -f ms\nt.mak clean
rmdir /S /Q out32
rmdir /S /Q tmp32
perl Configure VC-WIN64A --prefix=d:/install/openssl-1.0.2j/vs2005/lib/win64/release
ms\do_win64a.bat
nmake -f ms\nt.mak install
rem 运行测试程序
cd out32
..\ms\test
cd ..

rem 生成win64/release动态库dll
nmake -f ms\ntdll.mak clean
rmdir /S /Q out32dll
rmdir /S /Q tmp32dll
perl Configure VC-WIN64A --prefix=d:/install/openssl-1.0.2j/vs2005/dll/win64/release
ms\do_win64a.bat
nmake -f ms\ntdll.mak install
rem 运行测试程序
cd out32dll
..\ms\test
cd ..

rem 生成win64/debug静态库lib
nmake -f ms\nt.mak clean
rmdir /S /Q out32.dbg
rmdir /S /Q tmp32.dbg
perl Configure debug-VC-WIN64A --prefix=d:/install/openssl-1.0.2j/vs2005/lib/win64/debug
ms\do_win64a.bat
nmake -f ms\nt.mak install
rem 运行测试程序
cd out32.dbg
..\ms\test
cd ..

rem 生成win64/debug动态库dll
nmake -f ms\ntdll.mak clean
rmdir /S /Q out32dll.dbg
rmdir /S /Q tmp32dll.dbg
perl Configure debug-VC-WIN64A --prefix=d:/install/openssl-1.0.2j/vs2005/dll/win64/debug
ms\do_win64a.bat
nmake -f ms\ntdll.mak install
rem 运行测试程序
cd out32dll.dbg
..\ms\test
cd ..

rem vs2005 生成的8个版本96.9MB
rem 通常我们只需要生成的win32/release win64/release版本。
rem 其他版本只是调试使用

##8 使用自己编译的OpenSSL库文件。
这里测试一个使用vs2015编译的32位动态库的D:\install\openssl-1.0.2j\vs2015\dll\win32\release版本。不管自己的工程是debug还是release版本,都引入openssl的release版本动态库。因为实际上我们自己的工程基本不会修改openssl代码。如果是自己研究,需要调试跟踪openssl的代码,需要引入openssl对应的debug版本。
新建一个vs2015空的32位控制台工程,并引入OpenSSL库文件。

8.1 新建一个vs2015空的32位控制台工程,工程上面右键菜单选择属性,配置属性C/C++附加包含目录,添加内容:D:\install\openssl-1.0.2j\vs2015\dll\win32\release\include
注意:实际工程中,需要把vs2015目录内容拷贝到自己工程的特定第三方目录,然后使用相对路径引入。
这里写图片描述

8.2 配置属性==>连接器==>常规==>附加库目录,添加D:\install\openssl-1.0.2j\vs2015\dll\win32\release\lib;
这里写图片描述

8.3 配置属性==>连接器==>输入==>附近依赖项,添加 libeay32.lib;ssleay32.lib;
这里写图片描述

8.4 添加一个测试的c++文件。这里在其他人的blog上面引入了一个测试文件。OpenSSLTest.cpp。来自http://blog.csdn.net/gpltoken/article/details/53011068。

// 该代码来自 http://blog.csdn.net/gpltoken/article/details/53011068
// 把文件目录做了修改,解密后的文件多了一个换行符
// 
#include <openssl/evp.h>
#include <stdio.h>

#pragma warning(disable:4996)

#define N 1024
#define IN
//Aes算法ecb模式加密文件
/**********************************************************************
函数名称:AesEncryptFile
函数功能:加密文件
处理过程:
1.根据选择的密码算法以及口令,生成key和iv。
2.把文件头写入密文文件
3.循环读取原文文件数据加密后保存到密文文件路径中。
参数说明:
szSrc:[IN] char *,待加密的原文文件路径
szTarget:[IN] char *,加密后的密文文件保存路径
key:[IN] unsigned char *, 口令
iType:[IN] int, 加密类型(128或256)
返回值:成功返回1,否则返回0
************************************************************************/
int AesEncryptFile(IN char * szSrc,
	IN char * szTarget,
	IN unsigned char * key,
	IN int iType)
{
	unsigned char ukey[EVP_MAX_KEY_LENGTH];
	unsigned char iv[EVP_MAX_IV_LENGTH];
	unsigned char in[N];
	int inl;   //输入数据大小
	unsigned char out[N];
	int outl;   //输出数据大小

	int isSuccess;

	FILE *fpIn;
	FILE *fpOut;

	EVP_CIPHER_CTX ctx;   //evp加密上下文环境
	const	EVP_CIPHER *cipher;

	fpIn = fopen(szSrc, "rb");
	if (fpIn == NULL)
	{
		printf("fopen szSrc failed");
		return 0;
	}
	fpOut = fopen(szTarget, "w+");
	if (fpOut == NULL)
	{
		printf("fopen szTarget failed");
		fclose(fpIn);
		return 0;
	}

	//选择算法
	if (iType == 128)
	{
		cipher = EVP_aes_128_ecb();
	}
	else if (iType == 256)
	{
		cipher = EVP_aes_256_ecb();
	}
	else
	{
		printf("iType should be 128 or 256.");
		fclose(fpIn);
		fclose(fpOut);
		return 0;
	}
	//生成ukey和iv
	int len = sizeof(key);
	EVP_BytesToKey(cipher, EVP_md5(), NULL, (const unsigned char *)key, len - 1, 1, ukey, iv);

	//初始化ctx,加密算法初始化
	EVP_CIPHER_CTX_init(&ctx);
	isSuccess = EVP_EncryptInit_ex(&ctx, cipher, NULL, ukey, iv);
	if (!isSuccess)
	{
		printf("EVP_EncryptInit_ex() failed");
		EVP_CIPHER_CTX_cleanup(&ctx);
		fclose(fpIn);
		fclose(fpOut);
		return 0;
	}

	//加密文件
	for (;;)
	{
		inl = fread(in, 1, N, fpIn);
		if (inl <= 0)
			break;

		isSuccess = EVP_EncryptUpdate(&ctx, out, &outl, in, inl);
		if (!isSuccess)
		{
			printf("EVP_EncryptInit_ex() failed");
			EVP_CIPHER_CTX_cleanup(&ctx);
			fclose(fpIn);
			fclose(fpOut);
			return 0;
		}
		fwrite(out, 1, outl, fpOut);
	}
	isSuccess = EVP_EncryptFinal_ex(&ctx, out, &outl);
	if (!isSuccess)
	{
		printf("EVP_EncryptInit_ex() failed");
		EVP_CIPHER_CTX_cleanup(&ctx);
		fclose(fpIn);
		fclose(fpOut);
		return 0;
	}

	fwrite(out, 1, outl, fpOut);
	printf("加密成功\n");
	EVP_CIPHER_CTX_cleanup(&ctx);
	fclose(fpIn);
	fclose(fpOut);
	return 1;
}

//Aes算法ecb模式解密文件
/**********************************************************************
函数名称:AesDecryptFile
函数功能:解密文件
处理过程:
1.根据选择的密码算法以及口令,生成key和iv。
2.把文件头写入密文文件
3.循环读取原文文件数据加密后保存到密文文件路径中。
参数说明:
szSrc:[IN] char *,待解密的密文文件路径
szTarget:[IN] char *,解密后的解密文件保存路径
key:[IN] unsigned char *, 口令
iType:[IN] int, 加密类型(128或256)
返回值:成功返回1,否则返回0
************************************************************************/
int AesDecryptFile(IN char * szSrc,
	IN char * szTarget,
	IN unsigned char * key,
	IN int iType)
{
	unsigned char ukey[EVP_MAX_KEY_LENGTH];
	unsigned char iv[EVP_MAX_IV_LENGTH];
	unsigned char in[N];
	int inl;   //输入数据大小
	unsigned char out[N];
	int outl;   //输出数据大小

	int isSuccess;

	FILE *fpIn;
	FILE *fpOut;

	EVP_CIPHER_CTX ctx;   //evp加密上下文环境
	const EVP_CIPHER *cipher;

	fpIn = fopen(szSrc, "rb");
	if (fpIn == NULL)
	{
		printf("fopen szSrc failed");
		return 0;
	}
	fpOut = fopen(szTarget, "w+");
	if (fpOut == NULL)
	{
		printf("fopen szTarget failed");
		fclose(fpIn);
		return 0;
	}

	//选择算法
	if (iType == 128)
	{
		cipher = EVP_aes_128_ecb();
	}
	else if (iType == 256)
	{
		cipher = EVP_aes_256_ecb();
	}
	else
	{
		printf("iType should be 128 or 256.");
		fclose(fpIn);
		fclose(fpOut);
		return 0;
	}
	//生成ukey和iv
	int len = sizeof(key);
	EVP_BytesToKey(cipher, EVP_md5(), NULL, (const unsigned char *)key, len - 1, 1, ukey, iv);

	//初始化ctx,加密算法初始化
	EVP_CIPHER_CTX_init(&ctx);
	isSuccess = EVP_DecryptInit_ex(&ctx, cipher, NULL, ukey, iv);
	if (!isSuccess)
	{
		printf("EVP_DecryptInit_ex() failed");
		EVP_CIPHER_CTX_cleanup(&ctx);
		fclose(fpIn);
		fclose(fpOut);
		return 0;
	}

	//加密文件
	for (;;)
	{
		inl = fread(in, 1, N, fpIn);
		if (inl <= 0)
			break;

		isSuccess = EVP_DecryptUpdate(&ctx, out, &outl, in, inl);
		if (!isSuccess)
		{
			printf("EVP_EncryptInit_ex() failed");
			EVP_CIPHER_CTX_cleanup(&ctx);
			fclose(fpIn);
			fclose(fpOut);
			return 0;
		}
		fwrite(out, 1, outl, fpOut);
	}
	isSuccess = EVP_DecryptFinal_ex(&ctx, out, &outl);
	if (!isSuccess)
	{
		printf("EVP_DecryptInit_ex() failed");
		EVP_CIPHER_CTX_cleanup(&ctx);
		fclose(fpIn);
		fclose(fpOut);
		return 0;
	}

	fwrite(out, 1, outl, fpOut);
	printf("解密成功\n");
	EVP_CIPHER_CTX_cleanup(&ctx);
	fclose(fpIn);
	fclose(fpOut);
	return 1;
}

int main()
{
#if _DEBUG
	char *Src = "../debug/test.txt";
	char *TargetEnc = "../debug/test.txt.enc";
	char *TargetDec = "../debug/test.txt.dec";
#else
	//// 如果调试也需要指定正确的目录
	//char *Src = "../Release/test.txt";
	//char *TargetEnc = "../Release/test.txt.enc";
	//char *TargetDec = "../Release/test.txt.dec";
	char *Src = "test.txt";
	char *TargetEnc = "test.txt.enc";
	char *TargetDec = "test.txt.dec";
#endif
	unsigned char key[32] = "abcdefg";
	int rv = AesEncryptFile(Src, TargetEnc, key, 128);
	if (rv != 1)
	{
		printf("AesEncryptFile() failed");
		return 1;
	}
	rv = AesDecryptFile(TargetEnc, TargetDec, key, 128);
	if (rv != 1)
	{
		printf("AesDecryptFile() failed");
		return 1;
	}
	return 0;
}

8.5 Build 项目,生成debug/OpenSSLTest.exe文件
这里写图片描述

8.6 把D:\install\openssl-1.0.2j\vs2015\dll\win32\release\bin目录下的libeay32.dll和ssleay32.dll拷贝到与 debug/OpenSSLTest.exe 相同的目录下。在debug/OpenSSLTest.exe 目录下,生成一个文本文件,text.txt,随便写些内容后,F5,运行调试OpenSSLTest.exe,生成test.txt的加密文件test.txt.enc和test.txt.enc的解密文件test.txt.dec。

这里写图片描述

##09 关于运行时库的选中
openssl基本都会作为第三方库引入工程。而且往往会作为次级库引入,第三方库在编译使用的运行时库一般会是动态运行时,也有选择静态运行时库的。openssl的编译也面临同样问题。默认使用动态运行时库。通过修改配置项,可以选择静态运行时库。
###09.01 运行时库默认选项

nmake -f ms/ntdll.mak

该命令生成动态库,默认使用的是MD

nmake -f ms/nt.mak

该命令生成静态库,默认使用的是MT
###09.02 更改运行时库方法
想生成使用静态链接运行时库的动态库则采用下面方法
复制一个ntdll.mak并命名为ntdll_mt.mak,修改里面的 “CFLAG= /MD /Ox …” 为**/MT** ,然后重新编译,执行 nmake -f ms/ntdll_mt.mak
想生成使用动态链接运行时库的静态库则采用下面方法
复制一个nt.mak并命名为nt_md.mak,修改里面的 “CFLAG= /MT /Ox …” 为**/MD** ,然后重新编译 ,执行 nmake -f ms/nt_md.mak

##10 使用vs2017编译openssl

rem 编译x86位参考INSTALL.W32说明文件
rem 如果你要编译不同的visualStudio版本,每个vs版本要单独开一个cmd窗口来操作,以免受到上一个vs版本环境变量的影响。
rem 使用vs2017 x86编译环境,运行下面这句话,就启用了vs2017的x86环境
rem 我的vs2017 安装在d:\install\Microsoft Visual Studio\2017\Community
"d:\install\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars32.bat"

rem 一定要注意INSTALL.W32的文档说明,win32 release 版本需要指定no-asm,并且使用ms\do_nasm.bat脚本
rem 生成win32/release静态库lib
nmake -f ms\nt.mak clean
rmdir /S /Q out32
rmdir /S /Q tmp32
perl Configure VC-WIN32 no-asm --prefix=d:/install/openssl-1.0.2j/vs2017/lib/win32/release
ms\do_nasm.bat
nmake -f ms\nt.mak install
rem 运行测试程序
cd out32
..\ms\test
cd ..

rem 生成win32/release动态库dll
nmake -f ms\ntdll.mak clean
rmdir /S /Q out32dll
rmdir /S /Q tmp32dll
perl Configure VC-WIN32 no-asm --prefix=d:/install/openssl-1.0.2j/vs2017/dll/win32/release
ms\do_nasm.bat
nmake -f ms\ntdll.mak install
rem 运行测试程序
cd out32dll
..\ms\test
cd ..

rem 生成win32/debug静态库lib
nmake -f ms\nt.mak clean
rmdir /S /Q out32.dbg
rmdir /S /Q tmp32.dbg
perl Configure debug-VC-WIN32 no-asm --prefix=d:/install/openssl-1.0.2j/vs2017/lib/win32/debug
ms\do_ms.bat
nmake -f ms\nt.mak install
rem 运行测试程序
cd out32.dbg
..\ms\test
cd ..

rem 生成win32/debug动态库dll
nmake -f ms\ntdll.mak clean
rmdir /S /Q out32dll.dbg
rmdir /S /Q tmp32dll.dbg
perl Configure debug-VC-WIN32 no-asm --prefix=d:/install/openssl-1.0.2j/vs2017/dll/win32/debug
ms\do_ms.bat
nmake -f ms\ntdll.mak install
rem 运行测试程序
cd out32dll.dbg
..\ms\test
cd ..


rem 编译x64位参考INSTALL.W64说明文件
rem 如果你要编译不同的visualStudio版本,每个vs版本要单独开一个cmd窗口来操作,以免受到上一个vs版本环境变量的影响。
rem 使用vs2017 x64编译环境,如果使用其他vs版本,只需修改这个运行环境
rem 我的vs2017 安装在d:\install\Microsoft Visual Studio\2017\Community
"d:\install\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat"

rem 生成win64/release静态库lib
nmake -f ms\nt.mak clean
rmdir /S /Q out32
rmdir /S /Q tmp32
perl Configure VC-WIN64A --prefix=d:/install/openssl-1.0.2j/vs2017/lib/win64/release
ms\do_win64a.bat
nmake -f ms\nt.mak install
rem 运行测试程序
cd out32
..\ms\test
cd ..

rem 生成win64/release动态库dll
nmake -f ms\ntdll.mak clean
rmdir /S /Q out32dll
rmdir /S /Q tmp32dll
perl Configure VC-WIN64A --prefix=d:/install/openssl-1.0.2j/vs2017/dll/win64/release
ms\do_win64a.bat
nmake -f ms\ntdll.mak install
rem 运行测试程序
cd out32dll
..\ms\test
cd ..

rem 生成win64/debug静态库lib
nmake -f ms\nt.mak clean
rmdir /S /Q out32.dbg
rmdir /S /Q tmp32.dbg
perl Configure debug-VC-WIN64A --prefix=d:/install/openssl-1.0.2j/vs2017/lib/win64/debug
ms\do_win64a.bat
nmake -f ms\nt.mak install
rem 运行测试程序
cd out32.dbg
..\ms\test
cd ..

rem 生成win64/debug动态库dll
nmake -f ms\ntdll.mak clean
rmdir /S /Q out32dll.dbg
rmdir /S /Q tmp32dll.dbg
perl Configure debug-VC-WIN64A --prefix=d:/install/openssl-1.0.2j/vs2017/dll/win64/debug
ms\do_win64a.bat
nmake -f ms\ntdll.mak install
rem 运行测试程序
cd out32dll.dbg
..\ms\test
cd ..

rem vs2017 生成的4个版本90MB+
rem 通常我们只需要生成的win32/release win64/release版本。
rem 其他版本只是调试使用

09 可能遇到的问题

09.01 win10 perl_v5.28.1 vs2019 可能遇到如下问题

Can't locate Win32/Console.pm in @INC (you may need to install the Win32::Console module) (@INC contains: C:/git/openssl/util/perl C:/Perl64/site/lib C:/Perl64/lib) at C:/Perl64/lib/ActivePerl/Config.pm line 400.
Compilation failed in require at C:/Perl64/site/lib/ExtUtils/MakeMaker.pm line 9.
BEGIN failed--compilation aborted at C:/Perl64/site/lib/ExtUtils/MakeMaker.pm line 9.
Compilation failed in require at C:/Perl64/site/lib/IPC/Cmd.pm line 235.

解决方法:
把perl的C:/Perl64/lib/ActivePerl/Config.pm 文件问题处注释掉。
大约400行左右。接的把Config.pm文件的只读属性取消掉。

# Prevent calling Win32::Console::DESTROY on a STDOUT handle
my $console;
sub _warn {
    #my($msg) = @_;
    #unless (-t STDOUT) {
	#print "\n$msg\n";
	#return;
    #}
    #require Win32::Console;
    #unless ($console) {
	#$console = Win32::Console->new(Win32::Console::STD_OUTPUT_HANDLE());
    #}
    #my($col,undef) = $console->Size;
    #print "\n";
    #my $attr = $console->Attr;
    #$console->Attr($Win32::Console::FG_RED | $Win32::Console::BG_WHITE);
    #for (split(/\n/, "$msg")) {
	#$_ .= " " while length() < $col-1;
	#print "$_\n";
    #}
    #$console->Attr($attr);
    #print "\n";
}

10 编译openssl-1.1.1i

:: perl Configure VC-WIN32 [no-shared] [no-asm] [no-tests] [--debug] -D_WIN32_WINNT=0x0501 --prefix=c:/install/openssl-1.1.1/vs2019/lib/win32/release
:: perl Configure --help

:: 生成win64动态debug库,使用管理员权限启动[x64 Native Tools Command Prompt for VS 2019] "D:\install\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
:: 因为会有一些文件拷贝到 C:/Program Files/Common Files/SSL/ ,所以需要管理员权限
:: 如果在nmake是出现结束返回值非0错误,再次运行nmake即可。
mkdir build\win64dlldebug
cd build\win64dlldebug
perl ..\..\Configure VC-WIN64A shared no-asm no-tests -D_WIN32_WINNT=0x0501 --debug --prefix=d:/install/openssl-1.1.1i/vs2019/dll/win64/debug
perl configdata.pm --dump
nmake
::(编译时如果出现pdb加载问题,再次运行nmake即可)
::nmake test
nmake install
cd ..\..\

:: 生成win64动态release库
mkdir build\win64dllrelease
cd build\win64dllrelease
perl ..\..\Configure VC-WIN64A shared no-asm no-tests -D_WIN32_WINNT=0x0501 --prefix=d:/install/openssl-1.1.1i/vs2019/dll/win64/release
perl configdata.pm --dump
nmake
::nmake test
nmake install
cd ..\..\

:: 生成win64静态debug库
mkdir build\win64libdebug
cd build\win64libdebug
perl ..\..\Configure VC-WIN64A no-shared no-asm no-tests -D_WIN32_WINNT=0x0501 --debug --prefix=d:/install/openssl-1.1.1i/vs2019/lib/win64/debug
perl configdata.pm --dump
nmake
::nmake test
nmake install
cd ..\..\

:: 生成win64静态release库
mkdir build\win64librelease
cd build\win64librelease
perl ..\..\Configure VC-WIN64A no-shared no-asm no-tests -D_WIN32_WINNT=0x0501 --prefix=d:/install/openssl-1.1.1i/vs2019/lib/win64/release
perl configdata.pm --dump
nmake
::nmake test
nmake install
cd ..\..\


:: 生成win32动态debug库,使用管理员权限启动[x86 Native Tools Command Prompt for VS 2019] "D:\install\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars32.bat"
:: 因为会有一些文件拷贝到 C:/Program Files/Common Files/SSL/ ,所以需要管理员权限
:: 如果在nmake是出现结束返回值非0错误,再次运行nmake即可。
mkdir build\win32dlldebug
cd build\win32dlldebug
perl ..\..\Configure VC-WIN32 shared no-asm no-tests -D_WIN32_WINNT=0x0501 --debug --prefix=d:/install/openssl-1.1.1i/vs2019/dll/win32/debug
perl configdata.pm --dump
nmake
::(编译时如果出现pdb加载问题,再次运行nmake即可)
::nmake test
nmake install
cd ..\..\

:: 生成win32动态release库
mkdir build\win32dllrelease
cd build\win32dllrelease
perl ..\..\Configure VC-WIN32 shared no-asm no-tests -D_WIN32_WINNT=0x0501 --prefix=d:/install/openssl-1.1.1i/vs2019/dll/win32/release
perl configdata.pm --dump
nmake
::nmake test
nmake install
cd ..\..\

:: 生成win32静态debug库
mkdir build\win32libdebug
cd build\win32libdebug
perl ..\..\Configure VC-WIN32 no-shared no-asm no-tests -D_WIN32_WINNT=0x0501 --debug --prefix=d:/install/openssl-1.1.1i/vs2019/lib/win32/debug
perl configdata.pm --dump
nmake
::nmake test
nmake install
cd ..\..\

:: 生成win32静态release库
mkdir build\win32librelease
cd build\win32librelease
perl ..\..\Configure VC-WIN32 no-shared no-asm no-tests -D_WIN32_WINNT=0x0501 --prefix=d:/install/openssl-1.1.1i/vs2019/lib/win32/release
perl configdata.pm --dump
nmake
::nmake test
nmake install
cd ..\..\
Win7 下使用 VS2015 交叉编译最新 libcurl 7.51.0(包含openssl-1.0.2j,zlib-1.2.8) 本文参考了以下网友的辛勤劳动,在此我向你们表示感谢: http://blog.csdn.net/hujkay/article/details/18986153编译前的准备 下载所需工具源码:ActivePerl http://www.activestate.com/activeperl/downloads 或者StrawbarryPerl,我没有尝试,请各位自行尝试,安装路径默认即可。 zli 阅读详情

相关推荐

Win7 下用 VS2015 编译最新 openssl(1.0.2j)包含32、64位debug和release版本的dll、lib

在Win7 64Bit环境下用VS2015编译所有VC14版本的openssl(release、debug | 32位、64位 | dll、lib)共六个不同的库;附有一个完整的编译命令提示符代码。

Error:找不到对象。 1万+

vs2015 openssl-1.0.2j编译

1 openssl编译基本信息1.1 openssl版本信息openssl 官网:https://www.openssl.org/ 稳定版本LTS版本:https://www.openssl.org/source/openssl-1.0.2j.tar.gz官网上说1.0.2版本是支持到2019-12-31的长期支持版本。 官网版本说明:https://www.openssl.org/policie...

zb872676223的专栏 1771

UEFI-win10-EDK2搭建

UEFI-win10-EDK2搭建 主要参考链接UEFI 原理与编程 1 - UEFI开发环境EDK2搭建 开发工具 装2015的时候遇到很多问题,最后放弃了,我装了官方版VS 2017 ,参考https://www.cnblogs.com/yilezhu/p/10857134.html 安装Python2.7 https://www.python.org/downloads/release/python-2716/. 新建环境变量PYTHON_HOME,值为C:\Python27\ 下载IASL编译器.

LLeasen的博客 729

C++ OpenSSL库 源码编译及使用(VS2019)

源码编译 下载源码: git clone https://github.com/openssl/openssl.git 如果打不开可以试试: git clone git@gitee.com:epson/openssl.git 参考: https://blog.csdn.net/u012502355/article/details/109746722

道 3382

OpenSSL源码编译与C++项目集成实战指南

在现代软件开发中,密码学库是保障数据安全的核心组件,广泛应用于网络通信、数据加密和身份验证等场景。其原理基于成熟的加密算法和协议,通过提供标准化的API接口,为应用程序构建安全防线。从技术价值看,自主编译密码学库能实现环境隔离、版本控制和算法定制,有效解决依赖冲突和部署一致性问题。在应用场景上,无论是需要特定算法支持的金融系统、对部署环境有严格要求的嵌入式设备,还是追求极致性能的高并发服务,源码编译都提供了底层控制能力。本文聚焦OpenSSL这一广泛使用的密码学工具箱,详细解析其从源码获取、平台配置到编译安

weixin_30522095的博客 329

手动编译OpenSSL 1.1.1c:版本选型、配置参数与跨平台避坑指南

在工程实践中,基础加密库的编译与版本管理往往是项目稳定性的分水岭。OpenSSL作为广泛使用的安全通信库,其LTS版本1.1.1系列至今仍被大量嵌入式系统、旧版应用和私有协议栈依赖。理解动态库与静态库的构建差异、掌握configure参数与交叉编译环境配置,是复用和交付可靠二进制组件的基础能力。通过源码编译,可以精确控制头文件、库文件路径和运行期SONAME,避免系统级多版本冲突导致的API不兼容问题。本文以OpenSSL 1.1.1c为例,梳理从版本选型、环境准备到make install的完整流程,并针

chubaisheng8627的博客 405

openssl vs2015编译

工具: 1. 编译环境win10+vs2015专业版 2. ActivePerl工具,官网下载链接:http://www.activestate.com/activeperl/downloads 3. openssl源码,下载链接:https://www.openssl.org/source/,选择2016-May-03 13:57:13 openssl-1.0.1t.tar.gz这个版本...

fanhenghui的专栏 945

OpenSSL 1.0.2 Windows 64位

从官方下载的 openssl-1.0.2o 源码编译成功的二进制文件

[转]Win7 下用 VS2015 编译最新 openssl(1.0.2j)包含32、64位debug和release版本的dll、lib

原文: https://blog.csdn.net/YAOJINGKAO/article/details/53041165?locationNum=10&amp;fps=1        首先本文参考了以下网页,感谢!        http://www.jianshu.com/p/4522f17ce2ff和http://developer.covenanteyes.com/building...

tpriwwq的专栏 1059

openssl-1.0.2j.tar

openssl-1.0.2源码,权威的openssl,希望对你的工作学习有所帮助!!!

openssl-1.0.2j.tar.gz

openssl在Linux系统中是个非常重要,而且经常会用到的一个系统库,关于openssl有很多个版本,具体查阅官网。官网下载可参考:https://blog.csdn.net/u013992330/article/details/106933032,这里提供openssl-1.0.2j版本的源码,便于大家在官网无法下载时候可以从这里下载。

Win7 下用 VS2015 编译最新 openssl(1.0.2j)包含32、64位debug和release版本的dll、lib(转)

原文地址:https://blog.csdn.net/YAOJINGKAO/article/details/53041165?locationNum=10&amp;fps=1首先本文参考了以下网页,感谢!http://www.jianshu.com/p/4522f17ce2ff和 http://developer.covenanteyes.com/building-openssl-for-visu...

zhang43211234的博客 617

本地部署DeepSeek连接MATLAB:打造私有化AI编程助手全攻略

大型语言模型(LLM)通过理解自然语言生成代码、解释技术概念,其核心原理是基于海量数据训练的Transformer架构。这项技术为工程计算和数据分析带来了效率革命,尤其在代码生成、调试辅助和文档自动化等场景价值显著。开源模型如DeepSeek-coder凭借优秀的代码理解能力,结合Ollama提供的本地化部署方案,实现了完全离线、低延迟的私有化部署。通过配置国内镜像加速下载,并利用MATLAB内置的HTTP通信函数构造API请求,工程师可以在熟悉的MATLAB环境中直接调用本地模型,处理数据清洗、算法验证等

weixin_30239339的博客 523

windows7 编译openssl

参考链接: https://blog.csdn.net/wei242425445/article/details/81746385 https://www.cnblogs.com/suanguade/p/8520207.html https://blog.csdn.net/yuiiiii/article/details/81297880 1,编译环境 windows7 64位 2,...

weixin_30498807的博客 211

新手也能玩转!用Panosim+MATLAB/Simulink搭建你的第一个智能驾驶仿真场景(保姆级图文)

本文为新手提供了使用Panosim和MATLAB/Simulink搭建智能驾驶仿真场景的详细教程。从环境准备、基础场景创建到仿真模型构建,一步步指导用户完成第一个智能驾驶仿真项目,帮助零基础用户快速上手并体验智能驾驶仿真的乐趣。

weixin_29090089的博客 198

Odinub开源掌机:从硬件选型到软件定制,打造专属复古游戏体验

模拟器技术通过软件模拟经典游戏硬件的运行环境,其核心原理在于精确复制原硬件的CPU指令集、图形与音频处理逻辑。这项技术的价值在于以极低成本保存和重现数字文化遗产,让经典游戏跨越硬件生命周期得以延续。在工程实践中,开发者常基于Linux系统构建轻量级游戏环境,并利用RetroArch统一框架整合各类模拟器核心,实现跨平台游戏的集中管理与优化。具体到复古游戏掌机应用场景,需在性能、功耗与手感间精细平衡,例如选用RK3566等低功耗SoC,搭配Batocera等定制系统,最终自然收敛到Odinub这类开源项目——

weixin_30954817的博客 292

VC6编译OPENSSL

VC6编译方法: 1.http://www.openssl.org/source/old/0.9.x/ 下载0.9.x版本 -- VC6不能完全编译最新的1.0.x,所以尽量选择0.9.x 2.安装ActivePerl 3.cmd命令运行 VC6安装目录\VC98\Bin\VCVARS32.BAT 4.以此执行下面命令 perlConfigureVC-WIN32 ms\do_ms nm...

我的博客 1273

【verilog语法详解:从入门到精通】

Verilog语法详解:从入门到精通 摘要:本文系统讲解Verilog硬件描述语言的核心语法与应用。Verilog作为数字电路设计标准,具有并行执行、硬件映射和层次化三大特点。文章从基础语法框架入手,详细介绍了模块定义、端口类型(input/output/inout)声明规范,以及线网型(wire)和寄存器型(reg)两种核心数据类型的区别与应用场景。重点讲解了组合逻辑(assign连续赋值)和时序逻辑(always块)的实现方式,包括阻塞赋值(=)与非阻塞赋值(<=)的关键差异。此外,还涵盖了参数(

m0_58476824的博客 4702

静态编译 Qt5.7.0 (含 openssl 支持)

关于Qt静态便宜的环境等,请先参见Win10 + VS2015 下编译 Qt5.6.0。 首先编译 openssl 。我这里用的版本是 openssl 1.0.2j (新的1.1版本的便宜稍有不同,详见 openssl 的文档)。openssl编译的bat脚本如下: REM Initialize env for msvc 2015 cl compiler SET PATH=C:\Wi...

weixin_33736832的博客 324

告别环境报错:Qt Creator里配置Android SDK/NDK/JDK路径的完整避坑指南

本文详细解析了在Qt Creator中配置Android SDK/NDK/JDK路径的完整避坑指南,深入探讨了路径检测的内部机制、构建套件配置的隐藏逻辑以及项目级与全局配置的优先级。通过实际案例和高级排查技巧,帮助开发者解决常见的环境报错问题,提升Qt安卓开发效率。

weixin_42548829的博客 242

MIPI C-PHY介绍(Specification for C-PHY V1.2)

本文档描述了一个名为C-PHY的高速串行接口,它在带宽有限(bandwidth limited channels,看的有人说C的含义就是channel limit)的通道上提供高吞吐量性能,用于连接到外设,包括显示器和摄像头。首先0x4fff在0x4000~0x4fff区域,则f=(0,0,0,0,0,0,1),顺序是S6~S1;最后,端到端的传输过程是什么样呢,如下图所示,16bit先转换成7个符号(每个符号3位,共21位),然后并行数据转换成串行数据,输送到符号编码器和3个线的驱动器,接收端流程相反。

qflook的博客 5913

Openssl VS编译方法

工具: 1. 编译环境win10+vs2015专业版 2. ActivePerl工具,官网下载链接:http://www.activestate.com/activeperl/downloads 3. openssl源码,下载链接:https://www.openssl.org/source/,选择2016-May-03 13:57:13 openssl-1.0.1t.tar.gz这个版...

weixin_30542079的博客 329

【零基础入门unity游戏开发——2D篇】SpriteEditor图片编辑器

【零基础入门unity游戏开发——2D篇】SpriteEditor图片编辑器

向宇的博客,专注php/web全栈 unity游戏开发,欢迎大家评论纠错 2339

win7下使用vs2015编译librdkafka kafkac++封装库

本文参考以下文章: openssl编译安装参考 http://blog.csdn.net/YAOJINGKAO/article/details/53041165?locationNum=10&fps=1 kafka安装版测试参考 http://blog.csdn.net/u010283894/article/details/77106159 以下为开发编译librdkafka 64位

ke20100808的专栏 6746

全网最全RT-DETR涨点改进,基于官方源码1:1还原,在Ultralytics项目中配置rtdetr-r18、rtdetr-r34、rtdetr-r50、rtdetr-r101版本~小论文大论文必备

本文详细介绍了如何将RT-DETR的ResNet18/34/50/101/154版本移植到ultralytics项目中。主要内容包括:1) RT-DETR核心特点,如高效混合编码器、IoU感知查询选择等;2) 提供完整ResNet核心代码;3) 分步配置指南,包括创建模块文件和修改tasks.py;4) 各版本yaml配置文件的创建方法。该方案可帮助研究者快速实现RT-DETR改进,适用于目标检测相关论文研究。所有配置文件均可正常运行,为实验部署提供了便利。

Ai缝合怪、助力小伙伴高效发论文 3991

廖雪峰Python教程[完整版]

廖雪峰的python教程整理的,已经排好版了,而且还是完整的,适合小白

上一篇: 用inno setup制作管理员权限启动的安装包
下一篇: win10 zlib编译
longji
博客等级 码龄26年 1837粉丝 552原创
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值