什么是gmssl?
gmssl 作为openssl中其中一个分支,其中主要是支持SM2/SM3/SM4/SM9/ZUC/SSL国密算法功能。
参考官网:
http://gmssl.org/docs/quickstart.html
x86平台安装
解压文件
$ unzip GmSSL-master.zip
编译安装
$ ./config no-saf no-sdf no-skf no-sof no-zuc
$ make
$ sudo make install
arm平台交叉编译使用
1、配置,其中/opt/openssl为安装目录,arm-linux- 对应的arm交叉编译工具
./Configure --prefix=/opt/openssl --cross-compile-prefix=arm-linux- shared
2、编译安装
make
make install
3、将生成的.so库文件,及其bin文件放到对应arm平台。
测试使用
计算sm3的哈希值
## echo 'hello' | gmssl sm3
安装使用遇到的问题
1、使用的时候出现:gmssl: relocation error: gmssl: symbol PBEPARAM_it, version OPENSSL_1_1_0d not defined in file libcrypto.so.1.1 with link time reference
如果是在x86平台,进行如下操作:
(1)、修改/etc/ld.so.conf
文件。
(2)、在后面增加:/usr/local/lib
(3)、然后执行:ldconfig
如果是在arm平台,稍微复杂一点,每个平台不太一样,主要检查对应的库是否放在平台上面,能被调用执行起来。。