Hi Everyone,

I'm catching a crash with Nettle 3.5.1 on a Core-i7 8700 configured
with --enable-x86-aesni and --enable-x86-sha-ni. I verified the
compiler supports both AESNI and SHA.

    Illegal instruction (core dumped)
    FAIL: hkdf
    PASS: salsa20
    Illegal instruction (core dumped)
    FAIL: sha1
    Illegal instruction (core dumped)
    FAIL: sha224
    Illegal instruction (core dumped)
    FAIL: sha256

The machine is not configured with --enable-fat because of build
failures on other platforms. On other platforms, --enable-fat causes
SHA to be built even when the compiler does not support SHA. To avoid
the compile error I dropped --enable-fat .

So my question now is, how do I enable AES and SHA at compile time
depending on the compiler support, and enable runtime switching?

Thanks

-------

Here is the logic I was trying to use. It accommodates both Linux and Solaris.

AESNI_OPT=$("$CC" "$CFLAGS" -dM -E -maes - </dev/null 2>&1 | grep -i
-c "__AES__")
SHANI_OPT=$("$CC" "$CFLAGS" -dM -E -msha - </dev/null 2>&1 | grep -i
-c "__SHA__")

if [[ "$AESNI_OPT" -eq 1 ]]; then
    echo "Compiler supports AES-NI. Adding --enable-x86-aesni"
    CONFIG_OPTS+=("--enable-x86-aesni")
fi

if [[ "$SHANI_OPT" -eq 1 ]]; then
    echo "Compiler supports SHA-NI. Adding --enable-x86-sha-ni"
    CONFIG_OPTS+=("--enable-x86-sha-ni")
fi

# Crash on Solaris machines with --enable-fat
#if [[ "$IS_IA32" -ne 0 ]]; then
#    echo "Using runtime algorithm selection. Adding --enable-fat"
#    CONFIG_OPTS+=("--enable-fat")
#fi
_______________________________________________
nettle-bugs mailing list
[email protected]
http://lists.lysator.liu.se/mailman/listinfo/nettle-bugs

Reply via email to