diff options
author | John Kohl <jtkohl@mit.edu> | 1990-02-07 17:49:56 +0000 |
---|---|---|
committer | John Kohl <jtkohl@mit.edu> | 1990-02-07 17:49:56 +0000 |
commit | c65efafe73234062a1a2bb721c9330ac98591df0 (patch) | |
tree | 698ae21d16b130d725089fb4884f81d4597d1e62 /src/lib/krb5/krb/kdc_rep_dc.c | |
parent | 6628a5fd5f603491b9cf7a64cbcd5e1e2e3df20f (diff) | |
download | krb5-c65efafe73234062a1a2bb721c9330ac98591df0.zip krb5-c65efafe73234062a1a2bb721c9330ac98591df0.tar.gz krb5-c65efafe73234062a1a2bb721c9330ac98591df0.tar.bz2 |
*** empty log message ***
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@315 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/lib/krb5/krb/kdc_rep_dc.c')
-rw-r--r-- | src/lib/krb5/krb/kdc_rep_dc.c | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/src/lib/krb5/krb/kdc_rep_dc.c b/src/lib/krb5/krb/kdc_rep_dc.c new file mode 100644 index 0000000..7dfdfad --- /dev/null +++ b/src/lib/krb5/krb/kdc_rep_dc.c @@ -0,0 +1,76 @@ +/* + * $Source$ + * $Author$ + * + * Copyright 1990 by the Massachusetts Institute of Technology. + * + * For copying and distribution information, please see the file + * <krb5/mit-copyright.h>. + * + * krb5_kdc_rep_tkt_decrypt() + */ + +#if !defined(lint) && !defined(SABER) +static char rcsid_kdc_rep_dc_c [] = +"$Id$"; +#endif /* !lint & !SABER */ + +#include <krb5/copyright.h> +#include <krb5/krb5.h> +#include <krb5/krb5_err.h> +#include <krb5/ext-proto.h> +#include <errno.h> + +/*ARGSUSED*/ +krb5_error_code +krb5_kdc_rep_decrypt_proc(dec_rep, key, decryptarg) +krb5_kdc_rep *dec_rep; +krb5_keyblock *key; +krb5_pointer decryptarg; +{ + krb5_error_code retval; + krb5_encrypt_block eblock; + krb5_data scratch; + krb5_enc_kdc_rep_part *local_encpart; + + if (!valid_etype(dec_rep->etype)) + return KRB5KDC_ERR_ETYPE_NOSUPP; + + scratch.length = dec_rep->enc_part.length; + if (!(scratch.data = malloc(dec_rep->enc_part.length))) { + return(ENOMEM); + } + + /* put together an eblock for this encryption */ + + eblock.crypto_entry = krb5_csarray[dec_rep->etype]->system; + + /* do any necessary key pre-processing */ + if (retval = (*eblock.crypto_entry->process_key)(&eblock, key)) { + free(scratch.data); + return(retval); + } + + /* call the encryption routine */ + if (retval = + (*eblock.crypto_entry->decrypt_func)((krb5_pointer) dec_rep->enc_part.data, + (krb5_pointer) scratch.data, + scratch.length, &eblock)) { + (void) (*eblock.crypto_entry->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)) { + clean_scratch(); + return retval; + } + retval = decode_krb5_enc_kdc_rep_part(&scratch, &local_encpart); + clean_scratch(); + if (retval) + return retval; + + dec_rep->enc_part2 = local_encpart; + + return 0; +} |