使用fips模块时的Openssl交叉编译链接问题

使用fips模块时的Openssl交叉编译链接问题,openssl,cross-compiling,fips,Openssl,Cross Compiling,Fips,我正试图将Openssl FIPS模块添加到运行Linux的现有嵌入式powerpc系统中。它大部分进展顺利,但我被一个在链接阶段发生的问题困住了。如果在配置openssl时未禁用某些密码,则会出现如下链接错误: passwd.o: In function `do_passwd': passwd.c:(.text+0x70c): undefined reference to `DES_crypt' genrsa.o: In function `genrsa_main': genrsa.c:(.t

我正试图将Openssl FIPS模块添加到运行Linux的现有嵌入式powerpc系统中。它大部分进展顺利,但我被一个在链接阶段发生的问题困住了。如果在配置openssl时未禁用某些密码,则会出现如下链接错误:

passwd.o: In function `do_passwd':
passwd.c:(.text+0x70c): undefined reference to `DES_crypt'
genrsa.o: In function `genrsa_main':
genrsa.c:(.text+0x528): undefined reference to `EVP_des_cbc'
gendsa.o: In function `gendsa_main':
gendsa.c:(.text+0x3d8): undefined reference to `EVP_des_cbc'
speed.o: In function `speed_main':
speed.c:(.text+0x1078): undefined reference to `private_DES_set_key_unchecked'
speed.c:(.text+0x108c): undefined reference to `private_DES_set_key_unchecked'
speed.c:(.text+0x10a0): undefined reference to `private_DES_set_key_unchecked'
speed.c:(.text+0x1d1c): undefined reference to `DES_ncbc_encrypt'
speed.c:(.text+0x1e80): undefined reference to `DES_ede3_cbc_encrypt'
speed.c:(.text+0x3ec4): undefined reference to `EVP_mdc2'
speed.c:(.text+0x401c): undefined reference to `DES_options'
在这种情况下,除非在配置选项中指定“no des”,否则会出现这些错误,但同样的问题也适用于其他密码,例如cast、seed和rc2(以及其他密码)

现有的一些代码库引用了其中一些密码函数(特别是DES),因此完全删除它们并不理想。我的理解是,如果启用了FIPS模式,那么库将在运行时阻止这些非FIPS密码的使用(我认为是生成错误),而不是在编译时禁用所有非FIPS密码

下面是我如何配置openssl FIP和openssl的:

openssl fips:

MACHINE=ppc \
RELEASE=2.6.11 \
SYSTEM=linux2 \
ARCH=ppc \
CROSS_COMPILE="powerpc-405-linux-gnu-" \
HOSTCC=gcc \
./config
openssl:

CC="gcc [snipped]" \
FIPSDIR=$(ROOTPREFIX)$(PREFIX)/usr/local/ssl/fips-2.0 \
./Configure \
linux-ppc \
no-idea \
no-rc5 \
no-mcs2 \
no-hw \
no-krb5 \
no-seed \
no-rc2 \
no-bf \
no-cast \
--prefix=/usr \
threads \
shared \
fips \
--cross-compile-prefix=powerpc-405-linux-gnu-; \

通过将FIPS模块的配置命令更改为“/Configure linux ppc-Wa,--noexecstack”,我可以实现这一点。这意味着我的构建未经FIPS批准,但我想这不是我的目的所必需的。然而,似乎必须有一种方法来使用FIPS模块,而不必编译出所有非FIPS密码。