/*
*
* Copyright 1990 by the Massachusetts Institute of Technology.
* All Rights Reserved.
*
* Export of this software from the United States of America may
* require a specific license from the United States Government.
* It is the responsibility of any person or organization contemplating
* export to obtain such a license before exporting.
*
* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
* distribute this software and its documentation for any purpose and
* without fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright notice and
* this permission notice appear in supporting documentation, and that
* the name of M.I.T. not be used in advertising or publicity pertaining
* to distribution of the software without specific, written prior
* permission. Furthermore if you modify this software you must label
* your software as modified software and not distribute it in such a
* fashion that it might be confused with the original M.I.T. software.
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is" without express
* or implied warranty.
*
*
* krb5_encode_kdc_rep() function.
*/
#include "k5-int.h"
/*
Takes KDC rep parts in *rep and *encpart, and formats it into *enc_rep,
using message type type and encryption key client_key and encryption type
etype.
The string *enc_rep will be allocated before formatting; the caller should
free when finished.
returns system errors
dec_rep->enc_part.ciphertext is allocated and filled in.
*/
/* due to argument promotion rules, we need to use the DECLARG/OLDDECLARG
stuff... */
const krb5_enc_kdc_rep_part *encpart,
{
return KRB5_PROG_ETYPE_NOSUPP;
switch (type) {
case KRB5_AS_REP:
break;
case KRB5_TGS_REP:
if (using_subkey)
else
break;
default:
return KRB5_BADMSGTYPE;
}
/*
* We don't want to modify encpart, but we need to be able to pass
* in the message type to the encoder, so it can set the ASN.1
* type correct.
*
* Although note that it may be doing nothing with the message
* type, to be compatible with old versions of Kerberos that always
* encode this as a TGS_REP regardly of what it really should be;
* also note that the reason why we are passing it in a structure
* instead of as an argument to encode_krb5_enc_kdc_rep_part (the
* way we should) is for compatibility with the ISODE version of
* this fuction. Ah, compatibility....
*/
tmp_encpart = *encpart;
if (retval) {
return retval;
}
#define cleanup_encpart() { \
if (retval)
return(retval);
/* now it's ready to be encoded for the wire! */
switch (type) {
case KRB5_AS_REP:
break;
case KRB5_TGS_REP:
break;
}
if (retval)
return retval;
}