Visual Studio 2017 and ARM64 testing

143 views
Skip to first unread message

Jeffrey Walton

unread,
Jul 31, 2017, 3:16:51 PM7/31/17
to Crypto++ Users
Hi Everyone,

I'd like to get the library tested under VS2017. I have the build tools installed, but I have not been able to get a 64-bit ARM developer prompt.

If someone could perform the following, then it would be greatly appreciated. Below is a clone of my testing branch.

    cd Desktop
    git clone https://github.com/noloader/cryptopp.git cryptopp-jw

Then, point and click:

    Start -> Programs -> VS2017 -> VS Tools
    Select the ARM64 developer command prompt

Then, from within ARM64 developer prompt:

    cd Desktop\cryptopp-jw

Finally, the paydirt:

    nmake /f cryptest.nmake

cryptest.nmake may need some tuning. It may recognize its environment as ARM64 or it may not. Just open it up and start turning knobs. Also see https://github.com/noloader/cryptopp/blob/master/cryptest.nmake .

Thanks in advance,

Jeff

Jeffrey Walton

unread,
Jul 31, 2017, 6:02:16 PM7/31/17
to Crypto++ Users
I'd like to get the library tested under VS2017. I have the build tools installed, but I have not been able to get a 64-bit ARM developer prompt.

If someone could perform the following, then it would be greatly appreciated. ...


cryptest.nmake may need some tuning. It may recognize its environment as ARM64 or it may not. Just open it up and start turning knobs. Also see https://github.com/noloader/cryptopp/blob/master/cryptest.nmake .

Forgot to mention... config.h is what activates the ARMv8 code paths. For Microsoft toolchains, its the CRYPTOPP_MSC_VERSION >= 2000:

    # if defined(__ARM_FEATURE_CRC32) || (CRYPTOPP_MSC_VERSION >= 2000) || \
        defined(__aarch32__) || defined(__aarch64__)
    #  define CRYPTOPP_ARM_CRC32_AVAILABLE 1
    # endif

For the AMRv8 gear, you are looking for the following symbols:

$ grep "_ARMV8(" *.h *.cpp
cpu.cpp:extern bool CPU_TryAES_ARMV8();
cpu.cpp:extern bool CPU_TrySHA1_ARMV8();
cpu.cpp:extern bool CPU_TrySHA2_ARMV8();
cpu.cpp:extern bool CPU_TryCRC32_ARMV8();
cpu.cpp:extern bool CPU_TryPMULL_ARMV8();
cpu.cpp:        g_hasPMULL = CPU_TryPMULL_ARMV8();
cpu.cpp:        g_hasCRC32 = CPU_TryCRC32_ARMV8();
cpu.cpp:        g_hasSHA1 = CPU_TrySHA1_ARMV8();
cpu.cpp:        g_hasSHA2 = CPU_TrySHA2_ARMV8();
crc.cpp:extern void CRC32_Update_ARMV8(const byte *s, size_t n, word32& c);
crc.cpp:extern void CRC32C_Update_ARMV8(const byte *s, size_t n, word32& c);
crc.cpp:                CRC32_Update_ARMV8(s, n, m_crc);
crc.cpp:                CRC32C_Update_ARMV8(s, n, m_crc);
crc-simd.cpp:bool CPU_TryCRC32_ARMV8()
crc-simd.cpp:void CRC32_Update_ARMV8(const byte *s, size_t n, word32& c)
crc-simd.cpp:void CRC32C_Update_ARMV8(const byte *s, size_t n, word32& c)
gcm-simd.cpp:bool CPU_TryPMULL_ARMV8()
sha.cpp:extern void SHA1_Transform_ARMV8(word32 *state, const word32 *data);
sha.cpp:extern void CRYPTOPP_FASTCALL SHA256_HashBlocks_ARMV8(word32 *state, const word32 *data, size_t length);
sha.cpp:static void SHA256_Transform_ARMV8(word32 *state, const word32 *data)
sha-simd.cpp:bool CPU_TrySHA1_ARMV8()
sha-simd.cpp:bool CPU_TrySHA2_ARMV8()
sha-simd.cpp:void SHA1_Transform_ARMV8(word32 *state, const word32 *data)
sha-simd.cpp:void CRYPTOPP_FASTCALL SHA256_HashBlocks_ARMV8(word32 *state, const word32 *data, size_t length)

You can verify a symbol is present in an object file with dumpbin. For example, below is checking for NEON in BLAKE2:

;; From a developer command prompt
c:\cryptopp-fork>dumpbin /symbols blake2.obj | find "NEON"
832 00000000 SECT21D notype ()    External    | ?HasNEON@CryptoPP@@YA_NXZ (bool
__cdecl CryptoPP::HasNEON(void))
835 00000000 UNDEF  notype ()    External     | ?BLAKE2_Compress32_NEON@CryptoPP
@@YAXPBEAAU?$BLAKE2_State@I$0A@@1@@Z (void __cdecl CryptoPP::BLAKE2_Compress32_N
EON(unsigned char const *,struct CryptoPP::BLAKE2_State<unsigned int,0> &))
836 00000000 UNDEF  notype ()    External     | ?BLAKE2_Compress64_NEON@CryptoPP
@@YAXPBEAAU?$BLAKE2_State@_K$00@1@@Z (void __cdecl CryptoPP::BLAKE2_Compress64_N
EON(unsigned char const *,struct CryptoPP::BLAKE2_State<unsigned __int64,1> &))
11AB 00000000 SECT484 notype       Static      | $pdata1$?HasNEON@CryptoPP@@YA_N
XZ
12B8 00000000 UNDEF  notype       External     | ?g_hasNEON@CryptoPP@@3_NA (bool
 CryptoPP::g_hasNEON)

Jeff

Marcel Raad

unread,
Aug 2, 2017, 4:39:45 AM8/2/17
to Jeffrey Walton, Crypto++ Users
Am 31.07.2017 9:16 nachm. schrieb "Jeffrey Walton" <nolo...@gmail.com>:
I'd like to get the library tested under VS2017. I have the build tools installed, but I have not been able to get a 64-bit ARM developer prompt.

I don't think that's possible yet unless you have early access to those tools. I have the latest VS 2017 Update 3 Preview 7.0 and the latest Windows SDK Preview 10.0.16232 with ARM64 tools. vcvarsall.bat recognizes arm64 as a valid target, but some of the other scripts it calls don't and there's no cross compiler for ARM64 shipping with Visual Studio.

Marcel

Jeffrey Walton

unread,
Aug 8, 2017, 7:00:04 AM8/8/17
to Crypto++ Users

I'd like to get the library tested under VS2017. I have the build tools installed, but I have not been able to get a 64-bit ARM developer prompt.

If anyone gets lucky and figures out how to work things... You will probably need this commit: https://github.com/noloader/cryptopp/commit/e797418fbf27

Prior to the commit, an incorrect _MSC_VER was used for VS2017. Formerly it used the value 2000; and now it uses 1910 for VS2017.

Jeff
Reply all
Reply to author
Forward
0 new messages