summaryrefslogtreecommitdiff
path: root/kerberosV/lib
diff options
context:
space:
mode:
Diffstat (limited to 'kerberosV/lib')
-rw-r--r--kerberosV/lib/asn1/asn1_APOptions.c122
-rw-r--r--kerberosV/lib/asn1/asn1_AP_REP.c219
-rw-r--r--kerberosV/lib/asn1/asn1_AP_REQ.c305
-rw-r--r--kerberosV/lib/asn1/asn1_AS_REP.c84
-rw-r--r--kerberosV/lib/asn1/asn1_AS_REQ.c84
-rw-r--r--kerberosV/lib/asn1/asn1_Authenticator.c520
-rw-r--r--kerberosV/lib/asn1/asn1_AuthorizationData.c203
-rw-r--r--kerberosV/lib/asn1/asn1_CKSUMTYPE.c69
-rw-r--r--kerberosV/lib/asn1/asn1_Checksum.c163
-rw-r--r--kerberosV/lib/asn1/asn1_ENCTYPE.c69
-rw-r--r--kerberosV/lib/asn1/asn1_ETYPE_INFO.c111
-rw-r--r--kerberosV/lib/asn1/asn1_ETYPE_INFO_ENTRY.c227
-rw-r--r--kerberosV/lib/asn1/asn1_EncAPRepPart.c284
-rw-r--r--kerberosV/lib/asn1/asn1_EncASRepPart.c84
-rw-r--r--kerberosV/lib/asn1/asn1_EncKDCRepPart.c636
-rw-r--r--kerberosV/lib/asn1/asn1_EncKrbCredPart.c443
-rw-r--r--kerberosV/lib/asn1/asn1_EncKrbPrivPart.c403
-rw-r--r--kerberosV/lib/asn1/asn1_EncTGSRepPart.c84
-rw-r--r--kerberosV/lib/asn1/asn1_EncTicketPart.c608
-rw-r--r--kerberosV/lib/asn1/asn1_EncryptedData.c216
-rw-r--r--kerberosV/lib/asn1/asn1_EncryptionKey.c162
-rw-r--r--kerberosV/lib/asn1/asn1_HostAddress.c162
-rw-r--r--kerberosV/lib/asn1/asn1_HostAddresses.c111
-rw-r--r--kerberosV/lib/asn1/asn1_KDCOptions.c205
-rw-r--r--kerberosV/lib/asn1/asn1_KDC_REP.c388
-rw-r--r--kerberosV/lib/asn1/asn1_KDC_REQ.c259
-rw-r--r--kerberosV/lib/asn1/asn1_KDC_REQ_BODY.c762
-rw-r--r--kerberosV/lib/asn1/asn1_KRB_CRED.c303
-rw-r--r--kerberosV/lib/asn1/asn1_KRB_ERROR.c712
-rw-r--r--kerberosV/lib/asn1/asn1_KRB_PRIV.c219
-rw-r--r--kerberosV/lib/asn1/asn1_KRB_SAFE.c262
-rw-r--r--kerberosV/lib/asn1/asn1_KRB_SAFE_BODY.c389
-rw-r--r--kerberosV/lib/asn1/asn1_KerberosTime.c69
-rw-r--r--kerberosV/lib/asn1/asn1_KrbCredInfo.c660
-rw-r--r--kerberosV/lib/asn1/asn1_LR_TYPE.c69
-rw-r--r--kerberosV/lib/asn1/asn1_LastReq.c204
-rw-r--r--kerberosV/lib/asn1/asn1_MESSAGE_TYPE.c69
-rw-r--r--kerberosV/lib/asn1/asn1_METHOD_DATA.c111
-rw-r--r--kerberosV/lib/asn1/asn1_NAME_TYPE.c69
-rw-r--r--kerberosV/lib/asn1/asn1_PADATA_TYPE.c69
-rw-r--r--kerberosV/lib/asn1/asn1_PA_DATA.c163
-rw-r--r--kerberosV/lib/asn1/asn1_PA_ENC_TS_ENC.c173
-rw-r--r--kerberosV/lib/asn1/asn1_Principal.c163
-rw-r--r--kerberosV/lib/asn1/asn1_PrincipalName.c204
-rw-r--r--kerberosV/lib/asn1/asn1_Realm.c70
-rw-r--r--kerberosV/lib/asn1/asn1_TGS_REP.c84
-rw-r--r--kerberosV/lib/asn1/asn1_TGS_REQ.c84
-rw-r--r--kerberosV/lib/asn1/asn1_Ticket.c262
-rw-r--r--kerberosV/lib/asn1/asn1_TicketFlags.c183
-rw-r--r--kerberosV/lib/asn1/asn1_TransitedEncoding.c162
-rw-r--r--kerberosV/lib/asn1/asn1_UNSIGNED.c69
-rw-r--r--kerberosV/lib/asn1/krb5_asn1.h1279
52 files changed, 13084 insertions, 0 deletions
diff --git a/kerberosV/lib/asn1/asn1_APOptions.c b/kerberosV/lib/asn1/asn1_APOptions.c
new file mode 100644
index 00000000000..4e0cd7321e1
--- /dev/null
+++ b/kerberosV/lib/asn1/asn1_APOptions.c
@@ -0,0 +1,122 @@
+/* Generated from /usr/src/kerberosV/lib/asn1/../../src/lib/asn1/k5.asn1 */
+/* Do not edit */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+#include <errno.h>
+#include <krb5_asn1.h>
+#include <asn1_err.h>
+#include <der.h>
+#include <parse_units.h>
+
+#define BACK if (e) return e; p -= l; len -= l; ret += l
+
+int
+encode_APOptions(unsigned char *p, size_t len, const APOptions *data, size_t *size)
+{
+size_t ret = 0;
+size_t l;
+int i, e;
+
+i = 0;
+{
+unsigned char c = 0;
+*p-- = c; len--; ret++;
+c = 0;
+*p-- = c; len--; ret++;
+c = 0;
+*p-- = c; len--; ret++;
+c = 0;
+if(data->mutual_required) c |= 1<<5;
+if(data->use_session_key) c |= 1<<6;
+if(data->reserved) c |= 1<<7;
+*p-- = c;
+*p-- = 0;
+len -= 2;
+ret += 2;
+}
+
+e = der_put_length_and_tag (p, len, ret, UNIV, PRIM,UT_BitString, &l);
+BACK;
+*size = ret;
+return 0;
+}
+
+#define FORW if(e) goto fail; p += l; len -= l; ret += l
+
+int
+decode_APOptions(const unsigned char *p, size_t len, APOptions *data, size_t *size)
+{
+size_t ret = 0, reallen;
+size_t l;
+int e;
+
+memset(data, 0, sizeof(*data));
+reallen = 0;
+e = der_match_tag_and_length (p, len, UNIV, PRIM, UT_BitString,&reallen, &l);
+FORW;
+if(len < reallen)
+return ASN1_OVERRUN;
+p++;
+len--;
+reallen--;
+ret++;
+data->reserved = (*p >> 7) & 1;
+data->use_session_key = (*p >> 6) & 1;
+data->mutual_required = (*p >> 5) & 1;
+p += reallen; len -= reallen; ret += reallen;
+if(size) *size = ret;
+return 0;
+fail:
+free_APOptions(data);
+return e;
+}
+
+void
+free_APOptions(APOptions *data)
+{
+}
+
+size_t
+length_APOptions(const APOptions *data)
+{
+size_t ret = 0;
+ret += 7;
+return ret;
+}
+
+int
+copy_APOptions(const APOptions *from, APOptions *to)
+{
+*(to) = *(from);
+return 0;
+}
+
+unsigned APOptions2int(APOptions f)
+{
+unsigned r = 0;
+if(f.reserved) r |= (1U << 0);
+if(f.use_session_key) r |= (1U << 1);
+if(f.mutual_required) r |= (1U << 2);
+return r;
+}
+
+APOptions int2APOptions(unsigned n)
+{
+ APOptions flags;
+
+ flags.reserved = (n >> 0) & 1;
+ flags.use_session_key = (n >> 1) & 1;
+ flags.mutual_required = (n >> 2) & 1;
+ return flags;
+}
+
+struct units APOptions_units[] = {
+ {"mutual_required", 1U << 2},
+ {"use_session_key", 1U << 1},
+ {"reserved", 1U << 0},
+ {NULL, 0}
+};
+
diff --git a/kerberosV/lib/asn1/asn1_AP_REP.c b/kerberosV/lib/asn1/asn1_AP_REP.c
new file mode 100644
index 00000000000..e3042b911ad
--- /dev/null
+++ b/kerberosV/lib/asn1/asn1_AP_REP.c
@@ -0,0 +1,219 @@
+/* Generated from /usr/src/kerberosV/lib/asn1/../../src/lib/asn1/k5.asn1 */
+/* Do not edit */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+#include <errno.h>
+#include <krb5_asn1.h>
+#include <asn1_err.h>
+#include <der.h>
+#include <parse_units.h>
+
+#define BACK if (e) return e; p -= l; len -= l; ret += l
+
+int
+encode_AP_REP(unsigned char *p, size_t len, const AP_REP *data, size_t *size)
+{
+size_t ret = 0;
+size_t l;
+int i, e;
+
+i = 0;
+{
+int oldret = ret;
+ret = 0;
+e = encode_EncryptedData(p, len, &(data)->enc_part, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 2, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_MESSAGE_TYPE(p, len, &(data)->msg_type, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 1, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_integer(p, len, &(data)->pvno, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 0, &l);
+BACK;
+ret += oldret;
+}
+e = der_put_length_and_tag (p, len, ret, UNIV, CONS, UT_Sequence, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, APPL, CONS, 15, &l);
+BACK;
+*size = ret;
+return 0;
+}
+
+#define FORW if(e) goto fail; p += l; len -= l; ret += l
+
+int
+decode_AP_REP(const unsigned char *p, size_t len, AP_REP *data, size_t *size)
+{
+size_t ret = 0, reallen;
+size_t l;
+int e;
+
+memset(data, 0, sizeof(*data));
+reallen = 0;
+e = der_match_tag_and_length (p, len, APPL, CONS, 15, &reallen, &l);
+FORW;
+{
+int dce_fix;
+if((dce_fix = fix_dce(reallen, &len)) < 0)
+return ASN1_BAD_FORMAT;
+e = der_match_tag_and_length (p, len, UNIV, CONS, UT_Sequence,&reallen, &l);
+FORW;
+{
+int dce_fix;
+if((dce_fix = fix_dce(reallen, &len)) < 0)
+return ASN1_BAD_FORMAT;
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 0, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_integer(p, len, &(data)->pvno, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 1, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_MESSAGE_TYPE(p, len, &(data)->msg_type, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 2, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_EncryptedData(p, len, &(data)->enc_part, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}
+}
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}
+}
+if(size) *size = ret;
+return 0;
+fail:
+free_AP_REP(data);
+return e;
+}
+
+void
+free_AP_REP(AP_REP *data)
+{
+free_MESSAGE_TYPE(&(data)->msg_type);
+free_EncryptedData(&(data)->enc_part);
+}
+
+size_t
+length_AP_REP(const AP_REP *data)
+{
+size_t ret = 0;
+{
+int oldret = ret;
+ret = 0;
+ret += length_integer(&(data)->pvno);
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+ret += length_MESSAGE_TYPE(&(data)->msg_type);
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+ret += length_EncryptedData(&(data)->enc_part);
+ret += 1 + length_len(ret) + oldret;
+}
+ret += 1 + length_len(ret);
+ret += 1 + length_len (ret);
+return ret;
+}
+
+int
+copy_AP_REP(const AP_REP *from, AP_REP *to)
+{
+*(&(to)->pvno) = *(&(from)->pvno);
+if(copy_MESSAGE_TYPE(&(from)->msg_type, &(to)->msg_type)) return ENOMEM;
+if(copy_EncryptedData(&(from)->enc_part, &(to)->enc_part)) return ENOMEM;
+return 0;
+}
+
diff --git a/kerberosV/lib/asn1/asn1_AP_REQ.c b/kerberosV/lib/asn1/asn1_AP_REQ.c
new file mode 100644
index 00000000000..cfbc29e725e
--- /dev/null
+++ b/kerberosV/lib/asn1/asn1_AP_REQ.c
@@ -0,0 +1,305 @@
+/* Generated from /usr/src/kerberosV/lib/asn1/../../src/lib/asn1/k5.asn1 */
+/* Do not edit */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+#include <errno.h>
+#include <krb5_asn1.h>
+#include <asn1_err.h>
+#include <der.h>
+#include <parse_units.h>
+
+#define BACK if (e) return e; p -= l; len -= l; ret += l
+
+int
+encode_AP_REQ(unsigned char *p, size_t len, const AP_REQ *data, size_t *size)
+{
+size_t ret = 0;
+size_t l;
+int i, e;
+
+i = 0;
+{
+int oldret = ret;
+ret = 0;
+e = encode_EncryptedData(p, len, &(data)->authenticator, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 4, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_Ticket(p, len, &(data)->ticket, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 3, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_APOptions(p, len, &(data)->ap_options, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 2, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_MESSAGE_TYPE(p, len, &(data)->msg_type, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 1, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_integer(p, len, &(data)->pvno, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 0, &l);
+BACK;
+ret += oldret;
+}
+e = der_put_length_and_tag (p, len, ret, UNIV, CONS, UT_Sequence, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, APPL, CONS, 14, &l);
+BACK;
+*size = ret;
+return 0;
+}
+
+#define FORW if(e) goto fail; p += l; len -= l; ret += l
+
+int
+decode_AP_REQ(const unsigned char *p, size_t len, AP_REQ *data, size_t *size)
+{
+size_t ret = 0, reallen;
+size_t l;
+int e;
+
+memset(data, 0, sizeof(*data));
+reallen = 0;
+e = der_match_tag_and_length (p, len, APPL, CONS, 14, &reallen, &l);
+FORW;
+{
+int dce_fix;
+if((dce_fix = fix_dce(reallen, &len)) < 0)
+return ASN1_BAD_FORMAT;
+e = der_match_tag_and_length (p, len, UNIV, CONS, UT_Sequence,&reallen, &l);
+FORW;
+{
+int dce_fix;
+if((dce_fix = fix_dce(reallen, &len)) < 0)
+return ASN1_BAD_FORMAT;
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 0, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_integer(p, len, &(data)->pvno, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 1, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_MESSAGE_TYPE(p, len, &(data)->msg_type, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 2, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_APOptions(p, len, &(data)->ap_options, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 3, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_Ticket(p, len, &(data)->ticket, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 4, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_EncryptedData(p, len, &(data)->authenticator, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}
+}
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}
+}
+if(size) *size = ret;
+return 0;
+fail:
+free_AP_REQ(data);
+return e;
+}
+
+void
+free_AP_REQ(AP_REQ *data)
+{
+free_MESSAGE_TYPE(&(data)->msg_type);
+free_APOptions(&(data)->ap_options);
+free_Ticket(&(data)->ticket);
+free_EncryptedData(&(data)->authenticator);
+}
+
+size_t
+length_AP_REQ(const AP_REQ *data)
+{
+size_t ret = 0;
+{
+int oldret = ret;
+ret = 0;
+ret += length_integer(&(data)->pvno);
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+ret += length_MESSAGE_TYPE(&(data)->msg_type);
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+ret += length_APOptions(&(data)->ap_options);
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+ret += length_Ticket(&(data)->ticket);
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+ret += length_EncryptedData(&(data)->authenticator);
+ret += 1 + length_len(ret) + oldret;
+}
+ret += 1 + length_len(ret);
+ret += 1 + length_len (ret);
+return ret;
+}
+
+int
+copy_AP_REQ(const AP_REQ *from, AP_REQ *to)
+{
+*(&(to)->pvno) = *(&(from)->pvno);
+if(copy_MESSAGE_TYPE(&(from)->msg_type, &(to)->msg_type)) return ENOMEM;
+if(copy_APOptions(&(from)->ap_options, &(to)->ap_options)) return ENOMEM;
+if(copy_Ticket(&(from)->ticket, &(to)->ticket)) return ENOMEM;
+if(copy_EncryptedData(&(from)->authenticator, &(to)->authenticator)) return ENOMEM;
+return 0;
+}
+
diff --git a/kerberosV/lib/asn1/asn1_AS_REP.c b/kerberosV/lib/asn1/asn1_AS_REP.c
new file mode 100644
index 00000000000..90776b09850
--- /dev/null
+++ b/kerberosV/lib/asn1/asn1_AS_REP.c
@@ -0,0 +1,84 @@
+/* Generated from /usr/src/kerberosV/lib/asn1/../../src/lib/asn1/k5.asn1 */
+/* Do not edit */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+#include <errno.h>
+#include <krb5_asn1.h>
+#include <asn1_err.h>
+#include <der.h>
+#include <parse_units.h>
+
+#define BACK if (e) return e; p -= l; len -= l; ret += l
+
+int
+encode_AS_REP(unsigned char *p, size_t len, const AS_REP *data, size_t *size)
+{
+size_t ret = 0;
+size_t l;
+int i, e;
+
+i = 0;
+e = encode_KDC_REP(p, len, data, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, APPL, CONS, 11, &l);
+BACK;
+*size = ret;
+return 0;
+}
+
+#define FORW if(e) goto fail; p += l; len -= l; ret += l
+
+int
+decode_AS_REP(const unsigned char *p, size_t len, AS_REP *data, size_t *size)
+{
+size_t ret = 0, reallen;
+size_t l;
+int e;
+
+memset(data, 0, sizeof(*data));
+reallen = 0;
+e = der_match_tag_and_length (p, len, APPL, CONS, 11, &reallen, &l);
+FORW;
+{
+int dce_fix;
+if((dce_fix = fix_dce(reallen, &len)) < 0)
+return ASN1_BAD_FORMAT;
+e = decode_KDC_REP(p, len, data, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}
+}
+if(size) *size = ret;
+return 0;
+fail:
+free_AS_REP(data);
+return e;
+}
+
+void
+free_AS_REP(AS_REP *data)
+{
+free_KDC_REP(data);
+}
+
+size_t
+length_AS_REP(const AS_REP *data)
+{
+size_t ret = 0;
+ret += length_KDC_REP(data);
+ret += 1 + length_len (ret);
+return ret;
+}
+
+int
+copy_AS_REP(const AS_REP *from, AS_REP *to)
+{
+if(copy_KDC_REP(from, to)) return ENOMEM;
+return 0;
+}
+
diff --git a/kerberosV/lib/asn1/asn1_AS_REQ.c b/kerberosV/lib/asn1/asn1_AS_REQ.c
new file mode 100644
index 00000000000..9ef533b3f71
--- /dev/null
+++ b/kerberosV/lib/asn1/asn1_AS_REQ.c
@@ -0,0 +1,84 @@
+/* Generated from /usr/src/kerberosV/lib/asn1/../../src/lib/asn1/k5.asn1 */
+/* Do not edit */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+#include <errno.h>
+#include <krb5_asn1.h>
+#include <asn1_err.h>
+#include <der.h>
+#include <parse_units.h>
+
+#define BACK if (e) return e; p -= l; len -= l; ret += l
+
+int
+encode_AS_REQ(unsigned char *p, size_t len, const AS_REQ *data, size_t *size)
+{
+size_t ret = 0;
+size_t l;
+int i, e;
+
+i = 0;
+e = encode_KDC_REQ(p, len, data, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, APPL, CONS, 10, &l);
+BACK;
+*size = ret;
+return 0;
+}
+
+#define FORW if(e) goto fail; p += l; len -= l; ret += l
+
+int
+decode_AS_REQ(const unsigned char *p, size_t len, AS_REQ *data, size_t *size)
+{
+size_t ret = 0, reallen;
+size_t l;
+int e;
+
+memset(data, 0, sizeof(*data));
+reallen = 0;
+e = der_match_tag_and_length (p, len, APPL, CONS, 10, &reallen, &l);
+FORW;
+{
+int dce_fix;
+if((dce_fix = fix_dce(reallen, &len)) < 0)
+return ASN1_BAD_FORMAT;
+e = decode_KDC_REQ(p, len, data, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}
+}
+if(size) *size = ret;
+return 0;
+fail:
+free_AS_REQ(data);
+return e;
+}
+
+void
+free_AS_REQ(AS_REQ *data)
+{
+free_KDC_REQ(data);
+}
+
+size_t
+length_AS_REQ(const AS_REQ *data)
+{
+size_t ret = 0;
+ret += length_KDC_REQ(data);
+ret += 1 + length_len (ret);
+return ret;
+}
+
+int
+copy_AS_REQ(const AS_REQ *from, AS_REQ *to)
+{
+if(copy_KDC_REQ(from, to)) return ENOMEM;
+return 0;
+}
+
diff --git a/kerberosV/lib/asn1/asn1_Authenticator.c b/kerberosV/lib/asn1/asn1_Authenticator.c
new file mode 100644
index 00000000000..355dfd1f9ab
--- /dev/null
+++ b/kerberosV/lib/asn1/asn1_Authenticator.c
@@ -0,0 +1,520 @@
+/* Generated from /usr/src/kerberosV/lib/asn1/../../src/lib/asn1/k5.asn1 */
+/* Do not edit */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+#include <errno.h>
+#include <krb5_asn1.h>
+#include <asn1_err.h>
+#include <der.h>
+#include <parse_units.h>
+
+#define BACK if (e) return e; p -= l; len -= l; ret += l
+
+int
+encode_Authenticator(unsigned char *p, size_t len, const Authenticator *data, size_t *size)
+{
+size_t ret = 0;
+size_t l;
+int i, e;
+
+i = 0;
+if((data)->authorization_data)
+{
+int oldret = ret;
+ret = 0;
+e = encode_AuthorizationData(p, len, (data)->authorization_data, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 8, &l);
+BACK;
+ret += oldret;
+}
+if((data)->seq_number)
+{
+int oldret = ret;
+ret = 0;
+e = encode_UNSIGNED(p, len, (data)->seq_number, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 7, &l);
+BACK;
+ret += oldret;
+}
+if((data)->subkey)
+{
+int oldret = ret;
+ret = 0;
+e = encode_EncryptionKey(p, len, (data)->subkey, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 6, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_KerberosTime(p, len, &(data)->ctime, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 5, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_integer(p, len, &(data)->cusec, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 4, &l);
+BACK;
+ret += oldret;
+}
+if((data)->cksum)
+{
+int oldret = ret;
+ret = 0;
+e = encode_Checksum(p, len, (data)->cksum, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 3, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_PrincipalName(p, len, &(data)->cname, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 2, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_Realm(p, len, &(data)->crealm, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 1, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_integer(p, len, &(data)->authenticator_vno, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 0, &l);
+BACK;
+ret += oldret;
+}
+e = der_put_length_and_tag (p, len, ret, UNIV, CONS, UT_Sequence, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, APPL, CONS, 2, &l);
+BACK;
+*size = ret;
+return 0;
+}
+
+#define FORW if(e) goto fail; p += l; len -= l; ret += l
+
+int
+decode_Authenticator(const unsigned char *p, size_t len, Authenticator *data, size_t *size)
+{
+size_t ret = 0, reallen;
+size_t l;
+int e;
+
+memset(data, 0, sizeof(*data));
+reallen = 0;
+e = der_match_tag_and_length (p, len, APPL, CONS, 2, &reallen, &l);
+FORW;
+{
+int dce_fix;
+if((dce_fix = fix_dce(reallen, &len)) < 0)
+return ASN1_BAD_FORMAT;
+e = der_match_tag_and_length (p, len, UNIV, CONS, UT_Sequence,&reallen, &l);
+FORW;
+{
+int dce_fix;
+if((dce_fix = fix_dce(reallen, &len)) < 0)
+return ASN1_BAD_FORMAT;
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 0, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_integer(p, len, &(data)->authenticator_vno, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 1, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_Realm(p, len, &(data)->crealm, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 2, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_PrincipalName(p, len, &(data)->cname, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 3, &l);
+if (e)
+(data)->cksum = NULL;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+(data)->cksum = malloc(sizeof(*(data)->cksum));
+if((data)->cksum == NULL) return ENOMEM;
+e = decode_Checksum(p, len, (data)->cksum, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 4, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_integer(p, len, &(data)->cusec, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 5, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_KerberosTime(p, len, &(data)->ctime, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 6, &l);
+if (e)
+(data)->subkey = NULL;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+(data)->subkey = malloc(sizeof(*(data)->subkey));
+if((data)->subkey == NULL) return ENOMEM;
+e = decode_EncryptionKey(p, len, (data)->subkey, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 7, &l);
+if (e)
+(data)->seq_number = NULL;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+(data)->seq_number = malloc(sizeof(*(data)->seq_number));
+if((data)->seq_number == NULL) return ENOMEM;
+e = decode_UNSIGNED(p, len, (data)->seq_number, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 8, &l);
+if (e)
+(data)->authorization_data = NULL;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+(data)->authorization_data = malloc(sizeof(*(data)->authorization_data));
+if((data)->authorization_data == NULL) return ENOMEM;
+e = decode_AuthorizationData(p, len, (data)->authorization_data, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}
+}
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}
+}
+if(size) *size = ret;
+return 0;
+fail:
+free_Authenticator(data);
+return e;
+}
+
+void
+free_Authenticator(Authenticator *data)
+{
+free_Realm(&(data)->crealm);
+free_PrincipalName(&(data)->cname);
+if((data)->cksum) {
+free_Checksum((data)->cksum);
+free((data)->cksum);
+}
+free_KerberosTime(&(data)->ctime);
+if((data)->subkey) {
+free_EncryptionKey((data)->subkey);
+free((data)->subkey);
+}
+if((data)->seq_number) {
+free_UNSIGNED((data)->seq_number);
+free((data)->seq_number);
+}
+if((data)->authorization_data) {
+free_AuthorizationData((data)->authorization_data);
+free((data)->authorization_data);
+}
+}
+
+size_t
+length_Authenticator(const Authenticator *data)
+{
+size_t ret = 0;
+{
+int oldret = ret;
+ret = 0;
+ret += length_integer(&(data)->authenticator_vno);
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+ret += length_Realm(&(data)->crealm);
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+ret += length_PrincipalName(&(data)->cname);
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->cksum){
+int oldret = ret;
+ret = 0;
+ret += length_Checksum((data)->cksum);
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+ret += length_integer(&(data)->cusec);
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+ret += length_KerberosTime(&(data)->ctime);
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->subkey){
+int oldret = ret;
+ret = 0;
+ret += length_EncryptionKey((data)->subkey);
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->seq_number){
+int oldret = ret;
+ret = 0;
+ret += length_UNSIGNED((data)->seq_number);
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->authorization_data){
+int oldret = ret;
+ret = 0;
+ret += length_AuthorizationData((data)->authorization_data);
+ret += 1 + length_len(ret) + oldret;
+}
+ret += 1 + length_len(ret);
+ret += 1 + length_len (ret);
+return ret;
+}
+
+int
+copy_Authenticator(const Authenticator *from, Authenticator *to)
+{
+*(&(to)->authenticator_vno) = *(&(from)->authenticator_vno);
+if(copy_Realm(&(from)->crealm, &(to)->crealm)) return ENOMEM;
+if(copy_PrincipalName(&(from)->cname, &(to)->cname)) return ENOMEM;
+if((from)->cksum) {
+(to)->cksum = malloc(sizeof(*(to)->cksum));
+if((to)->cksum == NULL) return ENOMEM;
+if(copy_Checksum((from)->cksum, (to)->cksum)) return ENOMEM;
+}else
+(to)->cksum = NULL;
+*(&(to)->cusec) = *(&(from)->cusec);
+if(copy_KerberosTime(&(from)->ctime, &(to)->ctime)) return ENOMEM;
+if((from)->subkey) {
+(to)->subkey = malloc(sizeof(*(to)->subkey));
+if((to)->subkey == NULL) return ENOMEM;
+if(copy_EncryptionKey((from)->subkey, (to)->subkey)) return ENOMEM;
+}else
+(to)->subkey = NULL;
+if((from)->seq_number) {
+(to)->seq_number = malloc(sizeof(*(to)->seq_number));
+if((to)->seq_number == NULL) return ENOMEM;
+if(copy_UNSIGNED((from)->seq_number, (to)->seq_number)) return ENOMEM;
+}else
+(to)->seq_number = NULL;
+if((from)->authorization_data) {
+(to)->authorization_data = malloc(sizeof(*(to)->authorization_data));
+if((to)->authorization_data == NULL) return ENOMEM;
+if(copy_AuthorizationData((from)->authorization_data, (to)->authorization_data)) return ENOMEM;
+}else
+(to)->authorization_data = NULL;
+return 0;
+}
+
diff --git a/kerberosV/lib/asn1/asn1_AuthorizationData.c b/kerberosV/lib/asn1/asn1_AuthorizationData.c
new file mode 100644
index 00000000000..428973df00e
--- /dev/null
+++ b/kerberosV/lib/asn1/asn1_AuthorizationData.c
@@ -0,0 +1,203 @@
+/* Generated from /usr/src/kerberosV/lib/asn1/../../src/lib/asn1/k5.asn1 */
+/* Do not edit */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+#include <errno.h>
+#include <krb5_asn1.h>
+#include <asn1_err.h>
+#include <der.h>
+#include <parse_units.h>
+
+#define BACK if (e) return e; p -= l; len -= l; ret += l
+
+int
+encode_AuthorizationData(unsigned char *p, size_t len, const AuthorizationData *data, size_t *size)
+{
+size_t ret = 0;
+size_t l;
+int i, e;
+
+i = 0;
+for(i = (data)->len - 1; i >= 0; --i) {
+int oldret = ret;
+ret = 0;
+{
+int oldret = ret;
+ret = 0;
+e = encode_octet_string(p, len, &(&(data)->val[i])->ad_data, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 1, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_integer(p, len, &(&(data)->val[i])->ad_type, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 0, &l);
+BACK;
+ret += oldret;
+}
+e = der_put_length_and_tag (p, len, ret, UNIV, CONS, UT_Sequence, &l);
+BACK;
+ret += oldret;
+}
+e = der_put_length_and_tag (p, len, ret, UNIV, CONS, UT_Sequence, &l);
+BACK;
+*size = ret;
+return 0;
+}
+
+#define FORW if(e) goto fail; p += l; len -= l; ret += l
+
+int
+decode_AuthorizationData(const unsigned char *p, size_t len, AuthorizationData *data, size_t *size)
+{
+size_t ret = 0, reallen;
+size_t l;
+int e;
+
+memset(data, 0, sizeof(*data));
+reallen = 0;
+e = der_match_tag_and_length (p, len, UNIV, CONS, UT_Sequence,&reallen, &l);
+FORW;
+if(len < reallen)
+return ASN1_OVERRUN;
+len = reallen;
+{
+size_t origlen = len;
+int oldret = ret;
+ret = 0;
+(data)->len = 0;
+(data)->val = NULL;
+while(ret < origlen) {
+(data)->len++;
+(data)->val = realloc((data)->val, sizeof(*((data)->val)) * (data)->len);
+e = der_match_tag_and_length (p, len, UNIV, CONS, UT_Sequence,&reallen, &l);
+FORW;
+{
+int dce_fix;
+if((dce_fix = fix_dce(reallen, &len)) < 0)
+return ASN1_BAD_FORMAT;
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 0, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_integer(p, len, &(&(data)->val[(data)->len-1])->ad_type, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 1, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_octet_string(p, len, &(&(data)->val[(data)->len-1])->ad_data, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}
+}
+len = origlen - ret;
+}
+ret += oldret;
+}
+if(size) *size = ret;
+return 0;
+fail:
+free_AuthorizationData(data);
+return e;
+}
+
+void
+free_AuthorizationData(AuthorizationData *data)
+{
+while((data)->len){
+free_octet_string(&(&(data)->val[(data)->len-1])->ad_data);
+(data)->len--;
+}
+free((data)->val);
+}
+
+size_t
+length_AuthorizationData(const AuthorizationData *data)
+{
+size_t ret = 0;
+{
+int oldret = ret;
+int i;
+ret = 0;
+for(i = (data)->len - 1; i >= 0; --i){
+{
+int oldret = ret;
+ret = 0;
+ret += length_integer(&(&(data)->val[i])->ad_type);
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+ret += length_octet_string(&(&(data)->val[i])->ad_data);
+ret += 1 + length_len(ret) + oldret;
+}
+ret += 1 + length_len(ret);
+}
+ret += 1 + length_len(ret) + oldret;
+}
+return ret;
+}
+
+int
+copy_AuthorizationData(const AuthorizationData *from, AuthorizationData *to)
+{
+if(((to)->val = malloc((from)->len * sizeof(*(to)->val))) == NULL && (from)->len != 0)
+return ENOMEM;
+for((to)->len = 0; (to)->len < (from)->len; (to)->len++){
+*(&(&(to)->val[(to)->len])->ad_type) = *(&(&(from)->val[(to)->len])->ad_type);
+if(copy_octet_string(&(&(from)->val[(to)->len])->ad_data, &(&(to)->val[(to)->len])->ad_data)) return ENOMEM;
+}
+return 0;
+}
+
diff --git a/kerberosV/lib/asn1/asn1_CKSUMTYPE.c b/kerberosV/lib/asn1/asn1_CKSUMTYPE.c
new file mode 100644
index 00000000000..14926d9559b
--- /dev/null
+++ b/kerberosV/lib/asn1/asn1_CKSUMTYPE.c
@@ -0,0 +1,69 @@
+/* Generated from /usr/src/kerberosV/lib/asn1/../../src/lib/asn1/k5.asn1 */
+/* Do not edit */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+#include <errno.h>
+#include <krb5_asn1.h>
+#include <asn1_err.h>
+#include <der.h>
+#include <parse_units.h>
+
+#define BACK if (e) return e; p -= l; len -= l; ret += l
+
+int
+encode_CKSUMTYPE(unsigned char *p, size_t len, const CKSUMTYPE *data, size_t *size)
+{
+size_t ret = 0;
+size_t l;
+int i, e;
+
+i = 0;
+e = encode_integer(p, len, (const int*)data, &l);
+BACK;
+*size = ret;
+return 0;
+}
+
+#define FORW if(e) goto fail; p += l; len -= l; ret += l
+
+int
+decode_CKSUMTYPE(const unsigned char *p, size_t len, CKSUMTYPE *data, size_t *size)
+{
+size_t ret = 0, reallen;
+size_t l;
+int e;
+
+memset(data, 0, sizeof(*data));
+reallen = 0;
+e = decode_integer(p, len, (int*)data, &l);
+FORW;
+if(size) *size = ret;
+return 0;
+fail:
+free_CKSUMTYPE(data);
+return e;
+}
+
+void
+free_CKSUMTYPE(CKSUMTYPE *data)
+{
+}
+
+size_t
+length_CKSUMTYPE(const CKSUMTYPE *data)
+{
+size_t ret = 0;
+ret += length_integer((const int*)data);
+return ret;
+}
+
+int
+copy_CKSUMTYPE(const CKSUMTYPE *from, CKSUMTYPE *to)
+{
+*(to) = *(from);
+return 0;
+}
+
diff --git a/kerberosV/lib/asn1/asn1_Checksum.c b/kerberosV/lib/asn1/asn1_Checksum.c
new file mode 100644
index 00000000000..c88192e0dce
--- /dev/null
+++ b/kerberosV/lib/asn1/asn1_Checksum.c
@@ -0,0 +1,163 @@
+/* Generated from /usr/src/kerberosV/lib/asn1/../../src/lib/asn1/k5.asn1 */
+/* Do not edit */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+#include <errno.h>
+#include <krb5_asn1.h>
+#include <asn1_err.h>
+#include <der.h>
+#include <parse_units.h>
+
+#define BACK if (e) return e; p -= l; len -= l; ret += l
+
+int
+encode_Checksum(unsigned char *p, size_t len, const Checksum *data, size_t *size)
+{
+size_t ret = 0;
+size_t l;
+int i, e;
+
+i = 0;
+{
+int oldret = ret;
+ret = 0;
+e = encode_octet_string(p, len, &(data)->checksum, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 1, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_CKSUMTYPE(p, len, &(data)->cksumtype, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 0, &l);
+BACK;
+ret += oldret;
+}
+e = der_put_length_and_tag (p, len, ret, UNIV, CONS, UT_Sequence, &l);
+BACK;
+*size = ret;
+return 0;
+}
+
+#define FORW if(e) goto fail; p += l; len -= l; ret += l
+
+int
+decode_Checksum(const unsigned char *p, size_t len, Checksum *data, size_t *size)
+{
+size_t ret = 0, reallen;
+size_t l;
+int e;
+
+memset(data, 0, sizeof(*data));
+reallen = 0;
+e = der_match_tag_and_length (p, len, UNIV, CONS, UT_Sequence,&reallen, &l);
+FORW;
+{
+int dce_fix;
+if((dce_fix = fix_dce(reallen, &len)) < 0)
+return ASN1_BAD_FORMAT;
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 0, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_CKSUMTYPE(p, len, &(data)->cksumtype, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 1, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_octet_string(p, len, &(data)->checksum, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}
+}
+if(size) *size = ret;
+return 0;
+fail:
+free_Checksum(data);
+return e;
+}
+
+void
+free_Checksum(Checksum *data)
+{
+free_CKSUMTYPE(&(data)->cksumtype);
+free_octet_string(&(data)->checksum);
+}
+
+size_t
+length_Checksum(const Checksum *data)
+{
+size_t ret = 0;
+{
+int oldret = ret;
+ret = 0;
+ret += length_CKSUMTYPE(&(data)->cksumtype);
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+ret += length_octet_string(&(data)->checksum);
+ret += 1 + length_len(ret) + oldret;
+}
+ret += 1 + length_len(ret);
+return ret;
+}
+
+int
+copy_Checksum(const Checksum *from, Checksum *to)
+{
+if(copy_CKSUMTYPE(&(from)->cksumtype, &(to)->cksumtype)) return ENOMEM;
+if(copy_octet_string(&(from)->checksum, &(to)->checksum)) return ENOMEM;
+return 0;
+}
+
diff --git a/kerberosV/lib/asn1/asn1_ENCTYPE.c b/kerberosV/lib/asn1/asn1_ENCTYPE.c
new file mode 100644
index 00000000000..d48ccc982f6
--- /dev/null
+++ b/kerberosV/lib/asn1/asn1_ENCTYPE.c
@@ -0,0 +1,69 @@
+/* Generated from /usr/src/kerberosV/lib/asn1/../../src/lib/asn1/k5.asn1 */
+/* Do not edit */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+#include <errno.h>
+#include <krb5_asn1.h>
+#include <asn1_err.h>
+#include <der.h>
+#include <parse_units.h>
+
+#define BACK if (e) return e; p -= l; len -= l; ret += l
+
+int
+encode_ENCTYPE(unsigned char *p, size_t len, const ENCTYPE *data, size_t *size)
+{
+size_t ret = 0;
+size_t l;
+int i, e;
+
+i = 0;
+e = encode_integer(p, len, (const int*)data, &l);
+BACK;
+*size = ret;
+return 0;
+}
+
+#define FORW if(e) goto fail; p += l; len -= l; ret += l
+
+int
+decode_ENCTYPE(const unsigned char *p, size_t len, ENCTYPE *data, size_t *size)
+{
+size_t ret = 0, reallen;
+size_t l;
+int e;
+
+memset(data, 0, sizeof(*data));
+reallen = 0;
+e = decode_integer(p, len, (int*)data, &l);
+FORW;
+if(size) *size = ret;
+return 0;
+fail:
+free_ENCTYPE(data);
+return e;
+}
+
+void
+free_ENCTYPE(ENCTYPE *data)
+{
+}
+
+size_t
+length_ENCTYPE(const ENCTYPE *data)
+{
+size_t ret = 0;
+ret += length_integer((const int*)data);
+return ret;
+}
+
+int
+copy_ENCTYPE(const ENCTYPE *from, ENCTYPE *to)
+{
+*(to) = *(from);
+return 0;
+}
+
diff --git a/kerberosV/lib/asn1/asn1_ETYPE_INFO.c b/kerberosV/lib/asn1/asn1_ETYPE_INFO.c
new file mode 100644
index 00000000000..b4540b60766
--- /dev/null
+++ b/kerberosV/lib/asn1/asn1_ETYPE_INFO.c
@@ -0,0 +1,111 @@
+/* Generated from /usr/src/kerberosV/lib/asn1/../../src/lib/asn1/k5.asn1 */
+/* Do not edit */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+#include <errno.h>
+#include <krb5_asn1.h>
+#include <asn1_err.h>
+#include <der.h>
+#include <parse_units.h>
+
+#define BACK if (e) return e; p -= l; len -= l; ret += l
+
+int
+encode_ETYPE_INFO(unsigned char *p, size_t len, const ETYPE_INFO *data, size_t *size)
+{
+size_t ret = 0;
+size_t l;
+int i, e;
+
+i = 0;
+for(i = (data)->len - 1; i >= 0; --i) {
+int oldret = ret;
+ret = 0;
+e = encode_ETYPE_INFO_ENTRY(p, len, &(data)->val[i], &l);
+BACK;
+ret += oldret;
+}
+e = der_put_length_and_tag (p, len, ret, UNIV, CONS, UT_Sequence, &l);
+BACK;
+*size = ret;
+return 0;
+}
+
+#define FORW if(e) goto fail; p += l; len -= l; ret += l
+
+int
+decode_ETYPE_INFO(const unsigned char *p, size_t len, ETYPE_INFO *data, size_t *size)
+{
+size_t ret = 0, reallen;
+size_t l;
+int e;
+
+memset(data, 0, sizeof(*data));
+reallen = 0;
+e = der_match_tag_and_length (p, len, UNIV, CONS, UT_Sequence,&reallen, &l);
+FORW;
+if(len < reallen)
+return ASN1_OVERRUN;
+len = reallen;
+{
+size_t origlen = len;
+int oldret = ret;
+ret = 0;
+(data)->len = 0;
+(data)->val = NULL;
+while(ret < origlen) {
+(data)->len++;
+(data)->val = realloc((data)->val, sizeof(*((data)->val)) * (data)->len);
+e = decode_ETYPE_INFO_ENTRY(p, len, &(data)->val[(data)->len-1], &l);
+FORW;
+len = origlen - ret;
+}
+ret += oldret;
+}
+if(size) *size = ret;
+return 0;
+fail:
+free_ETYPE_INFO(data);
+return e;
+}
+
+void
+free_ETYPE_INFO(ETYPE_INFO *data)
+{
+while((data)->len){
+free_ETYPE_INFO_ENTRY(&(data)->val[(data)->len-1]);
+(data)->len--;
+}
+free((data)->val);
+}
+
+size_t
+length_ETYPE_INFO(const ETYPE_INFO *data)
+{
+size_t ret = 0;
+{
+int oldret = ret;
+int i;
+ret = 0;
+for(i = (data)->len - 1; i >= 0; --i){
+ret += length_ETYPE_INFO_ENTRY(&(data)->val[i]);
+}
+ret += 1 + length_len(ret) + oldret;
+}
+return ret;
+}
+
+int
+copy_ETYPE_INFO(const ETYPE_INFO *from, ETYPE_INFO *to)
+{
+if(((to)->val = malloc((from)->len * sizeof(*(to)->val))) == NULL && (from)->len != 0)
+return ENOMEM;
+for((to)->len = 0; (to)->len < (from)->len; (to)->len++){
+if(copy_ETYPE_INFO_ENTRY(&(from)->val[(to)->len], &(to)->val[(to)->len])) return ENOMEM;
+}
+return 0;
+}
+
diff --git a/kerberosV/lib/asn1/asn1_ETYPE_INFO_ENTRY.c b/kerberosV/lib/asn1/asn1_ETYPE_INFO_ENTRY.c
new file mode 100644
index 00000000000..ce0ebb02ae6
--- /dev/null
+++ b/kerberosV/lib/asn1/asn1_ETYPE_INFO_ENTRY.c
@@ -0,0 +1,227 @@
+/* Generated from /usr/src/kerberosV/lib/asn1/../../src/lib/asn1/k5.asn1 */
+/* Do not edit */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+#include <errno.h>
+#include <krb5_asn1.h>
+#include <asn1_err.h>
+#include <der.h>
+#include <parse_units.h>
+
+#define BACK if (e) return e; p -= l; len -= l; ret += l
+
+int
+encode_ETYPE_INFO_ENTRY(unsigned char *p, size_t len, const ETYPE_INFO_ENTRY *data, size_t *size)
+{
+size_t ret = 0;
+size_t l;
+int i, e;
+
+i = 0;
+if((data)->salttype)
+{
+int oldret = ret;
+ret = 0;
+e = encode_integer(p, len, (data)->salttype, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 2, &l);
+BACK;
+ret += oldret;
+}
+if((data)->salt)
+{
+int oldret = ret;
+ret = 0;
+e = encode_octet_string(p, len, (data)->salt, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 1, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_ENCTYPE(p, len, &(data)->etype, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 0, &l);
+BACK;
+ret += oldret;
+}
+e = der_put_length_and_tag (p, len, ret, UNIV, CONS, UT_Sequence, &l);
+BACK;
+*size = ret;
+return 0;
+}
+
+#define FORW if(e) goto fail; p += l; len -= l; ret += l
+
+int
+decode_ETYPE_INFO_ENTRY(const unsigned char *p, size_t len, ETYPE_INFO_ENTRY *data, size_t *size)
+{
+size_t ret = 0, reallen;
+size_t l;
+int e;
+
+memset(data, 0, sizeof(*data));
+reallen = 0;
+e = der_match_tag_and_length (p, len, UNIV, CONS, UT_Sequence,&reallen, &l);
+FORW;
+{
+int dce_fix;
+if((dce_fix = fix_dce(reallen, &len)) < 0)
+return ASN1_BAD_FORMAT;
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 0, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_ENCTYPE(p, len, &(data)->etype, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 1, &l);
+if (e)
+(data)->salt = NULL;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+(data)->salt = malloc(sizeof(*(data)->salt));
+if((data)->salt == NULL) return ENOMEM;
+e = decode_octet_string(p, len, (data)->salt, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 2, &l);
+if (e)
+(data)->salttype = NULL;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+(data)->salttype = malloc(sizeof(*(data)->salttype));
+if((data)->salttype == NULL) return ENOMEM;
+e = decode_integer(p, len, (data)->salttype, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}
+}
+if(size) *size = ret;
+return 0;
+fail:
+free_ETYPE_INFO_ENTRY(data);
+return e;
+}
+
+void
+free_ETYPE_INFO_ENTRY(ETYPE_INFO_ENTRY *data)
+{
+free_ENCTYPE(&(data)->etype);
+if((data)->salt) {
+free_octet_string((data)->salt);
+free((data)->salt);
+}
+if((data)->salttype) {
+free((data)->salttype);
+}
+}
+
+size_t
+length_ETYPE_INFO_ENTRY(const ETYPE_INFO_ENTRY *data)
+{
+size_t ret = 0;
+{
+int oldret = ret;
+ret = 0;
+ret += length_ENCTYPE(&(data)->etype);
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->salt){
+int oldret = ret;
+ret = 0;
+ret += length_octet_string((data)->salt);
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->salttype){
+int oldret = ret;
+ret = 0;
+ret += length_integer((data)->salttype);
+ret += 1 + length_len(ret) + oldret;
+}
+ret += 1 + length_len(ret);
+return ret;
+}
+
+int
+copy_ETYPE_INFO_ENTRY(const ETYPE_INFO_ENTRY *from, ETYPE_INFO_ENTRY *to)
+{
+if(copy_ENCTYPE(&(from)->etype, &(to)->etype)) return ENOMEM;
+if((from)->salt) {
+(to)->salt = malloc(sizeof(*(to)->salt));
+if((to)->salt == NULL) return ENOMEM;
+if(copy_octet_string((from)->salt, (to)->salt)) return ENOMEM;
+}else
+(to)->salt = NULL;
+if((from)->salttype) {
+(to)->salttype = malloc(sizeof(*(to)->salttype));
+if((to)->salttype == NULL) return ENOMEM;
+*((to)->salttype) = *((from)->salttype);
+}else
+(to)->salttype = NULL;
+return 0;
+}
+
diff --git a/kerberosV/lib/asn1/asn1_EncAPRepPart.c b/kerberosV/lib/asn1/asn1_EncAPRepPart.c
new file mode 100644
index 00000000000..68b781d2d2c
--- /dev/null
+++ b/kerberosV/lib/asn1/asn1_EncAPRepPart.c
@@ -0,0 +1,284 @@
+/* Generated from /usr/src/kerberosV/lib/asn1/../../src/lib/asn1/k5.asn1 */
+/* Do not edit */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+#include <errno.h>
+#include <krb5_asn1.h>
+#include <asn1_err.h>
+#include <der.h>
+#include <parse_units.h>
+
+#define BACK if (e) return e; p -= l; len -= l; ret += l
+
+int
+encode_EncAPRepPart(unsigned char *p, size_t len, const EncAPRepPart *data, size_t *size)
+{
+size_t ret = 0;
+size_t l;
+int i, e;
+
+i = 0;
+if((data)->seq_number)
+{
+int oldret = ret;
+ret = 0;
+e = encode_UNSIGNED(p, len, (data)->seq_number, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 3, &l);
+BACK;
+ret += oldret;
+}
+if((data)->subkey)
+{
+int oldret = ret;
+ret = 0;
+e = encode_EncryptionKey(p, len, (data)->subkey, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 2, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_integer(p, len, &(data)->cusec, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 1, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_KerberosTime(p, len, &(data)->ctime, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 0, &l);
+BACK;
+ret += oldret;
+}
+e = der_put_length_and_tag (p, len, ret, UNIV, CONS, UT_Sequence, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, APPL, CONS, 27, &l);
+BACK;
+*size = ret;
+return 0;
+}
+
+#define FORW if(e) goto fail; p += l; len -= l; ret += l
+
+int
+decode_EncAPRepPart(const unsigned char *p, size_t len, EncAPRepPart *data, size_t *size)
+{
+size_t ret = 0, reallen;
+size_t l;
+int e;
+
+memset(data, 0, sizeof(*data));
+reallen = 0;
+e = der_match_tag_and_length (p, len, APPL, CONS, 27, &reallen, &l);
+FORW;
+{
+int dce_fix;
+if((dce_fix = fix_dce(reallen, &len)) < 0)
+return ASN1_BAD_FORMAT;
+e = der_match_tag_and_length (p, len, UNIV, CONS, UT_Sequence,&reallen, &l);
+FORW;
+{
+int dce_fix;
+if((dce_fix = fix_dce(reallen, &len)) < 0)
+return ASN1_BAD_FORMAT;
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 0, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_KerberosTime(p, len, &(data)->ctime, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 1, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_integer(p, len, &(data)->cusec, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 2, &l);
+if (e)
+(data)->subkey = NULL;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+(data)->subkey = malloc(sizeof(*(data)->subkey));
+if((data)->subkey == NULL) return ENOMEM;
+e = decode_EncryptionKey(p, len, (data)->subkey, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 3, &l);
+if (e)
+(data)->seq_number = NULL;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+(data)->seq_number = malloc(sizeof(*(data)->seq_number));
+if((data)->seq_number == NULL) return ENOMEM;
+e = decode_UNSIGNED(p, len, (data)->seq_number, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}
+}
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}
+}
+if(size) *size = ret;
+return 0;
+fail:
+free_EncAPRepPart(data);
+return e;
+}
+
+void
+free_EncAPRepPart(EncAPRepPart *data)
+{
+free_KerberosTime(&(data)->ctime);
+if((data)->subkey) {
+free_EncryptionKey((data)->subkey);
+free((data)->subkey);
+}
+if((data)->seq_number) {
+free_UNSIGNED((data)->seq_number);
+free((data)->seq_number);
+}
+}
+
+size_t
+length_EncAPRepPart(const EncAPRepPart *data)
+{
+size_t ret = 0;
+{
+int oldret = ret;
+ret = 0;
+ret += length_KerberosTime(&(data)->ctime);
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+ret += length_integer(&(data)->cusec);
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->subkey){
+int oldret = ret;
+ret = 0;
+ret += length_EncryptionKey((data)->subkey);
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->seq_number){
+int oldret = ret;
+ret = 0;
+ret += length_UNSIGNED((data)->seq_number);
+ret += 1 + length_len(ret) + oldret;
+}
+ret += 1 + length_len(ret);
+ret += 1 + length_len (ret);
+return ret;
+}
+
+int
+copy_EncAPRepPart(const EncAPRepPart *from, EncAPRepPart *to)
+{
+if(copy_KerberosTime(&(from)->ctime, &(to)->ctime)) return ENOMEM;
+*(&(to)->cusec) = *(&(from)->cusec);
+if((from)->subkey) {
+(to)->subkey = malloc(sizeof(*(to)->subkey));
+if((to)->subkey == NULL) return ENOMEM;
+if(copy_EncryptionKey((from)->subkey, (to)->subkey)) return ENOMEM;
+}else
+(to)->subkey = NULL;
+if((from)->seq_number) {
+(to)->seq_number = malloc(sizeof(*(to)->seq_number));
+if((to)->seq_number == NULL) return ENOMEM;
+if(copy_UNSIGNED((from)->seq_number, (to)->seq_number)) return ENOMEM;
+}else
+(to)->seq_number = NULL;
+return 0;
+}
+
diff --git a/kerberosV/lib/asn1/asn1_EncASRepPart.c b/kerberosV/lib/asn1/asn1_EncASRepPart.c
new file mode 100644
index 00000000000..f0389a0e026
--- /dev/null
+++ b/kerberosV/lib/asn1/asn1_EncASRepPart.c
@@ -0,0 +1,84 @@
+/* Generated from /usr/src/kerberosV/lib/asn1/../../src/lib/asn1/k5.asn1 */
+/* Do not edit */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+#include <errno.h>
+#include <krb5_asn1.h>
+#include <asn1_err.h>
+#include <der.h>
+#include <parse_units.h>
+
+#define BACK if (e) return e; p -= l; len -= l; ret += l
+
+int
+encode_EncASRepPart(unsigned char *p, size_t len, const EncASRepPart *data, size_t *size)
+{
+size_t ret = 0;
+size_t l;
+int i, e;
+
+i = 0;
+e = encode_EncKDCRepPart(p, len, data, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, APPL, CONS, 25, &l);
+BACK;
+*size = ret;
+return 0;
+}
+
+#define FORW if(e) goto fail; p += l; len -= l; ret += l
+
+int
+decode_EncASRepPart(const unsigned char *p, size_t len, EncASRepPart *data, size_t *size)
+{
+size_t ret = 0, reallen;
+size_t l;
+int e;
+
+memset(data, 0, sizeof(*data));
+reallen = 0;
+e = der_match_tag_and_length (p, len, APPL, CONS, 25, &reallen, &l);
+FORW;
+{
+int dce_fix;
+if((dce_fix = fix_dce(reallen, &len)) < 0)
+return ASN1_BAD_FORMAT;
+e = decode_EncKDCRepPart(p, len, data, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}
+}
+if(size) *size = ret;
+return 0;
+fail:
+free_EncASRepPart(data);
+return e;
+}
+
+void
+free_EncASRepPart(EncASRepPart *data)
+{
+free_EncKDCRepPart(data);
+}
+
+size_t
+length_EncASRepPart(const EncASRepPart *data)
+{
+size_t ret = 0;
+ret += length_EncKDCRepPart(data);
+ret += 1 + length_len (ret);
+return ret;
+}
+
+int
+copy_EncASRepPart(const EncASRepPart *from, EncASRepPart *to)
+{
+if(copy_EncKDCRepPart(from, to)) return ENOMEM;
+return 0;
+}
+
diff --git a/kerberosV/lib/asn1/asn1_EncKDCRepPart.c b/kerberosV/lib/asn1/asn1_EncKDCRepPart.c
new file mode 100644
index 00000000000..13ee85de26f
--- /dev/null
+++ b/kerberosV/lib/asn1/asn1_EncKDCRepPart.c
@@ -0,0 +1,636 @@
+/* Generated from /usr/src/kerberosV/lib/asn1/../../src/lib/asn1/k5.asn1 */
+/* Do not edit */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+#include <errno.h>
+#include <krb5_asn1.h>
+#include <asn1_err.h>
+#include <der.h>
+#include <parse_units.h>
+
+#define BACK if (e) return e; p -= l; len -= l; ret += l
+
+int
+encode_EncKDCRepPart(unsigned char *p, size_t len, const EncKDCRepPart *data, size_t *size)
+{
+size_t ret = 0;
+size_t l;
+int i, e;
+
+i = 0;
+if((data)->caddr)
+{
+int oldret = ret;
+ret = 0;
+e = encode_HostAddresses(p, len, (data)->caddr, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 11, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_PrincipalName(p, len, &(data)->sname, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 10, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_Realm(p, len, &(data)->srealm, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 9, &l);
+BACK;
+ret += oldret;
+}
+if((data)->renew_till)
+{
+int oldret = ret;
+ret = 0;
+e = encode_KerberosTime(p, len, (data)->renew_till, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 8, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_KerberosTime(p, len, &(data)->endtime, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 7, &l);
+BACK;
+ret += oldret;
+}
+if((data)->starttime)
+{
+int oldret = ret;
+ret = 0;
+e = encode_KerberosTime(p, len, (data)->starttime, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 6, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_KerberosTime(p, len, &(data)->authtime, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 5, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_TicketFlags(p, len, &(data)->flags, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 4, &l);
+BACK;
+ret += oldret;
+}
+if((data)->key_expiration)
+{
+int oldret = ret;
+ret = 0;
+e = encode_KerberosTime(p, len, (data)->key_expiration, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 3, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_integer(p, len, &(data)->nonce, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 2, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_LastReq(p, len, &(data)->last_req, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 1, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_EncryptionKey(p, len, &(data)->key, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 0, &l);
+BACK;
+ret += oldret;
+}
+e = der_put_length_and_tag (p, len, ret, UNIV, CONS, UT_Sequence, &l);
+BACK;
+*size = ret;
+return 0;
+}
+
+#define FORW if(e) goto fail; p += l; len -= l; ret += l
+
+int
+decode_EncKDCRepPart(const unsigned char *p, size_t len, EncKDCRepPart *data, size_t *size)
+{
+size_t ret = 0, reallen;
+size_t l;
+int e;
+
+memset(data, 0, sizeof(*data));
+reallen = 0;
+e = der_match_tag_and_length (p, len, UNIV, CONS, UT_Sequence,&reallen, &l);
+FORW;
+{
+int dce_fix;
+if((dce_fix = fix_dce(reallen, &len)) < 0)
+return ASN1_BAD_FORMAT;
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 0, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_EncryptionKey(p, len, &(data)->key, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 1, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_LastReq(p, len, &(data)->last_req, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 2, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_integer(p, len, &(data)->nonce, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 3, &l);
+if (e)
+(data)->key_expiration = NULL;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+(data)->key_expiration = malloc(sizeof(*(data)->key_expiration));
+if((data)->key_expiration == NULL) return ENOMEM;
+e = decode_KerberosTime(p, len, (data)->key_expiration, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 4, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_TicketFlags(p, len, &(data)->flags, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 5, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_KerberosTime(p, len, &(data)->authtime, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 6, &l);
+if (e)
+(data)->starttime = NULL;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+(data)->starttime = malloc(sizeof(*(data)->starttime));
+if((data)->starttime == NULL) return ENOMEM;
+e = decode_KerberosTime(p, len, (data)->starttime, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 7, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_KerberosTime(p, len, &(data)->endtime, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 8, &l);
+if (e)
+(data)->renew_till = NULL;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+(data)->renew_till = malloc(sizeof(*(data)->renew_till));
+if((data)->renew_till == NULL) return ENOMEM;
+e = decode_KerberosTime(p, len, (data)->renew_till, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 9, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_Realm(p, len, &(data)->srealm, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 10, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_PrincipalName(p, len, &(data)->sname, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 11, &l);
+if (e)
+(data)->caddr = NULL;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+(data)->caddr = malloc(sizeof(*(data)->caddr));
+if((data)->caddr == NULL) return ENOMEM;
+e = decode_HostAddresses(p, len, (data)->caddr, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}
+}
+if(size) *size = ret;
+return 0;
+fail:
+free_EncKDCRepPart(data);
+return e;
+}
+
+void
+free_EncKDCRepPart(EncKDCRepPart *data)
+{
+free_EncryptionKey(&(data)->key);
+free_LastReq(&(data)->last_req);
+if((data)->key_expiration) {
+free_KerberosTime((data)->key_expiration);
+free((data)->key_expiration);
+}
+free_TicketFlags(&(data)->flags);
+free_KerberosTime(&(data)->authtime);
+if((data)->starttime) {
+free_KerberosTime((data)->starttime);
+free((data)->starttime);
+}
+free_KerberosTime(&(data)->endtime);
+if((data)->renew_till) {
+free_KerberosTime((data)->renew_till);
+free((data)->renew_till);
+}
+free_Realm(&(data)->srealm);
+free_PrincipalName(&(data)->sname);
+if((data)->caddr) {
+free_HostAddresses((data)->caddr);
+free((data)->caddr);
+}
+}
+
+size_t
+length_EncKDCRepPart(const EncKDCRepPart *data)
+{
+size_t ret = 0;
+{
+int oldret = ret;
+ret = 0;
+ret += length_EncryptionKey(&(data)->key);
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+ret += length_LastReq(&(data)->last_req);
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+ret += length_integer(&(data)->nonce);
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->key_expiration){
+int oldret = ret;
+ret = 0;
+ret += length_KerberosTime((data)->key_expiration);
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+ret += length_TicketFlags(&(data)->flags);
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+ret += length_KerberosTime(&(data)->authtime);
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->starttime){
+int oldret = ret;
+ret = 0;
+ret += length_KerberosTime((data)->starttime);
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+ret += length_KerberosTime(&(data)->endtime);
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->renew_till){
+int oldret = ret;
+ret = 0;
+ret += length_KerberosTime((data)->renew_till);
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+ret += length_Realm(&(data)->srealm);
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+ret += length_PrincipalName(&(data)->sname);
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->caddr){
+int oldret = ret;
+ret = 0;
+ret += length_HostAddresses((data)->caddr);
+ret += 1 + length_len(ret) + oldret;
+}
+ret += 1 + length_len(ret);
+return ret;
+}
+
+int
+copy_EncKDCRepPart(const EncKDCRepPart *from, EncKDCRepPart *to)
+{
+if(copy_EncryptionKey(&(from)->key, &(to)->key)) return ENOMEM;
+if(copy_LastReq(&(from)->last_req, &(to)->last_req)) return ENOMEM;
+*(&(to)->nonce) = *(&(from)->nonce);
+if((from)->key_expiration) {
+(to)->key_expiration = malloc(sizeof(*(to)->key_expiration));
+if((to)->key_expiration == NULL) return ENOMEM;
+if(copy_KerberosTime((from)->key_expiration, (to)->key_expiration)) return ENOMEM;
+}else
+(to)->key_expiration = NULL;
+if(copy_TicketFlags(&(from)->flags, &(to)->flags)) return ENOMEM;
+if(copy_KerberosTime(&(from)->authtime, &(to)->authtime)) return ENOMEM;
+if((from)->starttime) {
+(to)->starttime = malloc(sizeof(*(to)->starttime));
+if((to)->starttime == NULL) return ENOMEM;
+if(copy_KerberosTime((from)->starttime, (to)->starttime)) return ENOMEM;
+}else
+(to)->starttime = NULL;
+if(copy_KerberosTime(&(from)->endtime, &(to)->endtime)) return ENOMEM;
+if((from)->renew_till) {
+(to)->renew_till = malloc(sizeof(*(to)->renew_till));
+if((to)->renew_till == NULL) return ENOMEM;
+if(copy_KerberosTime((from)->renew_till, (to)->renew_till)) return ENOMEM;
+}else
+(to)->renew_till = NULL;
+if(copy_Realm(&(from)->srealm, &(to)->srealm)) return ENOMEM;
+if(copy_PrincipalName(&(from)->sname, &(to)->sname)) return ENOMEM;
+if((from)->caddr) {
+(to)->caddr = malloc(sizeof(*(to)->caddr));
+if((to)->caddr == NULL) return ENOMEM;
+if(copy_HostAddresses((from)->caddr, (to)->caddr)) return ENOMEM;
+}else
+(to)->caddr = NULL;
+return 0;
+}
+
diff --git a/kerberosV/lib/asn1/asn1_EncKrbCredPart.c b/kerberosV/lib/asn1/asn1_EncKrbCredPart.c
new file mode 100644
index 00000000000..bea4885b54b
--- /dev/null
+++ b/kerberosV/lib/asn1/asn1_EncKrbCredPart.c
@@ -0,0 +1,443 @@
+/* Generated from /usr/src/kerberosV/lib/asn1/../../src/lib/asn1/k5.asn1 */
+/* Do not edit */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+#include <errno.h>
+#include <krb5_asn1.h>
+#include <asn1_err.h>
+#include <der.h>
+#include <parse_units.h>
+
+#define BACK if (e) return e; p -= l; len -= l; ret += l
+
+int
+encode_EncKrbCredPart(unsigned char *p, size_t len, const EncKrbCredPart *data, size_t *size)
+{
+size_t ret = 0;
+size_t l;
+int i, e;
+
+i = 0;
+if((data)->r_address)
+{
+int oldret = ret;
+ret = 0;
+e = encode_HostAddress(p, len, (data)->r_address, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 5, &l);
+BACK;
+ret += oldret;
+}
+if((data)->s_address)
+{
+int oldret = ret;
+ret = 0;
+e = encode_HostAddress(p, len, (data)->s_address, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 4, &l);
+BACK;
+ret += oldret;
+}
+if((data)->usec)
+{
+int oldret = ret;
+ret = 0;
+e = encode_integer(p, len, (data)->usec, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 3, &l);
+BACK;
+ret += oldret;
+}
+if((data)->timestamp)
+{
+int oldret = ret;
+ret = 0;
+e = encode_KerberosTime(p, len, (data)->timestamp, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 2, &l);
+BACK;
+ret += oldret;
+}
+if((data)->nonce)
+{
+int oldret = ret;
+ret = 0;
+e = encode_integer(p, len, (data)->nonce, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 1, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+for(i = (&(data)->ticket_info)->len - 1; i >= 0; --i) {
+int oldret = ret;
+ret = 0;
+e = encode_KrbCredInfo(p, len, &(&(data)->ticket_info)->val[i], &l);
+BACK;
+ret += oldret;
+}
+e = der_put_length_and_tag (p, len, ret, UNIV, CONS, UT_Sequence, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 0, &l);
+BACK;
+ret += oldret;
+}
+e = der_put_length_and_tag (p, len, ret, UNIV, CONS, UT_Sequence, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, APPL, CONS, 29, &l);
+BACK;
+*size = ret;
+return 0;
+}
+
+#define FORW if(e) goto fail; p += l; len -= l; ret += l
+
+int
+decode_EncKrbCredPart(const unsigned char *p, size_t len, EncKrbCredPart *data, size_t *size)
+{
+size_t ret = 0, reallen;
+size_t l;
+int e;
+
+memset(data, 0, sizeof(*data));
+reallen = 0;
+e = der_match_tag_and_length (p, len, APPL, CONS, 29, &reallen, &l);
+FORW;
+{
+int dce_fix;
+if((dce_fix = fix_dce(reallen, &len)) < 0)
+return ASN1_BAD_FORMAT;
+e = der_match_tag_and_length (p, len, UNIV, CONS, UT_Sequence,&reallen, &l);
+FORW;
+{
+int dce_fix;
+if((dce_fix = fix_dce(reallen, &len)) < 0)
+return ASN1_BAD_FORMAT;
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 0, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = der_match_tag_and_length (p, len, UNIV, CONS, UT_Sequence,&reallen, &l);
+FORW;
+if(len < reallen)
+return ASN1_OVERRUN;
+len = reallen;
+{
+size_t origlen = len;
+int oldret = ret;
+ret = 0;
+(&(data)->ticket_info)->len = 0;
+(&(data)->ticket_info)->val = NULL;
+while(ret < origlen) {
+(&(data)->ticket_info)->len++;
+(&(data)->ticket_info)->val = realloc((&(data)->ticket_info)->val, sizeof(*((&(data)->ticket_info)->val)) * (&(data)->ticket_info)->len);
+e = decode_KrbCredInfo(p, len, &(&(data)->ticket_info)->val[(&(data)->ticket_info)->len-1], &l);
+FORW;
+len = origlen - ret;
+}
+ret += oldret;
+}
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 1, &l);
+if (e)
+(data)->nonce = NULL;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+(data)->nonce = malloc(sizeof(*(data)->nonce));
+if((data)->nonce == NULL) return ENOMEM;
+e = decode_integer(p, len, (data)->nonce, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 2, &l);
+if (e)
+(data)->timestamp = NULL;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+(data)->timestamp = malloc(sizeof(*(data)->timestamp));
+if((data)->timestamp == NULL) return ENOMEM;
+e = decode_KerberosTime(p, len, (data)->timestamp, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 3, &l);
+if (e)
+(data)->usec = NULL;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+(data)->usec = malloc(sizeof(*(data)->usec));
+if((data)->usec == NULL) return ENOMEM;
+e = decode_integer(p, len, (data)->usec, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 4, &l);
+if (e)
+(data)->s_address = NULL;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+(data)->s_address = malloc(sizeof(*(data)->s_address));
+if((data)->s_address == NULL) return ENOMEM;
+e = decode_HostAddress(p, len, (data)->s_address, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 5, &l);
+if (e)
+(data)->r_address = NULL;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+(data)->r_address = malloc(sizeof(*(data)->r_address));
+if((data)->r_address == NULL) return ENOMEM;
+e = decode_HostAddress(p, len, (data)->r_address, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}
+}
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}
+}
+if(size) *size = ret;
+return 0;
+fail:
+free_EncKrbCredPart(data);
+return e;
+}
+
+void
+free_EncKrbCredPart(EncKrbCredPart *data)
+{
+while((&(data)->ticket_info)->len){
+free_KrbCredInfo(&(&(data)->ticket_info)->val[(&(data)->ticket_info)->len-1]);
+(&(data)->ticket_info)->len--;
+}
+free((&(data)->ticket_info)->val);
+if((data)->nonce) {
+free((data)->nonce);
+}
+if((data)->timestamp) {
+free_KerberosTime((data)->timestamp);
+free((data)->timestamp);
+}
+if((data)->usec) {
+free((data)->usec);
+}
+if((data)->s_address) {
+free_HostAddress((data)->s_address);
+free((data)->s_address);
+}
+if((data)->r_address) {
+free_HostAddress((data)->r_address);
+free((data)->r_address);
+}
+}
+
+size_t
+length_EncKrbCredPart(const EncKrbCredPart *data)
+{
+size_t ret = 0;
+{
+int oldret = ret;
+ret = 0;
+{
+int oldret = ret;
+int i;
+ret = 0;
+for(i = (&(data)->ticket_info)->len - 1; i >= 0; --i){
+ret += length_KrbCredInfo(&(&(data)->ticket_info)->val[i]);
+}
+ret += 1 + length_len(ret) + oldret;
+}
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->nonce){
+int oldret = ret;
+ret = 0;
+ret += length_integer((data)->nonce);
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->timestamp){
+int oldret = ret;
+ret = 0;
+ret += length_KerberosTime((data)->timestamp);
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->usec){
+int oldret = ret;
+ret = 0;
+ret += length_integer((data)->usec);
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->s_address){
+int oldret = ret;
+ret = 0;
+ret += length_HostAddress((data)->s_address);
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->r_address){
+int oldret = ret;
+ret = 0;
+ret += length_HostAddress((data)->r_address);
+ret += 1 + length_len(ret) + oldret;
+}
+ret += 1 + length_len(ret);
+ret += 1 + length_len (ret);
+return ret;
+}
+
+int
+copy_EncKrbCredPart(const EncKrbCredPart *from, EncKrbCredPart *to)
+{
+if(((&(to)->ticket_info)->val = malloc((&(from)->ticket_info)->len * sizeof(*(&(to)->ticket_info)->val))) == NULL && (&(from)->ticket_info)->len != 0)
+return ENOMEM;
+for((&(to)->ticket_info)->len = 0; (&(to)->ticket_info)->len < (&(from)->ticket_info)->len; (&(to)->ticket_info)->len++){
+if(copy_KrbCredInfo(&(&(from)->ticket_info)->val[(&(to)->ticket_info)->len], &(&(to)->ticket_info)->val[(&(to)->ticket_info)->len])) return ENOMEM;
+}
+if((from)->nonce) {
+(to)->nonce = malloc(sizeof(*(to)->nonce));
+if((to)->nonce == NULL) return ENOMEM;
+*((to)->nonce) = *((from)->nonce);
+}else
+(to)->nonce = NULL;
+if((from)->timestamp) {
+(to)->timestamp = malloc(sizeof(*(to)->timestamp));
+if((to)->timestamp == NULL) return ENOMEM;
+if(copy_KerberosTime((from)->timestamp, (to)->timestamp)) return ENOMEM;
+}else
+(to)->timestamp = NULL;
+if((from)->usec) {
+(to)->usec = malloc(sizeof(*(to)->usec));
+if((to)->usec == NULL) return ENOMEM;
+*((to)->usec) = *((from)->usec);
+}else
+(to)->usec = NULL;
+if((from)->s_address) {
+(to)->s_address = malloc(sizeof(*(to)->s_address));
+if((to)->s_address == NULL) return ENOMEM;
+if(copy_HostAddress((from)->s_address, (to)->s_address)) return ENOMEM;
+}else
+(to)->s_address = NULL;
+if((from)->r_address) {
+(to)->r_address = malloc(sizeof(*(to)->r_address));
+if((to)->r_address == NULL) return ENOMEM;
+if(copy_HostAddress((from)->r_address, (to)->r_address)) return ENOMEM;
+}else
+(to)->r_address = NULL;
+return 0;
+}
+
diff --git a/kerberosV/lib/asn1/asn1_EncKrbPrivPart.c b/kerberosV/lib/asn1/asn1_EncKrbPrivPart.c
new file mode 100644
index 00000000000..0a806a0cf39
--- /dev/null
+++ b/kerberosV/lib/asn1/asn1_EncKrbPrivPart.c
@@ -0,0 +1,403 @@
+/* Generated from /usr/src/kerberosV/lib/asn1/../../src/lib/asn1/k5.asn1 */
+/* Do not edit */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+#include <errno.h>
+#include <krb5_asn1.h>
+#include <asn1_err.h>
+#include <der.h>
+#include <parse_units.h>
+
+#define BACK if (e) return e; p -= l; len -= l; ret += l
+
+int
+encode_EncKrbPrivPart(unsigned char *p, size_t len, const EncKrbPrivPart *data, size_t *size)
+{
+size_t ret = 0;
+size_t l;
+int i, e;
+
+i = 0;
+if((data)->r_address)
+{
+int oldret = ret;
+ret = 0;
+e = encode_HostAddress(p, len, (data)->r_address, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 5, &l);
+BACK;
+ret += oldret;
+}
+if((data)->s_address)
+{
+int oldret = ret;
+ret = 0;
+e = encode_HostAddress(p, len, (data)->s_address, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 4, &l);
+BACK;
+ret += oldret;
+}
+if((data)->seq_number)
+{
+int oldret = ret;
+ret = 0;
+e = encode_UNSIGNED(p, len, (data)->seq_number, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 3, &l);
+BACK;
+ret += oldret;
+}
+if((data)->usec)
+{
+int oldret = ret;
+ret = 0;
+e = encode_integer(p, len, (data)->usec, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 2, &l);
+BACK;
+ret += oldret;
+}
+if((data)->timestamp)
+{
+int oldret = ret;
+ret = 0;
+e = encode_KerberosTime(p, len, (data)->timestamp, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 1, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_octet_string(p, len, &(data)->user_data, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 0, &l);
+BACK;
+ret += oldret;
+}
+e = der_put_length_and_tag (p, len, ret, UNIV, CONS, UT_Sequence, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, APPL, CONS, 28, &l);
+BACK;
+*size = ret;
+return 0;
+}
+
+#define FORW if(e) goto fail; p += l; len -= l; ret += l
+
+int
+decode_EncKrbPrivPart(const unsigned char *p, size_t len, EncKrbPrivPart *data, size_t *size)
+{
+size_t ret = 0, reallen;
+size_t l;
+int e;
+
+memset(data, 0, sizeof(*data));
+reallen = 0;
+e = der_match_tag_and_length (p, len, APPL, CONS, 28, &reallen, &l);
+FORW;
+{
+int dce_fix;
+if((dce_fix = fix_dce(reallen, &len)) < 0)
+return ASN1_BAD_FORMAT;
+e = der_match_tag_and_length (p, len, UNIV, CONS, UT_Sequence,&reallen, &l);
+FORW;
+{
+int dce_fix;
+if((dce_fix = fix_dce(reallen, &len)) < 0)
+return ASN1_BAD_FORMAT;
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 0, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_octet_string(p, len, &(data)->user_data, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 1, &l);
+if (e)
+(data)->timestamp = NULL;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+(data)->timestamp = malloc(sizeof(*(data)->timestamp));
+if((data)->timestamp == NULL) return ENOMEM;
+e = decode_KerberosTime(p, len, (data)->timestamp, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 2, &l);
+if (e)
+(data)->usec = NULL;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+(data)->usec = malloc(sizeof(*(data)->usec));
+if((data)->usec == NULL) return ENOMEM;
+e = decode_integer(p, len, (data)->usec, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 3, &l);
+if (e)
+(data)->seq_number = NULL;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+(data)->seq_number = malloc(sizeof(*(data)->seq_number));
+if((data)->seq_number == NULL) return ENOMEM;
+e = decode_UNSIGNED(p, len, (data)->seq_number, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 4, &l);
+if (e)
+(data)->s_address = NULL;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+(data)->s_address = malloc(sizeof(*(data)->s_address));
+if((data)->s_address == NULL) return ENOMEM;
+e = decode_HostAddress(p, len, (data)->s_address, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 5, &l);
+if (e)
+(data)->r_address = NULL;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+(data)->r_address = malloc(sizeof(*(data)->r_address));
+if((data)->r_address == NULL) return ENOMEM;
+e = decode_HostAddress(p, len, (data)->r_address, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}
+}
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}
+}
+if(size) *size = ret;
+return 0;
+fail:
+free_EncKrbPrivPart(data);
+return e;
+}
+
+void
+free_EncKrbPrivPart(EncKrbPrivPart *data)
+{
+free_octet_string(&(data)->user_data);
+if((data)->timestamp) {
+free_KerberosTime((data)->timestamp);
+free((data)->timestamp);
+}
+if((data)->usec) {
+free((data)->usec);
+}
+if((data)->seq_number) {
+free_UNSIGNED((data)->seq_number);
+free((data)->seq_number);
+}
+if((data)->s_address) {
+free_HostAddress((data)->s_address);
+free((data)->s_address);
+}
+if((data)->r_address) {
+free_HostAddress((data)->r_address);
+free((data)->r_address);
+}
+}
+
+size_t
+length_EncKrbPrivPart(const EncKrbPrivPart *data)
+{
+size_t ret = 0;
+{
+int oldret = ret;
+ret = 0;
+ret += length_octet_string(&(data)->user_data);
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->timestamp){
+int oldret = ret;
+ret = 0;
+ret += length_KerberosTime((data)->timestamp);
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->usec){
+int oldret = ret;
+ret = 0;
+ret += length_integer((data)->usec);
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->seq_number){
+int oldret = ret;
+ret = 0;
+ret += length_UNSIGNED((data)->seq_number);
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->s_address){
+int oldret = ret;
+ret = 0;
+ret += length_HostAddress((data)->s_address);
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->r_address){
+int oldret = ret;
+ret = 0;
+ret += length_HostAddress((data)->r_address);
+ret += 1 + length_len(ret) + oldret;
+}
+ret += 1 + length_len(ret);
+ret += 1 + length_len (ret);
+return ret;
+}
+
+int
+copy_EncKrbPrivPart(const EncKrbPrivPart *from, EncKrbPrivPart *to)
+{
+if(copy_octet_string(&(from)->user_data, &(to)->user_data)) return ENOMEM;
+if((from)->timestamp) {
+(to)->timestamp = malloc(sizeof(*(to)->timestamp));
+if((to)->timestamp == NULL) return ENOMEM;
+if(copy_KerberosTime((from)->timestamp, (to)->timestamp)) return ENOMEM;
+}else
+(to)->timestamp = NULL;
+if((from)->usec) {
+(to)->usec = malloc(sizeof(*(to)->usec));
+if((to)->usec == NULL) return ENOMEM;
+*((to)->usec) = *((from)->usec);
+}else
+(to)->usec = NULL;
+if((from)->seq_number) {
+(to)->seq_number = malloc(sizeof(*(to)->seq_number));
+if((to)->seq_number == NULL) return ENOMEM;
+if(copy_UNSIGNED((from)->seq_number, (to)->seq_number)) return ENOMEM;
+}else
+(to)->seq_number = NULL;
+if((from)->s_address) {
+(to)->s_address = malloc(sizeof(*(to)->s_address));
+if((to)->s_address == NULL) return ENOMEM;
+if(copy_HostAddress((from)->s_address, (to)->s_address)) return ENOMEM;
+}else
+(to)->s_address = NULL;
+if((from)->r_address) {
+(to)->r_address = malloc(sizeof(*(to)->r_address));
+if((to)->r_address == NULL) return ENOMEM;
+if(copy_HostAddress((from)->r_address, (to)->r_address)) return ENOMEM;
+}else
+(to)->r_address = NULL;
+return 0;
+}
+
diff --git a/kerberosV/lib/asn1/asn1_EncTGSRepPart.c b/kerberosV/lib/asn1/asn1_EncTGSRepPart.c
new file mode 100644
index 00000000000..b7b72368065
--- /dev/null
+++ b/kerberosV/lib/asn1/asn1_EncTGSRepPart.c
@@ -0,0 +1,84 @@
+/* Generated from /usr/src/kerberosV/lib/asn1/../../src/lib/asn1/k5.asn1 */
+/* Do not edit */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+#include <errno.h>
+#include <krb5_asn1.h>
+#include <asn1_err.h>
+#include <der.h>
+#include <parse_units.h>
+
+#define BACK if (e) return e; p -= l; len -= l; ret += l
+
+int
+encode_EncTGSRepPart(unsigned char *p, size_t len, const EncTGSRepPart *data, size_t *size)
+{
+size_t ret = 0;
+size_t l;
+int i, e;
+
+i = 0;
+e = encode_EncKDCRepPart(p, len, data, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, APPL, CONS, 26, &l);
+BACK;
+*size = ret;
+return 0;
+}
+
+#define FORW if(e) goto fail; p += l; len -= l; ret += l
+
+int
+decode_EncTGSRepPart(const unsigned char *p, size_t len, EncTGSRepPart *data, size_t *size)
+{
+size_t ret = 0, reallen;
+size_t l;
+int e;
+
+memset(data, 0, sizeof(*data));
+reallen = 0;
+e = der_match_tag_and_length (p, len, APPL, CONS, 26, &reallen, &l);
+FORW;
+{
+int dce_fix;
+if((dce_fix = fix_dce(reallen, &len)) < 0)
+return ASN1_BAD_FORMAT;
+e = decode_EncKDCRepPart(p, len, data, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}
+}
+if(size) *size = ret;
+return 0;
+fail:
+free_EncTGSRepPart(data);
+return e;
+}
+
+void
+free_EncTGSRepPart(EncTGSRepPart *data)
+{
+free_EncKDCRepPart(data);
+}
+
+size_t
+length_EncTGSRepPart(const EncTGSRepPart *data)
+{
+size_t ret = 0;
+ret += length_EncKDCRepPart(data);
+ret += 1 + length_len (ret);
+return ret;
+}
+
+int
+copy_EncTGSRepPart(const EncTGSRepPart *from, EncTGSRepPart *to)
+{
+if(copy_EncKDCRepPart(from, to)) return ENOMEM;
+return 0;
+}
+
diff --git a/kerberosV/lib/asn1/asn1_EncTicketPart.c b/kerberosV/lib/asn1/asn1_EncTicketPart.c
new file mode 100644
index 00000000000..75f79a1d95b
--- /dev/null
+++ b/kerberosV/lib/asn1/asn1_EncTicketPart.c
@@ -0,0 +1,608 @@
+/* Generated from /usr/src/kerberosV/lib/asn1/../../src/lib/asn1/k5.asn1 */
+/* Do not edit */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+#include <errno.h>
+#include <krb5_asn1.h>
+#include <asn1_err.h>
+#include <der.h>
+#include <parse_units.h>
+
+#define BACK if (e) return e; p -= l; len -= l; ret += l
+
+int
+encode_EncTicketPart(unsigned char *p, size_t len, const EncTicketPart *data, size_t *size)
+{
+size_t ret = 0;
+size_t l;
+int i, e;
+
+i = 0;
+if((data)->authorization_data)
+{
+int oldret = ret;
+ret = 0;
+e = encode_AuthorizationData(p, len, (data)->authorization_data, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 10, &l);
+BACK;
+ret += oldret;
+}
+if((data)->caddr)
+{
+int oldret = ret;
+ret = 0;
+e = encode_HostAddresses(p, len, (data)->caddr, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 9, &l);
+BACK;
+ret += oldret;
+}
+if((data)->renew_till)
+{
+int oldret = ret;
+ret = 0;
+e = encode_KerberosTime(p, len, (data)->renew_till, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 8, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_KerberosTime(p, len, &(data)->endtime, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 7, &l);
+BACK;
+ret += oldret;
+}
+if((data)->starttime)
+{
+int oldret = ret;
+ret = 0;
+e = encode_KerberosTime(p, len, (data)->starttime, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 6, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_KerberosTime(p, len, &(data)->authtime, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 5, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_TransitedEncoding(p, len, &(data)->transited, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 4, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_PrincipalName(p, len, &(data)->cname, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 3, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_Realm(p, len, &(data)->crealm, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 2, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_EncryptionKey(p, len, &(data)->key, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 1, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_TicketFlags(p, len, &(data)->flags, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 0, &l);
+BACK;
+ret += oldret;
+}
+e = der_put_length_and_tag (p, len, ret, UNIV, CONS, UT_Sequence, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, APPL, CONS, 3, &l);
+BACK;
+*size = ret;
+return 0;
+}
+
+#define FORW if(e) goto fail; p += l; len -= l; ret += l
+
+int
+decode_EncTicketPart(const unsigned char *p, size_t len, EncTicketPart *data, size_t *size)
+{
+size_t ret = 0, reallen;
+size_t l;
+int e;
+
+memset(data, 0, sizeof(*data));
+reallen = 0;
+e = der_match_tag_and_length (p, len, APPL, CONS, 3, &reallen, &l);
+FORW;
+{
+int dce_fix;
+if((dce_fix = fix_dce(reallen, &len)) < 0)
+return ASN1_BAD_FORMAT;
+e = der_match_tag_and_length (p, len, UNIV, CONS, UT_Sequence,&reallen, &l);
+FORW;
+{
+int dce_fix;
+if((dce_fix = fix_dce(reallen, &len)) < 0)
+return ASN1_BAD_FORMAT;
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 0, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_TicketFlags(p, len, &(data)->flags, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 1, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_EncryptionKey(p, len, &(data)->key, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 2, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_Realm(p, len, &(data)->crealm, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 3, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_PrincipalName(p, len, &(data)->cname, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 4, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_TransitedEncoding(p, len, &(data)->transited, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 5, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_KerberosTime(p, len, &(data)->authtime, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 6, &l);
+if (e)
+(data)->starttime = NULL;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+(data)->starttime = malloc(sizeof(*(data)->starttime));
+if((data)->starttime == NULL) return ENOMEM;
+e = decode_KerberosTime(p, len, (data)->starttime, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 7, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_KerberosTime(p, len, &(data)->endtime, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 8, &l);
+if (e)
+(data)->renew_till = NULL;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+(data)->renew_till = malloc(sizeof(*(data)->renew_till));
+if((data)->renew_till == NULL) return ENOMEM;
+e = decode_KerberosTime(p, len, (data)->renew_till, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 9, &l);
+if (e)
+(data)->caddr = NULL;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+(data)->caddr = malloc(sizeof(*(data)->caddr));
+if((data)->caddr == NULL) return ENOMEM;
+e = decode_HostAddresses(p, len, (data)->caddr, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 10, &l);
+if (e)
+(data)->authorization_data = NULL;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+(data)->authorization_data = malloc(sizeof(*(data)->authorization_data));
+if((data)->authorization_data == NULL) return ENOMEM;
+e = decode_AuthorizationData(p, len, (data)->authorization_data, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}
+}
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}
+}
+if(size) *size = ret;
+return 0;
+fail:
+free_EncTicketPart(data);
+return e;
+}
+
+void
+free_EncTicketPart(EncTicketPart *data)
+{
+free_TicketFlags(&(data)->flags);
+free_EncryptionKey(&(data)->key);
+free_Realm(&(data)->crealm);
+free_PrincipalName(&(data)->cname);
+free_TransitedEncoding(&(data)->transited);
+free_KerberosTime(&(data)->authtime);
+if((data)->starttime) {
+free_KerberosTime((data)->starttime);
+free((data)->starttime);
+}
+free_KerberosTime(&(data)->endtime);
+if((data)->renew_till) {
+free_KerberosTime((data)->renew_till);
+free((data)->renew_till);
+}
+if((data)->caddr) {
+free_HostAddresses((data)->caddr);
+free((data)->caddr);
+}
+if((data)->authorization_data) {
+free_AuthorizationData((data)->authorization_data);
+free((data)->authorization_data);
+}
+}
+
+size_t
+length_EncTicketPart(const EncTicketPart *data)
+{
+size_t ret = 0;
+{
+int oldret = ret;
+ret = 0;
+ret += length_TicketFlags(&(data)->flags);
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+ret += length_EncryptionKey(&(data)->key);
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+ret += length_Realm(&(data)->crealm);
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+ret += length_PrincipalName(&(data)->cname);
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+ret += length_TransitedEncoding(&(data)->transited);
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+ret += length_KerberosTime(&(data)->authtime);
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->starttime){
+int oldret = ret;
+ret = 0;
+ret += length_KerberosTime((data)->starttime);
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+ret += length_KerberosTime(&(data)->endtime);
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->renew_till){
+int oldret = ret;
+ret = 0;
+ret += length_KerberosTime((data)->renew_till);
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->caddr){
+int oldret = ret;
+ret = 0;
+ret += length_HostAddresses((data)->caddr);
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->authorization_data){
+int oldret = ret;
+ret = 0;
+ret += length_AuthorizationData((data)->authorization_data);
+ret += 1 + length_len(ret) + oldret;
+}
+ret += 1 + length_len(ret);
+ret += 1 + length_len (ret);
+return ret;
+}
+
+int
+copy_EncTicketPart(const EncTicketPart *from, EncTicketPart *to)
+{
+if(copy_TicketFlags(&(from)->flags, &(to)->flags)) return ENOMEM;
+if(copy_EncryptionKey(&(from)->key, &(to)->key)) return ENOMEM;
+if(copy_Realm(&(from)->crealm, &(to)->crealm)) return ENOMEM;
+if(copy_PrincipalName(&(from)->cname, &(to)->cname)) return ENOMEM;
+if(copy_TransitedEncoding(&(from)->transited, &(to)->transited)) return ENOMEM;
+if(copy_KerberosTime(&(from)->authtime, &(to)->authtime)) return ENOMEM;
+if((from)->starttime) {
+(to)->starttime = malloc(sizeof(*(to)->starttime));
+if((to)->starttime == NULL) return ENOMEM;
+if(copy_KerberosTime((from)->starttime, (to)->starttime)) return ENOMEM;
+}else
+(to)->starttime = NULL;
+if(copy_KerberosTime(&(from)->endtime, &(to)->endtime)) return ENOMEM;
+if((from)->renew_till) {
+(to)->renew_till = malloc(sizeof(*(to)->renew_till));
+if((to)->renew_till == NULL) return ENOMEM;
+if(copy_KerberosTime((from)->renew_till, (to)->renew_till)) return ENOMEM;
+}else
+(to)->renew_till = NULL;
+if((from)->caddr) {
+(to)->caddr = malloc(sizeof(*(to)->caddr));
+if((to)->caddr == NULL) return ENOMEM;
+if(copy_HostAddresses((from)->caddr, (to)->caddr)) return ENOMEM;
+}else
+(to)->caddr = NULL;
+if((from)->authorization_data) {
+(to)->authorization_data = malloc(sizeof(*(to)->authorization_data));
+if((to)->authorization_data == NULL) return ENOMEM;
+if(copy_AuthorizationData((from)->authorization_data, (to)->authorization_data)) return ENOMEM;
+}else
+(to)->authorization_data = NULL;
+return 0;
+}
+
diff --git a/kerberosV/lib/asn1/asn1_EncryptedData.c b/kerberosV/lib/asn1/asn1_EncryptedData.c
new file mode 100644
index 00000000000..149fbaf916f
--- /dev/null
+++ b/kerberosV/lib/asn1/asn1_EncryptedData.c
@@ -0,0 +1,216 @@
+/* Generated from /usr/src/kerberosV/lib/asn1/../../src/lib/asn1/k5.asn1 */
+/* Do not edit */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+#include <errno.h>
+#include <krb5_asn1.h>
+#include <asn1_err.h>
+#include <der.h>
+#include <parse_units.h>
+
+#define BACK if (e) return e; p -= l; len -= l; ret += l
+
+int
+encode_EncryptedData(unsigned char *p, size_t len, const EncryptedData *data, size_t *size)
+{
+size_t ret = 0;
+size_t l;
+int i, e;
+
+i = 0;
+{
+int oldret = ret;
+ret = 0;
+e = encode_octet_string(p, len, &(data)->cipher, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 2, &l);
+BACK;
+ret += oldret;
+}
+if((data)->kvno)
+{
+int oldret = ret;
+ret = 0;
+e = encode_integer(p, len, (data)->kvno, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 1, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_ENCTYPE(p, len, &(data)->etype, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 0, &l);
+BACK;
+ret += oldret;
+}
+e = der_put_length_and_tag (p, len, ret, UNIV, CONS, UT_Sequence, &l);
+BACK;
+*size = ret;
+return 0;
+}
+
+#define FORW if(e) goto fail; p += l; len -= l; ret += l
+
+int
+decode_EncryptedData(const unsigned char *p, size_t len, EncryptedData *data, size_t *size)
+{
+size_t ret = 0, reallen;
+size_t l;
+int e;
+
+memset(data, 0, sizeof(*data));
+reallen = 0;
+e = der_match_tag_and_length (p, len, UNIV, CONS, UT_Sequence,&reallen, &l);
+FORW;
+{
+int dce_fix;
+if((dce_fix = fix_dce(reallen, &len)) < 0)
+return ASN1_BAD_FORMAT;
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 0, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_ENCTYPE(p, len, &(data)->etype, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 1, &l);
+if (e)
+(data)->kvno = NULL;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+(data)->kvno = malloc(sizeof(*(data)->kvno));
+if((data)->kvno == NULL) return ENOMEM;
+e = decode_integer(p, len, (data)->kvno, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 2, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_octet_string(p, len, &(data)->cipher, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}
+}
+if(size) *size = ret;
+return 0;
+fail:
+free_EncryptedData(data);
+return e;
+}
+
+void
+free_EncryptedData(EncryptedData *data)
+{
+free_ENCTYPE(&(data)->etype);
+if((data)->kvno) {
+free((data)->kvno);
+}
+free_octet_string(&(data)->cipher);
+}
+
+size_t
+length_EncryptedData(const EncryptedData *data)
+{
+size_t ret = 0;
+{
+int oldret = ret;
+ret = 0;
+ret += length_ENCTYPE(&(data)->etype);
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->kvno){
+int oldret = ret;
+ret = 0;
+ret += length_integer((data)->kvno);
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+ret += length_octet_string(&(data)->cipher);
+ret += 1 + length_len(ret) + oldret;
+}
+ret += 1 + length_len(ret);
+return ret;
+}
+
+int
+copy_EncryptedData(const EncryptedData *from, EncryptedData *to)
+{
+if(copy_ENCTYPE(&(from)->etype, &(to)->etype)) return ENOMEM;
+if((from)->kvno) {
+(to)->kvno = malloc(sizeof(*(to)->kvno));
+if((to)->kvno == NULL) return ENOMEM;
+*((to)->kvno) = *((from)->kvno);
+}else
+(to)->kvno = NULL;
+if(copy_octet_string(&(from)->cipher, &(to)->cipher)) return ENOMEM;
+return 0;
+}
+
diff --git a/kerberosV/lib/asn1/asn1_EncryptionKey.c b/kerberosV/lib/asn1/asn1_EncryptionKey.c
new file mode 100644
index 00000000000..01ee628b32d
--- /dev/null
+++ b/kerberosV/lib/asn1/asn1_EncryptionKey.c
@@ -0,0 +1,162 @@
+/* Generated from /usr/src/kerberosV/lib/asn1/../../src/lib/asn1/k5.asn1 */
+/* Do not edit */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+#include <errno.h>
+#include <krb5_asn1.h>
+#include <asn1_err.h>
+#include <der.h>
+#include <parse_units.h>
+
+#define BACK if (e) return e; p -= l; len -= l; ret += l
+
+int
+encode_EncryptionKey(unsigned char *p, size_t len, const EncryptionKey *data, size_t *size)
+{
+size_t ret = 0;
+size_t l;
+int i, e;
+
+i = 0;
+{
+int oldret = ret;
+ret = 0;
+e = encode_octet_string(p, len, &(data)->keyvalue, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 1, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_integer(p, len, &(data)->keytype, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 0, &l);
+BACK;
+ret += oldret;
+}
+e = der_put_length_and_tag (p, len, ret, UNIV, CONS, UT_Sequence, &l);
+BACK;
+*size = ret;
+return 0;
+}
+
+#define FORW if(e) goto fail; p += l; len -= l; ret += l
+
+int
+decode_EncryptionKey(const unsigned char *p, size_t len, EncryptionKey *data, size_t *size)
+{
+size_t ret = 0, reallen;
+size_t l;
+int e;
+
+memset(data, 0, sizeof(*data));
+reallen = 0;
+e = der_match_tag_and_length (p, len, UNIV, CONS, UT_Sequence,&reallen, &l);
+FORW;
+{
+int dce_fix;
+if((dce_fix = fix_dce(reallen, &len)) < 0)
+return ASN1_BAD_FORMAT;
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 0, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_integer(p, len, &(data)->keytype, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 1, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_octet_string(p, len, &(data)->keyvalue, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}
+}
+if(size) *size = ret;
+return 0;
+fail:
+free_EncryptionKey(data);
+return e;
+}
+
+void
+free_EncryptionKey(EncryptionKey *data)
+{
+free_octet_string(&(data)->keyvalue);
+}
+
+size_t
+length_EncryptionKey(const EncryptionKey *data)
+{
+size_t ret = 0;
+{
+int oldret = ret;
+ret = 0;
+ret += length_integer(&(data)->keytype);
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+ret += length_octet_string(&(data)->keyvalue);
+ret += 1 + length_len(ret) + oldret;
+}
+ret += 1 + length_len(ret);
+return ret;
+}
+
+int
+copy_EncryptionKey(const EncryptionKey *from, EncryptionKey *to)
+{
+*(&(to)->keytype) = *(&(from)->keytype);
+if(copy_octet_string(&(from)->keyvalue, &(to)->keyvalue)) return ENOMEM;
+return 0;
+}
+
diff --git a/kerberosV/lib/asn1/asn1_HostAddress.c b/kerberosV/lib/asn1/asn1_HostAddress.c
new file mode 100644
index 00000000000..4ace9a7d033
--- /dev/null
+++ b/kerberosV/lib/asn1/asn1_HostAddress.c
@@ -0,0 +1,162 @@
+/* Generated from /usr/src/kerberosV/lib/asn1/../../src/lib/asn1/k5.asn1 */
+/* Do not edit */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+#include <errno.h>
+#include <krb5_asn1.h>
+#include <asn1_err.h>
+#include <der.h>
+#include <parse_units.h>
+
+#define BACK if (e) return e; p -= l; len -= l; ret += l
+
+int
+encode_HostAddress(unsigned char *p, size_t len, const HostAddress *data, size_t *size)
+{
+size_t ret = 0;
+size_t l;
+int i, e;
+
+i = 0;
+{
+int oldret = ret;
+ret = 0;
+e = encode_octet_string(p, len, &(data)->address, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 1, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_integer(p, len, &(data)->addr_type, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 0, &l);
+BACK;
+ret += oldret;
+}
+e = der_put_length_and_tag (p, len, ret, UNIV, CONS, UT_Sequence, &l);
+BACK;
+*size = ret;
+return 0;
+}
+
+#define FORW if(e) goto fail; p += l; len -= l; ret += l
+
+int
+decode_HostAddress(const unsigned char *p, size_t len, HostAddress *data, size_t *size)
+{
+size_t ret = 0, reallen;
+size_t l;
+int e;
+
+memset(data, 0, sizeof(*data));
+reallen = 0;
+e = der_match_tag_and_length (p, len, UNIV, CONS, UT_Sequence,&reallen, &l);
+FORW;
+{
+int dce_fix;
+if((dce_fix = fix_dce(reallen, &len)) < 0)
+return ASN1_BAD_FORMAT;
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 0, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_integer(p, len, &(data)->addr_type, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 1, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_octet_string(p, len, &(data)->address, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}
+}
+if(size) *size = ret;
+return 0;
+fail:
+free_HostAddress(data);
+return e;
+}
+
+void
+free_HostAddress(HostAddress *data)
+{
+free_octet_string(&(data)->address);
+}
+
+size_t
+length_HostAddress(const HostAddress *data)
+{
+size_t ret = 0;
+{
+int oldret = ret;
+ret = 0;
+ret += length_integer(&(data)->addr_type);
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+ret += length_octet_string(&(data)->address);
+ret += 1 + length_len(ret) + oldret;
+}
+ret += 1 + length_len(ret);
+return ret;
+}
+
+int
+copy_HostAddress(const HostAddress *from, HostAddress *to)
+{
+*(&(to)->addr_type) = *(&(from)->addr_type);
+if(copy_octet_string(&(from)->address, &(to)->address)) return ENOMEM;
+return 0;
+}
+
diff --git a/kerberosV/lib/asn1/asn1_HostAddresses.c b/kerberosV/lib/asn1/asn1_HostAddresses.c
new file mode 100644
index 00000000000..799003b0fe4
--- /dev/null
+++ b/kerberosV/lib/asn1/asn1_HostAddresses.c
@@ -0,0 +1,111 @@
+/* Generated from /usr/src/kerberosV/lib/asn1/../../src/lib/asn1/k5.asn1 */
+/* Do not edit */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+#include <errno.h>
+#include <krb5_asn1.h>
+#include <asn1_err.h>
+#include <der.h>
+#include <parse_units.h>
+
+#define BACK if (e) return e; p -= l; len -= l; ret += l
+
+int
+encode_HostAddresses(unsigned char *p, size_t len, const HostAddresses *data, size_t *size)
+{
+size_t ret = 0;
+size_t l;
+int i, e;
+
+i = 0;
+for(i = (data)->len - 1; i >= 0; --i) {
+int oldret = ret;
+ret = 0;
+e = encode_HostAddress(p, len, &(data)->val[i], &l);
+BACK;
+ret += oldret;
+}
+e = der_put_length_and_tag (p, len, ret, UNIV, CONS, UT_Sequence, &l);
+BACK;
+*size = ret;
+return 0;
+}
+
+#define FORW if(e) goto fail; p += l; len -= l; ret += l
+
+int
+decode_HostAddresses(const unsigned char *p, size_t len, HostAddresses *data, size_t *size)
+{
+size_t ret = 0, reallen;
+size_t l;
+int e;
+
+memset(data, 0, sizeof(*data));
+reallen = 0;
+e = der_match_tag_and_length (p, len, UNIV, CONS, UT_Sequence,&reallen, &l);
+FORW;
+if(len < reallen)
+return ASN1_OVERRUN;
+len = reallen;
+{
+size_t origlen = len;
+int oldret = ret;
+ret = 0;
+(data)->len = 0;
+(data)->val = NULL;
+while(ret < origlen) {
+(data)->len++;
+(data)->val = realloc((data)->val, sizeof(*((data)->val)) * (data)->len);
+e = decode_HostAddress(p, len, &(data)->val[(data)->len-1], &l);
+FORW;
+len = origlen - ret;
+}
+ret += oldret;
+}
+if(size) *size = ret;
+return 0;
+fail:
+free_HostAddresses(data);
+return e;
+}
+
+void
+free_HostAddresses(HostAddresses *data)
+{
+while((data)->len){
+free_HostAddress(&(data)->val[(data)->len-1]);
+(data)->len--;
+}
+free((data)->val);
+}
+
+size_t
+length_HostAddresses(const HostAddresses *data)
+{
+size_t ret = 0;
+{
+int oldret = ret;
+int i;
+ret = 0;
+for(i = (data)->len - 1; i >= 0; --i){
+ret += length_HostAddress(&(data)->val[i]);
+}
+ret += 1 + length_len(ret) + oldret;
+}
+return ret;
+}
+
+int
+copy_HostAddresses(const HostAddresses *from, HostAddresses *to)
+{
+if(((to)->val = malloc((from)->len * sizeof(*(to)->val))) == NULL && (from)->len != 0)
+return ENOMEM;
+for((to)->len = 0; (to)->len < (from)->len; (to)->len++){
+if(copy_HostAddress(&(from)->val[(to)->len], &(to)->val[(to)->len])) return ENOMEM;
+}
+return 0;
+}
+
diff --git a/kerberosV/lib/asn1/asn1_KDCOptions.c b/kerberosV/lib/asn1/asn1_KDCOptions.c
new file mode 100644
index 00000000000..ce6c64065b5
--- /dev/null
+++ b/kerberosV/lib/asn1/asn1_KDCOptions.c
@@ -0,0 +1,205 @@
+/* Generated from /usr/src/kerberosV/lib/asn1/../../src/lib/asn1/k5.asn1 */
+/* Do not edit */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+#include <errno.h>
+#include <krb5_asn1.h>
+#include <asn1_err.h>
+#include <der.h>
+#include <parse_units.h>
+
+#define BACK if (e) return e; p -= l; len -= l; ret += l
+
+int
+encode_KDCOptions(unsigned char *p, size_t len, const KDCOptions *data, size_t *size)
+{
+size_t ret = 0;
+size_t l;
+int i, e;
+
+i = 0;
+{
+unsigned char c = 0;
+if(data->validate) c |= 1<<0;
+if(data->renew) c |= 1<<1;
+if(data->enc_tkt_in_skey) c |= 1<<3;
+if(data->renewable_ok) c |= 1<<4;
+if(data->disable_transited_check) c |= 1<<5;
+*p-- = c; len--; ret++;
+c = 0;
+*p-- = c; len--; ret++;
+c = 0;
+if(data->canonicalize) c |= 1<<0;
+if(data->request_anonymous) c |= 1<<1;
+if(data->unused11) c |= 1<<4;
+if(data->unused10) c |= 1<<5;
+if(data->unused9) c |= 1<<6;
+if(data->renewable) c |= 1<<7;
+*p-- = c; len--; ret++;
+c = 0;
+if(data->unused7) c |= 1<<0;
+if(data->postdated) c |= 1<<1;
+if(data->allow_postdate) c |= 1<<2;
+if(data->proxy) c |= 1<<3;
+if(data->proxiable) c |= 1<<4;
+if(data->forwarded) c |= 1<<5;
+if(data->forwardable) c |= 1<<6;
+if(data->reserved) c |= 1<<7;
+*p-- = c;
+*p-- = 0;
+len -= 2;
+ret += 2;
+}
+
+e = der_put_length_and_tag (p, len, ret, UNIV, PRIM,UT_BitString, &l);
+BACK;
+*size = ret;
+return 0;
+}
+
+#define FORW if(e) goto fail; p += l; len -= l; ret += l
+
+int
+decode_KDCOptions(const unsigned char *p, size_t len, KDCOptions *data, size_t *size)
+{
+size_t ret = 0, reallen;
+size_t l;
+int e;
+
+memset(data, 0, sizeof(*data));
+reallen = 0;
+e = der_match_tag_and_length (p, len, UNIV, PRIM, UT_BitString,&reallen, &l);
+FORW;
+if(len < reallen)
+return ASN1_OVERRUN;
+p++;
+len--;
+reallen--;
+ret++;
+data->reserved = (*p >> 7) & 1;
+data->forwardable = (*p >> 6) & 1;
+data->forwarded = (*p >> 5) & 1;
+data->proxiable = (*p >> 4) & 1;
+data->proxy = (*p >> 3) & 1;
+data->allow_postdate = (*p >> 2) & 1;
+data->postdated = (*p >> 1) & 1;
+data->unused7 = (*p >> 0) & 1;
+p++; len--; reallen--; ret++;
+data->renewable = (*p >> 7) & 1;
+data->unused9 = (*p >> 6) & 1;
+data->unused10 = (*p >> 5) & 1;
+data->unused11 = (*p >> 4) & 1;
+data->request_anonymous = (*p >> 1) & 1;
+data->canonicalize = (*p >> 0) & 1;
+p++; len--; reallen--; ret++;
+p++; len--; reallen--; ret++;
+data->disable_transited_check = (*p >> 5) & 1;
+data->renewable_ok = (*p >> 4) & 1;
+data->enc_tkt_in_skey = (*p >> 3) & 1;
+data->renew = (*p >> 1) & 1;
+data->validate = (*p >> 0) & 1;
+p += reallen; len -= reallen; ret += reallen;
+if(size) *size = ret;
+return 0;
+fail:
+free_KDCOptions(data);
+return e;
+}
+
+void
+free_KDCOptions(KDCOptions *data)
+{
+}
+
+size_t
+length_KDCOptions(const KDCOptions *data)
+{
+size_t ret = 0;
+ret += 7;
+return ret;
+}
+
+int
+copy_KDCOptions(const KDCOptions *from, KDCOptions *to)
+{
+*(to) = *(from);
+return 0;
+}
+
+unsigned KDCOptions2int(KDCOptions f)
+{
+unsigned r = 0;
+if(f.reserved) r |= (1U << 0);
+if(f.forwardable) r |= (1U << 1);
+if(f.forwarded) r |= (1U << 2);
+if(f.proxiable) r |= (1U << 3);
+if(f.proxy) r |= (1U << 4);
+if(f.allow_postdate) r |= (1U << 5);
+if(f.postdated) r |= (1U << 6);
+if(f.unused7) r |= (1U << 7);
+if(f.renewable) r |= (1U << 8);
+if(f.unused9) r |= (1U << 9);
+if(f.unused10) r |= (1U << 10);
+if(f.unused11) r |= (1U << 11);
+if(f.request_anonymous) r |= (1U << 14);
+if(f.canonicalize) r |= (1U << 15);
+if(f.disable_transited_check) r |= (1U << 26);
+if(f.renewable_ok) r |= (1U << 27);
+if(f.enc_tkt_in_skey) r |= (1U << 28);
+if(f.renew) r |= (1U << 30);
+if(f.validate) r |= (1U << 31);
+return r;
+}
+
+KDCOptions int2KDCOptions(unsigned n)
+{
+ KDCOptions flags;
+
+ flags.reserved = (n >> 0) & 1;
+ flags.forwardable = (n >> 1) & 1;
+ flags.forwarded = (n >> 2) & 1;
+ flags.proxiable = (n >> 3) & 1;
+ flags.proxy = (n >> 4) & 1;
+ flags.allow_postdate = (n >> 5) & 1;
+ flags.postdated = (n >> 6) & 1;
+ flags.unused7 = (n >> 7) & 1;
+ flags.renewable = (n >> 8) & 1;
+ flags.unused9 = (n >> 9) & 1;
+ flags.unused10 = (n >> 10) & 1;
+ flags.unused11 = (n >> 11) & 1;
+ flags.request_anonymous = (n >> 14) & 1;
+ flags.canonicalize = (n >> 15) & 1;
+ flags.disable_transited_check = (n >> 26) & 1;
+ flags.renewable_ok = (n >> 27) & 1;
+ flags.enc_tkt_in_skey = (n >> 28) & 1;
+ flags.renew = (n >> 30) & 1;
+ flags.validate = (n >> 31) & 1;
+ return flags;
+}
+
+struct units KDCOptions_units[] = {
+ {"validate", 1U << 31},
+ {"renew", 1U << 30},
+ {"enc_tkt_in_skey", 1U << 28},
+ {"renewable_ok", 1U << 27},
+ {"disable_transited_check", 1U << 26},
+ {"canonicalize", 1U << 15},
+ {"request_anonymous", 1U << 14},
+ {"unused11", 1U << 11},
+ {"unused10", 1U << 10},
+ {"unused9", 1U << 9},
+ {"renewable", 1U << 8},
+ {"unused7", 1U << 7},
+ {"postdated", 1U << 6},
+ {"allow_postdate", 1U << 5},
+ {"proxy", 1U << 4},
+ {"proxiable", 1U << 3},
+ {"forwarded", 1U << 2},
+ {"forwardable", 1U << 1},
+ {"reserved", 1U << 0},
+ {NULL, 0}
+};
+
diff --git a/kerberosV/lib/asn1/asn1_KDC_REP.c b/kerberosV/lib/asn1/asn1_KDC_REP.c
new file mode 100644
index 00000000000..b8bde9bcbae
--- /dev/null
+++ b/kerberosV/lib/asn1/asn1_KDC_REP.c
@@ -0,0 +1,388 @@
+/* Generated from /usr/src/kerberosV/lib/asn1/../../src/lib/asn1/k5.asn1 */
+/* Do not edit */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+#include <errno.h>
+#include <krb5_asn1.h>
+#include <asn1_err.h>
+#include <der.h>
+#include <parse_units.h>
+
+#define BACK if (e) return e; p -= l; len -= l; ret += l
+
+int
+encode_KDC_REP(unsigned char *p, size_t len, const KDC_REP *data, size_t *size)
+{
+size_t ret = 0;
+size_t l;
+int i, e;
+
+i = 0;
+{
+int oldret = ret;
+ret = 0;
+e = encode_EncryptedData(p, len, &(data)->enc_part, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 6, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_Ticket(p, len, &(data)->ticket, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 5, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_PrincipalName(p, len, &(data)->cname, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 4, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_Realm(p, len, &(data)->crealm, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 3, &l);
+BACK;
+ret += oldret;
+}
+if((data)->padata)
+{
+int oldret = ret;
+ret = 0;
+e = encode_METHOD_DATA(p, len, (data)->padata, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 2, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_MESSAGE_TYPE(p, len, &(data)->msg_type, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 1, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_integer(p, len, &(data)->pvno, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 0, &l);
+BACK;
+ret += oldret;
+}
+e = der_put_length_and_tag (p, len, ret, UNIV, CONS, UT_Sequence, &l);
+BACK;
+*size = ret;
+return 0;
+}
+
+#define FORW if(e) goto fail; p += l; len -= l; ret += l
+
+int
+decode_KDC_REP(const unsigned char *p, size_t len, KDC_REP *data, size_t *size)
+{
+size_t ret = 0, reallen;
+size_t l;
+int e;
+
+memset(data, 0, sizeof(*data));
+reallen = 0;
+e = der_match_tag_and_length (p, len, UNIV, CONS, UT_Sequence,&reallen, &l);
+FORW;
+{
+int dce_fix;
+if((dce_fix = fix_dce(reallen, &len)) < 0)
+return ASN1_BAD_FORMAT;
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 0, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_integer(p, len, &(data)->pvno, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 1, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_MESSAGE_TYPE(p, len, &(data)->msg_type, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 2, &l);
+if (e)
+(data)->padata = NULL;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+(data)->padata = malloc(sizeof(*(data)->padata));
+if((data)->padata == NULL) return ENOMEM;
+e = decode_METHOD_DATA(p, len, (data)->padata, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 3, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_Realm(p, len, &(data)->crealm, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 4, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_PrincipalName(p, len, &(data)->cname, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 5, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_Ticket(p, len, &(data)->ticket, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 6, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_EncryptedData(p, len, &(data)->enc_part, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}
+}
+if(size) *size = ret;
+return 0;
+fail:
+free_KDC_REP(data);
+return e;
+}
+
+void
+free_KDC_REP(KDC_REP *data)
+{
+free_MESSAGE_TYPE(&(data)->msg_type);
+if((data)->padata) {
+free_METHOD_DATA((data)->padata);
+free((data)->padata);
+}
+free_Realm(&(data)->crealm);
+free_PrincipalName(&(data)->cname);
+free_Ticket(&(data)->ticket);
+free_EncryptedData(&(data)->enc_part);
+}
+
+size_t
+length_KDC_REP(const KDC_REP *data)
+{
+size_t ret = 0;
+{
+int oldret = ret;
+ret = 0;
+ret += length_integer(&(data)->pvno);
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+ret += length_MESSAGE_TYPE(&(data)->msg_type);
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->padata){
+int oldret = ret;
+ret = 0;
+ret += length_METHOD_DATA((data)->padata);
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+ret += length_Realm(&(data)->crealm);
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+ret += length_PrincipalName(&(data)->cname);
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+ret += length_Ticket(&(data)->ticket);
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+ret += length_EncryptedData(&(data)->enc_part);
+ret += 1 + length_len(ret) + oldret;
+}
+ret += 1 + length_len(ret);
+return ret;
+}
+
+int
+copy_KDC_REP(const KDC_REP *from, KDC_REP *to)
+{
+*(&(to)->pvno) = *(&(from)->pvno);
+if(copy_MESSAGE_TYPE(&(from)->msg_type, &(to)->msg_type)) return ENOMEM;
+if((from)->padata) {
+(to)->padata = malloc(sizeof(*(to)->padata));
+if((to)->padata == NULL) return ENOMEM;
+if(copy_METHOD_DATA((from)->padata, (to)->padata)) return ENOMEM;
+}else
+(to)->padata = NULL;
+if(copy_Realm(&(from)->crealm, &(to)->crealm)) return ENOMEM;
+if(copy_PrincipalName(&(from)->cname, &(to)->cname)) return ENOMEM;
+if(copy_Ticket(&(from)->ticket, &(to)->ticket)) return ENOMEM;
+if(copy_EncryptedData(&(from)->enc_part, &(to)->enc_part)) return ENOMEM;
+return 0;
+}
+
diff --git a/kerberosV/lib/asn1/asn1_KDC_REQ.c b/kerberosV/lib/asn1/asn1_KDC_REQ.c
new file mode 100644
index 00000000000..1a285abdd40
--- /dev/null
+++ b/kerberosV/lib/asn1/asn1_KDC_REQ.c
@@ -0,0 +1,259 @@
+/* Generated from /usr/src/kerberosV/lib/asn1/../../src/lib/asn1/k5.asn1 */
+/* Do not edit */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+#include <errno.h>
+#include <krb5_asn1.h>
+#include <asn1_err.h>
+#include <der.h>
+#include <parse_units.h>
+
+#define BACK if (e) return e; p -= l; len -= l; ret += l
+
+int
+encode_KDC_REQ(unsigned char *p, size_t len, const KDC_REQ *data, size_t *size)
+{
+size_t ret = 0;
+size_t l;
+int i, e;
+
+i = 0;
+{
+int oldret = ret;
+ret = 0;
+e = encode_KDC_REQ_BODY(p, len, &(data)->req_body, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 4, &l);
+BACK;
+ret += oldret;
+}
+if((data)->padata)
+{
+int oldret = ret;
+ret = 0;
+e = encode_METHOD_DATA(p, len, (data)->padata, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 3, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_MESSAGE_TYPE(p, len, &(data)->msg_type, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 2, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_integer(p, len, &(data)->pvno, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 1, &l);
+BACK;
+ret += oldret;
+}
+e = der_put_length_and_tag (p, len, ret, UNIV, CONS, UT_Sequence, &l);
+BACK;
+*size = ret;
+return 0;
+}
+
+#define FORW if(e) goto fail; p += l; len -= l; ret += l
+
+int
+decode_KDC_REQ(const unsigned char *p, size_t len, KDC_REQ *data, size_t *size)
+{
+size_t ret = 0, reallen;
+size_t l;
+int e;
+
+memset(data, 0, sizeof(*data));
+reallen = 0;
+e = der_match_tag_and_length (p, len, UNIV, CONS, UT_Sequence,&reallen, &l);
+FORW;
+{
+int dce_fix;
+if((dce_fix = fix_dce(reallen, &len)) < 0)
+return ASN1_BAD_FORMAT;
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 1, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_integer(p, len, &(data)->pvno, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 2, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_MESSAGE_TYPE(p, len, &(data)->msg_type, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 3, &l);
+if (e)
+(data)->padata = NULL;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+(data)->padata = malloc(sizeof(*(data)->padata));
+if((data)->padata == NULL) return ENOMEM;
+e = decode_METHOD_DATA(p, len, (data)->padata, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 4, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_KDC_REQ_BODY(p, len, &(data)->req_body, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}
+}
+if(size) *size = ret;
+return 0;
+fail:
+free_KDC_REQ(data);
+return e;
+}
+
+void
+free_KDC_REQ(KDC_REQ *data)
+{
+free_MESSAGE_TYPE(&(data)->msg_type);
+if((data)->padata) {
+free_METHOD_DATA((data)->padata);
+free((data)->padata);
+}
+free_KDC_REQ_BODY(&(data)->req_body);
+}
+
+size_t
+length_KDC_REQ(const KDC_REQ *data)
+{
+size_t ret = 0;
+{
+int oldret = ret;
+ret = 0;
+ret += length_integer(&(data)->pvno);
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+ret += length_MESSAGE_TYPE(&(data)->msg_type);
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->padata){
+int oldret = ret;
+ret = 0;
+ret += length_METHOD_DATA((data)->padata);
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+ret += length_KDC_REQ_BODY(&(data)->req_body);
+ret += 1 + length_len(ret) + oldret;
+}
+ret += 1 + length_len(ret);
+return ret;
+}
+
+int
+copy_KDC_REQ(const KDC_REQ *from, KDC_REQ *to)
+{
+*(&(to)->pvno) = *(&(from)->pvno);
+if(copy_MESSAGE_TYPE(&(from)->msg_type, &(to)->msg_type)) return ENOMEM;
+if((from)->padata) {
+(to)->padata = malloc(sizeof(*(to)->padata));
+if((to)->padata == NULL) return ENOMEM;
+if(copy_METHOD_DATA((from)->padata, (to)->padata)) return ENOMEM;
+}else
+(to)->padata = NULL;
+if(copy_KDC_REQ_BODY(&(from)->req_body, &(to)->req_body)) return ENOMEM;
+return 0;
+}
+
diff --git a/kerberosV/lib/asn1/asn1_KDC_REQ_BODY.c b/kerberosV/lib/asn1/asn1_KDC_REQ_BODY.c
new file mode 100644
index 00000000000..58d76388d0d
--- /dev/null
+++ b/kerberosV/lib/asn1/asn1_KDC_REQ_BODY.c
@@ -0,0 +1,762 @@
+/* Generated from /usr/src/kerberosV/lib/asn1/../../src/lib/asn1/k5.asn1 */
+/* Do not edit */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+#include <errno.h>
+#include <krb5_asn1.h>
+#include <asn1_err.h>
+#include <der.h>
+#include <parse_units.h>
+
+#define BACK if (e) return e; p -= l; len -= l; ret += l
+
+int
+encode_KDC_REQ_BODY(unsigned char *p, size_t len, const KDC_REQ_BODY *data, size_t *size)
+{
+size_t ret = 0;
+size_t l;
+int i, e;
+
+i = 0;
+if((data)->additional_tickets)
+{
+int oldret = ret;
+ret = 0;
+for(i = ((data)->additional_tickets)->len - 1; i >= 0; --i) {
+int oldret = ret;
+ret = 0;
+e = encode_Ticket(p, len, &((data)->additional_tickets)->val[i], &l);
+BACK;
+ret += oldret;
+}
+e = der_put_length_and_tag (p, len, ret, UNIV, CONS, UT_Sequence, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 11, &l);
+BACK;
+ret += oldret;
+}
+if((data)->enc_authorization_data)
+{
+int oldret = ret;
+ret = 0;
+e = encode_EncryptedData(p, len, (data)->enc_authorization_data, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 10, &l);
+BACK;
+ret += oldret;
+}
+if((data)->addresses)
+{
+int oldret = ret;
+ret = 0;
+e = encode_HostAddresses(p, len, (data)->addresses, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 9, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+for(i = (&(data)->etype)->len - 1; i >= 0; --i) {
+int oldret = ret;
+ret = 0;
+e = encode_ENCTYPE(p, len, &(&(data)->etype)->val[i], &l);
+BACK;
+ret += oldret;
+}
+e = der_put_length_and_tag (p, len, ret, UNIV, CONS, UT_Sequence, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 8, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_integer(p, len, &(data)->nonce, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 7, &l);
+BACK;
+ret += oldret;
+}
+if((data)->rtime)
+{
+int oldret = ret;
+ret = 0;
+e = encode_KerberosTime(p, len, (data)->rtime, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 6, &l);
+BACK;
+ret += oldret;
+}
+if((data)->till)
+{
+int oldret = ret;
+ret = 0;
+e = encode_KerberosTime(p, len, (data)->till, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 5, &l);
+BACK;
+ret += oldret;
+}
+if((data)->from)
+{
+int oldret = ret;
+ret = 0;
+e = encode_KerberosTime(p, len, (data)->from, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 4, &l);
+BACK;
+ret += oldret;
+}
+if((data)->sname)
+{
+int oldret = ret;
+ret = 0;
+e = encode_PrincipalName(p, len, (data)->sname, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 3, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_Realm(p, len, &(data)->realm, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 2, &l);
+BACK;
+ret += oldret;
+}
+if((data)->cname)
+{
+int oldret = ret;
+ret = 0;
+e = encode_PrincipalName(p, len, (data)->cname, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 1, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_KDCOptions(p, len, &(data)->kdc_options, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 0, &l);
+BACK;
+ret += oldret;
+}
+e = der_put_length_and_tag (p, len, ret, UNIV, CONS, UT_Sequence, &l);
+BACK;
+*size = ret;
+return 0;
+}
+
+#define FORW if(e) goto fail; p += l; len -= l; ret += l
+
+int
+decode_KDC_REQ_BODY(const unsigned char *p, size_t len, KDC_REQ_BODY *data, size_t *size)
+{
+size_t ret = 0, reallen;
+size_t l;
+int e;
+
+memset(data, 0, sizeof(*data));
+reallen = 0;
+e = der_match_tag_and_length (p, len, UNIV, CONS, UT_Sequence,&reallen, &l);
+FORW;
+{
+int dce_fix;
+if((dce_fix = fix_dce(reallen, &len)) < 0)
+return ASN1_BAD_FORMAT;
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 0, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_KDCOptions(p, len, &(data)->kdc_options, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 1, &l);
+if (e)
+(data)->cname = NULL;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+(data)->cname = malloc(sizeof(*(data)->cname));
+if((data)->cname == NULL) return ENOMEM;
+e = decode_PrincipalName(p, len, (data)->cname, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 2, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_Realm(p, len, &(data)->realm, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 3, &l);
+if (e)
+(data)->sname = NULL;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+(data)->sname = malloc(sizeof(*(data)->sname));
+if((data)->sname == NULL) return ENOMEM;
+e = decode_PrincipalName(p, len, (data)->sname, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 4, &l);
+if (e)
+(data)->from = NULL;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+(data)->from = malloc(sizeof(*(data)->from));
+if((data)->from == NULL) return ENOMEM;
+e = decode_KerberosTime(p, len, (data)->from, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 5, &l);
+if (e)
+(data)->till = NULL;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+(data)->till = malloc(sizeof(*(data)->till));
+if((data)->till == NULL) return ENOMEM;
+e = decode_KerberosTime(p, len, (data)->till, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 6, &l);
+if (e)
+(data)->rtime = NULL;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+(data)->rtime = malloc(sizeof(*(data)->rtime));
+if((data)->rtime == NULL) return ENOMEM;
+e = decode_KerberosTime(p, len, (data)->rtime, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 7, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_integer(p, len, &(data)->nonce, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 8, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = der_match_tag_and_length (p, len, UNIV, CONS, UT_Sequence,&reallen, &l);
+FORW;
+if(len < reallen)
+return ASN1_OVERRUN;
+len = reallen;
+{
+size_t origlen = len;
+int oldret = ret;
+ret = 0;
+(&(data)->etype)->len = 0;
+(&(data)->etype)->val = NULL;
+while(ret < origlen) {
+(&(data)->etype)->len++;
+(&(data)->etype)->val = realloc((&(data)->etype)->val, sizeof(*((&(data)->etype)->val)) * (&(data)->etype)->len);
+e = decode_ENCTYPE(p, len, &(&(data)->etype)->val[(&(data)->etype)->len-1], &l);
+FORW;
+len = origlen - ret;
+}
+ret += oldret;
+}
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 9, &l);
+if (e)
+(data)->addresses = NULL;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+(data)->addresses = malloc(sizeof(*(data)->addresses));
+if((data)->addresses == NULL) return ENOMEM;
+e = decode_HostAddresses(p, len, (data)->addresses, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 10, &l);
+if (e)
+(data)->enc_authorization_data = NULL;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+(data)->enc_authorization_data = malloc(sizeof(*(data)->enc_authorization_data));
+if((data)->enc_authorization_data == NULL) return ENOMEM;
+e = decode_EncryptedData(p, len, (data)->enc_authorization_data, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 11, &l);
+if (e)
+(data)->additional_tickets = NULL;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+(data)->additional_tickets = malloc(sizeof(*(data)->additional_tickets));
+if((data)->additional_tickets == NULL) return ENOMEM;
+e = der_match_tag_and_length (p, len, UNIV, CONS, UT_Sequence,&reallen, &l);
+FORW;
+if(len < reallen)
+return ASN1_OVERRUN;
+len = reallen;
+{
+size_t origlen = len;
+int oldret = ret;
+ret = 0;
+((data)->additional_tickets)->len = 0;
+((data)->additional_tickets)->val = NULL;
+while(ret < origlen) {
+((data)->additional_tickets)->len++;
+((data)->additional_tickets)->val = realloc(((data)->additional_tickets)->val, sizeof(*(((data)->additional_tickets)->val)) * ((data)->additional_tickets)->len);
+e = decode_Ticket(p, len, &((data)->additional_tickets)->val[((data)->additional_tickets)->len-1], &l);
+FORW;
+len = origlen - ret;
+}
+ret += oldret;
+}
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}
+}
+if(size) *size = ret;
+return 0;
+fail:
+free_KDC_REQ_BODY(data);
+return e;
+}
+
+void
+free_KDC_REQ_BODY(KDC_REQ_BODY *data)
+{
+free_KDCOptions(&(data)->kdc_options);
+if((data)->cname) {
+free_PrincipalName((data)->cname);
+free((data)->cname);
+}
+free_Realm(&(data)->realm);
+if((data)->sname) {
+free_PrincipalName((data)->sname);
+free((data)->sname);
+}
+if((data)->from) {
+free_KerberosTime((data)->from);
+free((data)->from);
+}
+if((data)->till) {
+free_KerberosTime((data)->till);
+free((data)->till);
+}
+if((data)->rtime) {
+free_KerberosTime((data)->rtime);
+free((data)->rtime);
+}
+while((&(data)->etype)->len){
+free_ENCTYPE(&(&(data)->etype)->val[(&(data)->etype)->len-1]);
+(&(data)->etype)->len--;
+}
+free((&(data)->etype)->val);
+if((data)->addresses) {
+free_HostAddresses((data)->addresses);
+free((data)->addresses);
+}
+if((data)->enc_authorization_data) {
+free_EncryptedData((data)->enc_authorization_data);
+free((data)->enc_authorization_data);
+}
+if((data)->additional_tickets) {
+while(((data)->additional_tickets)->len){
+free_Ticket(&((data)->additional_tickets)->val[((data)->additional_tickets)->len-1]);
+((data)->additional_tickets)->len--;
+}
+free(((data)->additional_tickets)->val);
+free((data)->additional_tickets);
+}
+}
+
+size_t
+length_KDC_REQ_BODY(const KDC_REQ_BODY *data)
+{
+size_t ret = 0;
+{
+int oldret = ret;
+ret = 0;
+ret += length_KDCOptions(&(data)->kdc_options);
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->cname){
+int oldret = ret;
+ret = 0;
+ret += length_PrincipalName((data)->cname);
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+ret += length_Realm(&(data)->realm);
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->sname){
+int oldret = ret;
+ret = 0;
+ret += length_PrincipalName((data)->sname);
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->from){
+int oldret = ret;
+ret = 0;
+ret += length_KerberosTime((data)->from);
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->till){
+int oldret = ret;
+ret = 0;
+ret += length_KerberosTime((data)->till);
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->rtime){
+int oldret = ret;
+ret = 0;
+ret += length_KerberosTime((data)->rtime);
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+ret += length_integer(&(data)->nonce);
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+{
+int oldret = ret;
+int i;
+ret = 0;
+for(i = (&(data)->etype)->len - 1; i >= 0; --i){
+ret += length_ENCTYPE(&(&(data)->etype)->val[i]);
+}
+ret += 1 + length_len(ret) + oldret;
+}
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->addresses){
+int oldret = ret;
+ret = 0;
+ret += length_HostAddresses((data)->addresses);
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->enc_authorization_data){
+int oldret = ret;
+ret = 0;
+ret += length_EncryptedData((data)->enc_authorization_data);
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->additional_tickets){
+int oldret = ret;
+ret = 0;
+{
+int oldret = ret;
+int i;
+ret = 0;
+for(i = ((data)->additional_tickets)->len - 1; i >= 0; --i){
+ret += length_Ticket(&((data)->additional_tickets)->val[i]);
+}
+ret += 1 + length_len(ret) + oldret;
+}
+ret += 1 + length_len(ret) + oldret;
+}
+ret += 1 + length_len(ret);
+return ret;
+}
+
+int
+copy_KDC_REQ_BODY(const KDC_REQ_BODY *from, KDC_REQ_BODY *to)
+{
+if(copy_KDCOptions(&(from)->kdc_options, &(to)->kdc_options)) return ENOMEM;
+if((from)->cname) {
+(to)->cname = malloc(sizeof(*(to)->cname));
+if((to)->cname == NULL) return ENOMEM;
+if(copy_PrincipalName((from)->cname, (to)->cname)) return ENOMEM;
+}else
+(to)->cname = NULL;
+if(copy_Realm(&(from)->realm, &(to)->realm)) return ENOMEM;
+if((from)->sname) {
+(to)->sname = malloc(sizeof(*(to)->sname));
+if((to)->sname == NULL) return ENOMEM;
+if(copy_PrincipalName((from)->sname, (to)->sname)) return ENOMEM;
+}else
+(to)->sname = NULL;
+if((from)->from) {
+(to)->from = malloc(sizeof(*(to)->from));
+if((to)->from == NULL) return ENOMEM;
+if(copy_KerberosTime((from)->from, (to)->from)) return ENOMEM;
+}else
+(to)->from = NULL;
+if((from)->till) {
+(to)->till = malloc(sizeof(*(to)->till));
+if((to)->till == NULL) return ENOMEM;
+if(copy_KerberosTime((from)->till, (to)->till)) return ENOMEM;
+}else
+(to)->till = NULL;
+if((from)->rtime) {
+(to)->rtime = malloc(sizeof(*(to)->rtime));
+if((to)->rtime == NULL) return ENOMEM;
+if(copy_KerberosTime((from)->rtime, (to)->rtime)) return ENOMEM;
+}else
+(to)->rtime = NULL;
+*(&(to)->nonce) = *(&(from)->nonce);
+if(((&(to)->etype)->val = malloc((&(from)->etype)->len * sizeof(*(&(to)->etype)->val))) == NULL && (&(from)->etype)->len != 0)
+return ENOMEM;
+for((&(to)->etype)->len = 0; (&(to)->etype)->len < (&(from)->etype)->len; (&(to)->etype)->len++){
+if(copy_ENCTYPE(&(&(from)->etype)->val[(&(to)->etype)->len], &(&(to)->etype)->val[(&(to)->etype)->len])) return ENOMEM;
+}
+if((from)->addresses) {
+(to)->addresses = malloc(sizeof(*(to)->addresses));
+if((to)->addresses == NULL) return ENOMEM;
+if(copy_HostAddresses((from)->addresses, (to)->addresses)) return ENOMEM;
+}else
+(to)->addresses = NULL;
+if((from)->enc_authorization_data) {
+(to)->enc_authorization_data = malloc(sizeof(*(to)->enc_authorization_data));
+if((to)->enc_authorization_data == NULL) return ENOMEM;
+if(copy_EncryptedData((from)->enc_authorization_data, (to)->enc_authorization_data)) return ENOMEM;
+}else
+(to)->enc_authorization_data = NULL;
+if((from)->additional_tickets) {
+(to)->additional_tickets = malloc(sizeof(*(to)->additional_tickets));
+if((to)->additional_tickets == NULL) return ENOMEM;
+if((((to)->additional_tickets)->val = malloc(((from)->additional_tickets)->len * sizeof(*((to)->additional_tickets)->val))) == NULL && ((from)->additional_tickets)->len != 0)
+return ENOMEM;
+for(((to)->additional_tickets)->len = 0; ((to)->additional_tickets)->len < ((from)->additional_tickets)->len; ((to)->additional_tickets)->len++){
+if(copy_Ticket(&((from)->additional_tickets)->val[((to)->additional_tickets)->len], &((to)->additional_tickets)->val[((to)->additional_tickets)->len])) return ENOMEM;
+}
+}else
+(to)->additional_tickets = NULL;
+return 0;
+}
+
diff --git a/kerberosV/lib/asn1/asn1_KRB_CRED.c b/kerberosV/lib/asn1/asn1_KRB_CRED.c
new file mode 100644
index 00000000000..6198ad6afed
--- /dev/null
+++ b/kerberosV/lib/asn1/asn1_KRB_CRED.c
@@ -0,0 +1,303 @@
+/* Generated from /usr/src/kerberosV/lib/asn1/../../src/lib/asn1/k5.asn1 */
+/* Do not edit */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+#include <errno.h>
+#include <krb5_asn1.h>
+#include <asn1_err.h>
+#include <der.h>
+#include <parse_units.h>
+
+#define BACK if (e) return e; p -= l; len -= l; ret += l
+
+int
+encode_KRB_CRED(unsigned char *p, size_t len, const KRB_CRED *data, size_t *size)
+{
+size_t ret = 0;
+size_t l;
+int i, e;
+
+i = 0;
+{
+int oldret = ret;
+ret = 0;
+e = encode_EncryptedData(p, len, &(data)->enc_part, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 3, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+for(i = (&(data)->tickets)->len - 1; i >= 0; --i) {
+int oldret = ret;
+ret = 0;
+e = encode_Ticket(p, len, &(&(data)->tickets)->val[i], &l);
+BACK;
+ret += oldret;
+}
+e = der_put_length_and_tag (p, len, ret, UNIV, CONS, UT_Sequence, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 2, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_MESSAGE_TYPE(p, len, &(data)->msg_type, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 1, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_integer(p, len, &(data)->pvno, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 0, &l);
+BACK;
+ret += oldret;
+}
+e = der_put_length_and_tag (p, len, ret, UNIV, CONS, UT_Sequence, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, APPL, CONS, 22, &l);
+BACK;
+*size = ret;
+return 0;
+}
+
+#define FORW if(e) goto fail; p += l; len -= l; ret += l
+
+int
+decode_KRB_CRED(const unsigned char *p, size_t len, KRB_CRED *data, size_t *size)
+{
+size_t ret = 0, reallen;
+size_t l;
+int e;
+
+memset(data, 0, sizeof(*data));
+reallen = 0;
+e = der_match_tag_and_length (p, len, APPL, CONS, 22, &reallen, &l);
+FORW;
+{
+int dce_fix;
+if((dce_fix = fix_dce(reallen, &len)) < 0)
+return ASN1_BAD_FORMAT;
+e = der_match_tag_and_length (p, len, UNIV, CONS, UT_Sequence,&reallen, &l);
+FORW;
+{
+int dce_fix;
+if((dce_fix = fix_dce(reallen, &len)) < 0)
+return ASN1_BAD_FORMAT;
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 0, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_integer(p, len, &(data)->pvno, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 1, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_MESSAGE_TYPE(p, len, &(data)->msg_type, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 2, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = der_match_tag_and_length (p, len, UNIV, CONS, UT_Sequence,&reallen, &l);
+FORW;
+if(len < reallen)
+return ASN1_OVERRUN;
+len = reallen;
+{
+size_t origlen = len;
+int oldret = ret;
+ret = 0;
+(&(data)->tickets)->len = 0;
+(&(data)->tickets)->val = NULL;
+while(ret < origlen) {
+(&(data)->tickets)->len++;
+(&(data)->tickets)->val = realloc((&(data)->tickets)->val, sizeof(*((&(data)->tickets)->val)) * (&(data)->tickets)->len);
+e = decode_Ticket(p, len, &(&(data)->tickets)->val[(&(data)->tickets)->len-1], &l);
+FORW;
+len = origlen - ret;
+}
+ret += oldret;
+}
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 3, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_EncryptedData(p, len, &(data)->enc_part, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}
+}
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}
+}
+if(size) *size = ret;
+return 0;
+fail:
+free_KRB_CRED(data);
+return e;
+}
+
+void
+free_KRB_CRED(KRB_CRED *data)
+{
+free_MESSAGE_TYPE(&(data)->msg_type);
+while((&(data)->tickets)->len){
+free_Ticket(&(&(data)->tickets)->val[(&(data)->tickets)->len-1]);
+(&(data)->tickets)->len--;
+}
+free((&(data)->tickets)->val);
+free_EncryptedData(&(data)->enc_part);
+}
+
+size_t
+length_KRB_CRED(const KRB_CRED *data)
+{
+size_t ret = 0;
+{
+int oldret = ret;
+ret = 0;
+ret += length_integer(&(data)->pvno);
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+ret += length_MESSAGE_TYPE(&(data)->msg_type);
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+{
+int oldret = ret;
+int i;
+ret = 0;
+for(i = (&(data)->tickets)->len - 1; i >= 0; --i){
+ret += length_Ticket(&(&(data)->tickets)->val[i]);
+}
+ret += 1 + length_len(ret) + oldret;
+}
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+ret += length_EncryptedData(&(data)->enc_part);
+ret += 1 + length_len(ret) + oldret;
+}
+ret += 1 + length_len(ret);
+ret += 1 + length_len (ret);
+return ret;
+}
+
+int
+copy_KRB_CRED(const KRB_CRED *from, KRB_CRED *to)
+{
+*(&(to)->pvno) = *(&(from)->pvno);
+if(copy_MESSAGE_TYPE(&(from)->msg_type, &(to)->msg_type)) return ENOMEM;
+if(((&(to)->tickets)->val = malloc((&(from)->tickets)->len * sizeof(*(&(to)->tickets)->val))) == NULL && (&(from)->tickets)->len != 0)
+return ENOMEM;
+for((&(to)->tickets)->len = 0; (&(to)->tickets)->len < (&(from)->tickets)->len; (&(to)->tickets)->len++){
+if(copy_Ticket(&(&(from)->tickets)->val[(&(to)->tickets)->len], &(&(to)->tickets)->val[(&(to)->tickets)->len])) return ENOMEM;
+}
+if(copy_EncryptedData(&(from)->enc_part, &(to)->enc_part)) return ENOMEM;
+return 0;
+}
+
diff --git a/kerberosV/lib/asn1/asn1_KRB_ERROR.c b/kerberosV/lib/asn1/asn1_KRB_ERROR.c
new file mode 100644
index 00000000000..cceaf950270
--- /dev/null
+++ b/kerberosV/lib/asn1/asn1_KRB_ERROR.c
@@ -0,0 +1,712 @@
+/* Generated from /usr/src/kerberosV/lib/asn1/../../src/lib/asn1/k5.asn1 */
+/* Do not edit */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+#include <errno.h>
+#include <krb5_asn1.h>
+#include <asn1_err.h>
+#include <der.h>
+#include <parse_units.h>
+
+#define BACK if (e) return e; p -= l; len -= l; ret += l
+
+int
+encode_KRB_ERROR(unsigned char *p, size_t len, const KRB_ERROR *data, size_t *size)
+{
+size_t ret = 0;
+size_t l;
+int i, e;
+
+i = 0;
+if((data)->e_data)
+{
+int oldret = ret;
+ret = 0;
+e = encode_octet_string(p, len, (data)->e_data, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 12, &l);
+BACK;
+ret += oldret;
+}
+if((data)->e_text)
+{
+int oldret = ret;
+ret = 0;
+e = encode_general_string(p, len, (data)->e_text, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 11, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_PrincipalName(p, len, &(data)->sname, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 10, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_Realm(p, len, &(data)->realm, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 9, &l);
+BACK;
+ret += oldret;
+}
+if((data)->cname)
+{
+int oldret = ret;
+ret = 0;
+e = encode_PrincipalName(p, len, (data)->cname, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 8, &l);
+BACK;
+ret += oldret;
+}
+if((data)->crealm)
+{
+int oldret = ret;
+ret = 0;
+e = encode_Realm(p, len, (data)->crealm, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 7, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_integer(p, len, &(data)->error_code, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 6, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_integer(p, len, &(data)->susec, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 5, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_KerberosTime(p, len, &(data)->stime, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 4, &l);
+BACK;
+ret += oldret;
+}
+if((data)->cusec)
+{
+int oldret = ret;
+ret = 0;
+e = encode_integer(p, len, (data)->cusec, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 3, &l);
+BACK;
+ret += oldret;
+}
+if((data)->ctime)
+{
+int oldret = ret;
+ret = 0;
+e = encode_KerberosTime(p, len, (data)->ctime, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 2, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_MESSAGE_TYPE(p, len, &(data)->msg_type, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 1, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_integer(p, len, &(data)->pvno, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 0, &l);
+BACK;
+ret += oldret;
+}
+e = der_put_length_and_tag (p, len, ret, UNIV, CONS, UT_Sequence, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, APPL, CONS, 30, &l);
+BACK;
+*size = ret;
+return 0;
+}
+
+#define FORW if(e) goto fail; p += l; len -= l; ret += l
+
+int
+decode_KRB_ERROR(const unsigned char *p, size_t len, KRB_ERROR *data, size_t *size)
+{
+size_t ret = 0, reallen;
+size_t l;
+int e;
+
+memset(data, 0, sizeof(*data));
+reallen = 0;
+e = der_match_tag_and_length (p, len, APPL, CONS, 30, &reallen, &l);
+FORW;
+{
+int dce_fix;
+if((dce_fix = fix_dce(reallen, &len)) < 0)
+return ASN1_BAD_FORMAT;
+e = der_match_tag_and_length (p, len, UNIV, CONS, UT_Sequence,&reallen, &l);
+FORW;
+{
+int dce_fix;
+if((dce_fix = fix_dce(reallen, &len)) < 0)
+return ASN1_BAD_FORMAT;
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 0, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_integer(p, len, &(data)->pvno, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 1, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_MESSAGE_TYPE(p, len, &(data)->msg_type, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 2, &l);
+if (e)
+(data)->ctime = NULL;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+(data)->ctime = malloc(sizeof(*(data)->ctime));
+if((data)->ctime == NULL) return ENOMEM;
+e = decode_KerberosTime(p, len, (data)->ctime, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 3, &l);
+if (e)
+(data)->cusec = NULL;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+(data)->cusec = malloc(sizeof(*(data)->cusec));
+if((data)->cusec == NULL) return ENOMEM;
+e = decode_integer(p, len, (data)->cusec, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 4, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_KerberosTime(p, len, &(data)->stime, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 5, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_integer(p, len, &(data)->susec, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 6, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_integer(p, len, &(data)->error_code, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 7, &l);
+if (e)
+(data)->crealm = NULL;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+(data)->crealm = malloc(sizeof(*(data)->crealm));
+if((data)->crealm == NULL) return ENOMEM;
+e = decode_Realm(p, len, (data)->crealm, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 8, &l);
+if (e)
+(data)->cname = NULL;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+(data)->cname = malloc(sizeof(*(data)->cname));
+if((data)->cname == NULL) return ENOMEM;
+e = decode_PrincipalName(p, len, (data)->cname, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 9, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_Realm(p, len, &(data)->realm, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 10, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_PrincipalName(p, len, &(data)->sname, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 11, &l);
+if (e)
+(data)->e_text = NULL;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+(data)->e_text = malloc(sizeof(*(data)->e_text));
+if((data)->e_text == NULL) return ENOMEM;
+e = decode_general_string(p, len, (data)->e_text, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 12, &l);
+if (e)
+(data)->e_data = NULL;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+(data)->e_data = malloc(sizeof(*(data)->e_data));
+if((data)->e_data == NULL) return ENOMEM;
+e = decode_octet_string(p, len, (data)->e_data, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}
+}
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}
+}
+if(size) *size = ret;
+return 0;
+fail:
+free_KRB_ERROR(data);
+return e;
+}
+
+void
+free_KRB_ERROR(KRB_ERROR *data)
+{
+free_MESSAGE_TYPE(&(data)->msg_type);
+if((data)->ctime) {
+free_KerberosTime((data)->ctime);
+free((data)->ctime);
+}
+if((data)->cusec) {
+free((data)->cusec);
+}
+free_KerberosTime(&(data)->stime);
+if((data)->crealm) {
+free_Realm((data)->crealm);
+free((data)->crealm);
+}
+if((data)->cname) {
+free_PrincipalName((data)->cname);
+free((data)->cname);
+}
+free_Realm(&(data)->realm);
+free_PrincipalName(&(data)->sname);
+if((data)->e_text) {
+free_general_string((data)->e_text);
+free((data)->e_text);
+}
+if((data)->e_data) {
+free_octet_string((data)->e_data);
+free((data)->e_data);
+}
+}
+
+size_t
+length_KRB_ERROR(const KRB_ERROR *data)
+{
+size_t ret = 0;
+{
+int oldret = ret;
+ret = 0;
+ret += length_integer(&(data)->pvno);
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+ret += length_MESSAGE_TYPE(&(data)->msg_type);
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->ctime){
+int oldret = ret;
+ret = 0;
+ret += length_KerberosTime((data)->ctime);
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->cusec){
+int oldret = ret;
+ret = 0;
+ret += length_integer((data)->cusec);
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+ret += length_KerberosTime(&(data)->stime);
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+ret += length_integer(&(data)->susec);
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+ret += length_integer(&(data)->error_code);
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->crealm){
+int oldret = ret;
+ret = 0;
+ret += length_Realm((data)->crealm);
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->cname){
+int oldret = ret;
+ret = 0;
+ret += length_PrincipalName((data)->cname);
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+ret += length_Realm(&(data)->realm);
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+ret += length_PrincipalName(&(data)->sname);
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->e_text){
+int oldret = ret;
+ret = 0;
+ret += length_general_string((data)->e_text);
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->e_data){
+int oldret = ret;
+ret = 0;
+ret += length_octet_string((data)->e_data);
+ret += 1 + length_len(ret) + oldret;
+}
+ret += 1 + length_len(ret);
+ret += 1 + length_len (ret);
+return ret;
+}
+
+int
+copy_KRB_ERROR(const KRB_ERROR *from, KRB_ERROR *to)
+{
+*(&(to)->pvno) = *(&(from)->pvno);
+if(copy_MESSAGE_TYPE(&(from)->msg_type, &(to)->msg_type)) return ENOMEM;
+if((from)->ctime) {
+(to)->ctime = malloc(sizeof(*(to)->ctime));
+if((to)->ctime == NULL) return ENOMEM;
+if(copy_KerberosTime((from)->ctime, (to)->ctime)) return ENOMEM;
+}else
+(to)->ctime = NULL;
+if((from)->cusec) {
+(to)->cusec = malloc(sizeof(*(to)->cusec));
+if((to)->cusec == NULL) return ENOMEM;
+*((to)->cusec) = *((from)->cusec);
+}else
+(to)->cusec = NULL;
+if(copy_KerberosTime(&(from)->stime, &(to)->stime)) return ENOMEM;
+*(&(to)->susec) = *(&(from)->susec);
+*(&(to)->error_code) = *(&(from)->error_code);
+if((from)->crealm) {
+(to)->crealm = malloc(sizeof(*(to)->crealm));
+if((to)->crealm == NULL) return ENOMEM;
+if(copy_Realm((from)->crealm, (to)->crealm)) return ENOMEM;
+}else
+(to)->crealm = NULL;
+if((from)->cname) {
+(to)->cname = malloc(sizeof(*(to)->cname));
+if((to)->cname == NULL) return ENOMEM;
+if(copy_PrincipalName((from)->cname, (to)->cname)) return ENOMEM;
+}else
+(to)->cname = NULL;
+if(copy_Realm(&(from)->realm, &(to)->realm)) return ENOMEM;
+if(copy_PrincipalName(&(from)->sname, &(to)->sname)) return ENOMEM;
+if((from)->e_text) {
+(to)->e_text = malloc(sizeof(*(to)->e_text));
+if((to)->e_text == NULL) return ENOMEM;
+if(copy_general_string((from)->e_text, (to)->e_text)) return ENOMEM;
+}else
+(to)->e_text = NULL;
+if((from)->e_data) {
+(to)->e_data = malloc(sizeof(*(to)->e_data));
+if((to)->e_data == NULL) return ENOMEM;
+if(copy_octet_string((from)->e_data, (to)->e_data)) return ENOMEM;
+}else
+(to)->e_data = NULL;
+return 0;
+}
+
diff --git a/kerberosV/lib/asn1/asn1_KRB_PRIV.c b/kerberosV/lib/asn1/asn1_KRB_PRIV.c
new file mode 100644
index 00000000000..f660d6dcc47
--- /dev/null
+++ b/kerberosV/lib/asn1/asn1_KRB_PRIV.c
@@ -0,0 +1,219 @@
+/* Generated from /usr/src/kerberosV/lib/asn1/../../src/lib/asn1/k5.asn1 */
+/* Do not edit */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+#include <errno.h>
+#include <krb5_asn1.h>
+#include <asn1_err.h>
+#include <der.h>
+#include <parse_units.h>
+
+#define BACK if (e) return e; p -= l; len -= l; ret += l
+
+int
+encode_KRB_PRIV(unsigned char *p, size_t len, const KRB_PRIV *data, size_t *size)
+{
+size_t ret = 0;
+size_t l;
+int i, e;
+
+i = 0;
+{
+int oldret = ret;
+ret = 0;
+e = encode_EncryptedData(p, len, &(data)->enc_part, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 3, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_MESSAGE_TYPE(p, len, &(data)->msg_type, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 1, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_integer(p, len, &(data)->pvno, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 0, &l);
+BACK;
+ret += oldret;
+}
+e = der_put_length_and_tag (p, len, ret, UNIV, CONS, UT_Sequence, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, APPL, CONS, 21, &l);
+BACK;
+*size = ret;
+return 0;
+}
+
+#define FORW if(e) goto fail; p += l; len -= l; ret += l
+
+int
+decode_KRB_PRIV(const unsigned char *p, size_t len, KRB_PRIV *data, size_t *size)
+{
+size_t ret = 0, reallen;
+size_t l;
+int e;
+
+memset(data, 0, sizeof(*data));
+reallen = 0;
+e = der_match_tag_and_length (p, len, APPL, CONS, 21, &reallen, &l);
+FORW;
+{
+int dce_fix;
+if((dce_fix = fix_dce(reallen, &len)) < 0)
+return ASN1_BAD_FORMAT;
+e = der_match_tag_and_length (p, len, UNIV, CONS, UT_Sequence,&reallen, &l);
+FORW;
+{
+int dce_fix;
+if((dce_fix = fix_dce(reallen, &len)) < 0)
+return ASN1_BAD_FORMAT;
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 0, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_integer(p, len, &(data)->pvno, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 1, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_MESSAGE_TYPE(p, len, &(data)->msg_type, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 3, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_EncryptedData(p, len, &(data)->enc_part, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}
+}
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}
+}
+if(size) *size = ret;
+return 0;
+fail:
+free_KRB_PRIV(data);
+return e;
+}
+
+void
+free_KRB_PRIV(KRB_PRIV *data)
+{
+free_MESSAGE_TYPE(&(data)->msg_type);
+free_EncryptedData(&(data)->enc_part);
+}
+
+size_t
+length_KRB_PRIV(const KRB_PRIV *data)
+{
+size_t ret = 0;
+{
+int oldret = ret;
+ret = 0;
+ret += length_integer(&(data)->pvno);
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+ret += length_MESSAGE_TYPE(&(data)->msg_type);
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+ret += length_EncryptedData(&(data)->enc_part);
+ret += 1 + length_len(ret) + oldret;
+}
+ret += 1 + length_len(ret);
+ret += 1 + length_len (ret);
+return ret;
+}
+
+int
+copy_KRB_PRIV(const KRB_PRIV *from, KRB_PRIV *to)
+{
+*(&(to)->pvno) = *(&(from)->pvno);
+if(copy_MESSAGE_TYPE(&(from)->msg_type, &(to)->msg_type)) return ENOMEM;
+if(copy_EncryptedData(&(from)->enc_part, &(to)->enc_part)) return ENOMEM;
+return 0;
+}
+
diff --git a/kerberosV/lib/asn1/asn1_KRB_SAFE.c b/kerberosV/lib/asn1/asn1_KRB_SAFE.c
new file mode 100644
index 00000000000..e4a26856005
--- /dev/null
+++ b/kerberosV/lib/asn1/asn1_KRB_SAFE.c
@@ -0,0 +1,262 @@
+/* Generated from /usr/src/kerberosV/lib/asn1/../../src/lib/asn1/k5.asn1 */
+/* Do not edit */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+#include <errno.h>
+#include <krb5_asn1.h>
+#include <asn1_err.h>
+#include <der.h>
+#include <parse_units.h>
+
+#define BACK if (e) return e; p -= l; len -= l; ret += l
+
+int
+encode_KRB_SAFE(unsigned char *p, size_t len, const KRB_SAFE *data, size_t *size)
+{
+size_t ret = 0;
+size_t l;
+int i, e;
+
+i = 0;
+{
+int oldret = ret;
+ret = 0;
+e = encode_Checksum(p, len, &(data)->cksum, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 3, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_KRB_SAFE_BODY(p, len, &(data)->safe_body, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 2, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_MESSAGE_TYPE(p, len, &(data)->msg_type, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 1, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_integer(p, len, &(data)->pvno, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 0, &l);
+BACK;
+ret += oldret;
+}
+e = der_put_length_and_tag (p, len, ret, UNIV, CONS, UT_Sequence, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, APPL, CONS, 20, &l);
+BACK;
+*size = ret;
+return 0;
+}
+
+#define FORW if(e) goto fail; p += l; len -= l; ret += l
+
+int
+decode_KRB_SAFE(const unsigned char *p, size_t len, KRB_SAFE *data, size_t *size)
+{
+size_t ret = 0, reallen;
+size_t l;
+int e;
+
+memset(data, 0, sizeof(*data));
+reallen = 0;
+e = der_match_tag_and_length (p, len, APPL, CONS, 20, &reallen, &l);
+FORW;
+{
+int dce_fix;
+if((dce_fix = fix_dce(reallen, &len)) < 0)
+return ASN1_BAD_FORMAT;
+e = der_match_tag_and_length (p, len, UNIV, CONS, UT_Sequence,&reallen, &l);
+FORW;
+{
+int dce_fix;
+if((dce_fix = fix_dce(reallen, &len)) < 0)
+return ASN1_BAD_FORMAT;
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 0, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_integer(p, len, &(data)->pvno, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 1, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_MESSAGE_TYPE(p, len, &(data)->msg_type, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 2, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_KRB_SAFE_BODY(p, len, &(data)->safe_body, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 3, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_Checksum(p, len, &(data)->cksum, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}
+}
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}
+}
+if(size) *size = ret;
+return 0;
+fail:
+free_KRB_SAFE(data);
+return e;
+}
+
+void
+free_KRB_SAFE(KRB_SAFE *data)
+{
+free_MESSAGE_TYPE(&(data)->msg_type);
+free_KRB_SAFE_BODY(&(data)->safe_body);
+free_Checksum(&(data)->cksum);
+}
+
+size_t
+length_KRB_SAFE(const KRB_SAFE *data)
+{
+size_t ret = 0;
+{
+int oldret = ret;
+ret = 0;
+ret += length_integer(&(data)->pvno);
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+ret += length_MESSAGE_TYPE(&(data)->msg_type);
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+ret += length_KRB_SAFE_BODY(&(data)->safe_body);
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+ret += length_Checksum(&(data)->cksum);
+ret += 1 + length_len(ret) + oldret;
+}
+ret += 1 + length_len(ret);
+ret += 1 + length_len (ret);
+return ret;
+}
+
+int
+copy_KRB_SAFE(const KRB_SAFE *from, KRB_SAFE *to)
+{
+*(&(to)->pvno) = *(&(from)->pvno);
+if(copy_MESSAGE_TYPE(&(from)->msg_type, &(to)->msg_type)) return ENOMEM;
+if(copy_KRB_SAFE_BODY(&(from)->safe_body, &(to)->safe_body)) return ENOMEM;
+if(copy_Checksum(&(from)->cksum, &(to)->cksum)) return ENOMEM;
+return 0;
+}
+
diff --git a/kerberosV/lib/asn1/asn1_KRB_SAFE_BODY.c b/kerberosV/lib/asn1/asn1_KRB_SAFE_BODY.c
new file mode 100644
index 00000000000..b6c55935d82
--- /dev/null
+++ b/kerberosV/lib/asn1/asn1_KRB_SAFE_BODY.c
@@ -0,0 +1,389 @@
+/* Generated from /usr/src/kerberosV/lib/asn1/../../src/lib/asn1/k5.asn1 */
+/* Do not edit */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+#include <errno.h>
+#include <krb5_asn1.h>
+#include <asn1_err.h>
+#include <der.h>
+#include <parse_units.h>
+
+#define BACK if (e) return e; p -= l; len -= l; ret += l
+
+int
+encode_KRB_SAFE_BODY(unsigned char *p, size_t len, const KRB_SAFE_BODY *data, size_t *size)
+{
+size_t ret = 0;
+size_t l;
+int i, e;
+
+i = 0;
+if((data)->r_address)
+{
+int oldret = ret;
+ret = 0;
+e = encode_HostAddress(p, len, (data)->r_address, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 5, &l);
+BACK;
+ret += oldret;
+}
+if((data)->s_address)
+{
+int oldret = ret;
+ret = 0;
+e = encode_HostAddress(p, len, (data)->s_address, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 4, &l);
+BACK;
+ret += oldret;
+}
+if((data)->seq_number)
+{
+int oldret = ret;
+ret = 0;
+e = encode_UNSIGNED(p, len, (data)->seq_number, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 3, &l);
+BACK;
+ret += oldret;
+}
+if((data)->usec)
+{
+int oldret = ret;
+ret = 0;
+e = encode_integer(p, len, (data)->usec, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 2, &l);
+BACK;
+ret += oldret;
+}
+if((data)->timestamp)
+{
+int oldret = ret;
+ret = 0;
+e = encode_KerberosTime(p, len, (data)->timestamp, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 1, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_octet_string(p, len, &(data)->user_data, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 0, &l);
+BACK;
+ret += oldret;
+}
+e = der_put_length_and_tag (p, len, ret, UNIV, CONS, UT_Sequence, &l);
+BACK;
+*size = ret;
+return 0;
+}
+
+#define FORW if(e) goto fail; p += l; len -= l; ret += l
+
+int
+decode_KRB_SAFE_BODY(const unsigned char *p, size_t len, KRB_SAFE_BODY *data, size_t *size)
+{
+size_t ret = 0, reallen;
+size_t l;
+int e;
+
+memset(data, 0, sizeof(*data));
+reallen = 0;
+e = der_match_tag_and_length (p, len, UNIV, CONS, UT_Sequence,&reallen, &l);
+FORW;
+{
+int dce_fix;
+if((dce_fix = fix_dce(reallen, &len)) < 0)
+return ASN1_BAD_FORMAT;
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 0, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_octet_string(p, len, &(data)->user_data, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 1, &l);
+if (e)
+(data)->timestamp = NULL;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+(data)->timestamp = malloc(sizeof(*(data)->timestamp));
+if((data)->timestamp == NULL) return ENOMEM;
+e = decode_KerberosTime(p, len, (data)->timestamp, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 2, &l);
+if (e)
+(data)->usec = NULL;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+(data)->usec = malloc(sizeof(*(data)->usec));
+if((data)->usec == NULL) return ENOMEM;
+e = decode_integer(p, len, (data)->usec, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 3, &l);
+if (e)
+(data)->seq_number = NULL;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+(data)->seq_number = malloc(sizeof(*(data)->seq_number));
+if((data)->seq_number == NULL) return ENOMEM;
+e = decode_UNSIGNED(p, len, (data)->seq_number, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 4, &l);
+if (e)
+(data)->s_address = NULL;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+(data)->s_address = malloc(sizeof(*(data)->s_address));
+if((data)->s_address == NULL) return ENOMEM;
+e = decode_HostAddress(p, len, (data)->s_address, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 5, &l);
+if (e)
+(data)->r_address = NULL;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+(data)->r_address = malloc(sizeof(*(data)->r_address));
+if((data)->r_address == NULL) return ENOMEM;
+e = decode_HostAddress(p, len, (data)->r_address, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}
+}
+if(size) *size = ret;
+return 0;
+fail:
+free_KRB_SAFE_BODY(data);
+return e;
+}
+
+void
+free_KRB_SAFE_BODY(KRB_SAFE_BODY *data)
+{
+free_octet_string(&(data)->user_data);
+if((data)->timestamp) {
+free_KerberosTime((data)->timestamp);
+free((data)->timestamp);
+}
+if((data)->usec) {
+free((data)->usec);
+}
+if((data)->seq_number) {
+free_UNSIGNED((data)->seq_number);
+free((data)->seq_number);
+}
+if((data)->s_address) {
+free_HostAddress((data)->s_address);
+free((data)->s_address);
+}
+if((data)->r_address) {
+free_HostAddress((data)->r_address);
+free((data)->r_address);
+}
+}
+
+size_t
+length_KRB_SAFE_BODY(const KRB_SAFE_BODY *data)
+{
+size_t ret = 0;
+{
+int oldret = ret;
+ret = 0;
+ret += length_octet_string(&(data)->user_data);
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->timestamp){
+int oldret = ret;
+ret = 0;
+ret += length_KerberosTime((data)->timestamp);
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->usec){
+int oldret = ret;
+ret = 0;
+ret += length_integer((data)->usec);
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->seq_number){
+int oldret = ret;
+ret = 0;
+ret += length_UNSIGNED((data)->seq_number);
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->s_address){
+int oldret = ret;
+ret = 0;
+ret += length_HostAddress((data)->s_address);
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->r_address){
+int oldret = ret;
+ret = 0;
+ret += length_HostAddress((data)->r_address);
+ret += 1 + length_len(ret) + oldret;
+}
+ret += 1 + length_len(ret);
+return ret;
+}
+
+int
+copy_KRB_SAFE_BODY(const KRB_SAFE_BODY *from, KRB_SAFE_BODY *to)
+{
+if(copy_octet_string(&(from)->user_data, &(to)->user_data)) return ENOMEM;
+if((from)->timestamp) {
+(to)->timestamp = malloc(sizeof(*(to)->timestamp));
+if((to)->timestamp == NULL) return ENOMEM;
+if(copy_KerberosTime((from)->timestamp, (to)->timestamp)) return ENOMEM;
+}else
+(to)->timestamp = NULL;
+if((from)->usec) {
+(to)->usec = malloc(sizeof(*(to)->usec));
+if((to)->usec == NULL) return ENOMEM;
+*((to)->usec) = *((from)->usec);
+}else
+(to)->usec = NULL;
+if((from)->seq_number) {
+(to)->seq_number = malloc(sizeof(*(to)->seq_number));
+if((to)->seq_number == NULL) return ENOMEM;
+if(copy_UNSIGNED((from)->seq_number, (to)->seq_number)) return ENOMEM;
+}else
+(to)->seq_number = NULL;
+if((from)->s_address) {
+(to)->s_address = malloc(sizeof(*(to)->s_address));
+if((to)->s_address == NULL) return ENOMEM;
+if(copy_HostAddress((from)->s_address, (to)->s_address)) return ENOMEM;
+}else
+(to)->s_address = NULL;
+if((from)->r_address) {
+(to)->r_address = malloc(sizeof(*(to)->r_address));
+if((to)->r_address == NULL) return ENOMEM;
+if(copy_HostAddress((from)->r_address, (to)->r_address)) return ENOMEM;
+}else
+(to)->r_address = NULL;
+return 0;
+}
+
diff --git a/kerberosV/lib/asn1/asn1_KerberosTime.c b/kerberosV/lib/asn1/asn1_KerberosTime.c
new file mode 100644
index 00000000000..ac0b60d146a
--- /dev/null
+++ b/kerberosV/lib/asn1/asn1_KerberosTime.c
@@ -0,0 +1,69 @@
+/* Generated from /usr/src/kerberosV/lib/asn1/../../src/lib/asn1/k5.asn1 */
+/* Do not edit */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+#include <errno.h>
+#include <krb5_asn1.h>
+#include <asn1_err.h>
+#include <der.h>
+#include <parse_units.h>
+
+#define BACK if (e) return e; p -= l; len -= l; ret += l
+
+int
+encode_KerberosTime(unsigned char *p, size_t len, const KerberosTime *data, size_t *size)
+{
+size_t ret = 0;
+size_t l;
+int i, e;
+
+i = 0;
+e = encode_generalized_time(p, len, data, &l);
+BACK;
+*size = ret;
+return 0;
+}
+
+#define FORW if(e) goto fail; p += l; len -= l; ret += l
+
+int
+decode_KerberosTime(const unsigned char *p, size_t len, KerberosTime *data, size_t *size)
+{
+size_t ret = 0, reallen;
+size_t l;
+int e;
+
+memset(data, 0, sizeof(*data));
+reallen = 0;
+e = decode_generalized_time(p, len, data, &l);
+FORW;
+if(size) *size = ret;
+return 0;
+fail:
+free_KerberosTime(data);
+return e;
+}
+
+void
+free_KerberosTime(KerberosTime *data)
+{
+}
+
+size_t
+length_KerberosTime(const KerberosTime *data)
+{
+size_t ret = 0;
+ret += length_generalized_time(data);
+return ret;
+}
+
+int
+copy_KerberosTime(const KerberosTime *from, KerberosTime *to)
+{
+*(to) = *(from);
+return 0;
+}
+
diff --git a/kerberosV/lib/asn1/asn1_KrbCredInfo.c b/kerberosV/lib/asn1/asn1_KrbCredInfo.c
new file mode 100644
index 00000000000..51e549b6223
--- /dev/null
+++ b/kerberosV/lib/asn1/asn1_KrbCredInfo.c
@@ -0,0 +1,660 @@
+/* Generated from /usr/src/kerberosV/lib/asn1/../../src/lib/asn1/k5.asn1 */
+/* Do not edit */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+#include <errno.h>
+#include <krb5_asn1.h>
+#include <asn1_err.h>
+#include <der.h>
+#include <parse_units.h>
+
+#define BACK if (e) return e; p -= l; len -= l; ret += l
+
+int
+encode_KrbCredInfo(unsigned char *p, size_t len, const KrbCredInfo *data, size_t *size)
+{
+size_t ret = 0;
+size_t l;
+int i, e;
+
+i = 0;
+if((data)->caddr)
+{
+int oldret = ret;
+ret = 0;
+e = encode_HostAddresses(p, len, (data)->caddr, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 10, &l);
+BACK;
+ret += oldret;
+}
+if((data)->sname)
+{
+int oldret = ret;
+ret = 0;
+e = encode_PrincipalName(p, len, (data)->sname, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 9, &l);
+BACK;
+ret += oldret;
+}
+if((data)->srealm)
+{
+int oldret = ret;
+ret = 0;
+e = encode_Realm(p, len, (data)->srealm, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 8, &l);
+BACK;
+ret += oldret;
+}
+if((data)->renew_till)
+{
+int oldret = ret;
+ret = 0;
+e = encode_KerberosTime(p, len, (data)->renew_till, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 7, &l);
+BACK;
+ret += oldret;
+}
+if((data)->endtime)
+{
+int oldret = ret;
+ret = 0;
+e = encode_KerberosTime(p, len, (data)->endtime, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 6, &l);
+BACK;
+ret += oldret;
+}
+if((data)->starttime)
+{
+int oldret = ret;
+ret = 0;
+e = encode_KerberosTime(p, len, (data)->starttime, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 5, &l);
+BACK;
+ret += oldret;
+}
+if((data)->authtime)
+{
+int oldret = ret;
+ret = 0;
+e = encode_KerberosTime(p, len, (data)->authtime, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 4, &l);
+BACK;
+ret += oldret;
+}
+if((data)->flags)
+{
+int oldret = ret;
+ret = 0;
+e = encode_TicketFlags(p, len, (data)->flags, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 3, &l);
+BACK;
+ret += oldret;
+}
+if((data)->pname)
+{
+int oldret = ret;
+ret = 0;
+e = encode_PrincipalName(p, len, (data)->pname, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 2, &l);
+BACK;
+ret += oldret;
+}
+if((data)->prealm)
+{
+int oldret = ret;
+ret = 0;
+e = encode_Realm(p, len, (data)->prealm, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 1, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_EncryptionKey(p, len, &(data)->key, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 0, &l);
+BACK;
+ret += oldret;
+}
+e = der_put_length_and_tag (p, len, ret, UNIV, CONS, UT_Sequence, &l);
+BACK;
+*size = ret;
+return 0;
+}
+
+#define FORW if(e) goto fail; p += l; len -= l; ret += l
+
+int
+decode_KrbCredInfo(const unsigned char *p, size_t len, KrbCredInfo *data, size_t *size)
+{
+size_t ret = 0, reallen;
+size_t l;
+int e;
+
+memset(data, 0, sizeof(*data));
+reallen = 0;
+e = der_match_tag_and_length (p, len, UNIV, CONS, UT_Sequence,&reallen, &l);
+FORW;
+{
+int dce_fix;
+if((dce_fix = fix_dce(reallen, &len)) < 0)
+return ASN1_BAD_FORMAT;
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 0, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_EncryptionKey(p, len, &(data)->key, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 1, &l);
+if (e)
+(data)->prealm = NULL;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+(data)->prealm = malloc(sizeof(*(data)->prealm));
+if((data)->prealm == NULL) return ENOMEM;
+e = decode_Realm(p, len, (data)->prealm, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 2, &l);
+if (e)
+(data)->pname = NULL;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+(data)->pname = malloc(sizeof(*(data)->pname));
+if((data)->pname == NULL) return ENOMEM;
+e = decode_PrincipalName(p, len, (data)->pname, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 3, &l);
+if (e)
+(data)->flags = NULL;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+(data)->flags = malloc(sizeof(*(data)->flags));
+if((data)->flags == NULL) return ENOMEM;
+e = decode_TicketFlags(p, len, (data)->flags, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 4, &l);
+if (e)
+(data)->authtime = NULL;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+(data)->authtime = malloc(sizeof(*(data)->authtime));
+if((data)->authtime == NULL) return ENOMEM;
+e = decode_KerberosTime(p, len, (data)->authtime, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 5, &l);
+if (e)
+(data)->starttime = NULL;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+(data)->starttime = malloc(sizeof(*(data)->starttime));
+if((data)->starttime == NULL) return ENOMEM;
+e = decode_KerberosTime(p, len, (data)->starttime, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 6, &l);
+if (e)
+(data)->endtime = NULL;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+(data)->endtime = malloc(sizeof(*(data)->endtime));
+if((data)->endtime == NULL) return ENOMEM;
+e = decode_KerberosTime(p, len, (data)->endtime, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 7, &l);
+if (e)
+(data)->renew_till = NULL;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+(data)->renew_till = malloc(sizeof(*(data)->renew_till));
+if((data)->renew_till == NULL) return ENOMEM;
+e = decode_KerberosTime(p, len, (data)->renew_till, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 8, &l);
+if (e)
+(data)->srealm = NULL;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+(data)->srealm = malloc(sizeof(*(data)->srealm));
+if((data)->srealm == NULL) return ENOMEM;
+e = decode_Realm(p, len, (data)->srealm, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 9, &l);
+if (e)
+(data)->sname = NULL;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+(data)->sname = malloc(sizeof(*(data)->sname));
+if((data)->sname == NULL) return ENOMEM;
+e = decode_PrincipalName(p, len, (data)->sname, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 10, &l);
+if (e)
+(data)->caddr = NULL;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+(data)->caddr = malloc(sizeof(*(data)->caddr));
+if((data)->caddr == NULL) return ENOMEM;
+e = decode_HostAddresses(p, len, (data)->caddr, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}
+}
+if(size) *size = ret;
+return 0;
+fail:
+free_KrbCredInfo(data);
+return e;
+}
+
+void
+free_KrbCredInfo(KrbCredInfo *data)
+{
+free_EncryptionKey(&(data)->key);
+if((data)->prealm) {
+free_Realm((data)->prealm);
+free((data)->prealm);
+}
+if((data)->pname) {
+free_PrincipalName((data)->pname);
+free((data)->pname);
+}
+if((data)->flags) {
+free_TicketFlags((data)->flags);
+free((data)->flags);
+}
+if((data)->authtime) {
+free_KerberosTime((data)->authtime);
+free((data)->authtime);
+}
+if((data)->starttime) {
+free_KerberosTime((data)->starttime);
+free((data)->starttime);
+}
+if((data)->endtime) {
+free_KerberosTime((data)->endtime);
+free((data)->endtime);
+}
+if((data)->renew_till) {
+free_KerberosTime((data)->renew_till);
+free((data)->renew_till);
+}
+if((data)->srealm) {
+free_Realm((data)->srealm);
+free((data)->srealm);
+}
+if((data)->sname) {
+free_PrincipalName((data)->sname);
+free((data)->sname);
+}
+if((data)->caddr) {
+free_HostAddresses((data)->caddr);
+free((data)->caddr);
+}
+}
+
+size_t
+length_KrbCredInfo(const KrbCredInfo *data)
+{
+size_t ret = 0;
+{
+int oldret = ret;
+ret = 0;
+ret += length_EncryptionKey(&(data)->key);
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->prealm){
+int oldret = ret;
+ret = 0;
+ret += length_Realm((data)->prealm);
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->pname){
+int oldret = ret;
+ret = 0;
+ret += length_PrincipalName((data)->pname);
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->flags){
+int oldret = ret;
+ret = 0;
+ret += length_TicketFlags((data)->flags);
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->authtime){
+int oldret = ret;
+ret = 0;
+ret += length_KerberosTime((data)->authtime);
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->starttime){
+int oldret = ret;
+ret = 0;
+ret += length_KerberosTime((data)->starttime);
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->endtime){
+int oldret = ret;
+ret = 0;
+ret += length_KerberosTime((data)->endtime);
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->renew_till){
+int oldret = ret;
+ret = 0;
+ret += length_KerberosTime((data)->renew_till);
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->srealm){
+int oldret = ret;
+ret = 0;
+ret += length_Realm((data)->srealm);
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->sname){
+int oldret = ret;
+ret = 0;
+ret += length_PrincipalName((data)->sname);
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->caddr){
+int oldret = ret;
+ret = 0;
+ret += length_HostAddresses((data)->caddr);
+ret += 1 + length_len(ret) + oldret;
+}
+ret += 1 + length_len(ret);
+return ret;
+}
+
+int
+copy_KrbCredInfo(const KrbCredInfo *from, KrbCredInfo *to)
+{
+if(copy_EncryptionKey(&(from)->key, &(to)->key)) return ENOMEM;
+if((from)->prealm) {
+(to)->prealm = malloc(sizeof(*(to)->prealm));
+if((to)->prealm == NULL) return ENOMEM;
+if(copy_Realm((from)->prealm, (to)->prealm)) return ENOMEM;
+}else
+(to)->prealm = NULL;
+if((from)->pname) {
+(to)->pname = malloc(sizeof(*(to)->pname));
+if((to)->pname == NULL) return ENOMEM;
+if(copy_PrincipalName((from)->pname, (to)->pname)) return ENOMEM;
+}else
+(to)->pname = NULL;
+if((from)->flags) {
+(to)->flags = malloc(sizeof(*(to)->flags));
+if((to)->flags == NULL) return ENOMEM;
+if(copy_TicketFlags((from)->flags, (to)->flags)) return ENOMEM;
+}else
+(to)->flags = NULL;
+if((from)->authtime) {
+(to)->authtime = malloc(sizeof(*(to)->authtime));
+if((to)->authtime == NULL) return ENOMEM;
+if(copy_KerberosTime((from)->authtime, (to)->authtime)) return ENOMEM;
+}else
+(to)->authtime = NULL;
+if((from)->starttime) {
+(to)->starttime = malloc(sizeof(*(to)->starttime));
+if((to)->starttime == NULL) return ENOMEM;
+if(copy_KerberosTime((from)->starttime, (to)->starttime)) return ENOMEM;
+}else
+(to)->starttime = NULL;
+if((from)->endtime) {
+(to)->endtime = malloc(sizeof(*(to)->endtime));
+if((to)->endtime == NULL) return ENOMEM;
+if(copy_KerberosTime((from)->endtime, (to)->endtime)) return ENOMEM;
+}else
+(to)->endtime = NULL;
+if((from)->renew_till) {
+(to)->renew_till = malloc(sizeof(*(to)->renew_till));
+if((to)->renew_till == NULL) return ENOMEM;
+if(copy_KerberosTime((from)->renew_till, (to)->renew_till)) return ENOMEM;
+}else
+(to)->renew_till = NULL;
+if((from)->srealm) {
+(to)->srealm = malloc(sizeof(*(to)->srealm));
+if((to)->srealm == NULL) return ENOMEM;
+if(copy_Realm((from)->srealm, (to)->srealm)) return ENOMEM;
+}else
+(to)->srealm = NULL;
+if((from)->sname) {
+(to)->sname = malloc(sizeof(*(to)->sname));
+if((to)->sname == NULL) return ENOMEM;
+if(copy_PrincipalName((from)->sname, (to)->sname)) return ENOMEM;
+}else
+(to)->sname = NULL;
+if((from)->caddr) {
+(to)->caddr = malloc(sizeof(*(to)->caddr));
+if((to)->caddr == NULL) return ENOMEM;
+if(copy_HostAddresses((from)->caddr, (to)->caddr)) return ENOMEM;
+}else
+(to)->caddr = NULL;
+return 0;
+}
+
diff --git a/kerberosV/lib/asn1/asn1_LR_TYPE.c b/kerberosV/lib/asn1/asn1_LR_TYPE.c
new file mode 100644
index 00000000000..96fc2c66fc1
--- /dev/null
+++ b/kerberosV/lib/asn1/asn1_LR_TYPE.c
@@ -0,0 +1,69 @@
+/* Generated from /usr/src/kerberosV/lib/asn1/../../src/lib/asn1/k5.asn1 */
+/* Do not edit */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+#include <errno.h>
+#include <krb5_asn1.h>
+#include <asn1_err.h>
+#include <der.h>
+#include <parse_units.h>
+
+#define BACK if (e) return e; p -= l; len -= l; ret += l
+
+int
+encode_LR_TYPE(unsigned char *p, size_t len, const LR_TYPE *data, size_t *size)
+{
+size_t ret = 0;
+size_t l;
+int i, e;
+
+i = 0;
+e = encode_integer(p, len, (const int*)data, &l);
+BACK;
+*size = ret;
+return 0;
+}
+
+#define FORW if(e) goto fail; p += l; len -= l; ret += l
+
+int
+decode_LR_TYPE(const unsigned char *p, size_t len, LR_TYPE *data, size_t *size)
+{
+size_t ret = 0, reallen;
+size_t l;
+int e;
+
+memset(data, 0, sizeof(*data));
+reallen = 0;
+e = decode_integer(p, len, (int*)data, &l);
+FORW;
+if(size) *size = ret;
+return 0;
+fail:
+free_LR_TYPE(data);
+return e;
+}
+
+void
+free_LR_TYPE(LR_TYPE *data)
+{
+}
+
+size_t
+length_LR_TYPE(const LR_TYPE *data)
+{
+size_t ret = 0;
+ret += length_integer((const int*)data);
+return ret;
+}
+
+int
+copy_LR_TYPE(const LR_TYPE *from, LR_TYPE *to)
+{
+*(to) = *(from);
+return 0;
+}
+
diff --git a/kerberosV/lib/asn1/asn1_LastReq.c b/kerberosV/lib/asn1/asn1_LastReq.c
new file mode 100644
index 00000000000..c036a59b7b9
--- /dev/null
+++ b/kerberosV/lib/asn1/asn1_LastReq.c
@@ -0,0 +1,204 @@
+/* Generated from /usr/src/kerberosV/lib/asn1/../../src/lib/asn1/k5.asn1 */
+/* Do not edit */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+#include <errno.h>
+#include <krb5_asn1.h>
+#include <asn1_err.h>
+#include <der.h>
+#include <parse_units.h>
+
+#define BACK if (e) return e; p -= l; len -= l; ret += l
+
+int
+encode_LastReq(unsigned char *p, size_t len, const LastReq *data, size_t *size)
+{
+size_t ret = 0;
+size_t l;
+int i, e;
+
+i = 0;
+for(i = (data)->len - 1; i >= 0; --i) {
+int oldret = ret;
+ret = 0;
+{
+int oldret = ret;
+ret = 0;
+e = encode_KerberosTime(p, len, &(&(data)->val[i])->lr_value, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 1, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_LR_TYPE(p, len, &(&(data)->val[i])->lr_type, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 0, &l);
+BACK;
+ret += oldret;
+}
+e = der_put_length_and_tag (p, len, ret, UNIV, CONS, UT_Sequence, &l);
+BACK;
+ret += oldret;
+}
+e = der_put_length_and_tag (p, len, ret, UNIV, CONS, UT_Sequence, &l);
+BACK;
+*size = ret;
+return 0;
+}
+
+#define FORW if(e) goto fail; p += l; len -= l; ret += l
+
+int
+decode_LastReq(const unsigned char *p, size_t len, LastReq *data, size_t *size)
+{
+size_t ret = 0, reallen;
+size_t l;
+int e;
+
+memset(data, 0, sizeof(*data));
+reallen = 0;
+e = der_match_tag_and_length (p, len, UNIV, CONS, UT_Sequence,&reallen, &l);
+FORW;
+if(len < reallen)
+return ASN1_OVERRUN;
+len = reallen;
+{
+size_t origlen = len;
+int oldret = ret;
+ret = 0;
+(data)->len = 0;
+(data)->val = NULL;
+while(ret < origlen) {
+(data)->len++;
+(data)->val = realloc((data)->val, sizeof(*((data)->val)) * (data)->len);
+e = der_match_tag_and_length (p, len, UNIV, CONS, UT_Sequence,&reallen, &l);
+FORW;
+{
+int dce_fix;
+if((dce_fix = fix_dce(reallen, &len)) < 0)
+return ASN1_BAD_FORMAT;
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 0, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_LR_TYPE(p, len, &(&(data)->val[(data)->len-1])->lr_type, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 1, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_KerberosTime(p, len, &(&(data)->val[(data)->len-1])->lr_value, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}
+}
+len = origlen - ret;
+}
+ret += oldret;
+}
+if(size) *size = ret;
+return 0;
+fail:
+free_LastReq(data);
+return e;
+}
+
+void
+free_LastReq(LastReq *data)
+{
+while((data)->len){
+free_LR_TYPE(&(&(data)->val[(data)->len-1])->lr_type);
+free_KerberosTime(&(&(data)->val[(data)->len-1])->lr_value);
+(data)->len--;
+}
+free((data)->val);
+}
+
+size_t
+length_LastReq(const LastReq *data)
+{
+size_t ret = 0;
+{
+int oldret = ret;
+int i;
+ret = 0;
+for(i = (data)->len - 1; i >= 0; --i){
+{
+int oldret = ret;
+ret = 0;
+ret += length_LR_TYPE(&(&(data)->val[i])->lr_type);
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+ret += length_KerberosTime(&(&(data)->val[i])->lr_value);
+ret += 1 + length_len(ret) + oldret;
+}
+ret += 1 + length_len(ret);
+}
+ret += 1 + length_len(ret) + oldret;
+}
+return ret;
+}
+
+int
+copy_LastReq(const LastReq *from, LastReq *to)
+{
+if(((to)->val = malloc((from)->len * sizeof(*(to)->val))) == NULL && (from)->len != 0)
+return ENOMEM;
+for((to)->len = 0; (to)->len < (from)->len; (to)->len++){
+if(copy_LR_TYPE(&(&(from)->val[(to)->len])->lr_type, &(&(to)->val[(to)->len])->lr_type)) return ENOMEM;
+if(copy_KerberosTime(&(&(from)->val[(to)->len])->lr_value, &(&(to)->val[(to)->len])->lr_value)) return ENOMEM;
+}
+return 0;
+}
+
diff --git a/kerberosV/lib/asn1/asn1_MESSAGE_TYPE.c b/kerberosV/lib/asn1/asn1_MESSAGE_TYPE.c
new file mode 100644
index 00000000000..161a927cca0
--- /dev/null
+++ b/kerberosV/lib/asn1/asn1_MESSAGE_TYPE.c
@@ -0,0 +1,69 @@
+/* Generated from /usr/src/kerberosV/lib/asn1/../../src/lib/asn1/k5.asn1 */
+/* Do not edit */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+#include <errno.h>
+#include <krb5_asn1.h>
+#include <asn1_err.h>
+#include <der.h>
+#include <parse_units.h>
+
+#define BACK if (e) return e; p -= l; len -= l; ret += l
+
+int
+encode_MESSAGE_TYPE(unsigned char *p, size_t len, const MESSAGE_TYPE *data, size_t *size)
+{
+size_t ret = 0;
+size_t l;
+int i, e;
+
+i = 0;
+e = encode_integer(p, len, (const int*)data, &l);
+BACK;
+*size = ret;
+return 0;
+}
+
+#define FORW if(e) goto fail; p += l; len -= l; ret += l
+
+int
+decode_MESSAGE_TYPE(const unsigned char *p, size_t len, MESSAGE_TYPE *data, size_t *size)
+{
+size_t ret = 0, reallen;
+size_t l;
+int e;
+
+memset(data, 0, sizeof(*data));
+reallen = 0;
+e = decode_integer(p, len, (int*)data, &l);
+FORW;
+if(size) *size = ret;
+return 0;
+fail:
+free_MESSAGE_TYPE(data);
+return e;
+}
+
+void
+free_MESSAGE_TYPE(MESSAGE_TYPE *data)
+{
+}
+
+size_t
+length_MESSAGE_TYPE(const MESSAGE_TYPE *data)
+{
+size_t ret = 0;
+ret += length_integer((const int*)data);
+return ret;
+}
+
+int
+copy_MESSAGE_TYPE(const MESSAGE_TYPE *from, MESSAGE_TYPE *to)
+{
+*(to) = *(from);
+return 0;
+}
+
diff --git a/kerberosV/lib/asn1/asn1_METHOD_DATA.c b/kerberosV/lib/asn1/asn1_METHOD_DATA.c
new file mode 100644
index 00000000000..56f174a2f3b
--- /dev/null
+++ b/kerberosV/lib/asn1/asn1_METHOD_DATA.c
@@ -0,0 +1,111 @@
+/* Generated from /usr/src/kerberosV/lib/asn1/../../src/lib/asn1/k5.asn1 */
+/* Do not edit */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+#include <errno.h>
+#include <krb5_asn1.h>
+#include <asn1_err.h>
+#include <der.h>
+#include <parse_units.h>
+
+#define BACK if (e) return e; p -= l; len -= l; ret += l
+
+int
+encode_METHOD_DATA(unsigned char *p, size_t len, const METHOD_DATA *data, size_t *size)
+{
+size_t ret = 0;
+size_t l;
+int i, e;
+
+i = 0;
+for(i = (data)->len - 1; i >= 0; --i) {
+int oldret = ret;
+ret = 0;
+e = encode_PA_DATA(p, len, &(data)->val[i], &l);
+BACK;
+ret += oldret;
+}
+e = der_put_length_and_tag (p, len, ret, UNIV, CONS, UT_Sequence, &l);
+BACK;
+*size = ret;
+return 0;
+}
+
+#define FORW if(e) goto fail; p += l; len -= l; ret += l
+
+int
+decode_METHOD_DATA(const unsigned char *p, size_t len, METHOD_DATA *data, size_t *size)
+{
+size_t ret = 0, reallen;
+size_t l;
+int e;
+
+memset(data, 0, sizeof(*data));
+reallen = 0;
+e = der_match_tag_and_length (p, len, UNIV, CONS, UT_Sequence,&reallen, &l);
+FORW;
+if(len < reallen)
+return ASN1_OVERRUN;
+len = reallen;
+{
+size_t origlen = len;
+int oldret = ret;
+ret = 0;
+(data)->len = 0;
+(data)->val = NULL;
+while(ret < origlen) {
+(data)->len++;
+(data)->val = realloc((data)->val, sizeof(*((data)->val)) * (data)->len);
+e = decode_PA_DATA(p, len, &(data)->val[(data)->len-1], &l);
+FORW;
+len = origlen - ret;
+}
+ret += oldret;
+}
+if(size) *size = ret;
+return 0;
+fail:
+free_METHOD_DATA(data);
+return e;
+}
+
+void
+free_METHOD_DATA(METHOD_DATA *data)
+{
+while((data)->len){
+free_PA_DATA(&(data)->val[(data)->len-1]);
+(data)->len--;
+}
+free((data)->val);
+}
+
+size_t
+length_METHOD_DATA(const METHOD_DATA *data)
+{
+size_t ret = 0;
+{
+int oldret = ret;
+int i;
+ret = 0;
+for(i = (data)->len - 1; i >= 0; --i){
+ret += length_PA_DATA(&(data)->val[i]);
+}
+ret += 1 + length_len(ret) + oldret;
+}
+return ret;
+}
+
+int
+copy_METHOD_DATA(const METHOD_DATA *from, METHOD_DATA *to)
+{
+if(((to)->val = malloc((from)->len * sizeof(*(to)->val))) == NULL && (from)->len != 0)
+return ENOMEM;
+for((to)->len = 0; (to)->len < (from)->len; (to)->len++){
+if(copy_PA_DATA(&(from)->val[(to)->len], &(to)->val[(to)->len])) return ENOMEM;
+}
+return 0;
+}
+
diff --git a/kerberosV/lib/asn1/asn1_NAME_TYPE.c b/kerberosV/lib/asn1/asn1_NAME_TYPE.c
new file mode 100644
index 00000000000..bfe66579422
--- /dev/null
+++ b/kerberosV/lib/asn1/asn1_NAME_TYPE.c
@@ -0,0 +1,69 @@
+/* Generated from /usr/src/kerberosV/lib/asn1/../../src/lib/asn1/k5.asn1 */
+/* Do not edit */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+#include <errno.h>
+#include <krb5_asn1.h>
+#include <asn1_err.h>
+#include <der.h>
+#include <parse_units.h>
+
+#define BACK if (e) return e; p -= l; len -= l; ret += l
+
+int
+encode_NAME_TYPE(unsigned char *p, size_t len, const NAME_TYPE *data, size_t *size)
+{
+size_t ret = 0;
+size_t l;
+int i, e;
+
+i = 0;
+e = encode_integer(p, len, (const int*)data, &l);
+BACK;
+*size = ret;
+return 0;
+}
+
+#define FORW if(e) goto fail; p += l; len -= l; ret += l
+
+int
+decode_NAME_TYPE(const unsigned char *p, size_t len, NAME_TYPE *data, size_t *size)
+{
+size_t ret = 0, reallen;
+size_t l;
+int e;
+
+memset(data, 0, sizeof(*data));
+reallen = 0;
+e = decode_integer(p, len, (int*)data, &l);
+FORW;
+if(size) *size = ret;
+return 0;
+fail:
+free_NAME_TYPE(data);
+return e;
+}
+
+void
+free_NAME_TYPE(NAME_TYPE *data)
+{
+}
+
+size_t
+length_NAME_TYPE(const NAME_TYPE *data)
+{
+size_t ret = 0;
+ret += length_integer((const int*)data);
+return ret;
+}
+
+int
+copy_NAME_TYPE(const NAME_TYPE *from, NAME_TYPE *to)
+{
+*(to) = *(from);
+return 0;
+}
+
diff --git a/kerberosV/lib/asn1/asn1_PADATA_TYPE.c b/kerberosV/lib/asn1/asn1_PADATA_TYPE.c
new file mode 100644
index 00000000000..9489c6fd915
--- /dev/null
+++ b/kerberosV/lib/asn1/asn1_PADATA_TYPE.c
@@ -0,0 +1,69 @@
+/* Generated from /usr/src/kerberosV/lib/asn1/../../src/lib/asn1/k5.asn1 */
+/* Do not edit */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+#include <errno.h>
+#include <krb5_asn1.h>
+#include <asn1_err.h>
+#include <der.h>
+#include <parse_units.h>
+
+#define BACK if (e) return e; p -= l; len -= l; ret += l
+
+int
+encode_PADATA_TYPE(unsigned char *p, size_t len, const PADATA_TYPE *data, size_t *size)
+{
+size_t ret = 0;
+size_t l;
+int i, e;
+
+i = 0;
+e = encode_integer(p, len, (const int*)data, &l);
+BACK;
+*size = ret;
+return 0;
+}
+
+#define FORW if(e) goto fail; p += l; len -= l; ret += l
+
+int
+decode_PADATA_TYPE(const unsigned char *p, size_t len, PADATA_TYPE *data, size_t *size)
+{
+size_t ret = 0, reallen;
+size_t l;
+int e;
+
+memset(data, 0, sizeof(*data));
+reallen = 0;
+e = decode_integer(p, len, (int*)data, &l);
+FORW;
+if(size) *size = ret;
+return 0;
+fail:
+free_PADATA_TYPE(data);
+return e;
+}
+
+void
+free_PADATA_TYPE(PADATA_TYPE *data)
+{
+}
+
+size_t
+length_PADATA_TYPE(const PADATA_TYPE *data)
+{
+size_t ret = 0;
+ret += length_integer((const int*)data);
+return ret;
+}
+
+int
+copy_PADATA_TYPE(const PADATA_TYPE *from, PADATA_TYPE *to)
+{
+*(to) = *(from);
+return 0;
+}
+
diff --git a/kerberosV/lib/asn1/asn1_PA_DATA.c b/kerberosV/lib/asn1/asn1_PA_DATA.c
new file mode 100644
index 00000000000..d0f919d244a
--- /dev/null
+++ b/kerberosV/lib/asn1/asn1_PA_DATA.c
@@ -0,0 +1,163 @@
+/* Generated from /usr/src/kerberosV/lib/asn1/../../src/lib/asn1/k5.asn1 */
+/* Do not edit */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+#include <errno.h>
+#include <krb5_asn1.h>
+#include <asn1_err.h>
+#include <der.h>
+#include <parse_units.h>
+
+#define BACK if (e) return e; p -= l; len -= l; ret += l
+
+int
+encode_PA_DATA(unsigned char *p, size_t len, const PA_DATA *data, size_t *size)
+{
+size_t ret = 0;
+size_t l;
+int i, e;
+
+i = 0;
+{
+int oldret = ret;
+ret = 0;
+e = encode_octet_string(p, len, &(data)->padata_value, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 2, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_PADATA_TYPE(p, len, &(data)->padata_type, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 1, &l);
+BACK;
+ret += oldret;
+}
+e = der_put_length_and_tag (p, len, ret, UNIV, CONS, UT_Sequence, &l);
+BACK;
+*size = ret;
+return 0;
+}
+
+#define FORW if(e) goto fail; p += l; len -= l; ret += l
+
+int
+decode_PA_DATA(const unsigned char *p, size_t len, PA_DATA *data, size_t *size)
+{
+size_t ret = 0, reallen;
+size_t l;
+int e;
+
+memset(data, 0, sizeof(*data));
+reallen = 0;
+e = der_match_tag_and_length (p, len, UNIV, CONS, UT_Sequence,&reallen, &l);
+FORW;
+{
+int dce_fix;
+if((dce_fix = fix_dce(reallen, &len)) < 0)
+return ASN1_BAD_FORMAT;
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 1, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_PADATA_TYPE(p, len, &(data)->padata_type, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 2, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_octet_string(p, len, &(data)->padata_value, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}
+}
+if(size) *size = ret;
+return 0;
+fail:
+free_PA_DATA(data);
+return e;
+}
+
+void
+free_PA_DATA(PA_DATA *data)
+{
+free_PADATA_TYPE(&(data)->padata_type);
+free_octet_string(&(data)->padata_value);
+}
+
+size_t
+length_PA_DATA(const PA_DATA *data)
+{
+size_t ret = 0;
+{
+int oldret = ret;
+ret = 0;
+ret += length_PADATA_TYPE(&(data)->padata_type);
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+ret += length_octet_string(&(data)->padata_value);
+ret += 1 + length_len(ret) + oldret;
+}
+ret += 1 + length_len(ret);
+return ret;
+}
+
+int
+copy_PA_DATA(const PA_DATA *from, PA_DATA *to)
+{
+if(copy_PADATA_TYPE(&(from)->padata_type, &(to)->padata_type)) return ENOMEM;
+if(copy_octet_string(&(from)->padata_value, &(to)->padata_value)) return ENOMEM;
+return 0;
+}
+
diff --git a/kerberosV/lib/asn1/asn1_PA_ENC_TS_ENC.c b/kerberosV/lib/asn1/asn1_PA_ENC_TS_ENC.c
new file mode 100644
index 00000000000..067e16a4bc7
--- /dev/null
+++ b/kerberosV/lib/asn1/asn1_PA_ENC_TS_ENC.c
@@ -0,0 +1,173 @@
+/* Generated from /usr/src/kerberosV/lib/asn1/../../src/lib/asn1/k5.asn1 */
+/* Do not edit */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+#include <errno.h>
+#include <krb5_asn1.h>
+#include <asn1_err.h>
+#include <der.h>
+#include <parse_units.h>
+
+#define BACK if (e) return e; p -= l; len -= l; ret += l
+
+int
+encode_PA_ENC_TS_ENC(unsigned char *p, size_t len, const PA_ENC_TS_ENC *data, size_t *size)
+{
+size_t ret = 0;
+size_t l;
+int i, e;
+
+i = 0;
+if((data)->pausec)
+{
+int oldret = ret;
+ret = 0;
+e = encode_integer(p, len, (data)->pausec, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 1, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_KerberosTime(p, len, &(data)->patimestamp, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 0, &l);
+BACK;
+ret += oldret;
+}
+e = der_put_length_and_tag (p, len, ret, UNIV, CONS, UT_Sequence, &l);
+BACK;
+*size = ret;
+return 0;
+}
+
+#define FORW if(e) goto fail; p += l; len -= l; ret += l
+
+int
+decode_PA_ENC_TS_ENC(const unsigned char *p, size_t len, PA_ENC_TS_ENC *data, size_t *size)
+{
+size_t ret = 0, reallen;
+size_t l;
+int e;
+
+memset(data, 0, sizeof(*data));
+reallen = 0;
+e = der_match_tag_and_length (p, len, UNIV, CONS, UT_Sequence,&reallen, &l);
+FORW;
+{
+int dce_fix;
+if((dce_fix = fix_dce(reallen, &len)) < 0)
+return ASN1_BAD_FORMAT;
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 0, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_KerberosTime(p, len, &(data)->patimestamp, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 1, &l);
+if (e)
+(data)->pausec = NULL;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+(data)->pausec = malloc(sizeof(*(data)->pausec));
+if((data)->pausec == NULL) return ENOMEM;
+e = decode_integer(p, len, (data)->pausec, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}
+}
+if(size) *size = ret;
+return 0;
+fail:
+free_PA_ENC_TS_ENC(data);
+return e;
+}
+
+void
+free_PA_ENC_TS_ENC(PA_ENC_TS_ENC *data)
+{
+free_KerberosTime(&(data)->patimestamp);
+if((data)->pausec) {
+free((data)->pausec);
+}
+}
+
+size_t
+length_PA_ENC_TS_ENC(const PA_ENC_TS_ENC *data)
+{
+size_t ret = 0;
+{
+int oldret = ret;
+ret = 0;
+ret += length_KerberosTime(&(data)->patimestamp);
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->pausec){
+int oldret = ret;
+ret = 0;
+ret += length_integer((data)->pausec);
+ret += 1 + length_len(ret) + oldret;
+}
+ret += 1 + length_len(ret);
+return ret;
+}
+
+int
+copy_PA_ENC_TS_ENC(const PA_ENC_TS_ENC *from, PA_ENC_TS_ENC *to)
+{
+if(copy_KerberosTime(&(from)->patimestamp, &(to)->patimestamp)) return ENOMEM;
+if((from)->pausec) {
+(to)->pausec = malloc(sizeof(*(to)->pausec));
+if((to)->pausec == NULL) return ENOMEM;
+*((to)->pausec) = *((from)->pausec);
+}else
+(to)->pausec = NULL;
+return 0;
+}
+
diff --git a/kerberosV/lib/asn1/asn1_Principal.c b/kerberosV/lib/asn1/asn1_Principal.c
new file mode 100644
index 00000000000..554ef865780
--- /dev/null
+++ b/kerberosV/lib/asn1/asn1_Principal.c
@@ -0,0 +1,163 @@
+/* Generated from /usr/src/kerberosV/lib/asn1/../../src/lib/asn1/k5.asn1 */
+/* Do not edit */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+#include <errno.h>
+#include <krb5_asn1.h>
+#include <asn1_err.h>
+#include <der.h>
+#include <parse_units.h>
+
+#define BACK if (e) return e; p -= l; len -= l; ret += l
+
+int
+encode_Principal(unsigned char *p, size_t len, const Principal *data, size_t *size)
+{
+size_t ret = 0;
+size_t l;
+int i, e;
+
+i = 0;
+{
+int oldret = ret;
+ret = 0;
+e = encode_Realm(p, len, &(data)->realm, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 1, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_PrincipalName(p, len, &(data)->name, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 0, &l);
+BACK;
+ret += oldret;
+}
+e = der_put_length_and_tag (p, len, ret, UNIV, CONS, UT_Sequence, &l);
+BACK;
+*size = ret;
+return 0;
+}
+
+#define FORW if(e) goto fail; p += l; len -= l; ret += l
+
+int
+decode_Principal(const unsigned char *p, size_t len, Principal *data, size_t *size)
+{
+size_t ret = 0, reallen;
+size_t l;
+int e;
+
+memset(data, 0, sizeof(*data));
+reallen = 0;
+e = der_match_tag_and_length (p, len, UNIV, CONS, UT_Sequence,&reallen, &l);
+FORW;
+{
+int dce_fix;
+if((dce_fix = fix_dce(reallen, &len)) < 0)
+return ASN1_BAD_FORMAT;
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 0, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_PrincipalName(p, len, &(data)->name, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 1, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_Realm(p, len, &(data)->realm, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}
+}
+if(size) *size = ret;
+return 0;
+fail:
+free_Principal(data);
+return e;
+}
+
+void
+free_Principal(Principal *data)
+{
+free_PrincipalName(&(data)->name);
+free_Realm(&(data)->realm);
+}
+
+size_t
+length_Principal(const Principal *data)
+{
+size_t ret = 0;
+{
+int oldret = ret;
+ret = 0;
+ret += length_PrincipalName(&(data)->name);
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+ret += length_Realm(&(data)->realm);
+ret += 1 + length_len(ret) + oldret;
+}
+ret += 1 + length_len(ret);
+return ret;
+}
+
+int
+copy_Principal(const Principal *from, Principal *to)
+{
+if(copy_PrincipalName(&(from)->name, &(to)->name)) return ENOMEM;
+if(copy_Realm(&(from)->realm, &(to)->realm)) return ENOMEM;
+return 0;
+}
+
diff --git a/kerberosV/lib/asn1/asn1_PrincipalName.c b/kerberosV/lib/asn1/asn1_PrincipalName.c
new file mode 100644
index 00000000000..fd349073345
--- /dev/null
+++ b/kerberosV/lib/asn1/asn1_PrincipalName.c
@@ -0,0 +1,204 @@
+/* Generated from /usr/src/kerberosV/lib/asn1/../../src/lib/asn1/k5.asn1 */
+/* Do not edit */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+#include <errno.h>
+#include <krb5_asn1.h>
+#include <asn1_err.h>
+#include <der.h>
+#include <parse_units.h>
+
+#define BACK if (e) return e; p -= l; len -= l; ret += l
+
+int
+encode_PrincipalName(unsigned char *p, size_t len, const PrincipalName *data, size_t *size)
+{
+size_t ret = 0;
+size_t l;
+int i, e;
+
+i = 0;
+{
+int oldret = ret;
+ret = 0;
+for(i = (&(data)->name_string)->len - 1; i >= 0; --i) {
+int oldret = ret;
+ret = 0;
+e = encode_general_string(p, len, &(&(data)->name_string)->val[i], &l);
+BACK;
+ret += oldret;
+}
+e = der_put_length_and_tag (p, len, ret, UNIV, CONS, UT_Sequence, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 1, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_NAME_TYPE(p, len, &(data)->name_type, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 0, &l);
+BACK;
+ret += oldret;
+}
+e = der_put_length_and_tag (p, len, ret, UNIV, CONS, UT_Sequence, &l);
+BACK;
+*size = ret;
+return 0;
+}
+
+#define FORW if(e) goto fail; p += l; len -= l; ret += l
+
+int
+decode_PrincipalName(const unsigned char *p, size_t len, PrincipalName *data, size_t *size)
+{
+size_t ret = 0, reallen;
+size_t l;
+int e;
+
+memset(data, 0, sizeof(*data));
+reallen = 0;
+e = der_match_tag_and_length (p, len, UNIV, CONS, UT_Sequence,&reallen, &l);
+FORW;
+{
+int dce_fix;
+if((dce_fix = fix_dce(reallen, &len)) < 0)
+return ASN1_BAD_FORMAT;
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 0, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_NAME_TYPE(p, len, &(data)->name_type, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 1, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = der_match_tag_and_length (p, len, UNIV, CONS, UT_Sequence,&reallen, &l);
+FORW;
+if(len < reallen)
+return ASN1_OVERRUN;
+len = reallen;
+{
+size_t origlen = len;
+int oldret = ret;
+ret = 0;
+(&(data)->name_string)->len = 0;
+(&(data)->name_string)->val = NULL;
+while(ret < origlen) {
+(&(data)->name_string)->len++;
+(&(data)->name_string)->val = realloc((&(data)->name_string)->val, sizeof(*((&(data)->name_string)->val)) * (&(data)->name_string)->len);
+e = decode_general_string(p, len, &(&(data)->name_string)->val[(&(data)->name_string)->len-1], &l);
+FORW;
+len = origlen - ret;
+}
+ret += oldret;
+}
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}
+}
+if(size) *size = ret;
+return 0;
+fail:
+free_PrincipalName(data);
+return e;
+}
+
+void
+free_PrincipalName(PrincipalName *data)
+{
+free_NAME_TYPE(&(data)->name_type);
+while((&(data)->name_string)->len){
+free_general_string(&(&(data)->name_string)->val[(&(data)->name_string)->len-1]);
+(&(data)->name_string)->len--;
+}
+free((&(data)->name_string)->val);
+}
+
+size_t
+length_PrincipalName(const PrincipalName *data)
+{
+size_t ret = 0;
+{
+int oldret = ret;
+ret = 0;
+ret += length_NAME_TYPE(&(data)->name_type);
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+{
+int oldret = ret;
+int i;
+ret = 0;
+for(i = (&(data)->name_string)->len - 1; i >= 0; --i){
+ret += length_general_string(&(&(data)->name_string)->val[i]);
+}
+ret += 1 + length_len(ret) + oldret;
+}
+ret += 1 + length_len(ret) + oldret;
+}
+ret += 1 + length_len(ret);
+return ret;
+}
+
+int
+copy_PrincipalName(const PrincipalName *from, PrincipalName *to)
+{
+if(copy_NAME_TYPE(&(from)->name_type, &(to)->name_type)) return ENOMEM;
+if(((&(to)->name_string)->val = malloc((&(from)->name_string)->len * sizeof(*(&(to)->name_string)->val))) == NULL && (&(from)->name_string)->len != 0)
+return ENOMEM;
+for((&(to)->name_string)->len = 0; (&(to)->name_string)->len < (&(from)->name_string)->len; (&(to)->name_string)->len++){
+if(copy_general_string(&(&(from)->name_string)->val[(&(to)->name_string)->len], &(&(to)->name_string)->val[(&(to)->name_string)->len])) return ENOMEM;
+}
+return 0;
+}
+
diff --git a/kerberosV/lib/asn1/asn1_Realm.c b/kerberosV/lib/asn1/asn1_Realm.c
new file mode 100644
index 00000000000..e238533ddf4
--- /dev/null
+++ b/kerberosV/lib/asn1/asn1_Realm.c
@@ -0,0 +1,70 @@
+/* Generated from /usr/src/kerberosV/lib/asn1/../../src/lib/asn1/k5.asn1 */
+/* Do not edit */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+#include <errno.h>
+#include <krb5_asn1.h>
+#include <asn1_err.h>
+#include <der.h>
+#include <parse_units.h>
+
+#define BACK if (e) return e; p -= l; len -= l; ret += l
+
+int
+encode_Realm(unsigned char *p, size_t len, const Realm *data, size_t *size)
+{
+size_t ret = 0;
+size_t l;
+int i, e;
+
+i = 0;
+e = encode_general_string(p, len, data, &l);
+BACK;
+*size = ret;
+return 0;
+}
+
+#define FORW if(e) goto fail; p += l; len -= l; ret += l
+
+int
+decode_Realm(const unsigned char *p, size_t len, Realm *data, size_t *size)
+{
+size_t ret = 0, reallen;
+size_t l;
+int e;
+
+memset(data, 0, sizeof(*data));
+reallen = 0;
+e = decode_general_string(p, len, data, &l);
+FORW;
+if(size) *size = ret;
+return 0;
+fail:
+free_Realm(data);
+return e;
+}
+
+void
+free_Realm(Realm *data)
+{
+free_general_string(data);
+}
+
+size_t
+length_Realm(const Realm *data)
+{
+size_t ret = 0;
+ret += length_general_string(data);
+return ret;
+}
+
+int
+copy_Realm(const Realm *from, Realm *to)
+{
+if(copy_general_string(from, to)) return ENOMEM;
+return 0;
+}
+
diff --git a/kerberosV/lib/asn1/asn1_TGS_REP.c b/kerberosV/lib/asn1/asn1_TGS_REP.c
new file mode 100644
index 00000000000..59bd476e308
--- /dev/null
+++ b/kerberosV/lib/asn1/asn1_TGS_REP.c
@@ -0,0 +1,84 @@
+/* Generated from /usr/src/kerberosV/lib/asn1/../../src/lib/asn1/k5.asn1 */
+/* Do not edit */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+#include <errno.h>
+#include <krb5_asn1.h>
+#include <asn1_err.h>
+#include <der.h>
+#include <parse_units.h>
+
+#define BACK if (e) return e; p -= l; len -= l; ret += l
+
+int
+encode_TGS_REP(unsigned char *p, size_t len, const TGS_REP *data, size_t *size)
+{
+size_t ret = 0;
+size_t l;
+int i, e;
+
+i = 0;
+e = encode_KDC_REP(p, len, data, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, APPL, CONS, 13, &l);
+BACK;
+*size = ret;
+return 0;
+}
+
+#define FORW if(e) goto fail; p += l; len -= l; ret += l
+
+int
+decode_TGS_REP(const unsigned char *p, size_t len, TGS_REP *data, size_t *size)
+{
+size_t ret = 0, reallen;
+size_t l;
+int e;
+
+memset(data, 0, sizeof(*data));
+reallen = 0;
+e = der_match_tag_and_length (p, len, APPL, CONS, 13, &reallen, &l);
+FORW;
+{
+int dce_fix;
+if((dce_fix = fix_dce(reallen, &len)) < 0)
+return ASN1_BAD_FORMAT;
+e = decode_KDC_REP(p, len, data, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}
+}
+if(size) *size = ret;
+return 0;
+fail:
+free_TGS_REP(data);
+return e;
+}
+
+void
+free_TGS_REP(TGS_REP *data)
+{
+free_KDC_REP(data);
+}
+
+size_t
+length_TGS_REP(const TGS_REP *data)
+{
+size_t ret = 0;
+ret += length_KDC_REP(data);
+ret += 1 + length_len (ret);
+return ret;
+}
+
+int
+copy_TGS_REP(const TGS_REP *from, TGS_REP *to)
+{
+if(copy_KDC_REP(from, to)) return ENOMEM;
+return 0;
+}
+
diff --git a/kerberosV/lib/asn1/asn1_TGS_REQ.c b/kerberosV/lib/asn1/asn1_TGS_REQ.c
new file mode 100644
index 00000000000..b8254799600
--- /dev/null
+++ b/kerberosV/lib/asn1/asn1_TGS_REQ.c
@@ -0,0 +1,84 @@
+/* Generated from /usr/src/kerberosV/lib/asn1/../../src/lib/asn1/k5.asn1 */
+/* Do not edit */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+#include <errno.h>
+#include <krb5_asn1.h>
+#include <asn1_err.h>
+#include <der.h>
+#include <parse_units.h>
+
+#define BACK if (e) return e; p -= l; len -= l; ret += l
+
+int
+encode_TGS_REQ(unsigned char *p, size_t len, const TGS_REQ *data, size_t *size)
+{
+size_t ret = 0;
+size_t l;
+int i, e;
+
+i = 0;
+e = encode_KDC_REQ(p, len, data, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, APPL, CONS, 12, &l);
+BACK;
+*size = ret;
+return 0;
+}
+
+#define FORW if(e) goto fail; p += l; len -= l; ret += l
+
+int
+decode_TGS_REQ(const unsigned char *p, size_t len, TGS_REQ *data, size_t *size)
+{
+size_t ret = 0, reallen;
+size_t l;
+int e;
+
+memset(data, 0, sizeof(*data));
+reallen = 0;
+e = der_match_tag_and_length (p, len, APPL, CONS, 12, &reallen, &l);
+FORW;
+{
+int dce_fix;
+if((dce_fix = fix_dce(reallen, &len)) < 0)
+return ASN1_BAD_FORMAT;
+e = decode_KDC_REQ(p, len, data, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}
+}
+if(size) *size = ret;
+return 0;
+fail:
+free_TGS_REQ(data);
+return e;
+}
+
+void
+free_TGS_REQ(TGS_REQ *data)
+{
+free_KDC_REQ(data);
+}
+
+size_t
+length_TGS_REQ(const TGS_REQ *data)
+{
+size_t ret = 0;
+ret += length_KDC_REQ(data);
+ret += 1 + length_len (ret);
+return ret;
+}
+
+int
+copy_TGS_REQ(const TGS_REQ *from, TGS_REQ *to)
+{
+if(copy_KDC_REQ(from, to)) return ENOMEM;
+return 0;
+}
+
diff --git a/kerberosV/lib/asn1/asn1_Ticket.c b/kerberosV/lib/asn1/asn1_Ticket.c
new file mode 100644
index 00000000000..4ec9179a393
--- /dev/null
+++ b/kerberosV/lib/asn1/asn1_Ticket.c
@@ -0,0 +1,262 @@
+/* Generated from /usr/src/kerberosV/lib/asn1/../../src/lib/asn1/k5.asn1 */
+/* Do not edit */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+#include <errno.h>
+#include <krb5_asn1.h>
+#include <asn1_err.h>
+#include <der.h>
+#include <parse_units.h>
+
+#define BACK if (e) return e; p -= l; len -= l; ret += l
+
+int
+encode_Ticket(unsigned char *p, size_t len, const Ticket *data, size_t *size)
+{
+size_t ret = 0;
+size_t l;
+int i, e;
+
+i = 0;
+{
+int oldret = ret;
+ret = 0;
+e = encode_EncryptedData(p, len, &(data)->enc_part, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 3, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_PrincipalName(p, len, &(data)->sname, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 2, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_Realm(p, len, &(data)->realm, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 1, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_integer(p, len, &(data)->tkt_vno, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 0, &l);
+BACK;
+ret += oldret;
+}
+e = der_put_length_and_tag (p, len, ret, UNIV, CONS, UT_Sequence, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, APPL, CONS, 1, &l);
+BACK;
+*size = ret;
+return 0;
+}
+
+#define FORW if(e) goto fail; p += l; len -= l; ret += l
+
+int
+decode_Ticket(const unsigned char *p, size_t len, Ticket *data, size_t *size)
+{
+size_t ret = 0, reallen;
+size_t l;
+int e;
+
+memset(data, 0, sizeof(*data));
+reallen = 0;
+e = der_match_tag_and_length (p, len, APPL, CONS, 1, &reallen, &l);
+FORW;
+{
+int dce_fix;
+if((dce_fix = fix_dce(reallen, &len)) < 0)
+return ASN1_BAD_FORMAT;
+e = der_match_tag_and_length (p, len, UNIV, CONS, UT_Sequence,&reallen, &l);
+FORW;
+{
+int dce_fix;
+if((dce_fix = fix_dce(reallen, &len)) < 0)
+return ASN1_BAD_FORMAT;
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 0, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_integer(p, len, &(data)->tkt_vno, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 1, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_Realm(p, len, &(data)->realm, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 2, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_PrincipalName(p, len, &(data)->sname, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 3, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_EncryptedData(p, len, &(data)->enc_part, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}
+}
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}
+}
+if(size) *size = ret;
+return 0;
+fail:
+free_Ticket(data);
+return e;
+}
+
+void
+free_Ticket(Ticket *data)
+{
+free_Realm(&(data)->realm);
+free_PrincipalName(&(data)->sname);
+free_EncryptedData(&(data)->enc_part);
+}
+
+size_t
+length_Ticket(const Ticket *data)
+{
+size_t ret = 0;
+{
+int oldret = ret;
+ret = 0;
+ret += length_integer(&(data)->tkt_vno);
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+ret += length_Realm(&(data)->realm);
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+ret += length_PrincipalName(&(data)->sname);
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+ret += length_EncryptedData(&(data)->enc_part);
+ret += 1 + length_len(ret) + oldret;
+}
+ret += 1 + length_len(ret);
+ret += 1 + length_len (ret);
+return ret;
+}
+
+int
+copy_Ticket(const Ticket *from, Ticket *to)
+{
+*(&(to)->tkt_vno) = *(&(from)->tkt_vno);
+if(copy_Realm(&(from)->realm, &(to)->realm)) return ENOMEM;
+if(copy_PrincipalName(&(from)->sname, &(to)->sname)) return ENOMEM;
+if(copy_EncryptedData(&(from)->enc_part, &(to)->enc_part)) return ENOMEM;
+return 0;
+}
+
diff --git a/kerberosV/lib/asn1/asn1_TicketFlags.c b/kerberosV/lib/asn1/asn1_TicketFlags.c
new file mode 100644
index 00000000000..6e1a7f90472
--- /dev/null
+++ b/kerberosV/lib/asn1/asn1_TicketFlags.c
@@ -0,0 +1,183 @@
+/* Generated from /usr/src/kerberosV/lib/asn1/../../src/lib/asn1/k5.asn1 */
+/* Do not edit */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+#include <errno.h>
+#include <krb5_asn1.h>
+#include <asn1_err.h>
+#include <der.h>
+#include <parse_units.h>
+
+#define BACK if (e) return e; p -= l; len -= l; ret += l
+
+int
+encode_TicketFlags(unsigned char *p, size_t len, const TicketFlags *data, size_t *size)
+{
+size_t ret = 0;
+size_t l;
+int i, e;
+
+i = 0;
+{
+unsigned char c = 0;
+*p-- = c; len--; ret++;
+c = 0;
+*p-- = c; len--; ret++;
+c = 0;
+if(data->anonymous) c |= 1<<1;
+if(data->ok_as_delegate) c |= 1<<2;
+if(data->transited_policy_checked) c |= 1<<3;
+if(data->hw_authent) c |= 1<<4;
+if(data->pre_authent) c |= 1<<5;
+if(data->initial) c |= 1<<6;
+if(data->renewable) c |= 1<<7;
+*p-- = c; len--; ret++;
+c = 0;
+if(data->invalid) c |= 1<<0;
+if(data->postdated) c |= 1<<1;
+if(data->may_postdate) c |= 1<<2;
+if(data->proxy) c |= 1<<3;
+if(data->proxiable) c |= 1<<4;
+if(data->forwarded) c |= 1<<5;
+if(data->forwardable) c |= 1<<6;
+if(data->reserved) c |= 1<<7;
+*p-- = c;
+*p-- = 0;
+len -= 2;
+ret += 2;
+}
+
+e = der_put_length_and_tag (p, len, ret, UNIV, PRIM,UT_BitString, &l);
+BACK;
+*size = ret;
+return 0;
+}
+
+#define FORW if(e) goto fail; p += l; len -= l; ret += l
+
+int
+decode_TicketFlags(const unsigned char *p, size_t len, TicketFlags *data, size_t *size)
+{
+size_t ret = 0, reallen;
+size_t l;
+int e;
+
+memset(data, 0, sizeof(*data));
+reallen = 0;
+e = der_match_tag_and_length (p, len, UNIV, PRIM, UT_BitString,&reallen, &l);
+FORW;
+if(len < reallen)
+return ASN1_OVERRUN;
+p++;
+len--;
+reallen--;
+ret++;
+data->reserved = (*p >> 7) & 1;
+data->forwardable = (*p >> 6) & 1;
+data->forwarded = (*p >> 5) & 1;
+data->proxiable = (*p >> 4) & 1;
+data->proxy = (*p >> 3) & 1;
+data->may_postdate = (*p >> 2) & 1;
+data->postdated = (*p >> 1) & 1;
+data->invalid = (*p >> 0) & 1;
+p++; len--; reallen--; ret++;
+data->renewable = (*p >> 7) & 1;
+data->initial = (*p >> 6) & 1;
+data->pre_authent = (*p >> 5) & 1;
+data->hw_authent = (*p >> 4) & 1;
+data->transited_policy_checked = (*p >> 3) & 1;
+data->ok_as_delegate = (*p >> 2) & 1;
+data->anonymous = (*p >> 1) & 1;
+p += reallen; len -= reallen; ret += reallen;
+if(size) *size = ret;
+return 0;
+fail:
+free_TicketFlags(data);
+return e;
+}
+
+void
+free_TicketFlags(TicketFlags *data)
+{
+}
+
+size_t
+length_TicketFlags(const TicketFlags *data)
+{
+size_t ret = 0;
+ret += 7;
+return ret;
+}
+
+int
+copy_TicketFlags(const TicketFlags *from, TicketFlags *to)
+{
+*(to) = *(from);
+return 0;
+}
+
+unsigned TicketFlags2int(TicketFlags f)
+{
+unsigned r = 0;
+if(f.reserved) r |= (1U << 0);
+if(f.forwardable) r |= (1U << 1);
+if(f.forwarded) r |= (1U << 2);
+if(f.proxiable) r |= (1U << 3);
+if(f.proxy) r |= (1U << 4);
+if(f.may_postdate) r |= (1U << 5);
+if(f.postdated) r |= (1U << 6);
+if(f.invalid) r |= (1U << 7);
+if(f.renewable) r |= (1U << 8);
+if(f.initial) r |= (1U << 9);
+if(f.pre_authent) r |= (1U << 10);
+if(f.hw_authent) r |= (1U << 11);
+if(f.transited_policy_checked) r |= (1U << 12);
+if(f.ok_as_delegate) r |= (1U << 13);
+if(f.anonymous) r |= (1U << 14);
+return r;
+}
+
+TicketFlags int2TicketFlags(unsigned n)
+{
+ TicketFlags flags;
+
+ flags.reserved = (n >> 0) & 1;
+ flags.forwardable = (n >> 1) & 1;
+ flags.forwarded = (n >> 2) & 1;
+ flags.proxiable = (n >> 3) & 1;
+ flags.proxy = (n >> 4) & 1;
+ flags.may_postdate = (n >> 5) & 1;
+ flags.postdated = (n >> 6) & 1;
+ flags.invalid = (n >> 7) & 1;
+ flags.renewable = (n >> 8) & 1;
+ flags.initial = (n >> 9) & 1;
+ flags.pre_authent = (n >> 10) & 1;
+ flags.hw_authent = (n >> 11) & 1;
+ flags.transited_policy_checked = (n >> 12) & 1;
+ flags.ok_as_delegate = (n >> 13) & 1;
+ flags.anonymous = (n >> 14) & 1;
+ return flags;
+}
+
+struct units TicketFlags_units[] = {
+ {"anonymous", 1U << 14},
+ {"ok_as_delegate", 1U << 13},
+ {"transited_policy_checked", 1U << 12},
+ {"hw_authent", 1U << 11},
+ {"pre_authent", 1U << 10},
+ {"initial", 1U << 9},
+ {"renewable", 1U << 8},
+ {"invalid", 1U << 7},
+ {"postdated", 1U << 6},
+ {"may_postdate", 1U << 5},
+ {"proxy", 1U << 4},
+ {"proxiable", 1U << 3},
+ {"forwarded", 1U << 2},
+ {"forwardable", 1U << 1},
+ {"reserved", 1U << 0},
+ {NULL, 0}
+};
+
diff --git a/kerberosV/lib/asn1/asn1_TransitedEncoding.c b/kerberosV/lib/asn1/asn1_TransitedEncoding.c
new file mode 100644
index 00000000000..39812ecfdde
--- /dev/null
+++ b/kerberosV/lib/asn1/asn1_TransitedEncoding.c
@@ -0,0 +1,162 @@
+/* Generated from /usr/src/kerberosV/lib/asn1/../../src/lib/asn1/k5.asn1 */
+/* Do not edit */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+#include <errno.h>
+#include <krb5_asn1.h>
+#include <asn1_err.h>
+#include <der.h>
+#include <parse_units.h>
+
+#define BACK if (e) return e; p -= l; len -= l; ret += l
+
+int
+encode_TransitedEncoding(unsigned char *p, size_t len, const TransitedEncoding *data, size_t *size)
+{
+size_t ret = 0;
+size_t l;
+int i, e;
+
+i = 0;
+{
+int oldret = ret;
+ret = 0;
+e = encode_octet_string(p, len, &(data)->contents, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 1, &l);
+BACK;
+ret += oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_integer(p, len, &(data)->tr_type, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 0, &l);
+BACK;
+ret += oldret;
+}
+e = der_put_length_and_tag (p, len, ret, UNIV, CONS, UT_Sequence, &l);
+BACK;
+*size = ret;
+return 0;
+}
+
+#define FORW if(e) goto fail; p += l; len -= l; ret += l
+
+int
+decode_TransitedEncoding(const unsigned char *p, size_t len, TransitedEncoding *data, size_t *size)
+{
+size_t ret = 0, reallen;
+size_t l;
+int e;
+
+memset(data, 0, sizeof(*data));
+reallen = 0;
+e = der_match_tag_and_length (p, len, UNIV, CONS, UT_Sequence,&reallen, &l);
+FORW;
+{
+int dce_fix;
+if((dce_fix = fix_dce(reallen, &len)) < 0)
+return ASN1_BAD_FORMAT;
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 0, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_integer(p, len, &(data)->tr_type, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+{
+size_t newlen, oldlen;
+
+e = der_match_tag (p, len, CONTEXT, CONS, 1, &l);
+if (e)
+return e;
+else {
+p += l;
+len -= l;
+ret += l;
+e = der_get_length (p, len, &newlen, &l);
+FORW;
+{
+int dce_fix;
+oldlen = len;
+if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT;
+e = decode_octet_string(p, len, &(data)->contents, &l);
+FORW;
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}else
+len = oldlen - newlen;
+}
+}
+}
+if(dce_fix){
+e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l);
+FORW;
+}
+}
+if(size) *size = ret;
+return 0;
+fail:
+free_TransitedEncoding(data);
+return e;
+}
+
+void
+free_TransitedEncoding(TransitedEncoding *data)
+{
+free_octet_string(&(data)->contents);
+}
+
+size_t
+length_TransitedEncoding(const TransitedEncoding *data)
+{
+size_t ret = 0;
+{
+int oldret = ret;
+ret = 0;
+ret += length_integer(&(data)->tr_type);
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+ret += length_octet_string(&(data)->contents);
+ret += 1 + length_len(ret) + oldret;
+}
+ret += 1 + length_len(ret);
+return ret;
+}
+
+int
+copy_TransitedEncoding(const TransitedEncoding *from, TransitedEncoding *to)
+{
+*(&(to)->tr_type) = *(&(from)->tr_type);
+if(copy_octet_string(&(from)->contents, &(to)->contents)) return ENOMEM;
+return 0;
+}
+
diff --git a/kerberosV/lib/asn1/asn1_UNSIGNED.c b/kerberosV/lib/asn1/asn1_UNSIGNED.c
new file mode 100644
index 00000000000..88ebbfb674d
--- /dev/null
+++ b/kerberosV/lib/asn1/asn1_UNSIGNED.c
@@ -0,0 +1,69 @@
+/* Generated from /usr/src/kerberosV/lib/asn1/../../src/lib/asn1/k5.asn1 */
+/* Do not edit */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+#include <errno.h>
+#include <krb5_asn1.h>
+#include <asn1_err.h>
+#include <der.h>
+#include <parse_units.h>
+
+#define BACK if (e) return e; p -= l; len -= l; ret += l
+
+int
+encode_UNSIGNED(unsigned char *p, size_t len, const UNSIGNED *data, size_t *size)
+{
+size_t ret = 0;
+size_t l;
+int i, e;
+
+i = 0;
+e = encode_unsigned(p, len, data, &l);
+BACK;
+*size = ret;
+return 0;
+}
+
+#define FORW if(e) goto fail; p += l; len -= l; ret += l
+
+int
+decode_UNSIGNED(const unsigned char *p, size_t len, UNSIGNED *data, size_t *size)
+{
+size_t ret = 0, reallen;
+size_t l;
+int e;
+
+memset(data, 0, sizeof(*data));
+reallen = 0;
+e = decode_unsigned(p, len, data, &l);
+FORW;
+if(size) *size = ret;
+return 0;
+fail:
+free_UNSIGNED(data);
+return e;
+}
+
+void
+free_UNSIGNED(UNSIGNED *data)
+{
+}
+
+size_t
+length_UNSIGNED(const UNSIGNED *data)
+{
+size_t ret = 0;
+ret += length_unsigned(data);
+return ret;
+}
+
+int
+copy_UNSIGNED(const UNSIGNED *from, UNSIGNED *to)
+{
+*(to) = *(from);
+return 0;
+}
+
diff --git a/kerberosV/lib/asn1/krb5_asn1.h b/kerberosV/lib/asn1/krb5_asn1.h
new file mode 100644
index 00000000000..e9669bb5801
--- /dev/null
+++ b/kerberosV/lib/asn1/krb5_asn1.h
@@ -0,0 +1,1279 @@
+/* Generated from /usr/src/kerberosV/lib/asn1/../../src/lib/asn1/k5.asn1 */
+/* Do not edit */
+
+#ifndef __krb5_asn1_h__
+#define __krb5_asn1_h__
+
+#include <stddef.h>
+#include <time.h>
+
+#ifndef __asn1_common_definitions__
+#define __asn1_common_definitions__
+
+typedef struct octet_string {
+ size_t length;
+ void *data;
+} octet_string;
+
+typedef char *general_string;
+
+typedef struct oid {
+ size_t length;
+ unsigned *components;
+} oid;
+
+#define ASN1_MALLOC_ENCODE(T, B, BL, S, L, R) \
+ do { \
+ (BL) = length_##T((S)); \
+ (B) = malloc((BL)); \
+ if((B) == NULL) { \
+ (R) = ENOMEM; \
+ } else { \
+ (R) = encode_##T(((unsigned char*)(B)) + (BL) - 1, (BL), \
+ (S), (L)); \
+ if((R) != 0) { \
+ free((B)); \
+ (B) = NULL; \
+ } \
+ } \
+ } while (0)
+
+#endif
+
+/*
+NAME-TYPE ::= INTEGER
+*/
+
+typedef enum NAME_TYPE {
+ KRB5_NT_UNKNOWN = 0,
+ KRB5_NT_PRINCIPAL = 1,
+ KRB5_NT_SRV_INST = 2,
+ KRB5_NT_SRV_HST = 3,
+ KRB5_NT_SRV_XHST = 4,
+ KRB5_NT_UID = 5,
+ KRB5_NT_X500_PRINCIPAL = 6
+} NAME_TYPE;
+
+int encode_NAME_TYPE(unsigned char *, size_t, const NAME_TYPE *, size_t *);
+int decode_NAME_TYPE(const unsigned char *, size_t, NAME_TYPE *, size_t *);
+void free_NAME_TYPE (NAME_TYPE *);
+size_t length_NAME_TYPE(const NAME_TYPE *);
+int copy_NAME_TYPE (const NAME_TYPE *, NAME_TYPE *);
+
+
+/*
+MESSAGE-TYPE ::= INTEGER
+*/
+
+typedef enum MESSAGE_TYPE {
+ krb_as_req = 10,
+ krb_as_rep = 11,
+ krb_tgs_req = 12,
+ krb_tgs_rep = 13,
+ krb_ap_req = 14,
+ krb_ap_rep = 15,
+ krb_safe = 20,
+ krb_priv = 21,
+ krb_cred = 22,
+ krb_error = 30
+} MESSAGE_TYPE;
+
+int encode_MESSAGE_TYPE(unsigned char *, size_t, const MESSAGE_TYPE *, size_t *);
+int decode_MESSAGE_TYPE(const unsigned char *, size_t, MESSAGE_TYPE *, size_t *);
+void free_MESSAGE_TYPE (MESSAGE_TYPE *);
+size_t length_MESSAGE_TYPE(const MESSAGE_TYPE *);
+int copy_MESSAGE_TYPE (const MESSAGE_TYPE *, MESSAGE_TYPE *);
+
+
+/*
+PADATA-TYPE ::= INTEGER
+*/
+
+typedef enum PADATA_TYPE {
+ KRB5_PADATA_NONE = 0,
+ KRB5_PADATA_TGS_REQ = 1,
+ KRB5_PADATA_AP_REQ = 1,
+ KRB5_PADATA_ENC_TIMESTAMP = 2,
+ KRB5_PADATA_PW_SALT = 3,
+ KRB5_PADATA_ENC_UNIX_TIME = 5,
+ KRB5_PADATA_SANDIA_SECUREID = 6,
+ KRB5_PADATA_SESAME = 7,
+ KRB5_PADATA_OSF_DCE = 8,
+ KRB5_PADATA_CYBERSAFE_SECUREID = 9,
+ KRB5_PADATA_AFS3_SALT = 10,
+ KRB5_PADATA_ETYPE_INFO = 11,
+ KRB5_PADATA_SAM_CHALLENGE = 12,
+ KRB5_PADATA_SAM_RESPONSE = 13,
+ KRB5_PADATA_PK_AS_REQ = 14,
+ KRB5_PADATA_PK_AS_REP = 15,
+ KRB5_PADATA_PK_AS_SIGN = 16,
+ KRB5_PADATA_PK_KEY_REQ = 17,
+ KRB5_PADATA_PK_KEY_REP = 18,
+ KRB5_PADATA_USE_SPECIFIED_KVNO = 20,
+ KRB5_PADATA_SAM_REDIRECT = 21,
+ KRB5_PADATA_GET_FROM_TYPED_DATA = 22,
+ KRB5_PADATA_SAM_ETYPE_INFO = 23
+} PADATA_TYPE;
+
+int encode_PADATA_TYPE(unsigned char *, size_t, const PADATA_TYPE *, size_t *);
+int decode_PADATA_TYPE(const unsigned char *, size_t, PADATA_TYPE *, size_t *);
+void free_PADATA_TYPE (PADATA_TYPE *);
+size_t length_PADATA_TYPE(const PADATA_TYPE *);
+int copy_PADATA_TYPE (const PADATA_TYPE *, PADATA_TYPE *);
+
+
+/*
+CKSUMTYPE ::= INTEGER
+*/
+
+typedef enum CKSUMTYPE {
+ CKSUMTYPE_NONE = 0,
+ CKSUMTYPE_CRC32 = 1,
+ CKSUMTYPE_RSA_MD4 = 2,
+ CKSUMTYPE_RSA_MD4_DES = 3,
+ CKSUMTYPE_DES_MAC = 4,
+ CKSUMTYPE_DES_MAC_K = 5,
+ CKSUMTYPE_RSA_MD4_DES_K = 6,
+ CKSUMTYPE_RSA_MD5 = 7,
+ CKSUMTYPE_RSA_MD5_DES = 8,
+ CKSUMTYPE_RSA_MD5_DES3 = 9,
+ CKSUMTYPE_HMAC_SHA1_96_AES_128 = 10,
+ CKSUMTYPE_HMAC_SHA1_96_AES_256 = 11,
+ CKSUMTYPE_HMAC_SHA1_DES3 = 12,
+ CKSUMTYPE_SHA1 = 1000,
+ CKSUMTYPE_GSSAPI = 32771,
+ CKSUMTYPE_HMAC_MD5 = -138,
+ CKSUMTYPE_HMAC_MD5_ENC = -1138
+} CKSUMTYPE;
+
+int encode_CKSUMTYPE(unsigned char *, size_t, const CKSUMTYPE *, size_t *);
+int decode_CKSUMTYPE(const unsigned char *, size_t, CKSUMTYPE *, size_t *);
+void free_CKSUMTYPE (CKSUMTYPE *);
+size_t length_CKSUMTYPE(const CKSUMTYPE *);
+int copy_CKSUMTYPE (const CKSUMTYPE *, CKSUMTYPE *);
+
+
+/*
+ENCTYPE ::= INTEGER
+*/
+
+typedef enum ENCTYPE {
+ ETYPE_NULL = 0,
+ ETYPE_DES_CBC_CRC = 1,
+ ETYPE_DES_CBC_MD4 = 2,
+ ETYPE_DES_CBC_MD5 = 3,
+ ETYPE_DES3_CBC_MD5 = 5,
+ ETYPE_OLD_DES3_CBC_SHA1 = 7,
+ ETYPE_SIGN_DSA_GENERATE = 8,
+ ETYPE_ENCRYPT_RSA_PRIV = 9,
+ ETYPE_ENCRYPT_RSA_PUB = 10,
+ ETYPE_DES3_CBC_SHA1 = 16,
+ ETYPE_AES128_CTS_HMAC_SHA1_96 = 17,
+ ETYPE_AES256_CTS_HMAC_SHA1_96 = 18,
+ ETYPE_ARCFOUR_HMAC_MD5 = 23,
+ ETYPE_ARCFOUR_HMAC_MD5_56 = 24,
+ ETYPE_ENCTYPE_PK_CROSS = 48,
+ ETYPE_DES_CBC_NONE = -4096,
+ ETYPE_DES3_CBC_NONE = -4097,
+ ETYPE_DES_CFB64_NONE = -4098,
+ ETYPE_DES_PCBC_NONE = -4099
+} ENCTYPE;
+
+int encode_ENCTYPE(unsigned char *, size_t, const ENCTYPE *, size_t *);
+int decode_ENCTYPE(const unsigned char *, size_t, ENCTYPE *, size_t *);
+void free_ENCTYPE (ENCTYPE *);
+size_t length_ENCTYPE(const ENCTYPE *);
+int copy_ENCTYPE (const ENCTYPE *, ENCTYPE *);
+
+
+/*
+UNSIGNED ::= UNSIGNED INTEGER
+*/
+
+typedef unsigned int UNSIGNED;
+
+int encode_UNSIGNED(unsigned char *, size_t, const UNSIGNED *, size_t *);
+int decode_UNSIGNED(const unsigned char *, size_t, UNSIGNED *, size_t *);
+void free_UNSIGNED (UNSIGNED *);
+size_t length_UNSIGNED(const UNSIGNED *);
+int copy_UNSIGNED (const UNSIGNED *, UNSIGNED *);
+
+
+/*
+Realm ::= GeneralString
+*/
+
+typedef general_string Realm;
+
+int encode_Realm(unsigned char *, size_t, const Realm *, size_t *);
+int decode_Realm(const unsigned char *, size_t, Realm *, size_t *);
+void free_Realm (Realm *);
+size_t length_Realm(const Realm *);
+int copy_Realm (const Realm *, Realm *);
+
+
+/*
+PrincipalName ::= SEQUENCE {
+ name-type[0] NAME-TYPE,
+ name-string[1] SEQUENCE OF GeneralString
+}
+*/
+
+typedef struct PrincipalName {
+ NAME_TYPE name_type;
+ struct {
+ unsigned int len;
+ general_string *val;
+ } name_string;
+} PrincipalName;
+
+int encode_PrincipalName(unsigned char *, size_t, const PrincipalName *, size_t *);
+int decode_PrincipalName(const unsigned char *, size_t, PrincipalName *, size_t *);
+void free_PrincipalName (PrincipalName *);
+size_t length_PrincipalName(const PrincipalName *);
+int copy_PrincipalName (const PrincipalName *, PrincipalName *);
+
+
+/*
+Principal ::= SEQUENCE {
+ name[0] PrincipalName,
+ realm[1] Realm
+}
+*/
+
+typedef struct Principal {
+ PrincipalName name;
+ Realm realm;
+} Principal;
+
+int encode_Principal(unsigned char *, size_t, const Principal *, size_t *);
+int decode_Principal(const unsigned char *, size_t, Principal *, size_t *);
+void free_Principal (Principal *);
+size_t length_Principal(const Principal *);
+int copy_Principal (const Principal *, Principal *);
+
+
+/*
+HostAddress ::= SEQUENCE {
+ addr-type[0] INTEGER,
+ address[1] OCTET STRING
+}
+*/
+
+typedef struct HostAddress {
+ int addr_type;
+ octet_string address;
+} HostAddress;
+
+int encode_HostAddress(unsigned char *, size_t, const HostAddress *, size_t *);
+int decode_HostAddress(const unsigned char *, size_t, HostAddress *, size_t *);
+void free_HostAddress (HostAddress *);
+size_t length_HostAddress(const HostAddress *);
+int copy_HostAddress (const HostAddress *, HostAddress *);
+
+
+/*
+HostAddresses ::= SEQUENCE OF HostAddress
+*/
+
+typedef struct HostAddresses {
+ unsigned int len;
+ HostAddress *val;
+} HostAddresses;
+
+int encode_HostAddresses(unsigned char *, size_t, const HostAddresses *, size_t *);
+int decode_HostAddresses(const unsigned char *, size_t, HostAddresses *, size_t *);
+void free_HostAddresses (HostAddresses *);
+size_t length_HostAddresses(const HostAddresses *);
+int copy_HostAddresses (const HostAddresses *, HostAddresses *);
+
+
+/*
+KerberosTime ::= GeneralizedTime
+*/
+
+typedef time_t KerberosTime;
+
+int encode_KerberosTime(unsigned char *, size_t, const KerberosTime *, size_t *);
+int decode_KerberosTime(const unsigned char *, size_t, KerberosTime *, size_t *);
+void free_KerberosTime (KerberosTime *);
+size_t length_KerberosTime(const KerberosTime *);
+int copy_KerberosTime (const KerberosTime *, KerberosTime *);
+
+
+/*
+AuthorizationData ::= SEQUENCE OF SEQUENCE {
+ ad-type[0] INTEGER,
+ ad-data[1] OCTET STRING
+}
+*/
+
+typedef struct AuthorizationData {
+ unsigned int len;
+ struct {
+ int ad_type;
+ octet_string ad_data;
+ } *val;
+} AuthorizationData;
+
+int encode_AuthorizationData(unsigned char *, size_t, const AuthorizationData *, size_t *);
+int decode_AuthorizationData(const unsigned char *, size_t, AuthorizationData *, size_t *);
+void free_AuthorizationData (AuthorizationData *);
+size_t length_AuthorizationData(const AuthorizationData *);
+int copy_AuthorizationData (const AuthorizationData *, AuthorizationData *);
+
+
+/*
+APOptions ::= BIT STRING {
+ reserved(0),
+ use-session-key(1),
+ mutual-required(2)
+}
+*/
+
+typedef struct APOptions {
+ unsigned int reserved:1;
+ unsigned int use_session_key:1;
+ unsigned int mutual_required:1;
+} APOptions;
+
+
+int encode_APOptions(unsigned char *, size_t, const APOptions *, size_t *);
+int decode_APOptions(const unsigned char *, size_t, APOptions *, size_t *);
+void free_APOptions (APOptions *);
+size_t length_APOptions(const APOptions *);
+int copy_APOptions (const APOptions *, APOptions *);
+unsigned APOptions2int(APOptions);
+APOptions int2APOptions(unsigned);
+extern struct units APOptions_units[];
+
+/*
+TicketFlags ::= BIT STRING {
+ reserved(0),
+ forwardable(1),
+ forwarded(2),
+ proxiable(3),
+ proxy(4),
+ may-postdate(5),
+ postdated(6),
+ invalid(7),
+ renewable(8),
+ initial(9),
+ pre-authent(10),
+ hw-authent(11),
+ transited-policy-checked(12),
+ ok-as-delegate(13),
+ anonymous(14)
+}
+*/
+
+typedef struct TicketFlags {
+ unsigned int reserved:1;
+ unsigned int forwardable:1;
+ unsigned int forwarded:1;
+ unsigned int proxiable:1;
+ unsigned int proxy:1;
+ unsigned int may_postdate:1;
+ unsigned int postdated:1;
+ unsigned int invalid:1;
+ unsigned int renewable:1;
+ unsigned int initial:1;
+ unsigned int pre_authent:1;
+ unsigned int hw_authent:1;
+ unsigned int transited_policy_checked:1;
+ unsigned int ok_as_delegate:1;
+ unsigned int anonymous:1;
+} TicketFlags;
+
+
+int encode_TicketFlags(unsigned char *, size_t, const TicketFlags *, size_t *);
+int decode_TicketFlags(const unsigned char *, size_t, TicketFlags *, size_t *);
+void free_TicketFlags (TicketFlags *);
+size_t length_TicketFlags(const TicketFlags *);
+int copy_TicketFlags (const TicketFlags *, TicketFlags *);
+unsigned TicketFlags2int(TicketFlags);
+TicketFlags int2TicketFlags(unsigned);
+extern struct units TicketFlags_units[];
+
+/*
+KDCOptions ::= BIT STRING {
+ reserved(0),
+ forwardable(1),
+ forwarded(2),
+ proxiable(3),
+ proxy(4),
+ allow-postdate(5),
+ postdated(6),
+ unused7(7),
+ renewable(8),
+ unused9(9),
+ unused10(10),
+ unused11(11),
+ request-anonymous(14),
+ canonicalize(15),
+ disable-transited-check(26),
+ renewable-ok(27),
+ enc-tkt-in-skey(28),
+ renew(30),
+ validate(31)
+}
+*/
+
+typedef struct KDCOptions {
+ unsigned int reserved:1;
+ unsigned int forwardable:1;
+ unsigned int forwarded:1;
+ unsigned int proxiable:1;
+ unsigned int proxy:1;
+ unsigned int allow_postdate:1;
+ unsigned int postdated:1;
+ unsigned int unused7:1;
+ unsigned int renewable:1;
+ unsigned int unused9:1;
+ unsigned int unused10:1;
+ unsigned int unused11:1;
+ unsigned int request_anonymous:1;
+ unsigned int canonicalize:1;
+ unsigned int disable_transited_check:1;
+ unsigned int renewable_ok:1;
+ unsigned int enc_tkt_in_skey:1;
+ unsigned int renew:1;
+ unsigned int validate:1;
+} KDCOptions;
+
+
+int encode_KDCOptions(unsigned char *, size_t, const KDCOptions *, size_t *);
+int decode_KDCOptions(const unsigned char *, size_t, KDCOptions *, size_t *);
+void free_KDCOptions (KDCOptions *);
+size_t length_KDCOptions(const KDCOptions *);
+int copy_KDCOptions (const KDCOptions *, KDCOptions *);
+unsigned KDCOptions2int(KDCOptions);
+KDCOptions int2KDCOptions(unsigned);
+extern struct units KDCOptions_units[];
+
+/*
+LR-TYPE ::= INTEGER
+*/
+
+typedef enum LR_TYPE {
+ LR_NONE = 0,
+ LR_INITIAL_TGT = 1,
+ LR_INITIAL = 2,
+ LR_ISSUE_USE_TGT = 3,
+ LR_RENEWAL = 4,
+ LR_REQUEST = 5,
+ LR_PW_EXPTIME = 6,
+ LR_ACCT_EXPTIME = 7
+} LR_TYPE;
+
+int encode_LR_TYPE(unsigned char *, size_t, const LR_TYPE *, size_t *);
+int decode_LR_TYPE(const unsigned char *, size_t, LR_TYPE *, size_t *);
+void free_LR_TYPE (LR_TYPE *);
+size_t length_LR_TYPE(const LR_TYPE *);
+int copy_LR_TYPE (const LR_TYPE *, LR_TYPE *);
+
+
+/*
+LastReq ::= SEQUENCE OF SEQUENCE {
+ lr-type[0] LR-TYPE,
+ lr-value[1] KerberosTime
+}
+*/
+
+typedef struct LastReq {
+ unsigned int len;
+ struct {
+ LR_TYPE lr_type;
+ KerberosTime lr_value;
+ } *val;
+} LastReq;
+
+int encode_LastReq(unsigned char *, size_t, const LastReq *, size_t *);
+int decode_LastReq(const unsigned char *, size_t, LastReq *, size_t *);
+void free_LastReq (LastReq *);
+size_t length_LastReq(const LastReq *);
+int copy_LastReq (const LastReq *, LastReq *);
+
+
+/*
+EncryptedData ::= SEQUENCE {
+ etype[0] ENCTYPE,
+ kvno[1] INTEGER OPTIONAL,
+ cipher[2] OCTET STRING
+}
+*/
+
+typedef struct EncryptedData {
+ ENCTYPE etype;
+ int *kvno;
+ octet_string cipher;
+} EncryptedData;
+
+int encode_EncryptedData(unsigned char *, size_t, const EncryptedData *, size_t *);
+int decode_EncryptedData(const unsigned char *, size_t, EncryptedData *, size_t *);
+void free_EncryptedData (EncryptedData *);
+size_t length_EncryptedData(const EncryptedData *);
+int copy_EncryptedData (const EncryptedData *, EncryptedData *);
+
+
+/*
+EncryptionKey ::= SEQUENCE {
+ keytype[0] INTEGER,
+ keyvalue[1] OCTET STRING
+}
+*/
+
+typedef struct EncryptionKey {
+ int keytype;
+ octet_string keyvalue;
+} EncryptionKey;
+
+int encode_EncryptionKey(unsigned char *, size_t, const EncryptionKey *, size_t *);
+int decode_EncryptionKey(const unsigned char *, size_t, EncryptionKey *, size_t *);
+void free_EncryptionKey (EncryptionKey *);
+size_t length_EncryptionKey(const EncryptionKey *);
+int copy_EncryptionKey (const EncryptionKey *, EncryptionKey *);
+
+
+/*
+TransitedEncoding ::= SEQUENCE {
+ tr-type[0] INTEGER,
+ contents[1] OCTET STRING
+}
+*/
+
+typedef struct TransitedEncoding {
+ int tr_type;
+ octet_string contents;
+} TransitedEncoding;
+
+int encode_TransitedEncoding(unsigned char *, size_t, const TransitedEncoding *, size_t *);
+int decode_TransitedEncoding(const unsigned char *, size_t, TransitedEncoding *, size_t *);
+void free_TransitedEncoding (TransitedEncoding *);
+size_t length_TransitedEncoding(const TransitedEncoding *);
+int copy_TransitedEncoding (const TransitedEncoding *, TransitedEncoding *);
+
+
+/*
+Ticket ::= [APPLICATION 1] SEQUENCE {
+ tkt-vno[0] INTEGER,
+ realm[1] Realm,
+ sname[2] PrincipalName,
+ enc-part[3] EncryptedData
+}
+*/
+
+typedef struct {
+ int tkt_vno;
+ Realm realm;
+ PrincipalName sname;
+ EncryptedData enc_part;
+} Ticket;
+
+int encode_Ticket(unsigned char *, size_t, const Ticket *, size_t *);
+int decode_Ticket(const unsigned char *, size_t, Ticket *, size_t *);
+void free_Ticket (Ticket *);
+size_t length_Ticket(const Ticket *);
+int copy_Ticket (const Ticket *, Ticket *);
+
+
+/*
+EncTicketPart ::= [APPLICATION 3] SEQUENCE {
+ flags[0] TicketFlags,
+ key[1] EncryptionKey,
+ crealm[2] Realm,
+ cname[3] PrincipalName,
+ transited[4] TransitedEncoding,
+ authtime[5] KerberosTime,
+ starttime[6] KerberosTime OPTIONAL,
+ endtime[7] KerberosTime,
+ renew-till[8] KerberosTime OPTIONAL,
+ caddr[9] HostAddresses OPTIONAL,
+ authorization-data[10] AuthorizationData OPTIONAL
+}
+*/
+
+typedef struct {
+ TicketFlags flags;
+ EncryptionKey key;
+ Realm crealm;
+ PrincipalName cname;
+ TransitedEncoding transited;
+ KerberosTime authtime;
+ KerberosTime *starttime;
+ KerberosTime endtime;
+ KerberosTime *renew_till;
+ HostAddresses *caddr;
+ AuthorizationData *authorization_data;
+} EncTicketPart;
+
+int encode_EncTicketPart(unsigned char *, size_t, const EncTicketPart *, size_t *);
+int decode_EncTicketPart(const unsigned char *, size_t, EncTicketPart *, size_t *);
+void free_EncTicketPart (EncTicketPart *);
+size_t length_EncTicketPart(const EncTicketPart *);
+int copy_EncTicketPart (const EncTicketPart *, EncTicketPart *);
+
+
+/*
+Checksum ::= SEQUENCE {
+ cksumtype[0] CKSUMTYPE,
+ checksum[1] OCTET STRING
+}
+*/
+
+typedef struct Checksum {
+ CKSUMTYPE cksumtype;
+ octet_string checksum;
+} Checksum;
+
+int encode_Checksum(unsigned char *, size_t, const Checksum *, size_t *);
+int decode_Checksum(const unsigned char *, size_t, Checksum *, size_t *);
+void free_Checksum (Checksum *);
+size_t length_Checksum(const Checksum *);
+int copy_Checksum (const Checksum *, Checksum *);
+
+
+/*
+Authenticator ::= [APPLICATION 2] SEQUENCE {
+ authenticator-vno[0] INTEGER,
+ crealm[1] Realm,
+ cname[2] PrincipalName,
+ cksum[3] Checksum OPTIONAL,
+ cusec[4] INTEGER,
+ ctime[5] KerberosTime,
+ subkey[6] EncryptionKey OPTIONAL,
+ seq-number[7] UNSIGNED OPTIONAL,
+ authorization-data[8] AuthorizationData OPTIONAL
+}
+*/
+
+typedef struct {
+ int authenticator_vno;
+ Realm crealm;
+ PrincipalName cname;
+ Checksum *cksum;
+ int cusec;
+ KerberosTime ctime;
+ EncryptionKey *subkey;
+ UNSIGNED *seq_number;
+ AuthorizationData *authorization_data;
+} Authenticator;
+
+int encode_Authenticator(unsigned char *, size_t, const Authenticator *, size_t *);
+int decode_Authenticator(const unsigned char *, size_t, Authenticator *, size_t *);
+void free_Authenticator (Authenticator *);
+size_t length_Authenticator(const Authenticator *);
+int copy_Authenticator (const Authenticator *, Authenticator *);
+
+
+/*
+PA-DATA ::= SEQUENCE {
+ padata-type[1] PADATA-TYPE,
+ padata-value[2] OCTET STRING
+}
+*/
+
+typedef struct PA_DATA {
+ PADATA_TYPE padata_type;
+ octet_string padata_value;
+} PA_DATA;
+
+int encode_PA_DATA(unsigned char *, size_t, const PA_DATA *, size_t *);
+int decode_PA_DATA(const unsigned char *, size_t, PA_DATA *, size_t *);
+void free_PA_DATA (PA_DATA *);
+size_t length_PA_DATA(const PA_DATA *);
+int copy_PA_DATA (const PA_DATA *, PA_DATA *);
+
+
+/*
+ETYPE-INFO-ENTRY ::= SEQUENCE {
+ etype[0] ENCTYPE,
+ salt[1] OCTET STRING OPTIONAL,
+ salttype[2] INTEGER OPTIONAL
+}
+*/
+
+typedef struct ETYPE_INFO_ENTRY {
+ ENCTYPE etype;
+ octet_string *salt;
+ int *salttype;
+} ETYPE_INFO_ENTRY;
+
+int encode_ETYPE_INFO_ENTRY(unsigned char *, size_t, const ETYPE_INFO_ENTRY *, size_t *);
+int decode_ETYPE_INFO_ENTRY(const unsigned char *, size_t, ETYPE_INFO_ENTRY *, size_t *);
+void free_ETYPE_INFO_ENTRY (ETYPE_INFO_ENTRY *);
+size_t length_ETYPE_INFO_ENTRY(const ETYPE_INFO_ENTRY *);
+int copy_ETYPE_INFO_ENTRY (const ETYPE_INFO_ENTRY *, ETYPE_INFO_ENTRY *);
+
+
+/*
+ETYPE-INFO ::= SEQUENCE OF ETYPE-INFO-ENTRY
+*/
+
+typedef struct ETYPE_INFO {
+ unsigned int len;
+ ETYPE_INFO_ENTRY *val;
+} ETYPE_INFO;
+
+int encode_ETYPE_INFO(unsigned char *, size_t, const ETYPE_INFO *, size_t *);
+int decode_ETYPE_INFO(const unsigned char *, size_t, ETYPE_INFO *, size_t *);
+void free_ETYPE_INFO (ETYPE_INFO *);
+size_t length_ETYPE_INFO(const ETYPE_INFO *);
+int copy_ETYPE_INFO (const ETYPE_INFO *, ETYPE_INFO *);
+
+
+/*
+METHOD-DATA ::= SEQUENCE OF PA-DATA
+*/
+
+typedef struct METHOD_DATA {
+ unsigned int len;
+ PA_DATA *val;
+} METHOD_DATA;
+
+int encode_METHOD_DATA(unsigned char *, size_t, const METHOD_DATA *, size_t *);
+int decode_METHOD_DATA(const unsigned char *, size_t, METHOD_DATA *, size_t *);
+void free_METHOD_DATA (METHOD_DATA *);
+size_t length_METHOD_DATA(const METHOD_DATA *);
+int copy_METHOD_DATA (const METHOD_DATA *, METHOD_DATA *);
+
+
+/*
+KDC-REQ-BODY ::= SEQUENCE {
+ kdc-options[0] KDCOptions,
+ cname[1] PrincipalName OPTIONAL,
+ realm[2] Realm,
+ sname[3] PrincipalName OPTIONAL,
+ from[4] KerberosTime OPTIONAL,
+ till[5] KerberosTime OPTIONAL,
+ rtime[6] KerberosTime OPTIONAL,
+ nonce[7] INTEGER,
+ etype[8] SEQUENCE OF ENCTYPE,
+ addresses[9] HostAddresses OPTIONAL,
+ enc-authorization-data[10] EncryptedData OPTIONAL,
+ additional-tickets[11] SEQUENCE OF Ticket OPTIONAL
+}
+*/
+
+typedef struct KDC_REQ_BODY {
+ KDCOptions kdc_options;
+ PrincipalName *cname;
+ Realm realm;
+ PrincipalName *sname;
+ KerberosTime *from;
+ KerberosTime *till;
+ KerberosTime *rtime;
+ int nonce;
+ struct {
+ unsigned int len;
+ ENCTYPE *val;
+ } etype;
+ HostAddresses *addresses;
+ EncryptedData *enc_authorization_data;
+ struct {
+ unsigned int len;
+ Ticket *val;
+ } *additional_tickets;
+} KDC_REQ_BODY;
+
+int encode_KDC_REQ_BODY(unsigned char *, size_t, const KDC_REQ_BODY *, size_t *);
+int decode_KDC_REQ_BODY(const unsigned char *, size_t, KDC_REQ_BODY *, size_t *);
+void free_KDC_REQ_BODY (KDC_REQ_BODY *);
+size_t length_KDC_REQ_BODY(const KDC_REQ_BODY *);
+int copy_KDC_REQ_BODY (const KDC_REQ_BODY *, KDC_REQ_BODY *);
+
+
+/*
+KDC-REQ ::= SEQUENCE {
+ pvno[1] INTEGER,
+ msg-type[2] MESSAGE-TYPE,
+ padata[3] METHOD-DATA OPTIONAL,
+ req-body[4] KDC-REQ-BODY
+}
+*/
+
+typedef struct KDC_REQ {
+ int pvno;
+ MESSAGE_TYPE msg_type;
+ METHOD_DATA *padata;
+ KDC_REQ_BODY req_body;
+} KDC_REQ;
+
+int encode_KDC_REQ(unsigned char *, size_t, const KDC_REQ *, size_t *);
+int decode_KDC_REQ(const unsigned char *, size_t, KDC_REQ *, size_t *);
+void free_KDC_REQ (KDC_REQ *);
+size_t length_KDC_REQ(const KDC_REQ *);
+int copy_KDC_REQ (const KDC_REQ *, KDC_REQ *);
+
+
+/*
+AS-REQ ::= [APPLICATION 10] KDC-REQ
+*/
+
+typedef KDC_REQ AS_REQ;
+
+int encode_AS_REQ(unsigned char *, size_t, const AS_REQ *, size_t *);
+int decode_AS_REQ(const unsigned char *, size_t, AS_REQ *, size_t *);
+void free_AS_REQ (AS_REQ *);
+size_t length_AS_REQ(const AS_REQ *);
+int copy_AS_REQ (const AS_REQ *, AS_REQ *);
+
+
+/*
+TGS-REQ ::= [APPLICATION 12] KDC-REQ
+*/
+
+typedef KDC_REQ TGS_REQ;
+
+int encode_TGS_REQ(unsigned char *, size_t, const TGS_REQ *, size_t *);
+int decode_TGS_REQ(const unsigned char *, size_t, TGS_REQ *, size_t *);
+void free_TGS_REQ (TGS_REQ *);
+size_t length_TGS_REQ(const TGS_REQ *);
+int copy_TGS_REQ (const TGS_REQ *, TGS_REQ *);
+
+
+/*
+PA-ENC-TS-ENC ::= SEQUENCE {
+ patimestamp[0] KerberosTime,
+ pausec[1] INTEGER OPTIONAL
+}
+*/
+
+typedef struct PA_ENC_TS_ENC {
+ KerberosTime patimestamp;
+ int *pausec;
+} PA_ENC_TS_ENC;
+
+int encode_PA_ENC_TS_ENC(unsigned char *, size_t, const PA_ENC_TS_ENC *, size_t *);
+int decode_PA_ENC_TS_ENC(const unsigned char *, size_t, PA_ENC_TS_ENC *, size_t *);
+void free_PA_ENC_TS_ENC (PA_ENC_TS_ENC *);
+size_t length_PA_ENC_TS_ENC(const PA_ENC_TS_ENC *);
+int copy_PA_ENC_TS_ENC (const PA_ENC_TS_ENC *, PA_ENC_TS_ENC *);
+
+
+/*
+KDC-REP ::= SEQUENCE {
+ pvno[0] INTEGER,
+ msg-type[1] MESSAGE-TYPE,
+ padata[2] METHOD-DATA OPTIONAL,
+ crealm[3] Realm,
+ cname[4] PrincipalName,
+ ticket[5] Ticket,
+ enc-part[6] EncryptedData
+}
+*/
+
+typedef struct KDC_REP {
+ int pvno;
+ MESSAGE_TYPE msg_type;
+ METHOD_DATA *padata;
+ Realm crealm;
+ PrincipalName cname;
+ Ticket ticket;
+ EncryptedData enc_part;
+} KDC_REP;
+
+int encode_KDC_REP(unsigned char *, size_t, const KDC_REP *, size_t *);
+int decode_KDC_REP(const unsigned char *, size_t, KDC_REP *, size_t *);
+void free_KDC_REP (KDC_REP *);
+size_t length_KDC_REP(const KDC_REP *);
+int copy_KDC_REP (const KDC_REP *, KDC_REP *);
+
+
+/*
+AS-REP ::= [APPLICATION 11] KDC-REP
+*/
+
+typedef KDC_REP AS_REP;
+
+int encode_AS_REP(unsigned char *, size_t, const AS_REP *, size_t *);
+int decode_AS_REP(const unsigned char *, size_t, AS_REP *, size_t *);
+void free_AS_REP (AS_REP *);
+size_t length_AS_REP(const AS_REP *);
+int copy_AS_REP (const AS_REP *, AS_REP *);
+
+
+/*
+TGS-REP ::= [APPLICATION 13] KDC-REP
+*/
+
+typedef KDC_REP TGS_REP;
+
+int encode_TGS_REP(unsigned char *, size_t, const TGS_REP *, size_t *);
+int decode_TGS_REP(const unsigned char *, size_t, TGS_REP *, size_t *);
+void free_TGS_REP (TGS_REP *);
+size_t length_TGS_REP(const TGS_REP *);
+int copy_TGS_REP (const TGS_REP *, TGS_REP *);
+
+
+/*
+EncKDCRepPart ::= SEQUENCE {
+ key[0] EncryptionKey,
+ last-req[1] LastReq,
+ nonce[2] INTEGER,
+ key-expiration[3] KerberosTime OPTIONAL,
+ flags[4] TicketFlags,
+ authtime[5] KerberosTime,
+ starttime[6] KerberosTime OPTIONAL,
+ endtime[7] KerberosTime,
+ renew-till[8] KerberosTime OPTIONAL,
+ srealm[9] Realm,
+ sname[10] PrincipalName,
+ caddr[11] HostAddresses OPTIONAL
+}
+*/
+
+typedef struct EncKDCRepPart {
+ EncryptionKey key;
+ LastReq last_req;
+ int nonce;
+ KerberosTime *key_expiration;
+ TicketFlags flags;
+ KerberosTime authtime;
+ KerberosTime *starttime;
+ KerberosTime endtime;
+ KerberosTime *renew_till;
+ Realm srealm;
+ PrincipalName sname;
+ HostAddresses *caddr;
+} EncKDCRepPart;
+
+int encode_EncKDCRepPart(unsigned char *, size_t, const EncKDCRepPart *, size_t *);
+int decode_EncKDCRepPart(const unsigned char *, size_t, EncKDCRepPart *, size_t *);
+void free_EncKDCRepPart (EncKDCRepPart *);
+size_t length_EncKDCRepPart(const EncKDCRepPart *);
+int copy_EncKDCRepPart (const EncKDCRepPart *, EncKDCRepPart *);
+
+
+/*
+EncASRepPart ::= [APPLICATION 25] EncKDCRepPart
+*/
+
+typedef EncKDCRepPart EncASRepPart;
+
+int encode_EncASRepPart(unsigned char *, size_t, const EncASRepPart *, size_t *);
+int decode_EncASRepPart(const unsigned char *, size_t, EncASRepPart *, size_t *);
+void free_EncASRepPart (EncASRepPart *);
+size_t length_EncASRepPart(const EncASRepPart *);
+int copy_EncASRepPart (const EncASRepPart *, EncASRepPart *);
+
+
+/*
+EncTGSRepPart ::= [APPLICATION 26] EncKDCRepPart
+*/
+
+typedef EncKDCRepPart EncTGSRepPart;
+
+int encode_EncTGSRepPart(unsigned char *, size_t, const EncTGSRepPart *, size_t *);
+int decode_EncTGSRepPart(const unsigned char *, size_t, EncTGSRepPart *, size_t *);
+void free_EncTGSRepPart (EncTGSRepPart *);
+size_t length_EncTGSRepPart(const EncTGSRepPart *);
+int copy_EncTGSRepPart (const EncTGSRepPart *, EncTGSRepPart *);
+
+
+/*
+AP-REQ ::= [APPLICATION 14] SEQUENCE {
+ pvno[0] INTEGER,
+ msg-type[1] MESSAGE-TYPE,
+ ap-options[2] APOptions,
+ ticket[3] Ticket,
+ authenticator[4] EncryptedData
+}
+*/
+
+typedef struct {
+ int pvno;
+ MESSAGE_TYPE msg_type;
+ APOptions ap_options;
+ Ticket ticket;
+ EncryptedData authenticator;
+} AP_REQ;
+
+int encode_AP_REQ(unsigned char *, size_t, const AP_REQ *, size_t *);
+int decode_AP_REQ(const unsigned char *, size_t, AP_REQ *, size_t *);
+void free_AP_REQ (AP_REQ *);
+size_t length_AP_REQ(const AP_REQ *);
+int copy_AP_REQ (const AP_REQ *, AP_REQ *);
+
+
+/*
+AP-REP ::= [APPLICATION 15] SEQUENCE {
+ pvno[0] INTEGER,
+ msg-type[1] MESSAGE-TYPE,
+ enc-part[2] EncryptedData
+}
+*/
+
+typedef struct {
+ int pvno;
+ MESSAGE_TYPE msg_type;
+ EncryptedData enc_part;
+} AP_REP;
+
+int encode_AP_REP(unsigned char *, size_t, const AP_REP *, size_t *);
+int decode_AP_REP(const unsigned char *, size_t, AP_REP *, size_t *);
+void free_AP_REP (AP_REP *);
+size_t length_AP_REP(const AP_REP *);
+int copy_AP_REP (const AP_REP *, AP_REP *);
+
+
+/*
+EncAPRepPart ::= [APPLICATION 27] SEQUENCE {
+ ctime[0] KerberosTime,
+ cusec[1] INTEGER,
+ subkey[2] EncryptionKey OPTIONAL,
+ seq-number[3] UNSIGNED OPTIONAL
+}
+*/
+
+typedef struct {
+ KerberosTime ctime;
+ int cusec;
+ EncryptionKey *subkey;
+ UNSIGNED *seq_number;
+} EncAPRepPart;
+
+int encode_EncAPRepPart(unsigned char *, size_t, const EncAPRepPart *, size_t *);
+int decode_EncAPRepPart(const unsigned char *, size_t, EncAPRepPart *, size_t *);
+void free_EncAPRepPart (EncAPRepPart *);
+size_t length_EncAPRepPart(const EncAPRepPart *);
+int copy_EncAPRepPart (const EncAPRepPart *, EncAPRepPart *);
+
+
+/*
+KRB-SAFE-BODY ::= SEQUENCE {
+ user-data[0] OCTET STRING,
+ timestamp[1] KerberosTime OPTIONAL,
+ usec[2] INTEGER OPTIONAL,
+ seq-number[3] UNSIGNED OPTIONAL,
+ s-address[4] HostAddress OPTIONAL,
+ r-address[5] HostAddress OPTIONAL
+}
+*/
+
+typedef struct KRB_SAFE_BODY {
+ octet_string user_data;
+ KerberosTime *timestamp;
+ int *usec;
+ UNSIGNED *seq_number;
+ HostAddress *s_address;
+ HostAddress *r_address;
+} KRB_SAFE_BODY;
+
+int encode_KRB_SAFE_BODY(unsigned char *, size_t, const KRB_SAFE_BODY *, size_t *);
+int decode_KRB_SAFE_BODY(const unsigned char *, size_t, KRB_SAFE_BODY *, size_t *);
+void free_KRB_SAFE_BODY (KRB_SAFE_BODY *);
+size_t length_KRB_SAFE_BODY(const KRB_SAFE_BODY *);
+int copy_KRB_SAFE_BODY (const KRB_SAFE_BODY *, KRB_SAFE_BODY *);
+
+
+/*
+KRB-SAFE ::= [APPLICATION 20] SEQUENCE {
+ pvno[0] INTEGER,
+ msg-type[1] MESSAGE-TYPE,
+ safe-body[2] KRB-SAFE-BODY,
+ cksum[3] Checksum
+}
+*/
+
+typedef struct {
+ int pvno;
+ MESSAGE_TYPE msg_type;
+ KRB_SAFE_BODY safe_body;
+ Checksum cksum;
+} KRB_SAFE;
+
+int encode_KRB_SAFE(unsigned char *, size_t, const KRB_SAFE *, size_t *);
+int decode_KRB_SAFE(const unsigned char *, size_t, KRB_SAFE *, size_t *);
+void free_KRB_SAFE (KRB_SAFE *);
+size_t length_KRB_SAFE(const KRB_SAFE *);
+int copy_KRB_SAFE (const KRB_SAFE *, KRB_SAFE *);
+
+
+/*
+KRB-PRIV ::= [APPLICATION 21] SEQUENCE {
+ pvno[0] INTEGER,
+ msg-type[1] MESSAGE-TYPE,
+ enc-part[3] EncryptedData
+}
+*/
+
+typedef struct {
+ int pvno;
+ MESSAGE_TYPE msg_type;
+ EncryptedData enc_part;
+} KRB_PRIV;
+
+int encode_KRB_PRIV(unsigned char *, size_t, const KRB_PRIV *, size_t *);
+int decode_KRB_PRIV(const unsigned char *, size_t, KRB_PRIV *, size_t *);
+void free_KRB_PRIV (KRB_PRIV *);
+size_t length_KRB_PRIV(const KRB_PRIV *);
+int copy_KRB_PRIV (const KRB_PRIV *, KRB_PRIV *);
+
+
+/*
+EncKrbPrivPart ::= [APPLICATION 28] SEQUENCE {
+ user-data[0] OCTET STRING,
+ timestamp[1] KerberosTime OPTIONAL,
+ usec[2] INTEGER OPTIONAL,
+ seq-number[3] UNSIGNED OPTIONAL,
+ s-address[4] HostAddress OPTIONAL,
+ r-address[5] HostAddress OPTIONAL
+}
+*/
+
+typedef struct {
+ octet_string user_data;
+ KerberosTime *timestamp;
+ int *usec;
+ UNSIGNED *seq_number;
+ HostAddress *s_address;
+ HostAddress *r_address;
+} EncKrbPrivPart;
+
+int encode_EncKrbPrivPart(unsigned char *, size_t, const EncKrbPrivPart *, size_t *);
+int decode_EncKrbPrivPart(const unsigned char *, size_t, EncKrbPrivPart *, size_t *);
+void free_EncKrbPrivPart (EncKrbPrivPart *);
+size_t length_EncKrbPrivPart(const EncKrbPrivPart *);
+int copy_EncKrbPrivPart (const EncKrbPrivPart *, EncKrbPrivPart *);
+
+
+/*
+KRB-CRED ::= [APPLICATION 22] SEQUENCE {
+ pvno[0] INTEGER,
+ msg-type[1] MESSAGE-TYPE,
+ tickets[2] SEQUENCE OF Ticket,
+ enc-part[3] EncryptedData
+}
+*/
+
+typedef struct {
+ int pvno;
+ MESSAGE_TYPE msg_type;
+ struct {
+ unsigned int len;
+ Ticket *val;
+ } tickets;
+ EncryptedData enc_part;
+} KRB_CRED;
+
+int encode_KRB_CRED(unsigned char *, size_t, const KRB_CRED *, size_t *);
+int decode_KRB_CRED(const unsigned char *, size_t, KRB_CRED *, size_t *);
+void free_KRB_CRED (KRB_CRED *);
+size_t length_KRB_CRED(const KRB_CRED *);
+int copy_KRB_CRED (const KRB_CRED *, KRB_CRED *);
+
+
+/*
+KrbCredInfo ::= SEQUENCE {
+ key[0] EncryptionKey,
+ prealm[1] Realm OPTIONAL,
+ pname[2] PrincipalName OPTIONAL,
+ flags[3] TicketFlags OPTIONAL,
+ authtime[4] KerberosTime OPTIONAL,
+ starttime[5] KerberosTime OPTIONAL,
+ endtime[6] KerberosTime OPTIONAL,
+ renew-till[7] KerberosTime OPTIONAL,
+ srealm[8] Realm OPTIONAL,
+ sname[9] PrincipalName OPTIONAL,
+ caddr[10] HostAddresses OPTIONAL
+}
+*/
+
+typedef struct KrbCredInfo {
+ EncryptionKey key;
+ Realm *prealm;
+ PrincipalName *pname;
+ TicketFlags *flags;
+ KerberosTime *authtime;
+ KerberosTime *starttime;
+ KerberosTime *endtime;
+ KerberosTime *renew_till;
+ Realm *srealm;
+ PrincipalName *sname;
+ HostAddresses *caddr;
+} KrbCredInfo;
+
+int encode_KrbCredInfo(unsigned char *, size_t, const KrbCredInfo *, size_t *);
+int decode_KrbCredInfo(const unsigned char *, size_t, KrbCredInfo *, size_t *);
+void free_KrbCredInfo (KrbCredInfo *);
+size_t length_KrbCredInfo(const KrbCredInfo *);
+int copy_KrbCredInfo (const KrbCredInfo *, KrbCredInfo *);
+
+
+/*
+EncKrbCredPart ::= [APPLICATION 29] SEQUENCE {
+ ticket-info[0] SEQUENCE OF KrbCredInfo,
+ nonce[1] INTEGER OPTIONAL,
+ timestamp[2] KerberosTime OPTIONAL,
+ usec[3] INTEGER OPTIONAL,
+ s-address[4] HostAddress OPTIONAL,
+ r-address[5] HostAddress OPTIONAL
+}
+*/
+
+typedef struct {
+ struct {
+ unsigned int len;
+ KrbCredInfo *val;
+ } ticket_info;
+ int *nonce;
+ KerberosTime *timestamp;
+ int *usec;
+ HostAddress *s_address;
+ HostAddress *r_address;
+} EncKrbCredPart;
+
+int encode_EncKrbCredPart(unsigned char *, size_t, const EncKrbCredPart *, size_t *);
+int decode_EncKrbCredPart(const unsigned char *, size_t, EncKrbCredPart *, size_t *);
+void free_EncKrbCredPart (EncKrbCredPart *);
+size_t length_EncKrbCredPart(const EncKrbCredPart *);
+int copy_EncKrbCredPart (const EncKrbCredPart *, EncKrbCredPart *);
+
+
+/*
+KRB-ERROR ::= [APPLICATION 30] SEQUENCE {
+ pvno[0] INTEGER,
+ msg-type[1] MESSAGE-TYPE,
+ ctime[2] KerberosTime OPTIONAL,
+ cusec[3] INTEGER OPTIONAL,
+ stime[4] KerberosTime,
+ susec[5] INTEGER,
+ error-code[6] INTEGER,
+ crealm[7] Realm OPTIONAL,
+ cname[8] PrincipalName OPTIONAL,
+ realm[9] Realm,
+ sname[10] PrincipalName,
+ e-text[11] GeneralString OPTIONAL,
+ e-data[12] OCTET STRING OPTIONAL
+}
+*/
+
+typedef struct {
+ int pvno;
+ MESSAGE_TYPE msg_type;
+ KerberosTime *ctime;
+ int *cusec;
+ KerberosTime stime;
+ int susec;
+ int error_code;
+ Realm *crealm;
+ PrincipalName *cname;
+ Realm realm;
+ PrincipalName sname;
+ general_string *e_text;
+ octet_string *e_data;
+} KRB_ERROR;
+
+int encode_KRB_ERROR(unsigned char *, size_t, const KRB_ERROR *, size_t *);
+int decode_KRB_ERROR(const unsigned char *, size_t, KRB_ERROR *, size_t *);
+void free_KRB_ERROR (KRB_ERROR *);
+size_t length_KRB_ERROR(const KRB_ERROR *);
+int copy_KRB_ERROR (const KRB_ERROR *, KRB_ERROR *);
+
+
+enum { pvno = 5 };
+
+enum { DOMAIN_X500_COMPRESS = 1 };
+
+#endif /* __krb5_asn1_h__ */