Changed encrypted keyblocks to use krb5_encrypted_keyblock instead
authorTheodore Tso <tytso@mit.edu>
Thu, 13 Dec 1990 16:30:18 +0000 (16:30 +0000)
committerTheodore Tso <tytso@mit.edu>
Thu, 13 Dec 1990 16:30:18 +0000 (16:30 +0000)
of krb5_keyblock

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

src/include/krb5/encryption.h
src/include/krb5/kdb.h
src/kdc/do_as_req.c
src/kdc/do_tgs_req.c
src/kdc/kdc_util.c

index 65fd77961ef361536685717d3837e6991e666843..cf6ee739986c11a44ae251ed58f6280db270bfa1 100644 (file)
@@ -22,6 +22,12 @@ typedef struct _krb5_keyblock {
     krb5_octet *contents;
 } krb5_keyblock;
 
+typedef struct _krb5_encrypted_keyblock {
+    krb5_keytype keytype;
+    int length;
+    krb5_octet *contents;
+} krb5_encrypted_keyblock;
+
 typedef struct _krb5_checksum {
     krb5_cksumtype checksum_type;      /* checksum type */
     int length;
index b8b77b085f24cd59fc0283363c6e8e15fdcf0689..c42d8d585fd57ac6165aa2e518e93e6c4e58e304 100644 (file)
@@ -18,7 +18,7 @@
 
 typedef struct _krb5_db_entry {
     krb5_principal principal;
-    krb5_keyblock key;
+    krb5_encrypted_keyblock key;
     krb5_kvno kvno;
     krb5_deltat        max_life;
     krb5_deltat        max_renewable_life;
@@ -40,6 +40,9 @@ typedef struct _krb5_db_entry {
 /* XXX depends on knowledge of krb5_parse_name() formats */
 #define KRB5_KDB_M_NAME                "K/M"   /* Kerberos/Master */
 
+#define KDB_CONVERT_KEY_TO_DB(in,out) krb5_kdb_encrypt_key(&master_encblock, in, out)
+#define KDB_CONVERT_KEY_OUTOF_DB(in, out) krb5_kdb_decrypt_key(&master_encblock, in, out)
+
 /* prompts used by default when reading the KDC password from the keyboard. */
 #define KRB5_KDC_MKEY_1        "Enter KDC database master key:"
 #define KRB5_KDC_MKEY_2        "Re-enter KDC database master key to verify:"
@@ -89,10 +92,10 @@ krb5_error_code krb5_db_store_mkey PROTOTYPE((char *,
 krb5_error_code krb5_kdb_encrypt_key
        PROTOTYPE((krb5_encrypt_block *,
                   const krb5_keyblock *,
-                  krb5_keyblock *));
+                  krb5_encrypted_keyblock *));
 krb5_error_code krb5_kdb_decrypt_key
        PROTOTYPE((krb5_encrypt_block *,
-                  const krb5_keyblock *,
+                  const krb5_encrypted_keyblock *,
                   krb5_keyblock *));
 krb5_error_code krb5_db_setup_mkey_name
        PROTOTYPE((const char *, const char *, char **, krb5_principal *));
index 5a65823e1ac109867dd376c3ddfaff755b4cce42..a6a376da1748ec3f2323eb0fb28835253b3986b1 100644 (file)
@@ -234,8 +234,7 @@ krb5_data **response;                       /* filled in with a response packet */
 
     /* convert server.key into a real key (it may be encrypted
        in the database) */
-    if (retval = kdc_convert_key(&server.key, &encrypting_key,
-                                CONVERT_OUTOF_DB)) {
+    if (retval = KDB_CONVERT_KEY_OUTOF_DB(&server.key, &encrypting_key)) {
        cleanup();
        return retval;
     }
@@ -288,8 +287,7 @@ krb5_data **response;                       /* filled in with a response packet */
 
     /* convert client.key into a real key (it may be encrypted
        in the database) */
-    if (retval = kdc_convert_key(&client.key, &encrypting_key,
-                                CONVERT_OUTOF_DB)) {
+    if (retval = KDB_CONVERT_KEY_OUTOF_DB(&client.key, &encrypting_key)) {
        cleanup();
        return retval;
     }
index bd791c3edee8fd62e7a49b8a722dc07afbb05ca1..06e9a74daaf76831e7dcba5f06cdbef902c4b87c 100644 (file)
@@ -398,8 +398,7 @@ krb5_data **response;                       /* filled in with a response packet */
     } else {
        /* convert server.key into a real key (it may be encrypted
           in the database) */
-       if (retval = kdc_convert_key(&server.key, &encrypting_key,
-                                    CONVERT_OUTOF_DB)) {
+       if (retval = KDB_CONVERT_KEY_OUTOF_DB(&server.key, &encrypting_key)) {
            cleanup();
            return retval;
        }
index b70b0efa4340ecefb04abae6596b3df52fb444a9..39f06145b321fa34b060532264cab1aec7c0169c 100644 (file)
@@ -183,8 +183,7 @@ krb5_ticket **ticket;
     }
     /* convert server.key into a real key (it may be encrypted
        in the database) */
-    if (retval = kdc_convert_key(&server.key, &encrypting_key,
-                                CONVERT_OUTOF_DB)) {
+    if (retval = KDB_CONVERT_KEY_OUTOF_DB(&server.key, &encrypting_key)) {
        krb5_db_free_principal(&server, nprincs);
        cleanup_apreq();
        return retval;
@@ -271,19 +270,6 @@ krb5_ticket **ticket;
     return 0;
 }
 
-krb5_error_code
-kdc_convert_key(in, out, direction)
-krb5_keyblock *in, *out;
-int direction;
-{
-    if (direction == CONVERT_INTO_DB) {
-       return krb5_kdb_encrypt_key(&master_encblock, in, out);
-    } else if (direction == CONVERT_OUTOF_DB) {
-       return krb5_kdb_decrypt_key(&master_encblock, in, out);
-    } else
-       return KRB5_KDB_ILLDIRECTION;
-}
-
 /* This probably wants to be updated if you support last_req stuff */
 
 static krb5_last_req_entry *nolrarray[] = { 0 };