aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArvind Sankar <[email protected]>2020-06-16 18:56:47 -0400
committerBrian Behlendorf <[email protected]>2020-06-18 12:21:38 -0700
commiteebba5d8f486fd069e9fccd9e653894a7d635cdd (patch)
tree69f2d6c2fa950784cbc6fec2724f4967aa376b90
parent0ce2de637bf73e2c7e483e644aa09797439734ef (diff)
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 <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Arvind Sankar <[email protected]> Closes #10470
-rw-r--r--module/icp/algs/skein/skein.c2
-rw-r--r--module/icp/algs/skein/skein_port.h15
2 files changed, 2 insertions, 15 deletions
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 <sys/sysmacros.h>
#include <sys/types.h>
#include <sys/skein.h> /* 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 <sys/isa_defs.h> /* 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_ */