From d18f25e3bdf995e723a7d81bdb6ebac8b1e7f917 Mon Sep 17 00:00:00 2001 From: Theodore Tso Date: Tue, 8 Nov 1994 23:00:00 +0000 Subject: [PATCH] Change internal calling signature to pass in the encryption block, so that the encryption type in the keyblock structure can be properly initialized. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@4649 dc483132-0cff-0310-8789-dd5450dbe970 --- src/include/krb5/ChangeLog | 7 +++++++ src/include/krb5/encryption.h | 14 ++++++++------ src/lib/crypto/des/ChangeLog | 9 +++++++++ src/lib/crypto/des/des_int.h | 6 +++--- src/lib/crypto/des/random_key.c | 6 +++++- src/lib/crypto/des/string2key.c | 6 +++++- 6 files changed, 37 insertions(+), 11 deletions(-) diff --git a/src/include/krb5/ChangeLog b/src/include/krb5/ChangeLog index 2caf1c82a..fdcaab7c7 100644 --- a/src/include/krb5/ChangeLog +++ b/src/include/krb5/ChangeLog @@ -1,3 +1,10 @@ +Tue Nov 8 17:55:47 1994 Theodore Y. Ts'o (tytso@dcl) + + * encryption.h (krb5_string_to_key, krb5_random_key): Change + internal calling signature to pass in the encryption + block, so that the encryption type in the keyblock + structure can be properly initialized. + Thu Nov 3 16:38:44 1994 Theodore Y. Ts'o (tytso@dcl) * encryption.h (krb5_keyblock): Added a field to hold an diff --git a/src/include/krb5/encryption.h b/src/include/krb5/encryption.h index 3f4d70174..235b38ab4 100644 --- a/src/include/krb5/encryption.h +++ b/src/include/krb5/encryption.h @@ -31,7 +31,7 @@ typedef struct _krb5_keyblock { krb5_magic magic; krb5_keytype keytype; - krb5_enctype enctype; /* hint of what encryption type to use */ + krb5_enctype etype; /* hint of what encryption type to use */ int length; krb5_octet *contents; } krb5_keyblock; @@ -76,15 +76,17 @@ typedef struct _krb5_cryptosystem_entry { krb5_error_code (*process_key) NPROTOTYPE((krb5_encrypt_block *, const krb5_keyblock *)); krb5_error_code (*finish_key) NPROTOTYPE((krb5_encrypt_block *)); - krb5_error_code (*string_to_key) NPROTOTYPE((const krb5_keytype, + krb5_error_code (*string_to_key) NPROTOTYPE((const krb5_encrypt_block *, + const krb5_keytype, krb5_keyblock *, const krb5_data *, const krb5_data *)); krb5_error_code (*init_random_key) NPROTOTYPE((const krb5_keyblock *, krb5_pointer *)); krb5_error_code (*finish_random_key) NPROTOTYPE((krb5_pointer *)); - krb5_error_code (*random_key) NPROTOTYPE((krb5_pointer, - krb5_keyblock **)); + krb5_error_code (*random_key) NPROTOTYPE((const krb5_encrypt_block *, + krb5_pointer, + krb5_keyblock **)); int block_length; int pad_minimum; /* needed for cksum size computation */ int keysize; @@ -186,10 +188,10 @@ extern int krb5_max_cksum; /* max entry in array */ #define krb5_decrypt(inptr, outptr, size, eblock, ivec) (*(eblock)->crypto_entry->decrypt_func)(inptr, outptr, size, eblock, ivec) #define krb5_process_key(eblock, key) (*(eblock)->crypto_entry->process_key)(eblock, key) #define krb5_finish_key(eblock) (*(eblock)->crypto_entry->finish_key)(eblock) -#define krb5_string_to_key(eblock, keytype, keyblock, data, princ) (*(eblock)->crypto_entry->string_to_key)(keytype, keyblock, data, princ) +#define krb5_string_to_key(eblock, keytype, keyblock, data, princ) (*(eblock)->crypto_entry->string_to_key)(eblock, keytype, keyblock, data, princ) #define krb5_init_random_key(eblock, keyblock, ptr) (*(eblock)->crypto_entry->init_random_key)(keyblock, ptr) #define krb5_finish_random_key(eblock, ptr) (*(eblock)->crypto_entry->finish_random_key)(ptr) -#define krb5_random_key(eblock, ptr, keyblock) (*(eblock)->crypto_entry->random_key)(ptr, keyblock) +#define krb5_random_key(eblock, ptr, keyblock) (*(eblock)->crypto_entry->random_key)(eblock, ptr, keyblock) /* * Here's the stuff for the checksum switch: diff --git a/src/lib/crypto/des/ChangeLog b/src/lib/crypto/des/ChangeLog index c8f25e776..1d977f8e4 100644 --- a/src/lib/crypto/des/ChangeLog +++ b/src/lib/crypto/des/ChangeLog @@ -1,3 +1,12 @@ +Tue Nov 8 17:57:47 1994 Theodore Y. Ts'o (tytso@dcl) + + * des_int.h: + random_key.c (mit_des_random_key): + string2key.c (mit_des_string_to_key): Change + internal calling signature to pass in the encryption + block, so that the encryption type in the keyblock + structure can be properly initialized. + Thu Nov 3 18:31:55 1994 Mark Eichin (eichin@cygnus.com) * Makefile.in: stop building f_pcbc.c, since it belongs in diff --git a/src/lib/crypto/des/des_int.h b/src/lib/crypto/des/des_int.h index 038423a97..cc5762a35 100644 --- a/src/lib/crypto/des/des_int.h +++ b/src/lib/crypto/des/des_int.h @@ -163,12 +163,12 @@ extern krb5_error_code mit_des_process_key /* random_key.c */ extern krb5_error_code mit_des_random_key - PROTOTYPE(( krb5_pointer , krb5_keyblock **)); + PROTOTYPE(( const krb5_encrypt_block *, krb5_pointer , krb5_keyblock **)); /* string2key.c */ extern krb5_error_code mit_des_string_to_key - PROTOTYPE((const krb5_keytype, krb5_keyblock *, const krb5_data *, - const krb5_data *)); + PROTOTYPE(( const krb5_encrypt_block *, const krb5_keytype, + krb5_keyblock *, const krb5_data *, const krb5_data *)); /* weak_key.c */ extern int mit_des_is_weak_key PROTOTYPE((mit_des_cblock )); diff --git a/src/lib/crypto/des/random_key.c b/src/lib/crypto/des/random_key.c index 48ad309e0..184d1099e 100644 --- a/src/lib/crypto/des/random_key.c +++ b/src/lib/crypto/des/random_key.c @@ -33,8 +33,10 @@ filling in the keyblock address in *keyblock */ -krb5_error_code mit_des_random_key (DECLARG(krb5_pointer, seed), +krb5_error_code mit_des_random_key (DECLARG(const krb5_encrypt_block *, eblock), + DECLARG(krb5_pointer, seed), DECLARG(krb5_keyblock **, keyblock)) +OLDDECLARG(const krb5_encrypt_block *, eblock) OLDDECLARG(krb5_pointer, seed) OLDDECLARG(krb5_keyblock **, keyblock) { @@ -46,6 +48,8 @@ OLDDECLARG(krb5_keyblock **, keyblock) krb5_xfree(randkey); return ENOMEM; } + randkey->magic = KV5M_KEYBLOCK; + randkey->etype = eblock->crypto_entry->proto_enctype; randkey->length = sizeof(mit_des_cblock); randkey->keytype = KEYTYPE_DES; mit_des_new_random_key(randkey->contents, (mit_des_random_key_seed *) seed); diff --git a/src/lib/crypto/des/string2key.c b/src/lib/crypto/des/string2key.c index 63274bc99..be3292beb 100644 --- a/src/lib/crypto/des/string2key.c +++ b/src/lib/crypto/des/string2key.c @@ -44,10 +44,12 @@ returns: errors */ -krb5_error_code mit_des_string_to_key (DECLARG(const krb5_keytype, keytype), +krb5_error_code mit_des_string_to_key (DECLARG(const krb5_encrypt_block *, eblock), + DECLARG(const krb5_keytype, keytype), DECLARG(krb5_keyblock *,keyblock), DECLARG(const krb5_data *,data), DECLARG(const krb5_data *, salt)) +OLDDECLARG(const krb5_encrypt_block *, eblock) OLDDECLARG(const krb5_keytype, keytype) OLDDECLARG(krb5_keyblock *,keyblock) OLDDECLARG(const krb5_data *,data) @@ -73,6 +75,8 @@ OLDDECLARG(const krb5_data *, salt) if ( !(keyblock->contents = (krb5_octet *)malloc(sizeof(mit_des_cblock))) ) return(ENOMEM); + keyblock->magic = KV5M_KEYBLOCK; + keyblock->etype = eblock->crypto_entry->proto_enctype; keyblock->keytype = KEYTYPE_DES; keyblock->length = sizeof(mit_des_cblock); key = keyblock->contents; -- 2.26.2