Need to compile cryptopp on windows MSVC without the .asm files

17 views
Skip to first unread message

Samir Muradov

unread,
Dec 18, 2017, 5:54:08 AM12/18/17
to Crypto++ Users
Hi, I need to include the .cpp and .h files and get them to compile inside my project.
I tried defining CRYPTOPP_DISABLE_ASM but it still tries to call MASM_RSA_GenerateBlock. Here is the error:

Error    LNK2019    unresolved external symbol MASM_RSA_GenerateBlock referenced in function "public: virtual void __cdecl CryptoPP::RDSEED::GenerateBlock(unsigned char *,unsigned __int64)" (?GenerateBlock@RDSEED@CryptoPP@@UEAAXPEAE_K@Z)    CryptoppProjucerConsole_ConsoleApp    file:dir\rdrand.obj    1  

Inside rdrand.cpp I noticed that it defines MASM_RDRAND_ASM_AVAILABLE at line 58-60 without checking if CRYPTOPP_DISABLE_ASM is defined.
As a workaround for now I changed line 59-60 from
#    define MASM_RDRAND_ASM_AVAILABLE 1
#    define MASM_RDSEED_ASM_AVAILABLE 1
to
#  define ALL_RDRAND_INTRIN_AVAILABLE 1
#  define ALL_RDSEED_INTRIN_AVAILABLE 1

It is my understanding that the ASM version for rdrand is considered experimental and was only added recently. Are there any plans to support CRYPTOPP_DISABLE_ASM as originally intended?

(version 5.6.5)



Jeffrey Walton

unread,
Dec 18, 2017, 8:30:22 AM12/18/17
to Crypto++ Users
Things have changed a bit in Master, but its mostly the same as 5.6.5.

In Master... Microsoft platforms prefer the intrinsics and Unix/Linux prefer assembly. If intrinsics are not available then MS platforms fallback to ASM. Also see https://github.com/weidai11/cryptopp/blob/master/rdrand.cpp .

Unix and Linux prefer ASM because of a GCC bug in the intrinsics. We really need to avoid intrinsics when using GCC. Also see CVE-2017-11671.

So I am clear... You prefer nothing if intrinsics are not available. Is that correct?

Jeff

Samir Muradov

unread,
Dec 18, 2017, 9:02:03 AM12/18/17
to Crypto++ Users
Do I have any other options if intrinsics are not available? My only limitation is that I can't use the .asm files.

Jeffrey Walton

unread,
Dec 18, 2017, 11:43:14 AM12/18/17
to Crypto++ Users


On Monday, December 18, 2017 at 9:02:03 AM UTC-5, Samir Muradov wrote:
Do I have any other options if intrinsics are not available? My only limitation is that I can't use the .asm files. 

No, there are no other options.

Jeff
Reply all
Reply to author
Forward
0 new messages