use macros to hide abstraction
authorJohn Kohl <jtkohl@mit.edu>
Thu, 20 Sep 1990 16:23:00 +0000 (16:23 +0000)
committerJohn Kohl <jtkohl@mit.edu>
Thu, 20 Sep 1990 16:23:00 +0000 (16:23 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@1141 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/krb5/krb/decrypt_tk.c
src/lib/krb5/krb/encode_kdc.c
src/lib/krb5/krb/encrypt_tk.c
src/lib/krb5/krb/kdc_rep_dc.c
src/lib/krb5/krb/mk_priv.c
src/lib/krb5/krb/mk_req_ext.c
src/lib/krb5/krb/rd_priv.c
src/lib/krb5/krb/rd_req_dec.c

index ee879962414f9298690a1d3b854104de2dacd7ca..64fb6848c79224dd3753e50e2df7f323f7068853 100644 (file)
@@ -53,22 +53,21 @@ register krb5_ticket *ticket;
        return(ENOMEM);
 
     /* do any necessary key pre-processing */
-    if (retval = (*eblock.crypto_entry->process_key)(&eblock, srv_key)) {
+    if (retval = krb5_process_key(&eblock, srv_key)) {
        free(scratch.data);
        return(retval);
     }
 
     /* call the encryption routine */
-    if (retval =
-       (*eblock.crypto_entry->decrypt_func)((krb5_pointer) ticket->enc_part.data,
-                                            (krb5_pointer) scratch.data,
-                                            scratch.length, &eblock, 0)) {
-       (void) (*eblock.crypto_entry->finish_key)(&eblock);
+    if (retval = krb5_decrypt((krb5_pointer) ticket->enc_part.data,
+                             (krb5_pointer) scratch.data,
+                             scratch.length, &eblock, 0)) {
+       (void) krb5_finish_key(&eblock);
        free(scratch.data);
        return retval;
     }
 #define clean_scratch() {bzero(scratch.data, scratch.length); free(scratch.data);}
-    if (retval = (*eblock.crypto_entry->finish_key)(&eblock)) {
+    if (retval = krb5_finish_key(&eblock)) {
 
        clean_scratch();
        return retval;
index 767596bccd2ee215df9584d51f66b568eea3b2e2..0a8397ef7c8444ef3a07437fbedd86766d16e1b9 100644 (file)
@@ -87,23 +87,22 @@ OLDDECLARG(krb5_data **, enc_rep)
 
 #define cleanup_encpart() {(void) bzero(dec_rep->enc_part.data, dec_rep->enc_part.length); free(dec_rep->enc_part.data); dec_rep->enc_part.length = 0; dec_rep->enc_part.data = 0;}
 
-    if (retval = (*eblock.crypto_entry->process_key)(&eblock, client_key)) {
+    if (retval = krb5_process_key(&eblock, client_key)) {
        goto clean_encpart;
     }
 
-#define cleanup_prockey() {(void) (*eblock.crypto_entry->finish_key)(&eblock);}
+#define cleanup_prockey() {(void) krb5_finish_key(&eblock);}
 
-    if (retval =
-       (*eblock.crypto_entry->encrypt_func)((krb5_pointer) scratch->data,
-                                            (krb5_pointer) dec_rep->enc_part.data,
-                                            scratch->length, &eblock, 0)) {
+    if (retval = krb5_encrypt((krb5_pointer) scratch->data,
+                             (krb5_pointer) dec_rep->enc_part.data,
+                             scratch->length, &eblock, 0)) {
        goto clean_prockey;
     }
 
     /* do some cleanup */
     cleanup_scratch();
 
-    if (retval = (*eblock.crypto_entry->finish_key)(&eblock)) {
+    if (retval = krb5_finish_key(&eblock)) {
        cleanup_encpart();
        return retval;
     }
index ca5c73f23dfe5b962114c95a0de9763ac5c5df61..701149aae753edae30535f136131c7e0b2fce55c 100644 (file)
@@ -75,24 +75,23 @@ register krb5_ticket *dec_ticket;
 #define cleanup_encpart() {(void) bzero(dec_ticket->enc_part.data, dec_ticket->enc_part.length); free(dec_ticket->enc_part.data); dec_ticket->enc_part.length = 0; dec_ticket->enc_part.data = 0;}
 
     /* do any necessary key pre-processing */
-    if (retval = (*eblock.crypto_entry->process_key)(&eblock, srv_key)) {
+    if (retval = krb5_process_key(&eblock, srv_key)) {
        goto clean_encpart;
     }
 
-#define cleanup_prockey() {(void) (*eblock.crypto_entry->finish_key)(&eblock);}
+#define cleanup_prockey() {(void) krb5_finish_key(&eblock);}
 
     /* call the encryption routine */
-    if (retval =
-       (*eblock.crypto_entry->encrypt_func)((krb5_pointer) scratch->data,
-                                            (krb5_pointer) dec_ticket->enc_part.data,
-                                            scratch->length, &eblock, 0)) {
+    if (retval = krb5_encrypt((krb5_pointer) scratch->data,
+                             (krb5_pointer) dec_ticket->enc_part.data,
+                             scratch->length, &eblock, 0)) {
        goto clean_prockey;
     }
 
     /* ticket is now assembled-- do some cleanup */
     cleanup_scratch();
 
-    if (retval = (*eblock.crypto_entry->finish_key)(&eblock)) {
+    if (retval = krb5_finish_key(&eblock)) {
        cleanup_encpart();
        return retval;
     }
index f7c8f479e62af574b67a02c8686ec9cc4cd3e4cf..a2fa5b502a897357db8d728b462ba2e55c8b2182 100644 (file)
@@ -55,22 +55,21 @@ OLDDECLARG(krb5_kdc_rep *, dec_rep)
     eblock.crypto_entry = krb5_csarray[dec_rep->etype]->system;
 
     /* do any necessary key pre-processing */
-    if (retval = (*eblock.crypto_entry->process_key)(&eblock, key)) {
+    if (retval = krb5_process_key(&eblock, key)) {
        free(scratch.data);
        return(retval);
     }
 
     /* call the decryption routine */
-    if (retval =
-       (*eblock.crypto_entry->decrypt_func)((krb5_pointer) dec_rep->enc_part.data,
-                                            (krb5_pointer) scratch.data,
-                                            scratch.length, &eblock, 0)) {
-       (void) (*eblock.crypto_entry->finish_key)(&eblock);
+    if (retval = krb5_decrypt((krb5_pointer) dec_rep->enc_part.data,
+                             (krb5_pointer) scratch.data,
+                             scratch.length, &eblock, 0)) {
+       (void) krb5_finish_key(&eblock);
        free(scratch.data);
        return retval;
     }
 #define clean_scratch() {bzero(scratch.data, scratch.length); free(scratch.data);}
-    if (retval = (*eblock.crypto_entry->finish_key)(&eblock)) {
+    if (retval = krb5_finish_key(&eblock)) {
        clean_scratch();
        return retval;
     }
index 5aa92a3cdab18f24e72e5e7a3ffb04be1ba61de3..651504dab008bdbee5934365a4a6ca0f2e2b6fee 100644 (file)
@@ -108,18 +108,17 @@ OLDDECLARG(krb5_data *, outbuf)
 #define cleanup_encpart() {(void) bzero(privmsg.enc_part.data, privmsg.enc_part.length); free(privmsg.enc_part.data); privmsg.enc_part.length = 0; privmsg.enc_part.data = 0;}
 
     /* do any necessary key pre-processing */
-    if (retval = (*eblock.crypto_entry->process_key)(&eblock, key)) {
+    if (retval = krb5_process_key(&eblock, key)) {
         goto clean_encpart;
     }
 
-#define cleanup_prockey() {(void) (*eblock.crypto_entry->finish_key)(&eblock);}
+#define cleanup_prockey() {(void) krb5_finish_key(&eblock);}
 
     /* call the encryption routine */
-    if (retval =
-        (*eblock.crypto_entry->encrypt_func)((krb5_pointer) scratch->data,
-                                             (krb5_pointer) privmsg.enc_part.data,
-                                             scratch->length, &eblock,
-                                            i_vector)) {
+    if (retval = krb5_encrypt((krb5_pointer) scratch->data,
+                             (krb5_pointer) privmsg.enc_part.data,
+                             scratch->length, &eblock,
+                             i_vector)) {
         goto clean_prockey;
     }
 
@@ -133,7 +132,7 @@ OLDDECLARG(krb5_data *, outbuf)
     /* private message is now assembled-- do some cleanup */
     cleanup_scratch();
 
-    if (retval = (*eblock.crypto_entry->finish_key)(&eblock)) {
+    if (retval = krb5_finish_key(&eblock)) {
         cleanup_encpart();
         return retval;
     }
index 0f824301be83699ac0c85d5d95c43811e8138bf5..a2624e8c36f21fab4c01d1dcbe95dfd64a3a81f9 100644 (file)
@@ -137,25 +137,23 @@ krb5_data *outbuf;
 #define cleanup_encpart() {(void) bzero(request.authenticator.data, request.authenticator.length); free(request.authenticator.data); request.authenticator.length = 0; request.authenticator.data = 0;}
 
     /* do any necessary key pre-processing */
-    if (retval = (*eblock.crypto_entry->process_key)(&eblock,
-                                                    &creds->keyblock)) {
+    if (retval = krb5_process_key(&eblock, &creds->keyblock)) {
        goto clean_encpart;
     }
 
-#define cleanup_prockey() {(void) (*eblock.crypto_entry->finish_key)(&eblock);}
+#define cleanup_prockey() {(void) krb5_finish_key(&eblock);}
 
     /* call the encryption routine */
-    if (retval =
-       (*eblock.crypto_entry->encrypt_func)((krb5_pointer) scratch->data,
-                                            (krb5_pointer) request.authenticator.data,
-                                            scratch->length, &eblock, 0)) {
+    if (retval = krb5_encrypt((krb5_pointer) scratch->data,
+                             (krb5_pointer) request.authenticator.data,
+                             scratch->length, &eblock, 0)) {
        goto clean_prockey;
     }
 
     /* authenticator now assembled-- do some cleanup */
     cleanup_scratch();
 
-    if (retval = (*eblock.crypto_entry->finish_key)(&eblock)) {
+    if (retval = krb5_finish_key(&eblock)) {
        cleanup_encpart();
        return retval;
     }
index b59a90c163098838006b25adcbb933b8f6d44f7c..45bd4f5006a3c9819a691b030b66887999370691 100644 (file)
@@ -94,20 +94,19 @@ OLDDECLARG(krb5_data *, outbuf)
 #define cleanup_scratch() {(void)bzero(scratch.data, scratch.length); (void)xfree(scratch.data);}
 
     /* do any necessary key pre-processing */
-    if (retval = (*eblock.crypto_entry->process_key)(&eblock, key)) {
+    if (retval = krb5_process_key(&eblock, key)) {
         cleanup_privmsg();
        cleanup_scratch();
        return retval;
     }
 
-#define cleanup_prockey() {(void) (*eblock.crypto_entry->finish_key)(&eblock);}
+#define cleanup_prockey() {(void) krb5_finish_key(&eblock);}
 
     /* call the decryption routine */
-    if (retval =
-        (*eblock.crypto_entry->decrypt_func)((krb5_pointer) privmsg->enc_part.data,
-                                             (krb5_pointer) scratch.data,
-                                             scratch.length, &eblock,
-                                            i_vector)) {
+    if (retval = krb5_decrypt((krb5_pointer) privmsg->enc_part.data,
+                             (krb5_pointer) scratch.data,
+                             scratch.length, &eblock,
+                             i_vector)) {
        cleanup_privmsg();
        cleanup_scratch();
         cleanup_prockey();
@@ -127,7 +126,7 @@ OLDDECLARG(krb5_data *, outbuf)
 
     cleanup_privmsg();
 
-    if (retval = (*eblock.crypto_entry->finish_key)(&eblock)) {
+    if (retval = krb5_finish_key(&eblock)) {
         cleanup_scratch();
         return retval;
     }
index d9c326f25c7f72bac53bbfe82717bea78ac340f7..9be554eef54f3632de5ce2ce53bbf3b48817f965 100644 (file)
@@ -196,22 +196,21 @@ krb5_authenticator **authpp;
        return(ENOMEM);
 
     /* do any necessary key pre-processing */
-    if (retval = (*eblock.crypto_entry->process_key)(&eblock, sesskey)) {
+    if (retval = krb5_process_key(&eblock, sesskey)) {
        free(scratch.data);
        return(retval);
     }
 
     /* call the encryption routine */
-    if (retval =
-       (*eblock.crypto_entry->decrypt_func)((krb5_pointer) request->authenticator.data,
-                                            (krb5_pointer) scratch.data,
-                                            scratch.length, &eblock, 0)) {
-       (void) (*eblock.crypto_entry->finish_key)(&eblock);
+    if (retval = krb5_decrypt((krb5_pointer) request->authenticator.data,
+                             (krb5_pointer) scratch.data,
+                             scratch.length, &eblock, 0)) {
+       (void) krb5_finish_key(&eblock);
        free(scratch.data);
        return retval;
     }
 #define clean_scratch() {bzero(scratch.data, scratch.length); free(scratch.data);}
-    if (retval = (*eblock.crypto_entry->finish_key)(&eblock)) {
+    if (retval = krb5_finish_key(&eblock)) {
 
        clean_scratch();
        return retval;