summaryrefslogtreecommitdiff
path: root/umac.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2007-06-11 14:15:42 +1000
committerDamien Miller <djm@mindrot.org>2007-06-11 14:15:42 +1000
commit34a176995fe658e221b3a14730b695dd9f6943e5 (patch)
treee340f065770686f09a355f72328341f76d06c189 /umac.c
parent22b7b4933108dd07c9000bffcde8c13dbdcd240f (diff)
downloadopenssh-git-34a176995fe658e221b3a14730b695dd9f6943e5.tar.gz
- (djm) [configure.ac umac.c] If platform doesn't provide swap32(3), then
fallback to provided bit-swizzing functions
Diffstat (limited to 'umac.c')
-rw-r--r--umac.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/umac.c b/umac.c
index 676705c9..29c202a2 100644
--- a/umac.c
+++ b/umac.c
@@ -122,7 +122,11 @@ typedef unsigned int UWORD; /* Register */
/* --- Endian Conversion --- Forcing assembly on some platforms */
/* ---------------------------------------------------------------------- */
-#if 0
+#if HAVE_SWAP32
+#define LOAD_UINT32_REVERSED(p) (swap32(*(UINT32 *)(p)))
+#define STORE_UINT32_REVERSED(p,v) (*(UINT32 *)(p) = swap32(v))
+#else /* HAVE_SWAP32 */
+
static UINT32 LOAD_UINT32_REVERSED(void *ptr)
{
UINT32 temp = *(UINT32 *)ptr;
@@ -137,15 +141,12 @@ static void STORE_UINT32_REVERSED(void *ptr, UINT32 x)
*(UINT32 *)ptr = (i >> 24) | ((i & 0x00FF0000) >> 8 )
| ((i & 0x0000FF00) << 8 ) | (i << 24);
}
-#endif
+#endif /* HAVE_SWAP32 */
/* The following definitions use the above reversal-primitives to do the right
* thing on endian specific load and stores.
*/
-#define LOAD_UINT32_REVERSED(p) (swap32(*(UINT32 *)(p)))
-#define STORE_UINT32_REVERSED(p,v) (*(UINT32 *)(p) = swap32(v))
-
#if (__LITTLE_ENDIAN__)
#define LOAD_UINT32_LITTLE(ptr) (*(UINT32 *)(ptr))
#define STORE_UINT32_BIG(ptr,x) STORE_UINT32_REVERSED(ptr,x)
@@ -154,8 +155,6 @@ static void STORE_UINT32_REVERSED(void *ptr, UINT32 x)
#define STORE_UINT32_BIG(ptr,x) (*(UINT32 *)(ptr) = (UINT32)(x))
#endif
-
-
/* ---------------------------------------------------------------------- */
/* ---------------------------------------------------------------------- */
/* ----- Begin KDF & PDF Section ---------------------------------------- */