summaryrefslogtreecommitdiff
path: root/kerberosV
diff options
context:
space:
mode:
authorHans Insulander <hin@cvs.openbsd.org>2003-05-11 23:08:23 +0000
committerHans Insulander <hin@cvs.openbsd.org>2003-05-11 23:08:23 +0000
commitfc206143f58c821a032e984241c614d0ede2970b (patch)
tree8066974635a13624ee816869153d5434826465e8 /kerberosV
parentb4480435ed97bdda4b253553f99a88ad7577ca0d (diff)
Pregenerate these files as well, to remove asn1_compile bootstrapping
problem
Diffstat (limited to 'kerberosV')
-rw-r--r--kerberosV/lib/hdb/Makefile6
-rw-r--r--kerberosV/lib/hdb/asn1_Event.c175
-rw-r--r--kerberosV/lib/hdb/asn1_GENERATION.c205
-rw-r--r--kerberosV/lib/hdb/asn1_HDBFlags.c179
-rw-r--r--kerberosV/lib/hdb/asn1_Key.c228
-rw-r--r--kerberosV/lib/hdb/asn1_Salt.c163
-rw-r--r--kerberosV/lib/hdb/asn1_files1
-rw-r--r--kerberosV/lib/hdb/asn1_hdb_entry.c814
-rw-r--r--kerberosV/lib/hdb/hdb_asn1.h224
9 files changed, 1992 insertions, 3 deletions
diff --git a/kerberosV/lib/hdb/Makefile b/kerberosV/lib/hdb/Makefile
index b791957bc3a..5737c53fda2 100644
--- a/kerberosV/lib/hdb/Makefile
+++ b/kerberosV/lib/hdb/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.6 2003/05/11 20:54:39 mho Exp $
+# $OpenBSD: Makefile,v 1.7 2003/05/11 23:08:22 hin Exp $
KRBDEPTH=../..
.include <${.CURDIR}/../../Makefile.inc>
@@ -26,11 +26,11 @@ SRCS= ${ASN1_SRC} \
hdb_err.c \
hdb_err.h
-${ASN1_SRC}: ${KRB5SRC}/lib/hdb/hdb.asn1
+regen:
asn1_compile ${KRB5SRC}/lib/hdb/hdb.asn1 hdb_asn1
for f in *.x; do mv $$f `echo $$f | sed s,.x$$,.c,g`; done
-CLEANFILES+= ${ASN1_SRC} ${ASN1_SRC:.c=.x} hdb_err.[ch] \
+CLEANFILES+= hdb_err.[ch] \
hdb_asn1.[ch] ans1_files asn1.h asn1_files
CFLAGS+=-I${KRB5SRC}/lib/hdb -I${KRB5SRC}/lib/asn1 -I../asn1 -I. -I../krb5
diff --git a/kerberosV/lib/hdb/asn1_Event.c b/kerberosV/lib/hdb/asn1_Event.c
new file mode 100644
index 00000000000..4961ec22b93
--- /dev/null
+++ b/kerberosV/lib/hdb/asn1_Event.c
@@ -0,0 +1,175 @@
+/* Generated from /usr/src/kerberosV/lib/hdb/../../src/lib/hdb/hdb.asn1 */
+/* Do not edit */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+#include <errno.h>
+#include <krb5_asn1.h>
+#include <hdb_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_Event(unsigned char *p, size_t len, const Event *data, size_t *size)
+{
+size_t ret = 0;
+size_t l;
+int i, e;
+
+i = 0;
+if((data)->principal)
+{
+int oldret = ret;
+ret = 0;
+e = encode_Principal(p, len, (data)->principal, &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)->time, &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_Event(const unsigned char *p, size_t len, Event *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)->time, &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)->principal = 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)->principal = malloc(sizeof(*(data)->principal));
+if((data)->principal == NULL) return ENOMEM;
+e = decode_Principal(p, len, (data)->principal, &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_Event(data);
+return e;
+}
+
+void
+free_Event(Event *data)
+{
+free_KerberosTime(&(data)->time);
+if((data)->principal) {
+free_Principal((data)->principal);
+free((data)->principal);
+}
+}
+
+size_t
+length_Event(const Event *data)
+{
+size_t ret = 0;
+{
+int oldret = ret;
+ret = 0;
+ret += length_KerberosTime(&(data)->time);
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->principal){
+int oldret = ret;
+ret = 0;
+ret += length_Principal((data)->principal);
+ret += 1 + length_len(ret) + oldret;
+}
+ret += 1 + length_len(ret);
+return ret;
+}
+
+int
+copy_Event(const Event *from, Event *to)
+{
+if(copy_KerberosTime(&(from)->time, &(to)->time)) return ENOMEM;
+if((from)->principal) {
+(to)->principal = malloc(sizeof(*(to)->principal));
+if((to)->principal == NULL) return ENOMEM;
+if(copy_Principal((from)->principal, (to)->principal)) return ENOMEM;
+}else
+(to)->principal = NULL;
+return 0;
+}
+
diff --git a/kerberosV/lib/hdb/asn1_GENERATION.c b/kerberosV/lib/hdb/asn1_GENERATION.c
new file mode 100644
index 00000000000..764bdec3b43
--- /dev/null
+++ b/kerberosV/lib/hdb/asn1_GENERATION.c
@@ -0,0 +1,205 @@
+/* Generated from /usr/src/kerberosV/lib/hdb/../../src/lib/hdb/hdb.asn1 */
+/* Do not edit */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+#include <errno.h>
+#include <krb5_asn1.h>
+#include <hdb_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_GENERATION(unsigned char *p, size_t len, const GENERATION *data, size_t *size)
+{
+size_t ret = 0;
+size_t l;
+int i, e;
+
+i = 0;
+{
+int oldret = ret;
+ret = 0;
+e = encode_integer(p, len, &(data)->gen, &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)->usec, &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)->time, &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_GENERATION(const unsigned char *p, size_t len, GENERATION *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)->time, &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)->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, 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)->gen, &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_GENERATION(data);
+return e;
+}
+
+void
+free_GENERATION(GENERATION *data)
+{
+free_KerberosTime(&(data)->time);
+}
+
+size_t
+length_GENERATION(const GENERATION *data)
+{
+size_t ret = 0;
+{
+int oldret = ret;
+ret = 0;
+ret += length_KerberosTime(&(data)->time);
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+ret += length_integer(&(data)->usec);
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+ret += length_integer(&(data)->gen);
+ret += 1 + length_len(ret) + oldret;
+}
+ret += 1 + length_len(ret);
+return ret;
+}
+
+int
+copy_GENERATION(const GENERATION *from, GENERATION *to)
+{
+if(copy_KerberosTime(&(from)->time, &(to)->time)) return ENOMEM;
+*(&(to)->usec) = *(&(from)->usec);
+*(&(to)->gen) = *(&(from)->gen);
+return 0;
+}
+
diff --git a/kerberosV/lib/hdb/asn1_HDBFlags.c b/kerberosV/lib/hdb/asn1_HDBFlags.c
new file mode 100644
index 00000000000..b41d802a356
--- /dev/null
+++ b/kerberosV/lib/hdb/asn1_HDBFlags.c
@@ -0,0 +1,179 @@
+/* Generated from /usr/src/kerberosV/lib/hdb/../../src/lib/hdb/hdb.asn1 */
+/* Do not edit */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+#include <errno.h>
+#include <krb5_asn1.h>
+#include <hdb_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_HDBFlags(unsigned char *p, size_t len, const HDBFlags *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->immutable) c |= 1<<2;
+if(data->user_to_user) c |= 1<<3;
+if(data->ok_as_delegate) c |= 1<<4;
+if(data->require_hwauth) c |= 1<<5;
+if(data->change_pw) c |= 1<<6;
+if(data->require_preauth) c |= 1<<7;
+*p-- = c; len--; ret++;
+c = 0;
+if(data->invalid) c |= 1<<0;
+if(data->client) c |= 1<<1;
+if(data->server) c |= 1<<2;
+if(data->postdate) c |= 1<<3;
+if(data->renewable) c |= 1<<4;
+if(data->proxiable) c |= 1<<5;
+if(data->forwardable) c |= 1<<6;
+if(data->initial) 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_HDBFlags(const unsigned char *p, size_t len, HDBFlags *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->initial = (*p >> 7) & 1;
+data->forwardable = (*p >> 6) & 1;
+data->proxiable = (*p >> 5) & 1;
+data->renewable = (*p >> 4) & 1;
+data->postdate = (*p >> 3) & 1;
+data->server = (*p >> 2) & 1;
+data->client = (*p >> 1) & 1;
+data->invalid = (*p >> 0) & 1;
+p++; len--; reallen--; ret++;
+data->require_preauth = (*p >> 7) & 1;
+data->change_pw = (*p >> 6) & 1;
+data->require_hwauth = (*p >> 5) & 1;
+data->ok_as_delegate = (*p >> 4) & 1;
+data->user_to_user = (*p >> 3) & 1;
+data->immutable = (*p >> 2) & 1;
+p += reallen; len -= reallen; ret += reallen;
+if(size) *size = ret;
+return 0;
+fail:
+free_HDBFlags(data);
+return e;
+}
+
+void
+free_HDBFlags(HDBFlags *data)
+{
+}
+
+size_t
+length_HDBFlags(const HDBFlags *data)
+{
+size_t ret = 0;
+ret += 7;
+return ret;
+}
+
+int
+copy_HDBFlags(const HDBFlags *from, HDBFlags *to)
+{
+*(to) = *(from);
+return 0;
+}
+
+unsigned HDBFlags2int(HDBFlags f)
+{
+unsigned r = 0;
+if(f.initial) r |= (1U << 0);
+if(f.forwardable) r |= (1U << 1);
+if(f.proxiable) r |= (1U << 2);
+if(f.renewable) r |= (1U << 3);
+if(f.postdate) r |= (1U << 4);
+if(f.server) r |= (1U << 5);
+if(f.client) r |= (1U << 6);
+if(f.invalid) r |= (1U << 7);
+if(f.require_preauth) r |= (1U << 8);
+if(f.change_pw) r |= (1U << 9);
+if(f.require_hwauth) r |= (1U << 10);
+if(f.ok_as_delegate) r |= (1U << 11);
+if(f.user_to_user) r |= (1U << 12);
+if(f.immutable) r |= (1U << 13);
+return r;
+}
+
+HDBFlags int2HDBFlags(unsigned n)
+{
+ HDBFlags flags;
+
+ flags.initial = (n >> 0) & 1;
+ flags.forwardable = (n >> 1) & 1;
+ flags.proxiable = (n >> 2) & 1;
+ flags.renewable = (n >> 3) & 1;
+ flags.postdate = (n >> 4) & 1;
+ flags.server = (n >> 5) & 1;
+ flags.client = (n >> 6) & 1;
+ flags.invalid = (n >> 7) & 1;
+ flags.require_preauth = (n >> 8) & 1;
+ flags.change_pw = (n >> 9) & 1;
+ flags.require_hwauth = (n >> 10) & 1;
+ flags.ok_as_delegate = (n >> 11) & 1;
+ flags.user_to_user = (n >> 12) & 1;
+ flags.immutable = (n >> 13) & 1;
+ return flags;
+}
+
+struct units HDBFlags_units[] = {
+ {"immutable", 1U << 13},
+ {"user_to_user", 1U << 12},
+ {"ok_as_delegate", 1U << 11},
+ {"require_hwauth", 1U << 10},
+ {"change_pw", 1U << 9},
+ {"require_preauth", 1U << 8},
+ {"invalid", 1U << 7},
+ {"client", 1U << 6},
+ {"server", 1U << 5},
+ {"postdate", 1U << 4},
+ {"renewable", 1U << 3},
+ {"proxiable", 1U << 2},
+ {"forwardable", 1U << 1},
+ {"initial", 1U << 0},
+ {NULL, 0}
+};
+
diff --git a/kerberosV/lib/hdb/asn1_Key.c b/kerberosV/lib/hdb/asn1_Key.c
new file mode 100644
index 00000000000..d01810feb9a
--- /dev/null
+++ b/kerberosV/lib/hdb/asn1_Key.c
@@ -0,0 +1,228 @@
+/* Generated from /usr/src/kerberosV/lib/hdb/../../src/lib/hdb/hdb.asn1 */
+/* Do not edit */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+#include <errno.h>
+#include <krb5_asn1.h>
+#include <hdb_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_Key(unsigned char *p, size_t len, const Key *data, size_t *size)
+{
+size_t ret = 0;
+size_t l;
+int i, e;
+
+i = 0;
+if((data)->salt)
+{
+int oldret = ret;
+ret = 0;
+e = encode_Salt(p, len, (data)->salt, &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;
+}
+if((data)->mkvno)
+{
+int oldret = ret;
+ret = 0;
+e = encode_integer(p, len, (data)->mkvno, &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_Key(const unsigned char *p, size_t len, Key *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)
+(data)->mkvno = 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)->mkvno = malloc(sizeof(*(data)->mkvno));
+if((data)->mkvno == NULL) return ENOMEM;
+e = decode_integer(p, len, (data)->mkvno, &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)
+(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_Salt(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;
+}
+}
+}
+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_Key(data);
+return e;
+}
+
+void
+free_Key(Key *data)
+{
+if((data)->mkvno) {
+free((data)->mkvno);
+}
+free_EncryptionKey(&(data)->key);
+if((data)->salt) {
+free_Salt((data)->salt);
+free((data)->salt);
+}
+}
+
+size_t
+length_Key(const Key *data)
+{
+size_t ret = 0;
+if((data)->mkvno){
+int oldret = ret;
+ret = 0;
+ret += length_integer((data)->mkvno);
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+ret += length_EncryptionKey(&(data)->key);
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->salt){
+int oldret = ret;
+ret = 0;
+ret += length_Salt((data)->salt);
+ret += 1 + length_len(ret) + oldret;
+}
+ret += 1 + length_len(ret);
+return ret;
+}
+
+int
+copy_Key(const Key *from, Key *to)
+{
+if((from)->mkvno) {
+(to)->mkvno = malloc(sizeof(*(to)->mkvno));
+if((to)->mkvno == NULL) return ENOMEM;
+*((to)->mkvno) = *((from)->mkvno);
+}else
+(to)->mkvno = NULL;
+if(copy_EncryptionKey(&(from)->key, &(to)->key)) return ENOMEM;
+if((from)->salt) {
+(to)->salt = malloc(sizeof(*(to)->salt));
+if((to)->salt == NULL) return ENOMEM;
+if(copy_Salt((from)->salt, (to)->salt)) return ENOMEM;
+}else
+(to)->salt = NULL;
+return 0;
+}
+
diff --git a/kerberosV/lib/hdb/asn1_Salt.c b/kerberosV/lib/hdb/asn1_Salt.c
new file mode 100644
index 00000000000..db0433a4f79
--- /dev/null
+++ b/kerberosV/lib/hdb/asn1_Salt.c
@@ -0,0 +1,163 @@
+/* Generated from /usr/src/kerberosV/lib/hdb/../../src/lib/hdb/hdb.asn1 */
+/* Do not edit */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+#include <errno.h>
+#include <krb5_asn1.h>
+#include <hdb_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_Salt(unsigned char *p, size_t len, const Salt *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)->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_integer(p, len, &(data)->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_Salt(const unsigned char *p, size_t len, Salt *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)->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)->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;
+}
+}
+}
+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_Salt(data);
+return e;
+}
+
+void
+free_Salt(Salt *data)
+{
+free_octet_string(&(data)->salt);
+}
+
+size_t
+length_Salt(const Salt *data)
+{
+size_t ret = 0;
+{
+int oldret = ret;
+ret = 0;
+ret += length_integer(&(data)->type);
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+ret += length_octet_string(&(data)->salt);
+ret += 1 + length_len(ret) + oldret;
+}
+ret += 1 + length_len(ret);
+return ret;
+}
+
+int
+copy_Salt(const Salt *from, Salt *to)
+{
+*(&(to)->type) = *(&(from)->type);
+if(copy_octet_string(&(from)->salt, &(to)->salt)) return ENOMEM;
+return 0;
+}
+
diff --git a/kerberosV/lib/hdb/asn1_files b/kerberosV/lib/hdb/asn1_files
new file mode 100644
index 00000000000..4941815faeb
--- /dev/null
+++ b/kerberosV/lib/hdb/asn1_files
@@ -0,0 +1 @@
+asn1_Salt.x asn1_Key.x asn1_Event.x asn1_HDBFlags.x asn1_GENERATION.x asn1_hdb_entry.x
diff --git a/kerberosV/lib/hdb/asn1_hdb_entry.c b/kerberosV/lib/hdb/asn1_hdb_entry.c
new file mode 100644
index 00000000000..2061702db5a
--- /dev/null
+++ b/kerberosV/lib/hdb/asn1_hdb_entry.c
@@ -0,0 +1,814 @@
+/* Generated from /usr/src/kerberosV/lib/hdb/../../src/lib/hdb/hdb.asn1 */
+/* Do not edit */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+#include <errno.h>
+#include <krb5_asn1.h>
+#include <hdb_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_hdb_entry(unsigned char *p, size_t len, const hdb_entry *data, size_t *size)
+{
+size_t ret = 0;
+size_t l;
+int i, e;
+
+i = 0;
+if((data)->generation)
+{
+int oldret = ret;
+ret = 0;
+e = encode_GENERATION(p, len, (data)->generation, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 12, &l);
+BACK;
+ret += oldret;
+}
+if((data)->etypes)
+{
+int oldret = ret;
+ret = 0;
+for(i = ((data)->etypes)->len - 1; i >= 0; --i) {
+int oldret = ret;
+ret = 0;
+e = encode_integer(p, len, &((data)->etypes)->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;
+}
+{
+int oldret = ret;
+ret = 0;
+e = encode_HDBFlags(p, len, &(data)->flags, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 10, &l);
+BACK;
+ret += oldret;
+}
+if((data)->max_renew)
+{
+int oldret = ret;
+ret = 0;
+e = encode_integer(p, len, (data)->max_renew, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 9, &l);
+BACK;
+ret += oldret;
+}
+if((data)->max_life)
+{
+int oldret = ret;
+ret = 0;
+e = encode_integer(p, len, (data)->max_life, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 8, &l);
+BACK;
+ret += oldret;
+}
+if((data)->pw_end)
+{
+int oldret = ret;
+ret = 0;
+e = encode_KerberosTime(p, len, (data)->pw_end, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 7, &l);
+BACK;
+ret += oldret;
+}
+if((data)->valid_end)
+{
+int oldret = ret;
+ret = 0;
+e = encode_KerberosTime(p, len, (data)->valid_end, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 6, &l);
+BACK;
+ret += oldret;
+}
+if((data)->valid_start)
+{
+int oldret = ret;
+ret = 0;
+e = encode_KerberosTime(p, len, (data)->valid_start, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 5, &l);
+BACK;
+ret += oldret;
+}
+if((data)->modified_by)
+{
+int oldret = ret;
+ret = 0;
+e = encode_Event(p, len, (data)->modified_by, &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_Event(p, len, &(data)->created_by, &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)->keys)->len - 1; i >= 0; --i) {
+int oldret = ret;
+ret = 0;
+e = encode_Key(p, len, &(&(data)->keys)->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_integer(p, len, &(data)->kvno, &l);
+BACK;
+e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, 1, &l);
+BACK;
+ret += oldret;
+}
+if((data)->principal)
+{
+int oldret = ret;
+ret = 0;
+e = encode_Principal(p, len, (data)->principal, &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_hdb_entry(const unsigned char *p, size_t len, hdb_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)
+(data)->principal = 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)->principal = malloc(sizeof(*(data)->principal));
+if((data)->principal == NULL) return ENOMEM;
+e = decode_Principal(p, len, (data)->principal, &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)->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 = 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)->keys)->len = 0;
+(&(data)->keys)->val = NULL;
+while(ret < origlen) {
+(&(data)->keys)->len++;
+(&(data)->keys)->val = realloc((&(data)->keys)->val, sizeof(*((&(data)->keys)->val)) * (&(data)->keys)->len);
+e = decode_Key(p, len, &(&(data)->keys)->val[(&(data)->keys)->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_Event(p, len, &(data)->created_by, &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)->modified_by = 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)->modified_by = malloc(sizeof(*(data)->modified_by));
+if((data)->modified_by == NULL) return ENOMEM;
+e = decode_Event(p, len, (data)->modified_by, &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)->valid_start = 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)->valid_start = malloc(sizeof(*(data)->valid_start));
+if((data)->valid_start == NULL) return ENOMEM;
+e = decode_KerberosTime(p, len, (data)->valid_start, &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)->valid_end = 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)->valid_end = malloc(sizeof(*(data)->valid_end));
+if((data)->valid_end == NULL) return ENOMEM;
+e = decode_KerberosTime(p, len, (data)->valid_end, &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)->pw_end = 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)->pw_end = malloc(sizeof(*(data)->pw_end));
+if((data)->pw_end == NULL) return ENOMEM;
+e = decode_KerberosTime(p, len, (data)->pw_end, &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)->max_life = 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)->max_life = malloc(sizeof(*(data)->max_life));
+if((data)->max_life == NULL) return ENOMEM;
+e = decode_integer(p, len, (data)->max_life, &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)->max_renew = 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)->max_renew = malloc(sizeof(*(data)->max_renew));
+if((data)->max_renew == NULL) return ENOMEM;
+e = decode_integer(p, len, (data)->max_renew, &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_HDBFlags(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, 11, &l);
+if (e)
+(data)->etypes = 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)->etypes = malloc(sizeof(*(data)->etypes));
+if((data)->etypes == 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)->etypes)->len = 0;
+((data)->etypes)->val = NULL;
+while(ret < origlen) {
+((data)->etypes)->len++;
+((data)->etypes)->val = realloc(((data)->etypes)->val, sizeof(*(((data)->etypes)->val)) * ((data)->etypes)->len);
+e = decode_integer(p, len, &((data)->etypes)->val[((data)->etypes)->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, 12, &l);
+if (e)
+(data)->generation = 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)->generation = malloc(sizeof(*(data)->generation));
+if((data)->generation == NULL) return ENOMEM;
+e = decode_GENERATION(p, len, (data)->generation, &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_hdb_entry(data);
+return e;
+}
+
+void
+free_hdb_entry(hdb_entry *data)
+{
+if((data)->principal) {
+free_Principal((data)->principal);
+free((data)->principal);
+}
+while((&(data)->keys)->len){
+free_Key(&(&(data)->keys)->val[(&(data)->keys)->len-1]);
+(&(data)->keys)->len--;
+}
+free((&(data)->keys)->val);
+free_Event(&(data)->created_by);
+if((data)->modified_by) {
+free_Event((data)->modified_by);
+free((data)->modified_by);
+}
+if((data)->valid_start) {
+free_KerberosTime((data)->valid_start);
+free((data)->valid_start);
+}
+if((data)->valid_end) {
+free_KerberosTime((data)->valid_end);
+free((data)->valid_end);
+}
+if((data)->pw_end) {
+free_KerberosTime((data)->pw_end);
+free((data)->pw_end);
+}
+if((data)->max_life) {
+free((data)->max_life);
+}
+if((data)->max_renew) {
+free((data)->max_renew);
+}
+free_HDBFlags(&(data)->flags);
+if((data)->etypes) {
+while(((data)->etypes)->len){
+((data)->etypes)->len--;
+}
+free(((data)->etypes)->val);
+free((data)->etypes);
+}
+if((data)->generation) {
+free_GENERATION((data)->generation);
+free((data)->generation);
+}
+}
+
+size_t
+length_hdb_entry(const hdb_entry *data)
+{
+size_t ret = 0;
+if((data)->principal){
+int oldret = ret;
+ret = 0;
+ret += length_Principal((data)->principal);
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+ret += length_integer(&(data)->kvno);
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+{
+int oldret = ret;
+int i;
+ret = 0;
+for(i = (&(data)->keys)->len - 1; i >= 0; --i){
+ret += length_Key(&(&(data)->keys)->val[i]);
+}
+ret += 1 + length_len(ret) + oldret;
+}
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+ret += length_Event(&(data)->created_by);
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->modified_by){
+int oldret = ret;
+ret = 0;
+ret += length_Event((data)->modified_by);
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->valid_start){
+int oldret = ret;
+ret = 0;
+ret += length_KerberosTime((data)->valid_start);
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->valid_end){
+int oldret = ret;
+ret = 0;
+ret += length_KerberosTime((data)->valid_end);
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->pw_end){
+int oldret = ret;
+ret = 0;
+ret += length_KerberosTime((data)->pw_end);
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->max_life){
+int oldret = ret;
+ret = 0;
+ret += length_integer((data)->max_life);
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->max_renew){
+int oldret = ret;
+ret = 0;
+ret += length_integer((data)->max_renew);
+ret += 1 + length_len(ret) + oldret;
+}
+{
+int oldret = ret;
+ret = 0;
+ret += length_HDBFlags(&(data)->flags);
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->etypes){
+int oldret = ret;
+ret = 0;
+{
+int oldret = ret;
+int i;
+ret = 0;
+for(i = ((data)->etypes)->len - 1; i >= 0; --i){
+ret += length_integer(&((data)->etypes)->val[i]);
+}
+ret += 1 + length_len(ret) + oldret;
+}
+ret += 1 + length_len(ret) + oldret;
+}
+if((data)->generation){
+int oldret = ret;
+ret = 0;
+ret += length_GENERATION((data)->generation);
+ret += 1 + length_len(ret) + oldret;
+}
+ret += 1 + length_len(ret);
+return ret;
+}
+
+int
+copy_hdb_entry(const hdb_entry *from, hdb_entry *to)
+{
+if((from)->principal) {
+(to)->principal = malloc(sizeof(*(to)->principal));
+if((to)->principal == NULL) return ENOMEM;
+if(copy_Principal((from)->principal, (to)->principal)) return ENOMEM;
+}else
+(to)->principal = NULL;
+*(&(to)->kvno) = *(&(from)->kvno);
+if(((&(to)->keys)->val = malloc((&(from)->keys)->len * sizeof(*(&(to)->keys)->val))) == NULL && (&(from)->keys)->len != 0)
+return ENOMEM;
+for((&(to)->keys)->len = 0; (&(to)->keys)->len < (&(from)->keys)->len; (&(to)->keys)->len++){
+if(copy_Key(&(&(from)->keys)->val[(&(to)->keys)->len], &(&(to)->keys)->val[(&(to)->keys)->len])) return ENOMEM;
+}
+if(copy_Event(&(from)->created_by, &(to)->created_by)) return ENOMEM;
+if((from)->modified_by) {
+(to)->modified_by = malloc(sizeof(*(to)->modified_by));
+if((to)->modified_by == NULL) return ENOMEM;
+if(copy_Event((from)->modified_by, (to)->modified_by)) return ENOMEM;
+}else
+(to)->modified_by = NULL;
+if((from)->valid_start) {
+(to)->valid_start = malloc(sizeof(*(to)->valid_start));
+if((to)->valid_start == NULL) return ENOMEM;
+if(copy_KerberosTime((from)->valid_start, (to)->valid_start)) return ENOMEM;
+}else
+(to)->valid_start = NULL;
+if((from)->valid_end) {
+(to)->valid_end = malloc(sizeof(*(to)->valid_end));
+if((to)->valid_end == NULL) return ENOMEM;
+if(copy_KerberosTime((from)->valid_end, (to)->valid_end)) return ENOMEM;
+}else
+(to)->valid_end = NULL;
+if((from)->pw_end) {
+(to)->pw_end = malloc(sizeof(*(to)->pw_end));
+if((to)->pw_end == NULL) return ENOMEM;
+if(copy_KerberosTime((from)->pw_end, (to)->pw_end)) return ENOMEM;
+}else
+(to)->pw_end = NULL;
+if((from)->max_life) {
+(to)->max_life = malloc(sizeof(*(to)->max_life));
+if((to)->max_life == NULL) return ENOMEM;
+*((to)->max_life) = *((from)->max_life);
+}else
+(to)->max_life = NULL;
+if((from)->max_renew) {
+(to)->max_renew = malloc(sizeof(*(to)->max_renew));
+if((to)->max_renew == NULL) return ENOMEM;
+*((to)->max_renew) = *((from)->max_renew);
+}else
+(to)->max_renew = NULL;
+if(copy_HDBFlags(&(from)->flags, &(to)->flags)) return ENOMEM;
+if((from)->etypes) {
+(to)->etypes = malloc(sizeof(*(to)->etypes));
+if((to)->etypes == NULL) return ENOMEM;
+if((((to)->etypes)->val = malloc(((from)->etypes)->len * sizeof(*((to)->etypes)->val))) == NULL && ((from)->etypes)->len != 0)
+return ENOMEM;
+for(((to)->etypes)->len = 0; ((to)->etypes)->len < ((from)->etypes)->len; ((to)->etypes)->len++){
+*(&((to)->etypes)->val[((to)->etypes)->len]) = *(&((from)->etypes)->val[((to)->etypes)->len]);
+}
+}else
+(to)->etypes = NULL;
+if((from)->generation) {
+(to)->generation = malloc(sizeof(*(to)->generation));
+if((to)->generation == NULL) return ENOMEM;
+if(copy_GENERATION((from)->generation, (to)->generation)) return ENOMEM;
+}else
+(to)->generation = NULL;
+return 0;
+}
+
diff --git a/kerberosV/lib/hdb/hdb_asn1.h b/kerberosV/lib/hdb/hdb_asn1.h
new file mode 100644
index 00000000000..a7b4274106a
--- /dev/null
+++ b/kerberosV/lib/hdb/hdb_asn1.h
@@ -0,0 +1,224 @@
+/* Generated from /usr/src/kerberosV/lib/hdb/../../src/lib/hdb/hdb.asn1 */
+/* Do not edit */
+
+#ifndef __hdb_asn1_h__
+#define __hdb_asn1_h__
+
+#include <stddef.h>
+#include <time.h>
+
+time_t timegm (struct tm*);
+
+#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
+
+enum { HDB_DB_FORMAT = 2 };
+
+enum { hdb_pw_salt = 3 };
+
+enum { hdb_afs3_salt = 10 };
+
+/*
+Salt ::= SEQUENCE {
+ type[0] INTEGER,
+ salt[1] OCTET STRING
+}
+*/
+
+typedef struct Salt {
+ int type;
+ octet_string salt;
+} Salt;
+
+int encode_Salt(unsigned char *, size_t, const Salt *, size_t *);
+int decode_Salt(const unsigned char *, size_t, Salt *, size_t *);
+void free_Salt (Salt *);
+size_t length_Salt(const Salt *);
+int copy_Salt (const Salt *, Salt *);
+
+
+/*
+Key ::= SEQUENCE {
+ mkvno[0] INTEGER OPTIONAL,
+ key[1] EncryptionKey,
+ salt[2] Salt OPTIONAL
+}
+*/
+
+typedef struct Key {
+ int *mkvno;
+ EncryptionKey key;
+ Salt *salt;
+} Key;
+
+int encode_Key(unsigned char *, size_t, const Key *, size_t *);
+int decode_Key(const unsigned char *, size_t, Key *, size_t *);
+void free_Key (Key *);
+size_t length_Key(const Key *);
+int copy_Key (const Key *, Key *);
+
+
+/*
+Event ::= SEQUENCE {
+ time[0] KerberosTime,
+ principal[1] Principal OPTIONAL
+}
+*/
+
+typedef struct Event {
+ KerberosTime time;
+ Principal *principal;
+} Event;
+
+int encode_Event(unsigned char *, size_t, const Event *, size_t *);
+int decode_Event(const unsigned char *, size_t, Event *, size_t *);
+void free_Event (Event *);
+size_t length_Event(const Event *);
+int copy_Event (const Event *, Event *);
+
+
+/*
+HDBFlags ::= BIT STRING {
+ initial(0),
+ forwardable(1),
+ proxiable(2),
+ renewable(3),
+ postdate(4),
+ server(5),
+ client(6),
+ invalid(7),
+ require-preauth(8),
+ change-pw(9),
+ require-hwauth(10),
+ ok-as-delegate(11),
+ user-to-user(12),
+ immutable(13)
+}
+*/
+
+typedef struct HDBFlags {
+ unsigned int initial:1;
+ unsigned int forwardable:1;
+ unsigned int proxiable:1;
+ unsigned int renewable:1;
+ unsigned int postdate:1;
+ unsigned int server:1;
+ unsigned int client:1;
+ unsigned int invalid:1;
+ unsigned int require_preauth:1;
+ unsigned int change_pw:1;
+ unsigned int require_hwauth:1;
+ unsigned int ok_as_delegate:1;
+ unsigned int user_to_user:1;
+ unsigned int immutable:1;
+} HDBFlags;
+
+
+int encode_HDBFlags(unsigned char *, size_t, const HDBFlags *, size_t *);
+int decode_HDBFlags(const unsigned char *, size_t, HDBFlags *, size_t *);
+void free_HDBFlags (HDBFlags *);
+size_t length_HDBFlags(const HDBFlags *);
+int copy_HDBFlags (const HDBFlags *, HDBFlags *);
+unsigned HDBFlags2int(HDBFlags);
+HDBFlags int2HDBFlags(unsigned);
+extern struct units HDBFlags_units[];
+
+/*
+GENERATION ::= SEQUENCE {
+ time[0] KerberosTime,
+ usec[1] INTEGER,
+ gen[2] INTEGER
+}
+*/
+
+typedef struct GENERATION {
+ KerberosTime time;
+ int usec;
+ int gen;
+} GENERATION;
+
+int encode_GENERATION(unsigned char *, size_t, const GENERATION *, size_t *);
+int decode_GENERATION(const unsigned char *, size_t, GENERATION *, size_t *);
+void free_GENERATION (GENERATION *);
+size_t length_GENERATION(const GENERATION *);
+int copy_GENERATION (const GENERATION *, GENERATION *);
+
+
+/*
+hdb_entry ::= SEQUENCE {
+ principal[0] Principal OPTIONAL,
+ kvno[1] INTEGER,
+ keys[2] SEQUENCE OF Key,
+ created-by[3] Event,
+ modified-by[4] Event OPTIONAL,
+ valid-start[5] KerberosTime OPTIONAL,
+ valid-end[6] KerberosTime OPTIONAL,
+ pw-end[7] KerberosTime OPTIONAL,
+ max-life[8] INTEGER OPTIONAL,
+ max-renew[9] INTEGER OPTIONAL,
+ flags[10] HDBFlags,
+ etypes[11] SEQUENCE OF INTEGER OPTIONAL,
+ generation[12] GENERATION OPTIONAL
+}
+*/
+
+typedef struct hdb_entry {
+ Principal *principal;
+ int kvno;
+ struct {
+ unsigned int len;
+ Key *val;
+ } keys;
+ Event created_by;
+ Event *modified_by;
+ KerberosTime *valid_start;
+ KerberosTime *valid_end;
+ KerberosTime *pw_end;
+ int *max_life;
+ int *max_renew;
+ HDBFlags flags;
+ struct {
+ unsigned int len;
+ int *val;
+ } *etypes;
+ GENERATION *generation;
+} hdb_entry;
+
+int encode_hdb_entry(unsigned char *, size_t, const hdb_entry *, size_t *);
+int decode_hdb_entry(const unsigned char *, size_t, hdb_entry *, size_t *);
+void free_hdb_entry (hdb_entry *);
+size_t length_hdb_entry(const hdb_entry *);
+int copy_hdb_entry (const hdb_entry *, hdb_entry *);
+
+
+#endif /* __hdb_asn1_h__ */