GmSSL源码在Windows 10上的编译与安装

1.下载源码:

GmSSL下载地址:

https://github.com/guanzhi/GmSSL/

2.下载安装perl和nasm:

Perl下载地址:Perl Download - www.perl.org ,

nasm下载地址: 。

nasm设置运行文件路径到环境变量。

3. 安装最新版Visual Studio:

Visual Stuido下载地址:Visual Studio 2022 IDE - 适用于软件开发人员的编程工具

4. 生成makefile:

运行

perl Configure VC-WIN64A 

或者带--prefix= 参数指定gmssl安装目录, --openssldir=指定openssl路径。

5. 编译:

运行nmake

6. 安装:

运行nmake install

7. 遇到的问题:

(1)perl出现的一个问题

修改D:\Perl64\site\lib\ActivePerlConfig.pm文件,注释掉相应函数体内的实现代码:

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";
}
(2)无法解析的外部符号 EVP_get_ciphernames、EVP_get_digestnames

解决方法:GmSSL-master\crypto\evp\names2.c文件末尾添加下面的代码:

static void cipher_name_len(const EVP_CIPHER *cipher, const char *from,
	const char *to, void *x)
{
	*((int *)x) += strlen(EVP_CIPHER_name(cipher));
}

static void cipher_name(const EVP_CIPHER *cipher, const char *from,
	const char *to, void *x)
{
	strcat((char *)x, EVP_CIPHER_name(cipher));
}

char *EVP_get_ciphernames(int aliases)
{
	char *ret = NULL;
	int len = 0;
	EVP_CIPHER_do_all_sorted(cipher_name_len, &len);

	ret = OPENSSL_zalloc(len);
	if (!ret) {
		return NULL;
	}

	EVP_CIPHER_do_all_sorted(cipher_name, ret);
	return ret;
}

char *EVP_get_digestnames(int aliases)
{
	return "sm3:sha1:sha256";
}

参考:

GmSSL win10编译安装_gmssljni.dll-CSDN博客

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

109702008

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值