/*
*
* Copyright 1994 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.
*/
#include "k5-int.h"
#include "krbasn1.h"
#include "asn1_k_decode.h"
#include "asn1_decode.h"
#include "asn1_get.h"
/* setup *********************************************************/
/* set up variables */
/* the setup* macros can return, but are always used at function start
and thus need no malloc cleanup */
#define setup_buf_only()\
\
#define setup_no_tagnum()\
#define setup_no_length()\
#define setup()\
unsigned int length;\
/* helper macros for cleanup */
/* alloc_field is the first thing to allocate storage that may need cleanup */
/* process encoding header ***************************************/
/* decode tag and check that it == [APPLICATION tagnum] */
{ \
}
/* process a structure *******************************************/
/* decode an explicit tag and place the number in tagnum */
#define next_tag() \
}
#define get_eoc() \
{ \
return ASN1_MISSING_EOC; \
}
/* decode sequence header and initialize tagnum with the first field */
#define begin_structure()\
unsigned int taglen;\
int seqindef;\
int indef;\
next_tag()
#define end_structure()\
/* process fields *******************************************/
/* normal fields ************************/
next_tag()
/* decode a field (<[UNIVERSAL id]> <length> <contents>)
check that the id number == tagexpect then
decode into var
get the next tag */
/* decode (or skip, if not present) an optional field */
} \
}
/* field w/ accompanying length *********/
next_tag()
/* decode a field w/ its length (for string types) */
/* decode an optional field w/ length */
} \
}
/* clean up ******************************************************/
/* finish up */
/* to make things less painful, assume the cleanup is passed rep */
return 0; \
error_out: \
cleanup_routine(*rep); \
} \
return retval;
#define cleanup_none()\
return 0; \
error_out: \
return retval;
#define cleanup_manual()\
return 0;
{
setup();
check_apptag(2);
{ begin_structure();
if(tagnum == 3){
}
}
return retval;
}
{
}
{
setup();
check_apptag(1);
{ begin_structure();
}
}
}
return retval;
}
{
setup();
{ begin_structure();
}
}
{
setup();
check_apptag(3);
{ begin_structure();
if (tagnum == 6)
else
}
}
return retval;
}
{
else clean_return(KRB5_BADMSGTYPE);
}
{
check_apptag(11);
#ifdef KRB5_MSGTYPE_STRICT
#endif
}
{
check_apptag(13);
#ifdef KRB5_MSGTYPE_STRICT
#endif
}
{
setup();
check_apptag(14);
{ begin_structure();
#ifdef KRB5_MSGTYPE_STRICT
#endif
}
}
}
return retval;
}
{
setup();
check_apptag(15);
{ begin_structure();
#ifdef KRB5_MSGTYPE_STRICT
#endif
}
}
}
{
setup();
check_apptag(27);
{ begin_structure();
}
}
return retval;
}
{
check_apptag(10);
#ifdef KRB5_MSGTYPE_STRICT
#endif
}
{
check_apptag(12);
#ifdef KRB5_MSGTYPE_STRICT
#endif
}
{
}
/*
* decode_krb5_safe_with_body
*
* Like decode_krb5_safe(), but grabs the encoding of the
* KRB-SAFE-BODY as well, in case re-encoding would produce a
* different encoding. (Yes, we're using DER, but there's this
* annoying problem with pre-1.3.x code using signed sequence numbers,
* which we permissively decode and cram into unsigned 32-bit numbers.
* When they're re-encoded, they're no longer negative if they started
* out negative, so checksum verification fails.)
*
* This does *not* perform any copying; the returned pointer to the
* encoded KRB-SAFE-BODY points into the input buffer.
*/
{
setup();
check_apptag(20);
{ begin_structure();
#ifdef KRB5_MSGTYPE_STRICT
#endif
}
/*
* Gross kludge to extract pointer to encoded safe-body. Relies
* on tag prefetch done by next_tag(). Don't handle indefinite
* encoding, as it's too much work.
*/
if (!indef) {
} else {
}
}
}
return retval;
}
{
}
{
setup();
check_apptag(21);
{ begin_structure();
#ifdef KRB5_MSGTYPE_STRICT
#endif
}
}
}
{
setup();
check_apptag(28);
{ begin_structure();
}
}
return retval;
}
{
setup();
check_apptag(22);
{ begin_structure();
#ifdef KRB5_MSGTYPE_STRICT
#endif
}
}
}
{
setup();
check_apptag(29);
{ begin_structure();
}
}
return retval;
}
{
setup();
check_apptag(30);
{ begin_structure();
#ifdef KRB5_MSGTYPE_STRICT
#endif
}
}
}
return retval;
}
{
*rep = 0;
cleanup_none(); /* we're not allocating anything here... */
}
{
}
{
setup();
{ begin_structure();
end_structure (); }
}
{
*rep = 0;
cleanup_none(); /* we're not allocating anything here */
}
{
setup();
{ begin_structure();
if (tagnum == 1) {
} else {
}
}
}
{
*rep = 0;
cleanup_none(); /* we're not allocating anything here */
}
{
*rep = 0;
if (retval == ASN1_BAD_ID) {
}
cleanup_none(); /* we're not allocating anything here */
}
{
}
{
setup();
{ begin_structure();
if (tagnum == 1) {
} else
end_structure (); }
}
{
}
{
}
krb5_error_code decode_krb5_sam_challenge_2_body(const krb5_data *code, krb5_sam_challenge_2_body **rep)
{
}
{
}
krb5_error_code decode_krb5_enc_sam_response_enc(const krb5_data *code, krb5_enc_sam_response_enc **rep)
{
}
krb5_error_code decode_krb5_enc_sam_response_enc_2(const krb5_data *code, krb5_enc_sam_response_enc_2 **rep)
{
}
{
}
{
}
krb5_error_code decode_krb5_predicted_sam_response(const krb5_data *code, krb5_predicted_sam_response **rep)
{
setup_buf_only(); /* preallocated */
}
{
}
krb5_error_code decode_krb5_pa_pk_as_req_draft9(const krb5_data *code, krb5_pa_pk_as_req_draft9 **rep)
{
}
{
}
krb5_error_code decode_krb5_pa_pk_as_rep_draft9(const krb5_data *code, krb5_pa_pk_as_rep_draft9 **rep)
{
}
{
}
{
}
{
}
{
}
{
if (retval)
goto error_out;
}
return retval;
}
krb5_error_code decode_krb5_reply_key_pack_draft9(const krb5_data *code, krb5_reply_key_pack_draft9 **rep)
{
}
{
}
krb5_error_code decode_krb5_td_trusted_certifiers(const krb5_data *code, krb5_external_principal_identifier ***rep)
{
}
krb5_error_code decode_krb5_td_dh_parameters(const krb5_data *code, krb5_algorithm_identifier ***rep)
{
}