+#ifdef SERPENT_BIGENDIAN
+
+#define GETPUT_CP(bytenum) \
+ (((basep) + (lenbytes) - (offset) - 4)[(bytenum)])
+
+#define SERPENT_DECORATE(func) serpentbe_##func
+
+#else /* !defined(SERPENT_BIGENDIAN) */
+
+#define GETPUT_CP(bytenum) \
+ (((basep) + (offset))[3-(bytenum)])
+
+#define SERPENT_DECORATE(func) serpent_##func
+
+#endif /* !defined(SERPENT_BIGENDIAN) */
+
+#if 0
+
+#include <stdio.h>
+
+static void SERP_DEBUG(const char *str1,
+ const void *ary, int sz,
+ const char *str2)
+{
+ fprintf(stderr,"%s",str1);
+ hexdebug(stderr,ary,sz);
+ fprintf(stderr,"%s",str2);
+}
+
+#else
+
+#define SERP_DEBUG(str1,aryv,sz,str2) /*empty*/
+
+#endif
+
+
+static uint32_t serpent_get_32bit(const uint8_t *basep,
+ int lenbytes, int offset)
+{
+ return (((uint32_t)GETPUT_CP(0) << 24) |
+ ((uint32_t)GETPUT_CP(1) << 16) |
+ ((uint32_t)GETPUT_CP(2) << +8) |
+ ((uint32_t)GETPUT_CP(3)));
+}
+
+static void serpent_put_32bit(uint8_t *basep, int lenbytes, int offset, uint32_t value)