【问题标题】:FIPS Capable OpenSSL and openssl/fips.h: No such file or directoryFIPS Capable OpenSSL 和 openssl/fips.h:没有这样的文件或目录
【发布时间】:2015-04-07 15:34:26
【问题描述】:

我正在分别使用 openssl-fips-ecp-2.0.9 和 openssl-1.0.1j 为 FIPS 对象模块和兼容 FIPS 的 OpenSSL 构建。

其中一个 FIPS 编译成功。但是根据User Guide 使用 ./config 添加 fips 选项会给出错误:

march=mips32 -fomit-frame-pointer -Wall -Ifips/openssl-fips-ecp-2.0.9/include -DSHA1_ASM -DSHA256_ASM -DAES_ASM   -c -o o_fips.o o_fips.c
o_fips.c:60:26: fatal error: openssl/fips.h: No such file or directory
compilation terminated.
make[6]: *** [o_fips.o] Error 1

crypto 的 Makefile 使用 o_fips.c & o_fips.c 有这样的代码:

#include "cryptlib.h"
#ifdef OPENSSL_FIPS
#include <openssl/fips.h>
#include <openssl/fips_rand.h>
#include <openssl/rand.h>
#endif

由于 1.0.1 版本之后库中没有要包含的 fips 文件夹。 有谁能帮帮我吗?

【问题讨论】:

    标签: linux openssl fips


    【解决方案1】:

    通过提供正确的 --openssldir 和 --with-fipsdir 选项解决了问题。

    【讨论】:

    • 我知道这很旧,但我遇到了同样的问题。无论我给出什么路径,例如/usr/local/ssl/Release-iphoneos,它仍然会给出这个错误。你最终使用了什么路径?
    • 请看下面的详细回答。
    • 对于以不正确格式发布的所有人表示歉意。我现在已经能够编译 - 我的问题是我试图编译最新版本的 OpenSSL (1.1.0e),这显然不起作用 - 仅限 1.0.x 版本
    【解决方案2】:

    我当前的代码有两个库 openssl-1.0.2h 和 openssl-fips-ecp-2.0.12 并行放置在名为 library 的文件夹中。这是我在 Makefile 中使用的代码:

    export HOSTCC=gcc
    export FIPSLD_CC=gcc
    export FIPSDIR=$(OPENSSLFIPS_TOP_DIR)/../fips_install
    export OPENSSLDIR=$(OPENSSL_TOP_DIR)
    export PREMAIN_DSO=openssl-1.0.2h/fips_premain_dso
    

    其中 'OPENSSL_TOP_DIR' 和 'OPENSSLFIPS_TOP_DIR' 是各自库的路径。稍后在 Makefile 中,我们必须像这样构建库:

        @cd openssl-fips-ecp-2.0.12 path; \
            ./Configure --cross-compile-prefix=$(CROSS_COMPILE) $(PLATFORM) \
                        -fPIC no-ec2m
            $(MAKE) -C $(OPENSSLFIPS_DIR)
            mkdir -p $(FIPSDIR)
            $(MAKE) -C $(OPENSSLFIPS_DIR) install
    
        @cd openssl-1.0.2h path; \
            ./Configure --cross-compile-prefix=$(CROSS_COMPILE) $(PLATFORM) \
                        fips no-ec2m
            $(MAKE) -C $(OPENSSL_DIR)
            cp -f $(OPENSSL_DIR)/libssl.so $(LIB_DIR)/libssl.so.1.0.0
            cp -f $(OPENSSL_DIR)/libcrypto.so $(LIB_DIR)/libcrypto.so.1.0.0
    

    在设置所有平台特定(交叉编译)变量后,您应该使用 ./config 而不是 ./Configure。请参考 openSSL FIPS 用户指南Section 3.4

    第一次构建将在 fips_install(FIPSDIR) 文件夹中生成 fipscanister 和其他文件。此 FIPSDIR 将由 openssl 库在提及“fips”时在内部使用

    【讨论】:

    • 感谢您的更新。我仍然遇到架构 armv7 的未定义符号问题:... ld:未找到架构 armv7 的符号 clang:错误:链接器命令失败,退出代码为 1(使用 -v 查看调用)make [2 ]: *** [link_app.] 错误 1 ​​make[1]: *** [openssl] 错误 2 make: *** [build_apps] 错误 1 ​​Admins-MacBook-Pro:openssl-1.0.2h user$ ./config -t 操作系统:armv7-whatever-iphoneos 为 iphoneos-cross 配置 /usr/bin/perl ./Configure iphoneos-cross -arch%20armv7
    猜你喜欢
    • 1970-01-01
    • 2021-03-29
    • 2012-10-13
    • 2018-10-02
    • 1970-01-01
    • 2020-04-13
    • 2017-09-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多