Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F103257991
D21389.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
8 KB
Referenced Files
None
Subscribers
None
D21389.diff
View Options
Index: head/sys/crypto/des/des.h
===================================================================
--- head/sys/crypto/des/des.h
+++ head/sys/crypto/des/des.h
@@ -82,7 +82,7 @@
extern int des_check_key; /* defaults to false */
char *des_options(void);
-void des_ecb_encrypt(des_cblock *, des_cblock *, des_key_schedule, int);
+void des_ecb_encrypt(unsigned char *, unsigned char *, des_key_schedule, int);
void des_encrypt1(DES_LONG *, des_key_schedule, int);
void des_encrypt2(DES_LONG *, des_key_schedule, int);
@@ -91,24 +91,17 @@
void des_decrypt3(DES_LONG *, des_key_schedule, des_key_schedule,
des_key_schedule);
-void des_ecb3_encrypt(des_cblock *, des_cblock *, des_key_schedule,
+void des_ecb3_encrypt(unsigned char *, unsigned char *, des_key_schedule,
des_key_schedule, des_key_schedule, int);
-void des_ncbc_encrypt(const unsigned char *, unsigned char *, long,
- des_key_schedule, des_cblock *, int);
-
-void des_ede3_cbc_encrypt(const unsigned char *, unsigned char *, long,
- des_key_schedule, des_key_schedule,
- des_key_schedule, des_cblock *, int);
-
-void des_set_odd_parity(des_cblock *);
-void des_fixup_key_parity(des_cblock *);
-int des_is_weak_key(const des_cblock *);
-int des_set_key(const des_cblock *, des_key_schedule);
-int des_key_sched(const des_cblock *, des_key_schedule);
-int des_set_key_checked(const des_cblock *, des_key_schedule);
-void des_set_key_unchecked(const des_cblock *, des_key_schedule);
-int des_check_key_parity(const des_cblock *);
+void des_set_odd_parity(unsigned char *);
+void des_fixup_key_parity(unsigned char *);
+int des_is_weak_key(const unsigned char *);
+int des_set_key(const unsigned char *, des_key_schedule);
+int des_key_sched(const unsigned char *, des_key_schedule);
+int des_set_key_checked(const unsigned char *, des_key_schedule);
+void des_set_key_unchecked(const unsigned char *, des_key_schedule);
+int des_check_key_parity(const unsigned char *);
#ifdef __cplusplus
}
Index: head/sys/crypto/des/des_ecb.c
===================================================================
--- head/sys/crypto/des/des_ecb.c
+++ head/sys/crypto/des/des_ecb.c
@@ -97,13 +97,13 @@
}
return(buf);
}
-void des_ecb_encrypt(des_cblock *input, des_cblock *output,
+void des_ecb_encrypt(unsigned char *input, unsigned char *output,
des_key_schedule ks, int enc)
{
register DES_LONG l;
DES_LONG ll[2];
- const unsigned char *in=&(*input)[0];
- unsigned char *out = &(*output)[0];
+ const unsigned char *in = input;
+ unsigned char *out = output;
c2l(in,l); ll[0]=l;
c2l(in,l); ll[1]=l;
@@ -113,14 +113,14 @@
l=ll[0]=ll[1]=0;
}
-void des_ecb3_encrypt(des_cblock *input, des_cblock *output,
+void des_ecb3_encrypt(unsigned char *input, unsigned char *output,
des_key_schedule ks1, des_key_schedule ks2, des_key_schedule ks3,
int enc)
{
register DES_LONG l0,l1;
DES_LONG ll[2];
- const unsigned char *in = &(*input)[0];
- unsigned char *out = &(*output)[0];
+ const unsigned char *in = input;
+ unsigned char *out = output;
c2l(in,l0);
c2l(in,l1);
Index: head/sys/crypto/des/des_setkey.c
===================================================================
--- head/sys/crypto/des/des_setkey.c
+++ head/sys/crypto/des/des_setkey.c
@@ -67,21 +67,21 @@
int des_check_key=0;
-void des_set_odd_parity(des_cblock *key)
+void des_set_odd_parity(unsigned char *key)
{
int i;
for (i=0; i<DES_KEY_SZ; i++)
- (*key)[i]=odd_parity[(*key)[i]];
+ key[i]=odd_parity[key[i]];
}
-int des_check_key_parity(const des_cblock *key)
+int des_check_key_parity(const unsigned char *key)
{
int i;
for (i=0; i<DES_KEY_SZ; i++)
{
- if ((*key)[i] != odd_parity[(*key)[i]])
+ if (key[i] != odd_parity[key[i]])
return(0);
}
return(1);
@@ -117,7 +117,7 @@
{0xE0,0xFE,0xE0,0xFE,0xF1,0xFE,0xF1,0xFE},
{0xFE,0xE0,0xFE,0xE0,0xFE,0xF1,0xFE,0xF1}};
-int des_is_weak_key(const des_cblock *key)
+int des_is_weak_key(const unsigned char *key)
{
int i;
@@ -142,7 +142,7 @@
#define HPERM_OP(a,t,n,m) ((t)=((((a)<<(16-(n)))^(a))&(m)),\
(a)=(a)^(t)^(t>>(16-(n))))
-int des_set_key(const des_cblock *key, des_key_schedule schedule)
+int des_set_key(const unsigned char *key, des_key_schedule schedule)
{
if (des_check_key)
{
@@ -159,7 +159,7 @@
* return -1 if key parity error,
* return -2 if illegal weak key.
*/
-int des_set_key_checked(const des_cblock *key, des_key_schedule schedule)
+int des_set_key_checked(const unsigned char *key, des_key_schedule schedule)
{
if (!des_check_key_parity(key))
return(-1);
@@ -169,7 +169,7 @@
return 0;
}
-void des_set_key_unchecked(const des_cblock *key, des_key_schedule schedule)
+void des_set_key_unchecked(const unsigned char *key, des_key_schedule schedule)
{
static int shifts2[16]={0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0};
DES_LONG c,d,t,s,t2;
@@ -178,7 +178,7 @@
int i;
k = &schedule->ks.deslong[0];
- in = &(*key)[0];
+ in = key;
c2l(in,c);
c2l(in,d);
@@ -225,12 +225,12 @@
}
}
-int des_key_sched(const des_cblock *key, des_key_schedule schedule)
+int des_key_sched(const unsigned char *key, des_key_schedule schedule)
{
return(des_set_key(key,schedule));
}
-void des_fixup_key_parity(des_cblock *key)
+void des_fixup_key_parity(unsigned char *key)
{
des_set_odd_parity(key);
}
Index: head/sys/kgssapi/krb5/kcrypto_des.c
===================================================================
--- head/sys/kgssapi/krb5/kcrypto_des.c
+++ head/sys/kgssapi/krb5/kcrypto_des.c
@@ -135,8 +135,8 @@
| ((inkey[4] & 1) << 5)
| ((inkey[5] & 1) << 6)
| ((inkey[6] & 1) << 7));
- des_set_odd_parity((des_cblock *) outkey);
- if (des_is_weak_key((des_cblock *) outkey))
+ des_set_odd_parity(outkey);
+ if (des_is_weak_key(outkey))
outkey[7] ^= 0xf0;
des1_set_key(ks, ks->ks_key);
Index: head/sys/kgssapi/krb5/kcrypto_des3.c
===================================================================
--- head/sys/kgssapi/krb5/kcrypto_des3.c
+++ head/sys/kgssapi/krb5/kcrypto_des3.c
@@ -144,8 +144,8 @@
| ((inkey[4] & 1) << 5)
| ((inkey[5] & 1) << 6)
| ((inkey[6] & 1) << 7));
- des_set_odd_parity((des_cblock *) outkey);
- if (des_is_weak_key((des_cblock *) outkey))
+ des_set_odd_parity(outkey);
+ if (des_is_weak_key(outkey))
outkey[7] ^= 0xf0;
}
Index: head/sys/netsmb/smb_crypt.c
===================================================================
--- head/sys/netsmb/smb_crypt.c
+++ head/sys/netsmb/smb_crypt.c
@@ -83,8 +83,8 @@
kk[6] = key[5] << 2 | (key[6] >> 6 & 0xfe);
kk[7] = key[6] << 1;
ksp = malloc(sizeof(des_key_schedule), M_SMBTEMP, M_WAITOK);
- des_set_key((des_cblock *)kk, *ksp);
- des_ecb_encrypt((des_cblock *)data, (des_cblock *)dest, *ksp, 1);
+ des_set_key(kk, *ksp);
+ des_ecb_encrypt(data, dest, *ksp, 1);
free(ksp, M_SMBTEMP);
}
Index: head/sys/opencrypto/xform_des1.c
===================================================================
--- head/sys/opencrypto/xform_des1.c
+++ head/sys/opencrypto/xform_des1.c
@@ -75,19 +75,17 @@
static void
des1_encrypt(caddr_t key, u_int8_t *blk)
{
- des_cblock *cb = (des_cblock *) blk;
des_key_schedule *p = (des_key_schedule *) key;
- des_ecb_encrypt(cb, cb, p[0], DES_ENCRYPT);
+ des_ecb_encrypt(blk, blk, p[0], DES_ENCRYPT);
}
static void
des1_decrypt(caddr_t key, u_int8_t *blk)
{
- des_cblock *cb = (des_cblock *) blk;
des_key_schedule *p = (des_key_schedule *) key;
- des_ecb_encrypt(cb, cb, p[0], DES_DECRYPT);
+ des_ecb_encrypt(blk, blk, p[0], DES_DECRYPT);
}
static int
@@ -99,7 +97,7 @@
p = KMALLOC(sizeof (des_key_schedule),
M_CRYPTO_DATA, M_NOWAIT|M_ZERO);
if (p != NULL) {
- des_set_key((const des_cblock *) key, p[0]);
+ des_set_key(key, p[0]);
err = 0;
} else
err = ENOMEM;
Index: head/sys/opencrypto/xform_des3.c
===================================================================
--- head/sys/opencrypto/xform_des3.c
+++ head/sys/opencrypto/xform_des3.c
@@ -76,19 +76,17 @@
static void
des3_encrypt(caddr_t key, u_int8_t *blk)
{
- des_cblock *cb = (des_cblock *) blk;
des_key_schedule *p = (des_key_schedule *) key;
- des_ecb3_encrypt(cb, cb, p[0], p[1], p[2], DES_ENCRYPT);
+ des_ecb3_encrypt(blk, blk, p[0], p[1], p[2], DES_ENCRYPT);
}
static void
des3_decrypt(caddr_t key, u_int8_t *blk)
{
- des_cblock *cb = (des_cblock *) blk;
des_key_schedule *p = (des_key_schedule *) key;
- des_ecb3_encrypt(cb, cb, p[0], p[1], p[2], DES_DECRYPT);
+ des_ecb3_encrypt(blk, blk, p[0], p[1], p[2], DES_DECRYPT);
}
static int
@@ -100,9 +98,9 @@
p = KMALLOC(3*sizeof (des_key_schedule),
M_CRYPTO_DATA, M_NOWAIT|M_ZERO);
if (p != NULL) {
- des_set_key((const des_cblock *)(key + 0), p[0]);
- des_set_key((const des_cblock *)(key + 8), p[1]);
- des_set_key((const des_cblock *)(key + 16), p[2]);
+ des_set_key(key + 0, p[0]);
+ des_set_key(key + 8, p[1]);
+ des_set_key(key + 16, p[2]);
err = 0;
} else
err = ENOMEM;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 23, 5:42 PM (17 h, 55 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14795869
Default Alt Text
D21389.diff (8 KB)
Attached To
Mode
D21389: Stop using des_cblock * for arguments to DES functions.
Attached
Detach File
Event Timeline
Log In to Comment