From: Theodore Tso Date: Wed, 8 Nov 1995 07:43:46 +0000 (+0000) Subject: * krb5_decode_test.c (main): Add tests for decode_krb5_enc_data X-Git-Tag: krb5-1.0-beta6~847 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=d97f074a5db625995ad7a4371467082d65027c26;p=krb5.git * krb5_decode_test.c (main): Add tests for decode_krb5_enc_data and decode_krb5_pa_enc_ts. * krb5_encode_test.c (main): Add tests for encode_krb5_enc_data and encode_krb5_pa_enc_ts. * ktest.c (ktest_make_sample_pa_enc_ts): New functions to test {encode,decode}_krb5_pa_enc_ts(). * ktest_equal.c (ktest_equal_krb5_pa_enc_ts): New functions to test {encode,decode}_krb5_pa_enc_ts(). git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@7052 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/tests/asn.1/ChangeLog b/src/tests/asn.1/ChangeLog index 62f4e6151..837279e3b 100644 --- a/src/tests/asn.1/ChangeLog +++ b/src/tests/asn.1/ChangeLog @@ -1,8 +1,22 @@ +Tue Oct 31 21:30:28 1995 Theodore Y. Ts'o + + * krb5_decode_test.c (main): Add tests for + decode_krb5_enc_data and decode_krb5_pa_enc_ts. + + * krb5_encode_test.c (main): Add tests for + encode_krb5_enc_data and encode_krb5_pa_enc_ts. + + * ktest.c (ktest_make_sample_pa_enc_ts): New functions to + test {encode,decode}_krb5_pa_enc_ts(). + + * ktest_equal.c (ktest_equal_krb5_pa_enc_ts): New functions to test + {encode,decode}_krb5_pa_enc_ts(). + Sun Oct 15 10:51:22 1995 * ktest.c (ktest_make_sample_alt_method, - ktest_make_sample_etype_info): Fixed signed/unsinged - -Wall flame. + ktest_make_sample_etype_info): Fixed signed/unsinged -Wall + flame. Fri Sep 29 14:23:47 1995 Theodore Y. Ts'o diff --git a/src/tests/asn.1/krb5_decode_test.c b/src/tests/asn.1/krb5_decode_test.c index f33b242d7..10b4b606e 100644 --- a/src/tests/asn.1/krb5_decode_test.c +++ b/src/tests/asn.1/krb5_decode_test.c @@ -459,6 +459,21 @@ void main() ktest_destroy_etype_info(ref); } + /****************************************************************/ + /* decode_pa_enc_ts */ + { + setup(krb5_pa_enc_ts,"krb5_pa_enc_ts",ktest_make_sample_pa_enc_ts); + decode_run("pa_enc_ts","","30 1A A0 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A1 05 02 03 01 E2 40",decode_krb5_pa_enc_ts,ktest_equal_krb5_pa_enc_ts); + ref.pausec = 0; + decode_run("pa_enc_ts (no usec)","","30 13 A0 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A",decode_krb5_pa_enc_ts,ktest_equal_krb5_pa_enc_ts); + } + + /****************************************************************/ + /* decode_enc_data */ + { + setup(krb5_enc_data,"krb5_enc_data",ktest_make_sample_enc_data); + decode_run("enc_data","","30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65",decode_krb5_enc_data,ktest_equal_enc_data); + } exit(error_count); } diff --git a/src/tests/asn.1/krb5_encode_test.c b/src/tests/asn.1/krb5_encode_test.c index 9262a5742..ca18a8812 100644 --- a/src/tests/asn.1/krb5_encode_test.c +++ b/src/tests/asn.1/krb5_encode_test.c @@ -496,6 +496,25 @@ void main(argc, argv) free(info); } + + /****************************************************************/ + /* encode_pa_enc_ts */ + { + krb5_pa_enc_ts pa_enc; + setup(pa_enc,krb5_pa_enc_ts,"pa_enc_ts",ktest_make_sample_pa_enc_ts); + encode_run(pa_enc,krb5_pa_enc_ts,"pa_enc_ts","",encode_krb5_pa_enc_ts); + pa_enc.pausec = 0; + encode_run(pa_enc,krb5_pa_enc_ts,"pa_enc_ts (no usec)","",encode_krb5_pa_enc_ts); + } + + /****************************************************************/ + /* encode_enc_data */ + { + krb5_enc_data enc_data; + setup(enc_data,krb5_enc_data,"enc_data",ktest_make_sample_enc_data); + encode_run(enc_data,krb5_enc_data,"enc_data","",encode_krb5_enc_data); + } + exit(error_count); } diff --git a/src/tests/asn.1/ktest.c b/src/tests/asn.1/ktest.c index 666d0d35a..a995d1d99 100644 --- a/src/tests/asn.1/ktest.c +++ b/src/tests/asn.1/ktest.c @@ -689,6 +689,15 @@ memfail: return ENOMEM; } +krb5_error_code ktest_make_sample_pa_enc_ts(pa_enc) + krb5_pa_enc_ts * pa_enc; +{ + pa_enc->patimestamp = SAMPLE_TIME; + pa_enc->pausec = SAMPLE_USEC; + + return 0; +} + /****************************************************************/ /* destructors */ diff --git a/src/tests/asn.1/ktest.h b/src/tests/asn.1/ktest.h index 59c07ccfb..87ba0db62 100644 --- a/src/tests/asn.1/ktest.h +++ b/src/tests/asn.1/ktest.h @@ -89,6 +89,8 @@ krb5_error_code ktest_make_sample_alt_method krb5_error_code ktest_make_sample_etype_info KRB5_PROTOTYPE((krb5_etype_info_entry *** p)); +krb5_error_code ktest_make_sample_pa_enc_ts + KRB5_PROTOTYPE((krb5_pa_enc_ts *am)); /*----------------------------------------------------------------------*/ diff --git a/src/tests/asn.1/ktest_equal.c b/src/tests/asn.1/ktest_equal.c index 25e139f1a..d6bf62201 100644 --- a/src/tests/asn.1/ktest_equal.c +++ b/src/tests/asn.1/ktest_equal.c @@ -491,6 +491,18 @@ int ktest_equal_krb5_etype_info_entry(ref, var) return TRUE; } +int ktest_equal_krb5_pa_enc_ts(ref, var) + krb5_pa_enc_ts *ref; + krb5_pa_enc_ts *var; +{ + int p=TRUE; + if(ref==var) return TRUE; + else if(ref == NULL || var == NULL) return FALSE; + p=p&&scalar_equal(patimestamp); + p=p&&scalar_equal(pausec); + return p; +} + /**** arrays ****************************************************************/ int ktest_equal_array_of_data(length, ref, var) diff --git a/src/tests/asn.1/ktest_equal.h b/src/tests/asn.1/ktest_equal.h index 375cc546d..9f9d5cb90 100644 --- a/src/tests/asn.1/ktest_equal.h +++ b/src/tests/asn.1/ktest_equal.h @@ -53,6 +53,7 @@ generic(ktest_equal_encryption_key,krb5_keyblock); generic(ktest_equal_passwd_phrase_element,passwd_phrase_element); generic(ktest_equal_krb5_pwd_data,krb5_pwd_data); generic(ktest_equal_krb5_alt_method,krb5_alt_method); +generic(ktest_equal_krb5_pa_enc_ts,krb5_pa_enc_ts); int ktest_equal_last_req KRB5_PROTOTYPE((krb5_last_req_entry **ref, krb5_last_req_entry **var));