diff options
author | Tom Yu <tlyu@mit.edu> | 2002-09-27 04:26:59 +0000 |
---|---|---|
committer | Tom Yu <tlyu@mit.edu> | 2002-09-27 04:26:59 +0000 |
commit | 505c79ff465e719a5c22d80047a54aee7e3cf4f6 (patch) | |
tree | dc0c6a9b11327c98dd7b1795e8ddb6a37d76dd9b /src/lib/crypto | |
parent | 16f8791b67032adfc3282675a4d40f60acd0e58d (diff) | |
download | krb5-505c79ff465e719a5c22d80047a54aee7e3cf4f6.zip krb5-505c79ff465e719a5c22d80047a54aee7e3cf4f6.tar.gz krb5-505c79ff465e719a5c22d80047a54aee7e3cf4f6.tar.bz2 |
Fix DES_INT32 definition
Intial merge of KfM des library API.
Update krb.h to use offsets from krb_err.et constants as error codes.
Fix up definitions of KRB4_32, KRB_INT32, KRB_UINT32.
ticket: 1189
status: open
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@14904 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/lib/crypto')
-rw-r--r-- | src/lib/crypto/des/ChangeLog | 18 | ||||
-rw-r--r-- | src/lib/crypto/des/afsstring2key.c | 9 | ||||
-rw-r--r-- | src/lib/crypto/des/d3_kysched.c | 6 | ||||
-rw-r--r-- | src/lib/crypto/des/des_int.h | 43 | ||||
-rw-r--r-- | src/lib/crypto/des/f_cksum.c | 2 | ||||
-rw-r--r-- | src/lib/crypto/des/f_sched.c | 2 | ||||
-rw-r--r-- | src/lib/crypto/des/key_sched.c | 2 |
7 files changed, 35 insertions, 47 deletions
diff --git a/src/lib/crypto/des/ChangeLog b/src/lib/crypto/des/ChangeLog index 254324f..d1246b6 100644 --- a/src/lib/crypto/des/ChangeLog +++ b/src/lib/crypto/des/ChangeLog @@ -1,3 +1,21 @@ +2002-09-26 Tom Yu <tlyu@mit.edu> + + * afsstring2key.c (krb5_afs_crypt): Leak this function out as as + mit_afs_crypt to allow for des_crypt and des_fcrypt + implementations for the KfM merge. + + * des_int.h: Change DES_INT32 strategy to include kerberosIV/des.h + with a magic macro defined for skipping krb4-specific stuff. Make + renaming of make_key_sched explicit, to avoid conflict with + kerberosIV/des.h. + + * f_sched.c, key_sched.c, d3_kysched.c: Make renaming of + make_key_sched explicit. + + * f_cksum.c (mit_des_cbc_cksum): Return only the rightmost 32 + bits; this should optimize out on any platform where longs are + exactly 32 bits wide. + 2002-08-29 Ken Raeburn <raeburn@mit.edu> * Makefile.in: Revert $(S)=>/ change, for Windows support. diff --git a/src/lib/crypto/des/afsstring2key.c b/src/lib/crypto/des/afsstring2key.c index 8773397..0fe65ba 100644 --- a/src/lib/crypto/des/afsstring2key.c +++ b/src/lib/crypto/des/afsstring2key.c @@ -61,7 +61,8 @@ #include "des_int.h" #include <ctype.h> -static char *afs_crypt (char*,char*,char*); +#define afs_crypt mit_afs_crypt +char *afs_crypt (const char *, const char *, char *); #undef min #define min(a,b) ((a)>(b)?(b):(a)) @@ -337,9 +338,9 @@ static const char S[8][64] = { }; -static char *afs_crypt(pw, salt, iobuf) - char *pw; - char *salt; +char *afs_crypt(pw, salt, iobuf) + const char *pw; + const char *salt; char *iobuf; /* must be at least 16 bytes */ { int i, j, c; diff --git a/src/lib/crypto/des/d3_kysched.c b/src/lib/crypto/des/d3_kysched.c index 6d9c276..2bc93a9 100644 --- a/src/lib/crypto/des/d3_kysched.c +++ b/src/lib/crypto/des/d3_kysched.c @@ -28,9 +28,9 @@ mit_des3_key_sched(k,schedule) mit_des3_cblock k; mit_des3_key_schedule schedule; { - make_key_sched(k[0],schedule[0]); - make_key_sched(k[1],schedule[1]); - make_key_sched(k[2],schedule[2]); + mit_des_make_key_sched(k[0],schedule[0]); + mit_des_make_key_sched(k[1],schedule[1]); + mit_des_make_key_sched(k[2],schedule[2]); if (!mit_des_check_key_parity(k[0])) /* bad parity --> return -1 */ return(-1); diff --git a/src/lib/crypto/des/des_int.h b/src/lib/crypto/des/des_int.h index 1b2a351..2561276 100644 --- a/src/lib/crypto/des/des_int.h +++ b/src/lib/crypto/des/des_int.h @@ -1,8 +1,8 @@ /* * lib/crypto/des/des_int.h * - * Copyright 1987, 1988, 1990 by the Massachusetts Institute of Technology. - * All Rights Reserved. + * Copyright 1987, 1988, 1990, 2002 by the Massachusetts Institute of + * Technology. All Rights Reserved. * * Export of this software from the United States of America may * require a specific license from the United States Government. @@ -64,40 +64,10 @@ #ifndef KRB5_MIT_DES__ #define KRB5_MIT_DES__ -#ifndef DES_INT32 -#ifdef SIZEOF_INT -#if SIZEOF_INT >= 4 -#define DES_INT32 int -#else -#define DES_INT32 long -#endif -#else /* !defined(SIZEOF_INT) */ -#include <limits.h> -#if (UINT_MAX >= 0xffffffff) -#define DES_INT32 int -#else -#define DES_INT32 long -#endif -#endif /* !defined(SIZEOF_INT) */ -#endif /* !defined(DES_INT32) */ +#define KRB5INT_CRYPTO_DES_INT /* skip krb4-specific DES stuff */ +#include "kerberosIV/des.h" /* for des_key_schedule, etc. */ +#undef KRB5INT_CRYPTO_DES_INT /* don't screw other inclusions of des.h */ -/* - * - * NOTE WELL: - * - * This section must be kept in sync with include/kerberosIV/des.h, - * until we get around to actually combining them at the source level. - * We can't right now, because both the Mac and Windows platforms are - * using their own versions of krb4 des.h, and that's the one that - * would have to have the definitions because we install it under UNIX. - * - */ -#ifndef KRB5INT_DES_TYPES_DEFINED -#define KRB5INT_DES_TYPES_DEFINED -typedef unsigned char des_cblock[8]; /* crypto-block size */ -typedef struct des_ks_struct { DES_INT32 _[2]; } des_key_schedule[16]; -#endif -/* end sync */ typedef des_cblock mit_des_cblock; typedef des_key_schedule mit_des_key_schedule; @@ -217,8 +187,7 @@ krb5_error_code mit_des_combine_subkeys int mit_des_pcbc_encrypt (); /* f_sched.c */ -#define make_key_sched mit_des_make_key_sched -int make_key_sched (mit_des_cblock, mit_des_key_schedule); +int mit_des_make_key_sched(mit_des_cblock, mit_des_key_schedule); /* misc.c */ diff --git a/src/lib/crypto/des/f_cksum.c b/src/lib/crypto/des/f_cksum.c index 87b9c7f..8c80751 100644 --- a/src/lib/crypto/des/f_cksum.c +++ b/src/lib/crypto/des/f_cksum.c @@ -120,5 +120,5 @@ mit_des_cbc_cksum(in, out, length, schedule, ivec) * inconsistantly (with the low order byte of the checksum * not always in the low order byte of the DES_INT32). We won't. */ - return right; + return right & 0xFFFFFFFFUL; } diff --git a/src/lib/crypto/des/f_sched.c b/src/lib/crypto/des/f_sched.c index 6dbde1f..a3b1bf0 100644 --- a/src/lib/crypto/des/f_sched.c +++ b/src/lib/crypto/des/f_sched.c @@ -220,7 +220,7 @@ static const unsigned DES_INT32 PC2_D[4][64] = { * Permute the key to give us our key schedule. */ int -make_key_sched(key, schedule) +mit_des_make_key_sched(key, schedule) mit_des_cblock key; mit_des_key_schedule schedule; { diff --git a/src/lib/crypto/des/key_sched.c b/src/lib/crypto/des/key_sched.c index c84451d..b28c16f 100644 --- a/src/lib/crypto/des/key_sched.c +++ b/src/lib/crypto/des/key_sched.c @@ -50,7 +50,7 @@ mit_des_key_sched(k,schedule) mit_des_cblock k; mit_des_key_schedule schedule; { - make_key_sched(k,schedule); + mit_des_make_key_sched(k,schedule); if (!mit_des_check_key_parity(k)) /* bad parity --> return -1 */ return(-1); |