diff options
author | Theodore Tso <tytso@mit.edu> | 1994-11-21 20:33:53 +0000 |
---|---|---|
committer | Theodore Tso <tytso@mit.edu> | 1994-11-21 20:33:53 +0000 |
commit | 713fb98f15b22f626aa792a60f0e00f502a04456 (patch) | |
tree | 9210ae111762a6758d03304ccbc755b41f8f5a8e /src/lib/krb5/krb/encrypt_tk.c | |
parent | 701efdf4670d556f9164a87ce44939c2cd3f050d (diff) | |
download | krb5-713fb98f15b22f626aa792a60f0e00f502a04456.tar.gz krb5-713fb98f15b22f626aa792a60f0e00f502a04456.tar.xz krb5-713fb98f15b22f626aa792a60f0e00f502a04456.zip |
encode_kdc.c (krb5_encode_kdc_rep): Now requires that the
caller pass in the encryption block to be used for
encrpyting the ticket. That way, this routine doesn't
need to create its own encryption block.
encrypt_tk.c (krb5_encrypt_tkt_part): Now requires that the
caller pass in the encryption block to be used for
encrpyting the ticket. That way, this routine doesn't
need to create its own encryption block.
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@4710 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/lib/krb5/krb/encrypt_tk.c')
-rw-r--r-- | src/lib/krb5/krb/encrypt_tk.c | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/src/lib/krb5/krb/encrypt_tk.c b/src/lib/krb5/krb/encrypt_tk.c index 4051ca6bb3..bb263da007 100644 --- a/src/lib/krb5/krb/encrypt_tk.c +++ b/src/lib/krb5/krb/encrypt_tk.c @@ -44,20 +44,15 @@ */ krb5_error_code -krb5_encrypt_tkt_part(srv_key, dec_ticket) +krb5_encrypt_tkt_part(eblock, srv_key, dec_ticket) +krb5_encrypt_block *eblock; const krb5_keyblock *srv_key; register krb5_ticket *dec_ticket; { krb5_data *scratch; krb5_error_code retval; - krb5_encrypt_block eblock; register krb5_enc_tkt_part *dec_tkt_part = dec_ticket->enc_part2; - /* encrypt the encrypted part */ - - if (!valid_etype(dec_ticket->enc_part.etype)) - return KRB5_PROG_ETYPE_NOSUPP; - /* start by encoding the to-be-encrypted part. */ if (retval = encode_krb5_enc_tkt_part(dec_tkt_part, &scratch)) { return retval; @@ -66,12 +61,8 @@ register krb5_ticket *dec_ticket; #define cleanup_scratch() { (void) memset(scratch->data, 0, scratch->length); \ krb5_free_data(scratch); } - /* put together an eblock for this encryption */ - - krb5_use_cstype(&eblock, dec_ticket->enc_part.etype); dec_ticket->enc_part.ciphertext.length = - krb5_encrypt_size(scratch->length, - eblock.crypto_entry); + krb5_encrypt_size(scratch->length, eblock->crypto_entry); /* add padding area, and zero it */ if (!(scratch->data = realloc(scratch->data, dec_ticket->enc_part.ciphertext.length))) { @@ -95,23 +86,25 @@ dec_ticket->enc_part.ciphertext.length = 0; \ dec_ticket->enc_part.ciphertext.data = 0;} /* do any necessary key pre-processing */ - if (retval = krb5_process_key(&eblock, srv_key)) { + if (retval = krb5_process_key(eblock, srv_key)) { goto clean_encpart; } -#define cleanup_prockey() {(void) krb5_finish_key(&eblock);} +#define cleanup_prockey() {(void) krb5_finish_key(eblock);} /* call the encryption routine */ if (retval = krb5_encrypt((krb5_pointer) scratch->data, (krb5_pointer) dec_ticket->enc_part.ciphertext.data, - scratch->length, &eblock, 0)) { + scratch->length, eblock, 0)) { goto clean_prockey; } + dec_ticket->enc_part.etype = krb5_eblock_enctype(eblock); + /* ticket is now assembled-- do some cleanup */ cleanup_scratch(); - if (retval = krb5_finish_key(&eblock)) { + if (retval = krb5_finish_key(eblock)) { cleanup_encpart(); return retval; } |