From eebba5d8f486fd069e9fccd9e653894a7d635cdd Mon Sep 17 00:00:00 2001 From: Arvind Sankar Date: Tue, 16 Jun 2020 18:56:47 -0400 Subject: Make Skein_{Get,Put}64_LSB_First inline functions Turn the generic versions into inline functions and avoid SKEIN_PORT_CODE trickery. Also drop the PLATFORM_MUST_ALIGN check for using the fast bcopy variants. bcopy doesn't assume alignment, and the userspace version is currently different because the _ALIGNMENT_REQUIRED macro is only defined by the kernelspace headers. Reviewed-by: Ryan Moeller Reviewed-by: Brian Behlendorf Signed-off-by: Arvind Sankar Closes #10470 --- module/icp/algs/skein/skein.c | 2 -- module/icp/algs/skein/skein_port.h | 15 ++------------- 2 files changed, 2 insertions(+), 15 deletions(-) (limited to 'module/icp/algs') diff --git a/module/icp/algs/skein/skein.c b/module/icp/algs/skein/skein.c index 39a0bff35..83fe84260 100644 --- a/module/icp/algs/skein/skein.c +++ b/module/icp/algs/skein/skein.c @@ -5,8 +5,6 @@ */ /* Copyright 2013 Doug Whiting. This code is released to the public domain. */ -#define SKEIN_PORT_CODE /* instantiate any code in skein_port.h */ - #include #include #include /* get the Skein API definitions */ diff --git a/module/icp/algs/skein/skein_port.h b/module/icp/algs/skein/skein_port.h index 4fe268bb5..417ed7c4b 100644 --- a/module/icp/algs/skein/skein_port.h +++ b/module/icp/algs/skein/skein_port.h @@ -44,19 +44,16 @@ #include /* get endianness selection */ -#define PLATFORM_MUST_ALIGN _ALIGNMENT_REQUIRED #if defined(_BIG_ENDIAN) /* here for big-endian CPUs */ #define SKEIN_NEED_SWAP (1) #else /* here for x86 and x86-64 CPUs (and other detected little-endian CPUs) */ #define SKEIN_NEED_SWAP (0) -#if PLATFORM_MUST_ALIGN == 0 /* ok to use "fast" versions? */ #define Skein_Put64_LSB_First(dst08, src64, bCnt) bcopy(src64, dst08, bCnt) #define Skein_Get64_LSB_First(dst64, src08, wCnt) \ bcopy(src08, dst64, 8 * (wCnt)) #endif -#endif #endif /* ifndef SKEIN_NEED_SWAP */ @@ -80,9 +77,8 @@ #endif /* ifndef Skein_Swap64 */ #ifndef Skein_Put64_LSB_First -void +static inline void Skein_Put64_LSB_First(uint8_t *dst, const uint64_t *src, size_t bCnt) -#ifdef SKEIN_PORT_CODE /* instantiate the function code here? */ { /* * this version is fully portable (big-endian or little-endian), @@ -93,15 +89,11 @@ Skein_Put64_LSB_First(uint8_t *dst, const uint64_t *src, size_t bCnt) for (n = 0; n < bCnt; n++) dst[n] = (uint8_t)(src[n >> 3] >> (8 * (n & 7))); } -#else -; /* output only the function prototype */ -#endif #endif /* ifndef Skein_Put64_LSB_First */ #ifndef Skein_Get64_LSB_First -void +static inline void Skein_Get64_LSB_First(uint64_t *dst, const uint8_t *src, size_t wCnt) -#ifdef SKEIN_PORT_CODE /* instantiate the function code here? */ { /* * this version is fully portable (big-endian or little-endian), @@ -119,9 +111,6 @@ Skein_Get64_LSB_First(uint64_t *dst, const uint8_t *src, size_t wCnt) (((uint64_t)src[n + 6]) << 48) + (((uint64_t)src[n + 7]) << 56); } -#else -; /* output only the function prototype */ -#endif #endif /* ifndef Skein_Get64_LSB_First */ #endif /* _SKEIN_PORT_H_ */ -- cgit v1.2.3