当前位置: 首页 > news >正文

windows 平台编译openssl

文章目录

  • 准备环境
    • 安装perl
    • 安装NASM
    • 获取源码
  • 源码编译
    • 配置
    • 编译

准备环境

安装perl

下载Perl 5.40.0.1 Portable zip
strawberryperl

解压后设置系统环境变量
测试安装是否成功

perl --version

This is perl 5, version 40, subversion 0 (v5.40.0) built for MSWin32-x64-multi-thread

Copyright 1987-2024, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl".  If you have access to the
Internet, point your browser at https://www.perl.org/, the Perl Home Page.

安装NASM

nasm官网
nasm-2.16.03-win64

下载解压后要加入系统环境变量中

获取源码

openssl官网
openssl源码3.4.1

源码编译

配置

打开VS2019 开发人员命令提示符​

  • x64 Native Tools Command Prompt for VS 2019
  • x86 Native Tools Command Prompt for VS 2019

正确安装了VisualStudio2019的话可以在win菜单中打到,可以在win任务栏的搜索中搜到

进入openssl 源码目录

E:
cd E:\openssl\openssl-3.4.1

# 64位动态库(默认)
perl Configure VC-WIN64A --prefix=D:\openssl-output
# 32位静态库(无汇编优化)
perl Configure VC-WIN32 no-asm --prefix=D:\openssl-output[2,7](@ref)

​关键参数说明:

  • –prefix:指定输出目录(默认安装到系统路径)。
  • no-asm:禁用汇编优化(避免 NASM 依赖问题)。
  • no-shared:生成静态库(.lib 而非 .dll)。

使用64位编译,输出

perl Configure VC-WIN64A --prefix=D:\openssl-output
Configuring OpenSSL version 3.4.1 for target VC-WIN64A
Using os-specific seed configuration
Created configdata.pm
Running configdata.pm
Created makefile.in
Created makefile
Created include\openssl\configuration.h

**********************************************************************
***                                                                ***
***   OpenSSL has been successfully configured                     ***
***                                                                ***
***   If you encounter a problem while building, please open an    ***
***   issue on GitHub <https://github.com/openssl/openssl/issues>  ***
***   and include the output from the following command:           ***
***                                                                ***
***       perl configdata.pm --dump                                ***
***                                                                ***
***   (If you are new to OpenSSL, you might want to consult the    ***
***   'Troubleshooting' section in the INSTALL.md file first)      ***
***                                                                ***
**********************************************************************

编译

然后可以nmake

nmake      # 仅编译
nmake test # 运行测试(可选,确保功能正常)
nmake install  # 安装到 --prefix 指定目录[3,8](@ref)

相关文章:

  • Web开发-JS应用原生代码前端数据加密CryptoJS库jsencrypt库代码混淆
  • unityAB包(1/2)
  • Arduino示例代码讲解:Multiple tone player 多音播放器
  • 【优选算法】二分算法模板总结及应用
  • 图解AUTOSAR_CP_SOMEIP_Transformer
  • Datawhale大语言模型-Transformer以及模型详细配置
  • BFS--------N叉树的层序遍历
  • WPF的主题切换
  • 基于视觉的核桃分级与套膜装置研究(大纲)
  • 深度学习 Deep Learning 第5章 机器学习基础
  • 使用自定义指令实现css样式层叠
  • DeDeCMS漏洞
  • Matrix-Breakout-2-Morpheus靶场通关心得:技巧与经验分享
  • 机器学习-手搓KNN算法
  • 小程序API —— 54 路由与通信 - 编程式导航
  • Mistral AI发布开源多模态模型Mistral Small 3.1:240亿参数实现超越GPT-4o Mini的性能
  • Handler消息机制源码分析
  • 从模拟到现实:Sensodrive高精度力反馈技术赋能物流运输的高效与安全
  • 基于Wasm的边缘计算Pandas:突破端侧AI的最后一公里——让数据分析在手机、IoT设备上飞驰
  • 若依 Excel导入与导出 配置下拉选项
  • 美国失去最后一个AAA评级,资产价格怎么走?美股或将触及天花板
  • 蒲慕明院士:未来数十年不是AI取代人,而是会用AI的人取代不会用的
  • 病愈出院、跳大神消灾也办酒,新华每日电讯:农村滥办酒席何时休
  • 腾讯一季度净利增14%:AI直接拉动广告收入增长,王者荣耀流水创新高
  • 中国—美国经贸合作对接交流会在华盛顿成功举行
  • 商人运作亿元“茅台酒庞氏骗局”,俩客户自认受害人不服“从犯”判决提申诉