我的目标是构建启用 FIPS 的 32 位 OpenSSL (openssl-1.0.2n) 共享库 (DLL)。根据 openssl.org ( https://www.openssl.org/docs/fips/UserGuide-2.0.pdf ) 规定的程序,在构建 FIPS 容器后,我做了:
- perl 配置 VC-WIN32 fips --with-fipslibdir=C:\usr\local\ssl\fips-2.0
- ms\do_nasm
- nmake f ms\ntdll.mak
最后一个 (nmake f ms\ntdll.msk) 抛出这个错误:
makefile(243) : fatal error U1001: syntax error : 非法字符 '{' in macro Stop.
指导?这很棘手,因为 OpenSSL FIPS 指令非常具体地说明不修改 MAKE 文件以保持 FIPS 兼容。有点让我筋疲力尽。
来自 x86 VS2017 命令提示符的完整列表(在管理员模式下运行):
**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.4.5
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x86'
C:\Users\jlaird\source>cd C:\OpenSSL_Source\32bit\openssl-1.0.2n
C:\OpenSSL_Source\32bit\openssl-1.0.2n>perl Configure VC-WIN32 fips --with-fipslibdir=C:\usr\local\ssl\fips-2.0
Configuring for VC-WIN32
no-ec_nistp_64_gcc_128 [default] OPENSSL_NO_EC_NISTP_64_GCC_128 (skip dir)
no-gmp [default] OPENSSL_NO_GMP (skip dir)
no-jpake [experimental] OPENSSL_NO_JPAKE (skip dir)
no-krb5 [krb5-flavor not specified] OPENSSL_NO_KRB5
no-libunbound [experimental] OPENSSL_NO_LIBUNBOUND (skip dir)
no-md2 [default] OPENSSL_NO_MD2 (skip dir)
no-rc5 [default] OPENSSL_NO_RC5 (skip dir)
no-rfc3779 [default] OPENSSL_NO_RFC3779 (skip dir)
no-rsax [forced] OPENSSL_NO_RSAX (skip dir)
no-sctp [default] OPENSSL_NO_SCTP (skip dir)
no-shared [default]
no-ssl-trace [default] OPENSSL_NO_SSL_TRACE (skip dir)
no-ssl2 [default] OPENSSL_NO_SSL2 (skip dir)
no-store [experimental] OPENSSL_NO_STORE (skip dir)
no-unit-test [default] OPENSSL_NO_UNIT_TEST (skip dir)
no-weak-ssl-ciphers [default] OPENSSL_NO_WEAK_SSL_CIPHERS (skip dir)
no-zlib [default]
no-zlib-dynamic [default]
IsMK1MF=1
CC =cl
CFLAG =-DOPENSSL_THREADS -DDSO_WIN32 -W3 -WX -Gs0 -GF -Gy -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -D_CRT_SECURE_NO_DEPRECATE -D_WINSOCK_DEPRECATED_NO_WARNINGS -DOPENSSL_BN_ASM_PART_WORDS -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -I$(FIPSDIR)/include -DRC4_ASM -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DRMD160_ASM -DAES_ASM -DVPAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM
EX_LIBS =
CPUID_OBJ =x86cpuid.o
BN_ASM =bn-586.o co-586.o x86-mont.o x86-gf2m.o
EC_ASM =
DES_ENC =des-586.o crypt586.o
AES_ENC =aes-586.o vpaes-x86.o aesni-x86.o
BF_ENC =bf-586.o
CAST_ENC =cast-586.o
RC4_ENC =rc4-586.o
RC5_ENC =rc5-586.o
MD5_OBJ_ASM =md5-586.o
SHA1_OBJ_ASM =sha1-586.o sha256-586.o sha512-586.o
RMD160_OBJ_ASM=rmd-586.o
CMLL_ENC =cmll-x86.o
MODES_OBJ =ghash-x86.o
ENGINES_OBJ =
PROCESSOR =
RANLIB =true
ARFLAGS =
PERL =perl
THIRTY_TWO_BIT mode
BN_LLONG mode
RC4_INDEX mode
RC4_CHUNK is undefined
Configured for VC-WIN32.
C:\OpenSSL_Source\32bit\openssl-1.0.2n>ms\do_nasm
C:\OpenSSL_Source\32bit\openssl-1.0.2n>perl util\mkfiles.pl 1>MINFO
C:\OpenSSL_Source\32bit\openssl-1.0.2n>perl util\mk1mf.pl nasm VC-WIN32 1>ms\nt.mak
C:\OpenSSL_Source\32bit\openssl-1.0.2n>perl util\mk1mf.pl dll nasm VC-WIN32 1>ms\ntdll.mak
C:\OpenSSL_Source\32bit\openssl-1.0.2n>perl util\mk1mf.pl nasm BC-NT 1>ms\bcb.mak
C:\OpenSSL_Source\32bit\openssl-1.0.2n>perl util\mkdef.pl 32 libeay 1>ms\libeay32.def
C:\OpenSSL_Source\32bit\openssl-1.0.2n>perl util\mkdef.pl 32 ssleay 1>ms\ssleay32.def
C:\OpenSSL_Source\32bit\openssl-1.0.2n>nmake f ms\ntdll.mak
Microsoft (R) Program Maintenance Utility Version 14.11.25547.0
Copyright (C) Microsoft Corporation. All rights reserved.
makefile(243) : fatal error U1001: syntax error : illegal character '{' in macro
Stop.
在 GitHub 上的 OpenSSL 的早期版本中似乎已经注意到了这一点,但没有发布解决方案...问题刚刚关闭,我不知道该怎么做: https://github.com/openssl/openssl/issues/4352
我在此处将 ntdll.mak 文件上传到谷歌驱动器: https://drive.google.com/file/d/1B2GIWJjdyOXR6ycCLq8OpV4Skhg2N8ob/view?usp=sharing
第 243 行(不是很有帮助,但它在这里):
$(OBJ_D)\ecb3_enc.obj $(OBJ_D)\cfb64enc.obj $(OBJ_D)\cfb64ede.obj \
最佳答案
您只是在命令中的“f”之前遗漏了一个小破折号,确切的命令应该是:
nmake -f ms\ntdll.mak
由于缺少破折号,您实际上是在顶层目录中的 Makefile 上调用 nmake,它恰好存在但与 nmake 不兼容,因此出现错误。
我发现是因为我在 Windows 上尝试构建 OpenSSL 时收到了相同的错误消息,而在我的情况下,我只是在没有任何参数的情况下调用 nmake(因为我没有先阅读 INSTALL.W32 文件...... )
关于c++ - 构建 32 位 OpenSSL FIPS (nmake f ms\ntdll.mak) : Illegal Character in macro,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47777371/