Change internal calling signature to pass in the encryption block, so
authorTheodore Tso <tytso@mit.edu>
Tue, 8 Nov 1994 23:00:00 +0000 (23:00 +0000)
committerTheodore Tso <tytso@mit.edu>
Tue, 8 Nov 1994 23:00:00 +0000 (23:00 +0000)
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
src/include/krb5/encryption.h
src/lib/crypto/des/ChangeLog
src/lib/crypto/des/des_int.h
src/lib/crypto/des/random_key.c
src/lib/crypto/des/string2key.c

index 2caf1c82a0b636ae2908a15ac1f4af2bae1f72b5..fdcaab7c7c726a6c5425a8af721bb729f3caf7da 100644 (file)
@@ -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
index 3f4d70174f1a336c9ced18a9b30f73cb0e687b26..235b38ab4666becb599872d763d3c25d5d4df050 100644 (file)
@@ -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:
index c8f25e776ac91510ada2c40aab656f819e3d9394..1d977f8e48e2109a998eec61a00ff7256d9feedc 100644 (file)
@@ -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
index 038423a97c997d5c756080728c12f5feaf0df8b1..cc5762a355504bcb7a858cf5bb78007425b1320a 100644 (file)
@@ -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 ));
index 48ad309e0f565eeccdb33a268f25f9a288483de0..184d1099e6dcf612ddafb1e75ba931da3818d1ed 100644 (file)
         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);
index 63274bc9987591c42049c69c0f17b9edd6ed5ec8..be3292bebedc86480eac7f4ec8cd4831a5cc2eed 100644 (file)
        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;