summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2002-10-27 13:24:27 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2002-10-27 13:24:27 +0000
commit92dc62825b7c3de333f49664fd271fb5d42ba844 (patch)
treecf2e2a1cef80233348ccee15f2fa71ce4b58d1bb /sys
parente041cded2ec57399070f1fcd10c9387747f6cd43 (diff)
Use int32_t rather long on strategic places, to be more sparc64-friendly;
ok jason@ a long time ago
Diffstat (limited to 'sys')
-rw-r--r--sys/crypto/des.h17
-rw-r--r--sys/crypto/des_locl.h54
-rw-r--r--sys/crypto/ecb3_enc.c6
-rw-r--r--sys/crypto/ecb_enc.c26
-rw-r--r--sys/crypto/set_key.c8
-rw-r--r--sys/crypto/sk.h4
-rw-r--r--sys/crypto/spr.h4
7 files changed, 60 insertions, 59 deletions
diff --git a/sys/crypto/des.h b/sys/crypto/des.h
index deb4af651da..407a8fdddf9 100644
--- a/sys/crypto/des.h
+++ b/sys/crypto/des.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: des.h,v 1.1 2000/02/28 23:13:04 deraadt Exp $ */
+/* $OpenBSD: des.h,v 1.2 2002/10/27 13:24:26 miod Exp $ */
/* lib/des/des.h */
/* Copyright (C) 1995 Eric Young (eay@mincom.oz.au)
@@ -50,6 +50,7 @@
#ifndef HEADER_DES_H
#define HEADER_DES_H
+#include <sys/types.h>
#ifndef _KERNEL
#include <stdio.h>
#endif
@@ -61,7 +62,7 @@ typedef struct des_ks_struct
des_cblock _;
/* make sure things are correct size on machines with
* 8 byte longs */
- unsigned long pad[2];
+ int32_t pad[2];
} ks;
#undef _
#define _ ks._
@@ -124,7 +125,7 @@ extern int des_rw_mode; /* defaults to DES_PCBC_MODE */
void des_ecb3_encrypt(des_cblock *input,des_cblock *output,
des_key_schedule ks1,des_key_schedule ks2,
des_key_schedule ks3, int enc);
-unsigned long des_cbc_cksum(des_cblock *input,des_cblock *output,
+u_int32_t des_cbc_cksum(des_cblock *input,des_cblock *output,
long length,des_key_schedule schedule,des_cblock *ivec);
void des_cbc_encrypt(des_cblock *input,des_cblock *output,long length,
des_key_schedule schedule,des_cblock *ivec,int enc);
@@ -137,8 +138,8 @@ void des_cfb_encrypt(unsigned char *in,unsigned char *out,int numbits,
long length,des_key_schedule schedule,des_cblock *ivec,int enc);
void des_ecb_encrypt(des_cblock *input,des_cblock *output,
des_key_schedule ks,int enc);
-void des_encrypt(unsigned long *data,des_key_schedule ks, int enc);
-void des_encrypt2(unsigned long *data,des_key_schedule ks, int enc);
+void des_encrypt(u_int32_t *data,des_key_schedule ks, int enc);
+void des_encrypt2(u_int32_t *data,des_key_schedule ks, int enc);
void des_ede3_cbc_encrypt(des_cblock *input, des_cblock *output,
long length, des_key_schedule ks1, des_key_schedule ks2,
des_key_schedule ks3, des_cblock *ivec, int enc);
@@ -168,7 +169,7 @@ void des_ofb_encrypt(unsigned char *in,unsigned char *out,
int numbits,long length,des_key_schedule schedule,des_cblock *ivec);
void des_pcbc_encrypt(des_cblock *input,des_cblock *output,long length,
des_key_schedule schedule,des_cblock *ivec,int enc);
-unsigned long des_quad_cksum(des_cblock *input,des_cblock *output,
+u_int32_t des_quad_cksum(des_cblock *input,des_cblock *output,
long length,int out_count,des_cblock *seed);
void des_random_seed(des_cblock key);
void des_random_key(des_cblock ret);
@@ -202,7 +203,7 @@ void des_generate_random_block(des_cblock *block);
#else
void des_ecb3_encrypt();
-unsigned long des_cbc_cksum();
+u_int32_t des_cbc_cksum();
void des_cbc_encrypt();
void des_ncbc_encrypt();
void des_3cbc_encrypt();
@@ -222,7 +223,7 @@ char *crypt();
#endif
void des_ofb_encrypt();
void des_pcbc_encrypt();
-unsigned long des_quad_cksum();
+u_int32_t des_quad_cksum();
void des_random_seed();
void des_random_key();
int des_read_password();
diff --git a/sys/crypto/des_locl.h b/sys/crypto/des_locl.h
index 5dfdb5c5199..d6b729170e1 100644
--- a/sys/crypto/des_locl.h
+++ b/sys/crypto/des_locl.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: des_locl.h,v 1.1 2000/02/28 23:13:04 deraadt Exp $ */
+/* $OpenBSD: des_locl.h,v 1.2 2002/10/27 13:24:26 miod Exp $ */
/* lib/des/des_locl.h */
/* Copyright (C) 1995 Eric Young (eay@mincom.oz.au)
@@ -87,24 +87,24 @@
#define MAXWRITE (1024*16)
#define BSIZE (MAXWRITE+4)
-#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 =((u_int32_t)(*((c)++))) , \
+ l|=((u_int32_t)(*((c)++)))<< 8L, \
+ l|=((u_int32_t)(*((c)++)))<<16L, \
+ l|=((u_int32_t)(*((c)++)))<<24L)
/* NOTE - c is not incremented as per c2l */
#define c2ln(c,l1,l2,n) { \
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 =((u_int32_t)(*(--(c))))<<24L; \
+ case 7: l2|=((u_int32_t)(*(--(c))))<<16L; \
+ case 6: l2|=((u_int32_t)(*(--(c))))<< 8L; \
+ case 5: l2|=((u_int32_t)(*(--(c)))); \
+ case 4: l1 =((u_int32_t)(*(--(c))))<<24L; \
+ case 3: l1|=((u_int32_t)(*(--(c))))<<16L; \
+ case 2: l1|=((u_int32_t)(*(--(c))))<< 8L; \
+ case 1: l1|=((u_int32_t)(*(--(c)))); \
} \
}
@@ -117,10 +117,10 @@
* when faced with machines with 8 byte longs. */
#define HDRSIZE 4
-#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 =((u_int32_t)(*((c)++)))<<24L, \
+ l|=((u_int32_t)(*((c)++)))<<16L, \
+ l|=((u_int32_t)(*((c)++)))<< 8L, \
+ l|=((u_int32_t)(*((c)++))))
#define l2n(l,c) (*((c)++)=(unsigned char)(((l)>>24L)&0xff), \
*((c)++)=(unsigned char)(((l)>>16L)&0xff), \
@@ -152,14 +152,14 @@
t= R^s[S+1]; \
t=((t>>2)+(t<<30)); \
L^= \
- *(unsigned long *)(des_SP+0x0100+((t )&0xfc))+ \
- *(unsigned long *)(des_SP+0x0300+((t>> 8)&0xfc))+ \
- *(unsigned long *)(des_SP+0x0500+((t>>16)&0xfc))+ \
- *(unsigned long *)(des_SP+0x0700+((t>>24)&0xfc))+ \
- *(unsigned long *)(des_SP+ ((u )&0xfc))+ \
- *(unsigned long *)(des_SP+0x0200+((u>> 8)&0xfc))+ \
- *(unsigned long *)(des_SP+0x0400+((u>>16)&0xfc))+ \
- *(unsigned long *)(des_SP+0x0600+((u>>24)&0xfc)); }
+ *(u_int32_t *)(des_SP+0x0100+((t )&0xfc))+ \
+ *(u_int32_t *)(des_SP+0x0300+((t>> 8)&0xfc))+ \
+ *(u_int32_t *)(des_SP+0x0500+((t>>16)&0xfc))+ \
+ *(u_int32_t *)(des_SP+0x0700+((t>>24)&0xfc))+ \
+ *(u_int32_t *)(des_SP+ ((u )&0xfc))+ \
+ *(u_int32_t *)(des_SP+0x0200+((u>> 8)&0xfc))+ \
+ *(u_int32_t *)(des_SP+0x0400+((u>>16)&0xfc))+ \
+ *(u_int32_t *)(des_SP+0x0600+((u>>24)&0xfc)); }
#else /* original version */
#ifdef MSDOS
#define D_ENCRYPT(L,R,S) \
@@ -234,7 +234,7 @@
#define IP(l,r) \
{ \
- register unsigned long tt; \
+ register u_int32_t tt; \
PERM_OP(r,l,tt, 4,0x0f0f0f0fL); \
PERM_OP(l,r,tt,16,0x0000ffffL); \
PERM_OP(r,l,tt, 2,0x33333333L); \
@@ -244,7 +244,7 @@
#define FP(l,r) \
{ \
- register unsigned long tt; \
+ register u_int32_t tt; \
PERM_OP(l,r,tt, 1,0x55555555L); \
PERM_OP(r,l,tt, 8,0x00ff00ffL); \
PERM_OP(l,r,tt, 2,0x33333333L); \
diff --git a/sys/crypto/ecb3_enc.c b/sys/crypto/ecb3_enc.c
index f20ae89a975..2d52795f18e 100644
--- a/sys/crypto/ecb3_enc.c
+++ b/sys/crypto/ecb3_enc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ecb3_enc.c,v 1.1 2000/02/28 23:13:04 deraadt Exp $ */
+/* $OpenBSD: ecb3_enc.c,v 1.2 2002/10/27 13:24:26 miod Exp $ */
/* lib/des/ecb3_enc.c */
/* Copyright (C) 1995 Eric Young (eay@mincom.oz.au)
@@ -57,9 +57,9 @@ des_key_schedule ks2;
des_key_schedule ks3;
int encrypt;
{
- register unsigned long l0,l1;
+ register u_int32_t l0,l1;
register unsigned char *in,*out;
- unsigned long ll[2];
+ u_int32_t ll[2];
in=(unsigned char *)input;
out=(unsigned char *)output;
diff --git a/sys/crypto/ecb_enc.c b/sys/crypto/ecb_enc.c
index 1a32771533c..384c263c6b5 100644
--- a/sys/crypto/ecb_enc.c
+++ b/sys/crypto/ecb_enc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ecb_enc.c,v 1.1 2000/02/28 23:13:05 deraadt Exp $ */
+/* $OpenBSD: ecb_enc.c,v 1.2 2002/10/27 13:24:26 miod Exp $ */
/* lib/des/ecb_enc.c */
/* Copyright (C) 1995 Eric Young (eay@mincom.oz.au)
@@ -58,9 +58,9 @@ des_cblock (*output);
des_key_schedule ks;
int encrypt;
{
- register unsigned long l0,l1;
+ register u_int32_t l0,l1;
register unsigned char *in,*out;
- unsigned long ll[2];
+ u_int32_t ll[2];
in=(unsigned char *)input;
out=(unsigned char *)output;
@@ -73,23 +73,23 @@ int encrypt;
}
void des_encrypt(data, ks, encrypt)
-unsigned long *data;
+u_int32_t *data;
des_key_schedule ks;
int encrypt;
{
- register unsigned long l,r,t,u;
+ register u_int32_t l,r,t,u;
#ifdef DES_USE_PTR
register unsigned char *des_SP=(unsigned char *)des_SPtrans;
#endif
#ifdef MSDOS
union fudge {
- unsigned long l;
+ u_int32_t l;
unsigned short s[2];
unsigned char c[4];
} U,T;
#endif
register int i;
- register unsigned long *s;
+ register u_int32_t *s;
u=data[0];
r=data[1];
@@ -108,7 +108,7 @@ int encrypt;
l&=0xffffffffL;
r&=0xffffffffL;
- s=(unsigned long *)ks;
+ s=(u_int32_t *)ks;
/* I don't know if it is worth the effort of loop unrolling the
* inner loop */
if (encrypt)
@@ -140,23 +140,23 @@ int encrypt;
}
void des_encrypt2(data, ks, encrypt)
-unsigned long *data;
+u_int32_t *data;
des_key_schedule ks;
int encrypt;
{
- register unsigned long l,r,t,u;
+ register u_int32_t l,r,t,u;
#ifdef DES_USE_PTR
register unsigned char *des_SP=(unsigned char *)des_SPtrans;
#endif
#ifdef MSDOS
union fudge {
- unsigned long l;
+ u_int32_t l;
unsigned short s[2];
unsigned char c[4];
} U,T;
#endif
register int i;
- register unsigned long *s;
+ register u_int32_t *s;
u=data[0];
r=data[1];
@@ -174,7 +174,7 @@ int encrypt;
l&=0xffffffffL;
r&=0xffffffffL;
- s=(unsigned long *)ks;
+ s=(u_int32_t *)ks;
/* I don't know if it is worth the effort of loop unrolling the
* inner loop */
if (encrypt)
diff --git a/sys/crypto/set_key.c b/sys/crypto/set_key.c
index 4ecdf8adf6f..31b9be0f648 100644
--- a/sys/crypto/set_key.c
+++ b/sys/crypto/set_key.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: set_key.c,v 1.1 2000/02/28 23:13:05 deraadt Exp $ */
+/* $OpenBSD: set_key.c,v 1.2 2002/10/27 13:24:26 miod Exp $ */
/* lib/des/set_key.c */
/* Copyright (C) 1995 Eric Young (eay@mincom.oz.au)
@@ -152,9 +152,9 @@ int des_set_key(key, schedule)
des_cblock (*key);
des_key_schedule schedule;
{
- register unsigned long c,d,t,s;
+ register u_int32_t c,d,t,s;
register unsigned char *in;
- register unsigned long *k;
+ register u_int32_t *k;
register int i;
if (des_check_key)
@@ -166,7 +166,7 @@ des_key_schedule schedule;
return(-2);
}
- k=(unsigned long *)schedule;
+ k=(u_int32_t *)schedule;
in=(unsigned char *)key;
c2l(in,c);
diff --git a/sys/crypto/sk.h b/sys/crypto/sk.h
index 7c12128ee77..e087471c0cf 100644
--- a/sys/crypto/sk.h
+++ b/sys/crypto/sk.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: sk.h,v 1.1 2000/02/28 23:13:05 deraadt Exp $ */
+/* $OpenBSD: sk.h,v 1.2 2002/10/27 13:24:26 miod Exp $ */
/* lib/des/sk.h */
/* Copyright (C) 1995 Eric Young (eay@mincom.oz.au)
@@ -47,7 +47,7 @@
* [including the GNU Public Licence.]
*/
-static const unsigned long des_skb[8][64]={
+static const u_int32_t des_skb[8][64]={
{
/* for C bits (numbered as per FIPS 46) 1 2 3 4 5 6 */
0x00000000L,0x00000010L,0x20000000L,0x20000010L,
diff --git a/sys/crypto/spr.h b/sys/crypto/spr.h
index 4e99929ea7c..8be4254c8ca 100644
--- a/sys/crypto/spr.h
+++ b/sys/crypto/spr.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: spr.h,v 1.1 2000/02/28 23:13:05 deraadt Exp $ */
+/* $OpenBSD: spr.h,v 1.2 2002/10/27 13:24:26 miod Exp $ */
/* lib/des/spr.h */
/* Copyright (C) 1995 Eric Young (eay@mincom.oz.au)
@@ -47,7 +47,7 @@
* [including the GNU Public Licence.]
*/
-static const unsigned long des_SPtrans[8][64]={
+static const u_int32_t des_SPtrans[8][64]={
{
/* nibble 0 */
0x00820200L, 0x00020000L, 0x80800000L, 0x80820200L,