Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -782,9 +782,11 @@ if test "$OPT_SHANI" = "auto"; then
"-msse4 -msha";
then
HAS_X86_SSE4_SHANI=yes
# Add all SHANI options to the LIBRHASH_OPTFLAGS, so it can be overriden by
# distro-specific OPTFLAGS, but only all together
LIBRHASH_OPTFLAGS=$(join_params $LIBRHASH_OPTFLAGS -DRHASH_SSE4_SHANI -msse4 -msha)
# Enable runtime dispatch globally, but compile only the SHA-NI
# implementation with ISA-specific flags. Other objects must remain
# runnable on CPUs without SSE4.1 and SHA-NI.
LIBRHASH_OPTFLAGS=$(join_params $LIBRHASH_OPTFLAGS -DRHASH_SSE4_SHANI)
LIBRHASH_SHANI_CFLAGS=$(join_params $LIBRHASH_SHANI_CFLAGS -msse4 -msha)
fi
fi
finish_check "$HAS_X86_SSE4_SHANI"
Expand Down Expand Up @@ -1013,6 +1015,7 @@ EXTRA_INSTALL_LIBSHARED = $EXTRA_INSTALL_LIBSHARED
EXTRA_UNINSTALL_LIBSHARED = $EXTRA_UNINSTALL_LIBSHARED

OPTFLAGS = $LIBRHASH_OPTFLAGS
SHANI_CFLAGS = $LIBRHASH_SHANI_CFLAGS
OPTLDFLAGS = $WIN_LDFLAGS
WARN_CFLAGS = $WARN_CFLAGS
ADDCFLAGS = $BUILD_EXTRA_CFLAGS
Expand Down Expand Up @@ -1060,4 +1063,4 @@ if test -f "${MAN_PATH}.in"; then
SED_SYSCONFDIR=$(echo $INSTALL_SYSCONFDIR | sed -e 's/\([|\\&]\)/\\\1/g')
echo "Writing ${MAN_PATH}"
sed -e "s|@SYSCONFDIR@|$SED_SYSCONFDIR|" ${MAN_PATH}.in > ${MAN_PATH}
fi
fi
2 changes: 1 addition & 1 deletion librhash/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ sha1.o: sha1.c byte_order.h ustd.h sha1.h
$(CC) -c $(CFLAGS) $< -o $@

sha_ni.o: sha_ni.c sha_ni.h sha1.h ustd.h sha256.h byte_order.h
$(CC) -c $(CFLAGS) $< -o $@
$(CC) -c $(CFLAGS) $(SHANI_CFLAGS) $< -o $@

sha256.o: sha256.c byte_order.h ustd.h sha256.h
$(CC) -c $(CFLAGS) $< -o $@
Expand Down
2 changes: 1 addition & 1 deletion librhash/algorithms.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ rhash_hash_info rhash_hash_info_default[] =
{ &info_blake3, sizeof(blake3_ctx), dgshft2(blake3, root.hash), iuf(rhash_blake3), 0 } /* 256 bit */
};

#if defined(RHASH_SSE4_SHANI) && !defined(RHASH_DISABLE_SHANI)
#if defined(RHASH_SSE4_SHANI)
static void table_init_sha_ext(void)
{
/* SHA-NI Implementation uses SHANI, SSE2, SSSE3, SSE4.1 instructions.
Expand Down
2 changes: 1 addition & 1 deletion librhash/sha_ni.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# endif
#endif

#if defined(RHASH_SSE4_SHANI) && !defined(RHASH_DISABLE_SHANI)
#if defined(RHASH_SSE4_SHANI)
#include "sha1.h"
#include "sha256.h"

Expand Down