Fedora 29 rpmbuild 打包openssl 1.1.1a版本

为了研究Fedora29内置的OpenSSL-1.1.1a版本
特地在虚拟机下搭建rpm打包环境

We don't encourage you to do this task as root user, to learn how to make you own rpmbuild environment, see Thomas's Tutorial: How to create a rpmbuild directory.

RPM version 4.14.2.1

sudo dnf install \
    'dnf-command(builddep)' \
    rpm-build
sudo dnf groupinstall "C Development Tools and Libraries"

sudo dnf builddep openssl

dnf download --source openssl
# 下载回来源码包 openssl-1.1.1a-1.fc29.src.rpm
# 普通用户身份导入这个src.rpm包
rpm -ivh *.src.rpm
cd ~/rpmbuild

进入rpmbuild/SPECS目录,手动修改openssl.spec

选项-no-sm2 禁用了SM2椭圆曲线
选项-no-sm4 禁用了SM4对称加密算法

删除openssl.spec文件中的上述两个选项:

./Configure \
    --prefix=%{_prefix} --openssldir=%{_sysconfdir}/pki/tls ${sslflags} \
    --system-ciphers-file=%{_sysconfdir}/crypto-policies/back-ends/openssl.config \
    zlib enable-camellia enable-seed enable-rfc3779 enable-sctp \
    enable-cms enable-md2 enable-rc5 enable-ssl3 enable-ssl3-method \
    enable-weak-ssl-ciphers \
    no-mdc2 no-ec2m \
    shared  ${sslarch} $RPM_OPT_FLAGS '-DDEVRANDOM="\"/dev/urandom\""'

我曾尝试同时把--prefix=%{_prefix}修改成--prefix=/usr/local但发现RPM打包过程对BUILDROOT子目录内的文件位置不能随便改,手动修改prefix会引起后续步骤找不到文件

rpmbuild -ba ./SPECS/openssl.spec

rpmbuild执行(包括SM4)单元测试用例的时候会卡住,导致编译中断
不会生成rpm包
不过我们仍然可以输出编译成功的文件
进入子目录BUILDROOT/子目录里的usr/bin里的openssl和usr/lib所有的文件拷贝一份到系统目录/usr/local/bin/和/usr/local/lib里

which openssl
如果显示/usr/local/bin/openssl表示我们已经成功
$ openssl enc -ciphers
Supported ciphers:
-aes-128-cbc               -aes-128-cfb               -aes-128-cfb1             
-aes-128-cfb8              -aes-128-ctr               -aes-128-ecb              

····

-sm4                       -sm4-cbc                   -sm4-cfb                  
-sm4-ctr                   -sm4-ecb                   -sm4-ofb  
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值