changeset 18842:969c95446ef0

common/crypto: make skein and edonr loader friendly illumos issue #8904
author Toomas Soome <tsoome@me.com>
date Wed, 01 Jun 2016 18:53:15 +0300
parents 110ba24536a1
children 2f1019fa0103
files usr/src/common/crypto/edonr/edonr.c usr/src/common/crypto/skein/skein_port.h
diffstat 2 files changed, 18 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/common/crypto/edonr/edonr.c	Sat May 19 18:50:26 2018 +0300
+++ b/usr/src/common/crypto/edonr/edonr.c	Wed Jun 01 18:53:15 2016 +0300
@@ -30,7 +30,7 @@
  */
 
 /* determine where we can get bcopy/bzero declarations */
-#ifdef	_KERNEL
+#if defined(_KERNEL) || defined(_STANDALONE)
 #include <sys/systm.h>
 #else
 #include <strings.h>
--- a/usr/src/common/crypto/skein/skein_port.h	Sat May 19 18:50:26 2018 +0300
+++ b/usr/src/common/crypto/skein/skein_port.h	Wed Jun 01 18:53:15 2016 +0300
@@ -43,7 +43,24 @@
  */
 #ifndef	SKEIN_NEED_SWAP		/* compile-time "override" for endianness? */
 
+#ifndef	_STANDALONE
 #include <sys/isa_defs.h>	/* get endianness selection */
+#else
+#include <sys/param.h>		/* get endianness selection */
+#define	_ALIGNMENT_REQUIRED	1
+/*
+ * The STANDALONE build is using endian.h logic, where we have defined
+ * macros _BIG_ENDIAN and _LITTLE_ENDIAN, and the current endian is set
+ * in _BYTE_ORDER. To keep the changes minimal, we need to #undef the
+ * other. Once we have kernel version of endian.h, we can have further
+ * clean up.
+ */
+#if (_BYTE_ORDER == _LITTLE_ENDIAN)
+#undef _BIG_ENDIAN
+#else
+#undef _LITTLE_ENDIAN
+#endif
+#endif
 
 #define	PLATFORM_MUST_ALIGN	_ALIGNMENT_REQUIRED
 #if	defined(_BIG_ENDIAN)