diff options
author | John Kohl <jtkohl@mit.edu> | 1990-10-10 17:19:54 +0000 |
---|---|---|
committer | John Kohl <jtkohl@mit.edu> | 1990-10-10 17:19:54 +0000 |
commit | c1b41eb1f2af031cb9e999c274378653f5ce3872 (patch) | |
tree | 3b0b7b424958c1fa55797809f678df274a03a171 /src/lib/krb5/krb/encode_kdc.c | |
parent | 8c6003de6cf943286a987fc2494078754c156704 (diff) | |
download | krb5-c1b41eb1f2af031cb9e999c274378653f5ce3872.tar.gz krb5-c1b41eb1f2af031cb9e999c274378653f5ce3872.tar.xz krb5-c1b41eb1f2af031cb9e999c274378653f5ce3872.zip |
changes for new encryption data structures
and new message styles for KDC requests.
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@1226 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/lib/krb5/krb/encode_kdc.c')
-rw-r--r-- | src/lib/krb5/krb/encode_kdc.c | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/src/lib/krb5/krb/encode_kdc.c b/src/lib/krb5/krb/encode_kdc.c index 0a8397ef7..4c7f9f81e 100644 --- a/src/lib/krb5/krb/encode_kdc.c +++ b/src/lib/krb5/krb/encode_kdc.c @@ -31,9 +31,10 @@ static char rcsid_encode_kdc_c [] = returns system errors - dec_rep->enc_part is allocated and filled in. + dec_rep->enc_part.ciphertext is allocated and filled in. */ -/* due to promotion rules, we need to play with this... */ +/* due to argument promotion rules, we need to use the DECLARG/OLDDECLARG + stuff... */ krb5_error_code krb5_encode_kdc_rep(DECLARG(const krb5_msgtype, type), DECLARG(const register krb5_enc_kdc_rep_part *, encpart), @@ -50,7 +51,7 @@ OLDDECLARG(krb5_data **, enc_rep) krb5_encrypt_block eblock; krb5_error_code retval; - if (!valid_etype(dec_rep->etype)) + if (!valid_etype(dec_rep->enc_part.etype)) return KRB5_PROG_ETYPE_NOSUPP; switch (type) { @@ -69,23 +70,30 @@ OLDDECLARG(krb5_data **, enc_rep) /* put together an eblock for this encryption */ - eblock.crypto_entry = krb5_csarray[dec_rep->etype]->system; - dec_rep->enc_part.length = krb5_encrypt_size(scratch->length, - eblock.crypto_entry); + eblock.crypto_entry = krb5_csarray[dec_rep->enc_part.etype]->system; + dec_rep->enc_part.ciphertext.length = + krb5_encrypt_size(scratch->length, eblock.crypto_entry); /* add padding area, and zero it */ - if (!(scratch->data = realloc(scratch->data, dec_rep->enc_part.length))) { + if (!(scratch->data = realloc(scratch->data, + dec_rep->enc_part.ciphertext.length))) { /* may destroy scratch->data */ xfree(scratch); return ENOMEM; } bzero(scratch->data + scratch->length, - dec_rep->enc_part.length - scratch->length); - if (!(dec_rep->enc_part.data = malloc(dec_rep->enc_part.length))) { + dec_rep->enc_part.ciphertext.length - scratch->length); + if (!(dec_rep->enc_part.ciphertext.data = + malloc(dec_rep->enc_part.ciphertext.length))) { retval = ENOMEM; goto clean_scratch; } -#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;} +#define cleanup_encpart() { \ +(void) bzero(dec_rep->enc_part.ciphertext.data, \ + dec_rep->enc_part.ciphertext.length); \ +free(dec_rep->enc_part.ciphertext.data); \ +dec_rep->enc_part.ciphertext.length = 0; \ +dec_rep->enc_part.ciphertext.data = 0;} if (retval = krb5_process_key(&eblock, client_key)) { goto clean_encpart; @@ -94,7 +102,7 @@ OLDDECLARG(krb5_data **, enc_rep) #define cleanup_prockey() {(void) krb5_finish_key(&eblock);} if (retval = krb5_encrypt((krb5_pointer) scratch->data, - (krb5_pointer) dec_rep->enc_part.data, + (krb5_pointer) dec_rep->enc_part.ciphertext.data, scratch->length, &eblock, 0)) { goto clean_prockey; } |