summaryrefslogtreecommitdiffstats
path: root/src/tests
diff options
context:
space:
mode:
authorGreg Hudson <ghudson@mit.edu>2012-02-11 23:25:25 +0000
committerGreg Hudson <ghudson@mit.edu>2012-02-11 23:25:25 +0000
commit9f23e1a8133c11bff4ef5f41cb44d28041320a76 (patch)
tree0117414b7f978bf5e03a65f8886af9ccbc5e3b66 /src/tests
parent0af4df0af5fb856419681e8d259a5229c59e361f (diff)
downloadkrb5-9f23e1a8133c11bff4ef5f41cb44d28041320a76.tar.gz
krb5-9f23e1a8133c11bff4ef5f41cb44d28041320a76.tar.xz
krb5-9f23e1a8133c11bff4ef5f41cb44d28041320a76.zip
Data-driven ASN.1 decoder
Add a general ASN.1 decoder implementation in asn1_encode.c using the same data structures as the encoder (augmented where necessary), and use it to define decoder functions in asn1_k_encode.c. Add a boolean type to atype_info, as it is needed for the pa_pac_req decoder. For the moment, just #if out the old decoder functions; they and their support code can be cleaned up later after a a few remaining utility functions are addressed. Changes to encoder and decoder interfaces are minimized, but there are two small ones. ldap_seqof_key_data has a kvno field added, and some of the decoder logic is pushed up into the caller. The safe_with_body decoder now outputs an allocated krb5_data * instead of a krb5_data with aliases into the input buffer. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25693 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/asn.1/ktest.c3
-rw-r--r--src/tests/asn.1/ktest_equal.c3
2 files changed, 2 insertions, 4 deletions
diff --git a/src/tests/asn.1/ktest.c b/src/tests/asn.1/ktest.c
index 6963c018cf..e3e7839266 100644
--- a/src/tests/asn.1/ktest.c
+++ b/src/tests/asn.1/ktest.c
@@ -808,8 +808,6 @@ ktest_make_sample_key_data(krb5_key_data *p, int i)
char *str;
int len;
- p->key_data_ver = 2;
- p->key_data_kvno = 42;
len = asprintf(&str, "key%d", i);
if (len < 0)
abort();
@@ -832,6 +830,7 @@ ktest_make_sample_ldap_seqof_key_data(ldap_seqof_key_data *p)
p->mkvno = 14;
p->n_key_data = 3;
p->key_data = calloc(3,sizeof(krb5_key_data));
+ p->kvno = 42;
for (i = 0; i < 3; i++)
ktest_make_sample_key_data(&p->key_data[i], i);
}
diff --git a/src/tests/asn.1/ktest_equal.c b/src/tests/asn.1/ktest_equal.c
index 0418e5dafa..6953708cac 100644
--- a/src/tests/asn.1/ktest_equal.c
+++ b/src/tests/asn.1/ktest_equal.c
@@ -620,8 +620,6 @@ equal_key_data(krb5_key_data *ref, krb5_key_data *var)
int p = TRUE;
if (ref == var) return TRUE;
else if (ref == NULL || var == NULL) return FALSE;
- p = p && scalar_equal(key_data_ver);
- p = p && scalar_equal(key_data_kvno);
p = p && scalar_equal(key_data_type[0]);
p = p && scalar_equal(key_data_type[1]);
p = p && len_equal(key_data_length[0],key_data_contents[0],
@@ -649,6 +647,7 @@ ktest_equal_ldap_sequence_of_keys(ldap_seqof_key_data *ref,
if (ref == var) return TRUE;
else if (ref == NULL || var == NULL) return FALSE;
p = p && scalar_equal(mkvno);
+ p = p && scalar_equal(kvno);
p = p && len_equal(n_key_data,key_data,equal_key_data_array);
return p;
}