ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

OpenSSL 3.0.x build

2022-04-11 18:31:05  阅读:286  来源: 互联网

标签:1.1 openssl perl build 3.0 OpenSSL dll


How to build


参考 OpenSSL文件中
  - INSTALL.md
  - NOTES-WINDOWS.md
  - NOTES-UNIX.md
  - NOTES-ANDROID.md



1. 下载
  - strawberry-perl-5.32.1.1-64bit.msi
  - nasm

2. set env 设置环境变量
  - perl  (MSI auto set env)
  - nasm  (should set env by self)
  - openSSL  


3. build

  a.打开x64命令行工具
  b.运行configure
    perl Configure VC-WIN64A  (Release版本)
    perl Configure debug-VC-WIN64A (Debug版本)
    perl Configure VC-WIN32   (Release版本)
    perl Configure debug-VC-WIN32   (Debug版本)


 
  // 指定openSSL目录,指定生成位置 lib(*.lib),bin(dll),include(header),html(?)
  perl Configure VC-WIN64A --prefix=G:\Temp\ssl\openssl-openssl-3.0.2\Output
  
  
  
 nmake
 
 nmake test
 
 nmake install

 以下结果正确
 
 *** Installing runtime programs
Copying: apps//openssl.exe to G:/Temp/ssl/openssl-openssl-3.0.2/Output/bin/openssl.exe
Copying: apps//openssl.pdb to G:/Temp/ssl/openssl-openssl-3.0.2/Output/bin/openssl.pdb
Copying: tools//c_rehash.pl to G:/Temp/ssl/openssl-openssl-3.0.2/Output/bin/c_rehash.pl
Cannot create directory C:/Program Files/Common Files/SSL: Permission denied 
NMAKE : fatal error U1077: 'C:\Strawberry\perl\bin\perl.exe' : return code '0x2'
Stop.

因为访问权限,所以install 无法安装到 C:/Program Files/Common Files/SSL 中


reference

web
https://wiki.openssl.org/index.php/OpenSSL_3.0
https://www.openssl.org/docs/
https://www.openssl.org/docs/man3.0/man7/crypto.html
https://www.openssl.org/docs/man3.0/man1/openssl.html



book
https://www.feistyduck.com/library/openssl-cookbook/
doc/readme.txt


OpenSSL Documentation
=====================

README.md  This file

[fingerprints.txt](fingerprints.txt)
        PGP fingerprints of authorised release signers

standards.txt
standards.txt
        Moved to the web, <https://www.openssl.org/docs/standards.html>

[HOWTO/](HOWTO/)
        A few how-to documents; not necessarily up-to-date

[man1/](man1/)
        The openssl command-line tools; start with openssl.pod

[man3/](man3/)
        The SSL library and the crypto library

[man5/](man5/)
        File formats

[man7/](man7/)
        Overviews; start with crypto.pod and ssl.pod, for example
        Algorithm specific EVP_PKEY documentation.

Formatted versions of the manpages (apps,ssl,crypto) can be found at
        <https://www.openssl.org/docs/manpages.html>


版本区别1.x与 3.x

================

openssl 1.x.x  生成 libeay32.dll,  ssleay.dll
openssl 3.x.x  生成 libssl.dll,libcrypto.dll


So while previously in 1.0.x there were libeay32 and ssleay32, 
they are in 1.1.x named libssl and libcrypto

(在1.0.x之前的版本中,文件为libeay32.dll和ssleay32.dll,在1.1.x之后的版本中,名字是libssl.dll和libcrypto.dll)




改变说明   http://www.npcglib.org/~stathis/blog/precompiled-openssl/




The complete explanation is that 1.0.x and 1.1.x do not have the same naming conventions for the generated libraries. OpenSSL 1.1.x has moved into what they call the “unified build system” and changed themselves the names of the libraries. This was done on purpose, mainly because these libraries are not binary compatible and should not be intermixed into projects or dlls deployed to replace 1.0.x with 1.1.x, and vice versa. So while previously in 1.0.x there were libeay32 and ssleay32, they are in 1.1.x named libssl and libcrypto(在1.0.x之前的版本中,文件为libeay32.dll和ssleay32.dll,在1.1.x之后的版本中,名字是libssl.dll和libcrypto.dll). That’s what happened upstream in OpenSSL. Read here also: https://marc.info/?l=openssl-dev&m=147223063610803&w=2 and there are tons of other discussions online you can tap to.

Beyond that, I also manipulate the suffixes in my builds. Namely, I append the MD[d] and MT[d] suffixes, so that it can be clearer when someone uses a library. This may not be very important when using DLLs, but with static builds chaos ensues if you mix them. So I made my own patches to produce these suffixes to the libraries.

I think that’s a complete answer now. I have also a suggestion for you:

You can download my build scripts if you still like to change the names of the library files in a different way and look at the patch, and modify it accordingly.
You can also skip the application of the patch and then you will get exactly the filenaming conventions of OpenSSL upstream in different builds.

I hope this helps.



使用DLL

VS工程导入DLL(或静态库)确认好编译的版本,x86,x64
1. [c/c++]->[Additional Library Directories] add include header
2. [link] ->  [input] 设置lib目录,
3. [link] ->  [Additional Library Directories]  添加  libcrypto.lib libssl.lib


代码使用

参考
 - ./demos 目录  cipher/aesgcm.c   signature\EVP_Signature_demo.c 等等
 - ./test 目录   aesgcmtest.c 等等
 - ./apps/openssl.exe 相关源码(因为涉及cmd,调用各种加密算法)


Tips:

网上很多示例代码,调用后,都会说deprecated since openSSL 3.0 ,  接口API需要更换,
某些doc 可能未完成,参考上文中的 wiki  https://wiki.openssl.org/index.php/OpenSSL_3.0

标签:1.1,openssl,perl,build,3.0,OpenSSL,dll
来源: https://www.cnblogs.com/scotth/p/16131378.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有