spnego_asn1.c revision 444f2a8efd07b9b4472781fbab89208eb1c4c5f5
/*
* Copyright (C) 2006, 2007, 2012, 2013 Internet Systems Consortium, Inc. ("ISC")
*
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: spnego_asn1.c,v 1.4 2007/06/19 23:47:16 tbox Exp $ */
/*! \file
* \brief Method routines generated from SPNEGO ASN.1 module.
* See spnego_asn1.pl for details. Do not edit.
*/
/* Generated from spnego.asn1 */
/* Do not edit */
#ifndef __asn1_h__
#define __asn1_h__
#ifndef __asn1_common_definitions__
#define __asn1_common_definitions__
typedef struct octet_string {
void *data;
} octet_string;
typedef char *general_string;
typedef char *utf8_string;
typedef struct oid {
unsigned *components;
} oid;
#define ASN1_MALLOC_ENCODE(T, B, BL, S, L, R) \
do { \
if((B) == NULL) { \
(R) = ENOMEM; \
} else { \
(S), (L)); \
if((R) != 0) { \
free((B)); \
(B) = NULL; \
} \
} \
} while (0)
#endif
/*
* MechType ::= OBJECT IDENTIFIER
*/
static void free_MechType(MechType *);
/* unused declaration: length_MechType */
/* unused declaration: copy_MechType */
/*
* MechTypeList ::= SEQUENCE OF MechType
*/
typedef struct MechTypeList {
unsigned int len;
} MechTypeList;
static void free_MechTypeList(MechTypeList *);
/* unused declaration: length_MechTypeList */
/* unused declaration: copy_MechTypeList */
/*
* ContextFlags ::= BIT STRING { delegFlag(0), mutualFlag(1), replayFlag(2),
* sequenceFlag(3), anonFlag(4), confFlag(5), integFlag(6) }
*/
typedef struct ContextFlags {
unsigned int delegFlag:1;
unsigned int mutualFlag:1;
unsigned int replayFlag:1;
unsigned int sequenceFlag:1;
unsigned int anonFlag:1;
unsigned int confFlag:1;
unsigned int integFlag:1;
} ContextFlags;
static void free_ContextFlags(ContextFlags *);
/* unused declaration: length_ContextFlags */
/* unused declaration: copy_ContextFlags */
/* unused declaration: ContextFlags2int */
/* unused declaration: int2ContextFlags */
/* unused declaration: asn1_ContextFlags_units */
/*
* NegTokenInit ::= SEQUENCE { mechTypes[0] MechTypeList, reqFlags[1]
* ContextFlags OPTIONAL, mechToken[2] OCTET STRING OPTIONAL,
* mechListMIC[3] OCTET STRING OPTIONAL }
*/
typedef struct NegTokenInit {
} NegTokenInit;
static void free_NegTokenInit(NegTokenInit *);
/* unused declaration: length_NegTokenInit */
/* unused declaration: copy_NegTokenInit */
/*
* NegTokenResp ::= SEQUENCE { negState[0] ENUMERATED {
* accept-completed(0), accept-incomplete(1), reject(2), request-mic(3) }
* OPTIONAL, supportedMech[1] MechType OPTIONAL, responseToken[2] OCTET
* STRING OPTIONAL, mechListMIC[3] OCTET STRING OPTIONAL }
*/
typedef struct NegTokenResp {
enum {
accept_completed = 0,
accept_incomplete = 1,
reject = 2,
request_mic = 3
} *negState;
} NegTokenResp;
static void free_NegTokenResp(NegTokenResp *);
/* unused declaration: length_NegTokenResp */
/* unused declaration: copy_NegTokenResp */
#endif /* __asn1_h__ */
/* Generated from spnego.asn1 */
/* Do not edit */
static int
{
size_t l;
int e;
BACK;
return 0;
}
static int
{
size_t l;
int e;
FORW;
if (size)
return 0;
fail:
return e;
}
static void
{
}
/* unused function: length_MechType */
/* unused function: copy_MechType */
/* Generated from spnego.asn1 */
/* Do not edit */
static int
{
size_t l;
int i, e;
ret = 0;
BACK;
}
BACK;
return 0;
}
static int
{
size_t l;
int e;
reallen = 0;
FORW;
return ASN1_OVERRUN;
{
ret = 0;
return ENOMEM;
}
FORW;
}
}
if (size)
return 0;
fail:
return e;
}
static void
{
}
}
/* unused function: length_MechTypeList */
/* unused function: copy_MechTypeList */
/* Generated from spnego.asn1 */
/* Do not edit */
static int
{
size_t l;
int e;
{
unsigned char c = 0;
*p-- = c;
len--;
ret++;
c = 0;
*p-- = c;
len--;
ret++;
c = 0;
*p-- = c;
len--;
ret++;
c = 0;
c |= 1 << 1;
c |= 1 << 2;
c |= 1 << 3;
if (data->sequenceFlag)
c |= 1 << 4;
if (data->replayFlag)
c |= 1 << 5;
if (data->mutualFlag)
c |= 1 << 6;
c |= 1 << 7;
*p-- = c;
*p-- = 0;
len -= 2;
ret += 2;
}
BACK;
return 0;
}
static int
{
size_t l;
int e;
reallen = 0;
FORW;
return ASN1_OVERRUN;
p++;
len--;
reallen--;
ret++;
if (size)
return 0;
fail:
return e;
}
static void
{
(void)data;
}
/* unused function: length_ContextFlags */
/* unused function: copy_ContextFlags */
/* unused function: ContextFlags2int */
/* unused function: int2ContextFlags */
/* unused variable: ContextFlags_units */
/* unused function: asn1_ContextFlags_units */
/* Generated from spnego.asn1 */
/* Do not edit */
static int
{
size_t l;
int e;
if ((data)->mechListMIC) {
ret = 0;
BACK;
BACK;
}
ret = 0;
BACK;
BACK;
}
ret = 0;
BACK;
BACK;
} {
ret = 0;
BACK;
BACK;
}
BACK;
return 0;
}
static int
{
size_t l;
int e;
reallen = 0;
FORW;
{
int dce_fix;
return ASN1_BAD_FORMAT;
{
if (e)
return e;
else {
p += l;
len -= l;
ret += l;
FORW;
{
int dce_fix;
return ASN1_BAD_FORMAT;
FORW;
if (dce_fix) {
FORW;
} else
}
}
}
{
if (e)
else {
p += l;
len -= l;
ret += l;
FORW;
{
int dce_fix;
return ASN1_BAD_FORMAT;
return ENOMEM;
FORW;
if (dce_fix) {
FORW;
} else
}
}
}
{
if (e)
else {
p += l;
len -= l;
ret += l;
FORW;
{
int dce_fix;
return ASN1_BAD_FORMAT;
return ENOMEM;
FORW;
if (dce_fix) {
FORW;
} else
}
}
}
{
if (e)
else {
p += l;
len -= l;
ret += l;
FORW;
{
int dce_fix;
return ASN1_BAD_FORMAT;
return ENOMEM;
FORW;
if (dce_fix) {
FORW;
} else
}
}
}
if (dce_fix) {
FORW;
}
}
if (size)
return 0;
fail:
return e;
}
static void
{
}
}
if ((data)->mechListMIC) {
}
}
/* unused function: length_NegTokenInit */
/* unused function: copy_NegTokenInit */
/* Generated from spnego.asn1 */
/* Do not edit */
static int
{
size_t l;
int e;
if ((data)->mechListMIC) {
ret = 0;
BACK;
BACK;
}
if ((data)->responseToken) {
ret = 0;
BACK;
BACK;
}
if ((data)->supportedMech) {
ret = 0;
BACK;
BACK;
}
ret = 0;
BACK;
BACK;
}
BACK;
return 0;
}
static int
{
size_t l;
int e;
reallen = 0;
FORW;
{
int dce_fix;
return ASN1_BAD_FORMAT;
{
if (e)
else {
p += l;
len -= l;
ret += l;
FORW;
{
int dce_fix;
return ASN1_BAD_FORMAT;
return ENOMEM;
FORW;
if (dce_fix) {
FORW;
} else
}
}
}
{
if (e)
else {
p += l;
len -= l;
ret += l;
FORW;
{
int dce_fix;
return ASN1_BAD_FORMAT;
return ENOMEM;
FORW;
if (dce_fix) {
FORW;
} else
}
}
}
{
if (e)
else {
p += l;
len -= l;
ret += l;
FORW;
{
int dce_fix;
return ASN1_BAD_FORMAT;
return ENOMEM;
FORW;
if (dce_fix) {
FORW;
} else
}
}
}
{
if (e)
else {
p += l;
len -= l;
ret += l;
FORW;
{
int dce_fix;
return ASN1_BAD_FORMAT;
return ENOMEM;
FORW;
if (dce_fix) {
FORW;
} else
}
}
}
if (dce_fix) {
FORW;
}
}
if (size)
return 0;
fail:
return e;
}
static void
{
}
if ((data)->supportedMech) {
}
if ((data)->responseToken) {
}
if ((data)->mechListMIC) {
}
}
/* unused function: length_NegTokenResp */
/* unused function: copy_NegTokenResp */
/* Generated from spnego.asn1 */
/* Do not edit */
/* CHOICE */
/* unused variable: asn1_NegotiationToken_dummy_holder */