1*ba7b222eSGlenn Barry /* -*- mode: c; indent-tabs-mode: nil -*- */ 27c478bd9Sstevel@tonic-gate #ifndef __KRBASN1_H__ 37c478bd9Sstevel@tonic-gate #define __KRBASN1_H__ 47c478bd9Sstevel@tonic-gate 5159d09a2SMark Phalan #include "k5-int.h" 67c478bd9Sstevel@tonic-gate #include <stdio.h> 77c478bd9Sstevel@tonic-gate #include <errno.h> 8*ba7b222eSGlenn Barry #include <limits.h> /* For INT_MAX */ 97c478bd9Sstevel@tonic-gate #ifdef HAVE_STDLIB_H 107c478bd9Sstevel@tonic-gate #include <stdlib.h> 117c478bd9Sstevel@tonic-gate #endif 127c478bd9Sstevel@tonic-gate 137c478bd9Sstevel@tonic-gate /* 147c478bd9Sstevel@tonic-gate * If KRB5_MSGTYPE_STRICT is defined, then be strict about checking 157c478bd9Sstevel@tonic-gate * the msgtype fields. Unfortunately, there old versions of Kerberos 167c478bd9Sstevel@tonic-gate * don't set these fields correctly, so we have to make allowances for 177c478bd9Sstevel@tonic-gate * them. 187c478bd9Sstevel@tonic-gate */ 197c478bd9Sstevel@tonic-gate /* #define KRB5_MSGTYPE_STRICT */ 207c478bd9Sstevel@tonic-gate 21505d05c7Sgtb /* 22505d05c7Sgtb * If KRB5_GENEROUS_LR_TYPE is defined, then we are generous about 23505d05c7Sgtb * accepting a one byte negative lr_type - which is not sign 24505d05c7Sgtb * extended. Prior to July 2000, we were sending a negative lr_type as 25505d05c7Sgtb * a positve single byte value - instead of a signed integer. This 26505d05c7Sgtb * allows us to receive the old value and deal 27505d05c7Sgtb */ 28505d05c7Sgtb #define KRB5_GENEROUS_LR_TYPE 29505d05c7Sgtb 307c478bd9Sstevel@tonic-gate typedef krb5_octet asn1_octet; 317c478bd9Sstevel@tonic-gate typedef krb5_error_code asn1_error_code; 327c478bd9Sstevel@tonic-gate 337c478bd9Sstevel@tonic-gate typedef enum { PRIMITIVE = 0x00, CONSTRUCTED = 0x20 } asn1_construction; 347c478bd9Sstevel@tonic-gate 357c478bd9Sstevel@tonic-gate typedef enum { UNIVERSAL = 0x00, APPLICATION = 0x40, 36*ba7b222eSGlenn Barry CONTEXT_SPECIFIC = 0x80, PRIVATE = 0xC0 } asn1_class; 37*ba7b222eSGlenn Barry 38*ba7b222eSGlenn Barry typedef INT64_TYPE asn1_intmax; 39*ba7b222eSGlenn Barry typedef UINT64_TYPE asn1_uintmax; 407c478bd9Sstevel@tonic-gate 417c478bd9Sstevel@tonic-gate typedef int asn1_tagnum; 427c478bd9Sstevel@tonic-gate #define ASN1_TAGNUM_CEILING INT_MAX 437c478bd9Sstevel@tonic-gate #define ASN1_TAGNUM_MAX (ASN1_TAGNUM_CEILING-1) 447c478bd9Sstevel@tonic-gate 457c478bd9Sstevel@tonic-gate /* This is Kerberos Version 5 */ 467c478bd9Sstevel@tonic-gate #define KVNO 5 477c478bd9Sstevel@tonic-gate 487c478bd9Sstevel@tonic-gate /* Universal Tag Numbers */ 49*ba7b222eSGlenn Barry #define ASN1_BOOLEAN 1 50*ba7b222eSGlenn Barry #define ASN1_INTEGER 2 51*ba7b222eSGlenn Barry #define ASN1_BITSTRING 3 52*ba7b222eSGlenn Barry #define ASN1_OCTETSTRING 4 53*ba7b222eSGlenn Barry #define ASN1_NULL 5 54*ba7b222eSGlenn Barry #define ASN1_OBJECTIDENTIFIER 6 55*ba7b222eSGlenn Barry #define ASN1_ENUMERATED 10 56*ba7b222eSGlenn Barry #define ASN1_SEQUENCE 16 57*ba7b222eSGlenn Barry #define ASN1_SET 17 58*ba7b222eSGlenn Barry #define ASN1_PRINTABLESTRING 19 59*ba7b222eSGlenn Barry #define ASN1_IA5STRING 22 60*ba7b222eSGlenn Barry #define ASN1_UTCTIME 23 61*ba7b222eSGlenn Barry #define ASN1_GENERALTIME 24 62*ba7b222eSGlenn Barry #define ASN1_GENERALSTRING 27 637c478bd9Sstevel@tonic-gate 647c478bd9Sstevel@tonic-gate /* Kerberos Message Types */ 65*ba7b222eSGlenn Barry #define ASN1_KRB_AS_REQ 10 66*ba7b222eSGlenn Barry #define ASN1_KRB_AS_REP 11 67*ba7b222eSGlenn Barry #define ASN1_KRB_TGS_REQ 12 68*ba7b222eSGlenn Barry #define ASN1_KRB_TGS_REP 13 69*ba7b222eSGlenn Barry #define ASN1_KRB_AP_REQ 14 70*ba7b222eSGlenn Barry #define ASN1_KRB_AP_REP 15 71*ba7b222eSGlenn Barry #define ASN1_KRB_SAFE 20 72*ba7b222eSGlenn Barry #define ASN1_KRB_PRIV 21 73*ba7b222eSGlenn Barry #define ASN1_KRB_CRED 22 74*ba7b222eSGlenn Barry #define ASN1_KRB_ERROR 30 757c478bd9Sstevel@tonic-gate 767c478bd9Sstevel@tonic-gate #endif 77