Fixed the abstraction violation, where the code knew the details about the
authorRichard Basch <probe@mit.edu>
Mon, 6 May 1996 16:25:53 +0000 (16:25 +0000)
committerRichard Basch <probe@mit.edu>
Mon, 6 May 1996 16:25:53 +0000 (16:25 +0000)
cryptosystem structure.

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@7907 dc483132-0cff-0310-8789-dd5450dbe970

src/kdc/ChangeLog
src/kdc/main.c
src/tests/create/ChangeLog
src/tests/create/kdb5_mkdums.c
src/tests/verify/ChangeLog
src/tests/verify/kdb5_verify.c

index ec59d747ae5479e019e2b7fc6d77aa9ad632c3d5..4e0096aa1b47f2adbc320f0c15641683e5ec374b 100644 (file)
@@ -1,3 +1,8 @@
+Mon May  6 12:15:36 1996  Richard Basch  <basch@lehman.com>
+
+       * main.c: Fixed various abstraction violations where the code knew
+       the internals of eblock->crypto_entry.
+
 Wed Feb 28 13:07:28 1996  Ezra Peisach  <epeisach@kangaroo.mit.edu>
 
        * main.c: Move com_err.h after k5-int.h include.
index bd4aba9d222715e96bf313c903b3561bcc7122d6..443acecb545d022f56230f99e5e570a60905d790 100644 (file)
@@ -619,9 +619,9 @@ goto whoops;
            }
            if (!rkey_init_done) {
                krb5_enctype enctype;
+               krb5_encrypt_block temp_eblock;
 #ifdef KRB5_KRB4_COMPAT
                krb5_keyblock *temp_key;
-               krb5_encrypt_block temp_eblock;
 #endif
                /*
                 * If all that worked, then initialize the random key
@@ -630,10 +630,11 @@ goto whoops;
                for (enctype = 0; enctype <= krb5_max_enctype; enctype++) {
                    if (krb5_enctype_array[enctype] &&
                        !krb5_enctype_array[enctype]->random_sequence) {
-                       if ((kret = (*krb5_enctype_array[enctype]->system->
-                                    init_random_key)
-                            (&rdp->realm_mkey,
-                             &krb5_enctype_array[enctype]->random_sequence))) {
+                       krb5_use_enctype(rdp->realm_context, &temp_eblock, enctype);
+                       if ((kret = krb5_init_random_key(
+                               rdp->realm_context, &temp_eblock,
+                               &rdp->realm_mkey,
+                               &krb5_enctype_array[enctype]->random_sequence))) {
                            com_err(progname, kret, 
                                    "while setting up random key generator for enctype %d--enctype disabled",
                                    enctype);
@@ -641,13 +642,10 @@ goto whoops;
                        } else {
 #ifdef KRB5_KRB4_COMPAT
                            if (enctype == ENCTYPE_DES_CBC_CRC) {
-                               krb5_use_enctype(rdp->realm_context,
-                                                &temp_eblock, enctype);
-                               if ((kret = (*krb5_enctype_array[enctype]->
-                                            system->random_key)
-                                    (&temp_eblock,
-                                     krb5_enctype_array[enctype]->random_sequence,
-                                     &temp_key)))
+                               if ((kret = krb5_random_key(
+                                       rdp->realm_context, &temp_eblock,
+                                       krb5_enctype_array[enctype]->random_sequence,
+                                       &temp_key)))
                                    com_err(progname, kret,
                                            "while initializing V4 random key generator");
                                else {
index 847f83a41b9ae13c67ea1f226afd285cf3daa0f3..2d7720c07a5b426f80b318f7e5d98b18ceb94fc4 100644 (file)
@@ -1,3 +1,8 @@
+Thu May  2 21:17:27 1996  Richard Basch  <basch@lehman.com>
+
+       * kdb5_mkdums.c: fixed various abstraction violations where the
+               code "knew" the cryptosystem_entry structure
+
 Sat Dec 23 01:04:40 1995    <tytso@rsts-11.mit.edu>
 
        * configure.in: Add check for DBM/db libraries
index 52ee8f290f12a84cdacd9f7e26dacdda1622742b..df11ddb241b9af38b2565e0397770a66b7805656 100644 (file)
@@ -102,7 +102,6 @@ char *argv[];
     krb5_error_code retval;
     char *dbname = 0;
     int enctypedone = 0;
-    register krb5_cryptosystem_entry *csentry;
     extern krb5_kt_ops krb5_ktf_writable_ops;
     int num_to_create;
     char principal_string[BUFSIZ];
@@ -178,7 +177,6 @@ char *argv[];
     }
 
     krb5_use_enctype(test_context, &master_encblock, master_keyblock.enctype);
-    csentry = master_encblock.crypto_entry;
 
     if (!dbname)
        dbname = DEFAULT_KDB_FILE;      /* XXX? */
@@ -210,8 +208,9 @@ char *argv[];
       }
     }
 
-    (void) (*csentry->finish_key)(&master_encblock);
-    (void) (*csentry->finish_random_key)(&master_random);
+    krb5_finish_random_key(test_context, &master_encblock, &master_random);
+    krb5_finish_key(test_context, &master_encblock);
+
     retval = krb5_db_fini(test_context);
     memset((char *)master_keyblock.contents, 0, master_keyblock.length);
     if (retval && retval != KRB5_KDB_DBNOTINITED) {
@@ -333,11 +332,8 @@ char *dbname;
     krb5_error_code retval;
     int nentries;
     krb5_boolean more;
-    register krb5_cryptosystem_entry *csentry;
     krb5_data pwd, scratch;
 
-    csentry = master_encblock.crypto_entry;
-
     if (retval = krb5_db_set_name(test_context, dbname)) {
        com_err(pname, retval, "while setting active database to '%s'",
                dbname);
@@ -400,16 +396,17 @@ char *dbname;
        return(1);
     }
 
-    if (retval = (*csentry->process_key)(&master_encblock,
-                                        &master_keyblock)) {
+    if (retval = krb5_process_key(test_context,
+                                 &master_encblock, &master_keyblock)) {
        com_err(pname, retval, "while processing master key");
        (void) krb5_db_fini(test_context);
        return(1);
     }
-    if (retval = (*csentry->init_random_key)(&master_keyblock,
-                                            &master_random)) {
+    if (retval = krb5_init_random_key(test_context,
+                                     &master_encblock, &master_keyblock,
+                                     &master_random)) {
        com_err(pname, retval, "while initializing random key generator");
-       (void) (*csentry->finish_key)(&master_encblock);
+       krb5_finish_key(test_context, &master_encblock);
        (void) krb5_db_fini(test_context);
        return(1);
     }
index eeafcf245bd5aa12b08dfcbd802b21f8d9f4b673..96182d999cc8aef3afe79ef9a325ef37aca1e015 100644 (file)
@@ -1,3 +1,8 @@
+Thu May  2 21:16:40 1996  Richard Basch  <basch@lehman.com>
+
+       * kdb5_verify.c: fixed various abstraction violations where the
+               code "knew" the cryptosystem_entry structure
+
 Sat Dec 23 01:05:33 1995    <tytso@rsts-11.mit.edu>
 
        * configure.in (withval): Add check for DBM/db libraries.
index 1684ea5bae639092f3bfc7fc41300dbd47bfb03a..fed870a7ec179c4b34739519eb78753102547e91 100644 (file)
@@ -103,7 +103,6 @@ char *argv[];
     krb5_error_code retval;
     char *dbname = 0;
     int enctypedone = 0;
-    register krb5_cryptosystem_entry *csentry;
     int num_to_check;
     char principal_string[BUFSIZ];
     char *suffix = 0;
@@ -171,7 +170,6 @@ char *argv[];
     }
 
     krb5_use_enctype(context, &master_encblock, master_keyblock.enctype);
-    csentry = master_encblock.crypto_entry;
 
     if (!dbname)
        dbname = DEFAULT_KDB_FILE;      /* XXX? */
@@ -212,8 +210,9 @@ char *argv[];
     else
       fprintf(stdout, "\nNo errors.\n");
 
-    (void) (*csentry->finish_key)(&master_encblock);
-    (void) (*csentry->finish_random_key)(&master_random);
+    krb5_finish_random_key(context, &master_encblock, &master_random);
+    krb5_finish_key(context, &master_encblock);
+
     retval = krb5_db_fini(context);
     memset((char *)master_keyblock.contents, 0, master_keyblock.length);
     if (retval && retval != KRB5_KDB_DBNOTINITED) {
@@ -357,11 +356,8 @@ set_dbname_help(context, pname, dbname)
     krb5_error_code retval;
     int nentries;
     krb5_boolean more;
-    register krb5_cryptosystem_entry *csentry;
     krb5_data pwd, scratch;
 
-    csentry = master_encblock.crypto_entry;
-
     if (retval = krb5_db_set_name(context, dbname)) {
        com_err(pname, retval, "while setting active database to '%s'",
                dbname);
@@ -430,16 +426,17 @@ set_dbname_help(context, pname, dbname)
       return(1);
     }
 
-    if (retval = (*csentry->process_key)(&master_encblock,
-                                        &master_keyblock)) {
+    if (retval = krb5_process_key(context,
+                                 &master_encblock, &master_keyblock)) {
        com_err(pname, retval, "while processing master key");
        (void) krb5_db_fini(context);
        return(1);
     }
-    if (retval = (*csentry->init_random_key)(&master_keyblock,
-                                            &master_random)) {
+    if (retval = krb5_init_random_key(context,
+                                     &master_encblock, &master_keyblock,
+                                     &master_random)) {
        com_err(pname, retval, "while initializing random key generator");
-       (void) (*csentry->finish_key)(&master_encblock);
+       krb5_finish_key(context, &master_encblock);
        (void) krb5_db_fini(context);
        return(1);
     }