+/* $FreeBSD: src/sys/crypto/blowfish/bf_locl.h,v 1.1.2.2 2001/07/03 11:01:28 ume Exp $ */
+/* $KAME: bf_locl.h,v 1.5 2000/08/31 06:03:48 itojun Exp $ */
+
/* crypto/bf/bf_local.h */
/* Copyright (C) 1995-1997 Eric Young (eay@mincom.oz.au)
* All rights reserved.
*/
#undef c2l
-#define c2l(c,l) (l =((unsigned long)(*((c)++))) , \
- l|=((unsigned long)(*((c)++)))<< 8L, \
- l|=((unsigned long)(*((c)++)))<<16L, \
- l|=((unsigned long)(*((c)++)))<<24L)
+#define c2l(c,l) (l =((BF_LONG)(*((c)++))) , \
+ l|=((BF_LONG)(*((c)++)))<< 8L, \
+ l|=((BF_LONG)(*((c)++)))<<16L, \
+ l|=((BF_LONG)(*((c)++)))<<24L)
/* NOTE - c is not incremented as per c2l */
#undef c2ln
c+=n; \
l1=l2=0; \
switch (n) { \
- case 8: l2 =((unsigned long)(*(--(c))))<<24L; \
- case 7: l2|=((unsigned long)(*(--(c))))<<16L; \
- case 6: l2|=((unsigned long)(*(--(c))))<< 8L; \
- case 5: l2|=((unsigned long)(*(--(c)))); \
- case 4: l1 =((unsigned long)(*(--(c))))<<24L; \
- case 3: l1|=((unsigned long)(*(--(c))))<<16L; \
- case 2: l1|=((unsigned long)(*(--(c))))<< 8L; \
- case 1: l1|=((unsigned long)(*(--(c)))); \
+ case 8: l2 =((BF_LONG)(*(--(c))))<<24L; \
+ case 7: l2|=((BF_LONG)(*(--(c))))<<16L; \
+ case 6: l2|=((BF_LONG)(*(--(c))))<< 8L; \
+ case 5: l2|=((BF_LONG)(*(--(c)))); \
+ case 4: l1 =((BF_LONG)(*(--(c))))<<24L; \
+ case 3: l1|=((BF_LONG)(*(--(c))))<<16L; \
+ case 2: l1|=((BF_LONG)(*(--(c))))<< 8L; \
+ case 1: l1|=((BF_LONG)(*(--(c)))); \
} \
}
c+=n; \
l1=l2=0; \
switch (n) { \
- case 8: l2 =((unsigned long)(*(--(c)))) ; \
- case 7: l2|=((unsigned long)(*(--(c))))<< 8; \
- case 6: l2|=((unsigned long)(*(--(c))))<<16; \
- case 5: l2|=((unsigned long)(*(--(c))))<<24; \
- case 4: l1 =((unsigned long)(*(--(c)))) ; \
- case 3: l1|=((unsigned long)(*(--(c))))<< 8; \
- case 2: l1|=((unsigned long)(*(--(c))))<<16; \
- case 1: l1|=((unsigned long)(*(--(c))))<<24; \
+ case 8: l2 =((BF_LONG)(*(--(c)))) ; \
+ case 7: l2|=((BF_LONG)(*(--(c))))<< 8; \
+ case 6: l2|=((BF_LONG)(*(--(c))))<<16; \
+ case 5: l2|=((BF_LONG)(*(--(c))))<<24; \
+ case 4: l1 =((BF_LONG)(*(--(c)))) ; \
+ case 3: l1|=((BF_LONG)(*(--(c))))<< 8; \
+ case 2: l1|=((BF_LONG)(*(--(c))))<<16; \
+ case 1: l1|=((BF_LONG)(*(--(c))))<<24; \
} \
}
}
#undef n2l
-#define n2l(c,l) (l =((unsigned long)(*((c)++)))<<24L, \
- l|=((unsigned long)(*((c)++)))<<16L, \
- l|=((unsigned long)(*((c)++)))<< 8L, \
- l|=((unsigned long)(*((c)++))))
+#define n2l(c,l) (l =((BF_LONG)(*((c)++)))<<24L, \
+ l|=((BF_LONG)(*((c)++)))<<16L, \
+ l|=((BF_LONG)(*((c)++)))<< 8L, \
+ l|=((BF_LONG)(*((c)++))))
#undef l2n
#define l2n(l,c) (*((c)++)=(unsigned char)(((l)>>24L)&0xff), \
* BF_PTR for sparc and MIPS/SGI
* use nothing for Alpha and HP.
*/
-#if !defined(BF_PTR) && !defined(BF_PTR2)
-#undef BF_PTR
+#undef BF_PTR
+#undef BF_PTR2
+#ifdef __NetBSD__
+#ifdef __i386__
+#define BF_PTR2
+#else
+#ifdef __mips__
+#define BF_PTR
+#endif
#endif
+#endif /*NetBSD*/
#define BF_M 0x3fc
#define BF_0 22L