From: John Kohl Date: Thu, 20 Sep 1990 16:23:00 +0000 (+0000) Subject: use macros to hide abstraction X-Git-Tag: krb5-1.0-alpha2~270 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=f2769fa77c6cc1910982f63f82e678e9f990266c;p=krb5.git use macros to hide abstraction git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@1141 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/krb5/krb/decrypt_tk.c b/src/lib/krb5/krb/decrypt_tk.c index ee8799624..64fb6848c 100644 --- a/src/lib/krb5/krb/decrypt_tk.c +++ b/src/lib/krb5/krb/decrypt_tk.c @@ -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; diff --git a/src/lib/krb5/krb/encode_kdc.c b/src/lib/krb5/krb/encode_kdc.c index 767596bcc..0a8397ef7 100644 --- a/src/lib/krb5/krb/encode_kdc.c +++ b/src/lib/krb5/krb/encode_kdc.c @@ -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; } diff --git a/src/lib/krb5/krb/encrypt_tk.c b/src/lib/krb5/krb/encrypt_tk.c index ca5c73f23..701149aae 100644 --- a/src/lib/krb5/krb/encrypt_tk.c +++ b/src/lib/krb5/krb/encrypt_tk.c @@ -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; } diff --git a/src/lib/krb5/krb/kdc_rep_dc.c b/src/lib/krb5/krb/kdc_rep_dc.c index f7c8f479e..a2fa5b502 100644 --- a/src/lib/krb5/krb/kdc_rep_dc.c +++ b/src/lib/krb5/krb/kdc_rep_dc.c @@ -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; } diff --git a/src/lib/krb5/krb/mk_priv.c b/src/lib/krb5/krb/mk_priv.c index 5aa92a3cd..651504dab 100644 --- a/src/lib/krb5/krb/mk_priv.c +++ b/src/lib/krb5/krb/mk_priv.c @@ -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; } diff --git a/src/lib/krb5/krb/mk_req_ext.c b/src/lib/krb5/krb/mk_req_ext.c index 0f824301b..a2624e8c3 100644 --- a/src/lib/krb5/krb/mk_req_ext.c +++ b/src/lib/krb5/krb/mk_req_ext.c @@ -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; } diff --git a/src/lib/krb5/krb/rd_priv.c b/src/lib/krb5/krb/rd_priv.c index b59a90c16..45bd4f500 100644 --- a/src/lib/krb5/krb/rd_priv.c +++ b/src/lib/krb5/krb/rd_priv.c @@ -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; } diff --git a/src/lib/krb5/krb/rd_req_dec.c b/src/lib/krb5/krb/rd_req_dec.c index d9c326f25..9be554eef 100644 --- a/src/lib/krb5/krb/rd_req_dec.c +++ b/src/lib/krb5/krb/rd_req_dec.c @@ -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;