【问题标题】:OpenSSL Fips in C++ Wrapper Library How To? Err: fingerprint does not matchC++ 包装库中的 OpenSSL Fips 如何? Err:指纹不匹配
【发布时间】:2018-10-03 01:35:55
【问题描述】:

我正在尝试编译一个包含静态 OpenSSL Fips 库的静态包装器 dll。

我已经链接了:

C:\Work\win_x64\fipscanister.lib
C:\Work\libeayfips32.lib
C:\Work\ssleay32.lib
ws2_32.lib
crypt32.lib

我还在includes目录中包含了libs的目录。

我添加了在 openssl-fip2.0 构建期间生成的 fips_premain.c 文件。我将 SHA1_HASH_SIG 调整为等于 fips_premain.c.sha1 中的值

我正在使用 Visual Studio 2017 构建我的包装器 dll。我在我的项目中包含了包装器 dll。当我调用 FIPS_mode_set(1) 时,我收到以下错误:

17480:error:2D0A3073:FIPS routines:func(163):fips selftest failed:
.\crypto\ecdh\ech_ossl.c:125: Exception thrown:
'System.Exception' in Test.OpenSSL.dll [Test][11872][26]
ERROR [Native][-] 2018-10-03T01:13:54.971Z ERROR 
Setting fips mode: fingerprint does not match
[Native][11872][27] ERROR [Native][-] 2018-10-03T01:13:54.972Z 
ERROR Setting fips mode: fingerprint does not match Exception thrown: 'System.Exception'
in Test.OpenSSL.dll Exception thrown:
'System.NullReferenceException' in Test.OpenSSL.dll

当我运行 nmake f ms\nt.mak test 时,所有测试都成功完成

我一定是在某个地方遗漏了一步,我很好奇其他人是如何做到这一点的。

我构建了这样的库:

perl Configure VC-WIN64A --prefix=C:\Build-OpenSSL-VC-64 
ms\do_win64a 
nmake -f ms\nt.mak  
nmake -f ms\nt.mak install

我正在使用 openssl-1.0.2p 和 openssl-fips-2.0.16 两者都正确构建,这让我认为这是我构建包装器的方式。或者它可能无法处理散列,因为它被包装了?

【问题讨论】:

  • 您查看 (OpenSSL) 构建日志了吗?它是否提到fips?作为测试,如果您从项目中的 VStudio 中删除 fipscanister.lib 会发生什么?它建立吗?您似乎配置错​​误(OpenSSL)。 perl Configure VC-WIN64A --prefix=C:\Build-OpenSSL-VC-64:您还必须传递 fips ­­--with­fipsdir=%FIPS_INSTALL_DIR%(其中 %FIPS_INSTALL_DIR% 是安装 fips 的目录 (do_fips))参数。如果您构建 OpenSSL 动态,它可以重现吗?检查openssl.org/docs/fips/UserGuide-2.0.pdf。

标签: c++ c windows openssl fips


【解决方案1】:

所以我不得不将 fips_premain.c 添加到我的 Visual Studio 项目中。运行 fips_premain_dso.exe,传入我的新静态库(确保 fips_premain.c 没有更改,否则它不会生成哈希),然后将哈希值放入 fips_premain.c,然后在 Visual Studio 中重建它可以工作:D

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-01-10
    • 1970-01-01
    • 2013-02-16
    • 2017-01-29
    • 2019-05-25
    • 1970-01-01
    相关资源
    最近更新 更多