1*7f2fe78bSCy Schubert /* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2*7f2fe78bSCy Schubert /* tests/asn.1/krb5_encode_test.c */
3*7f2fe78bSCy Schubert /*
4*7f2fe78bSCy Schubert * Copyright (C) 1994 by the Massachusetts Institute of Technology.
5*7f2fe78bSCy Schubert * All rights reserved.
6*7f2fe78bSCy Schubert *
7*7f2fe78bSCy Schubert * Export of this software from the United States of America may
8*7f2fe78bSCy Schubert * require a specific license from the United States Government.
9*7f2fe78bSCy Schubert * It is the responsibility of any person or organization contemplating
10*7f2fe78bSCy Schubert * export to obtain such a license before exporting.
11*7f2fe78bSCy Schubert *
12*7f2fe78bSCy Schubert * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
13*7f2fe78bSCy Schubert * distribute this software and its documentation for any purpose and
14*7f2fe78bSCy Schubert * without fee is hereby granted, provided that the above copyright
15*7f2fe78bSCy Schubert * notice appear in all copies and that both that copyright notice and
16*7f2fe78bSCy Schubert * this permission notice appear in supporting documentation, and that
17*7f2fe78bSCy Schubert * the name of M.I.T. not be used in advertising or publicity pertaining
18*7f2fe78bSCy Schubert * to distribution of the software without specific, written prior
19*7f2fe78bSCy Schubert * permission. Furthermore if you modify this software you must label
20*7f2fe78bSCy Schubert * your software as modified software and not distribute it in such a
21*7f2fe78bSCy Schubert * fashion that it might be confused with the original M.I.T. software.
22*7f2fe78bSCy Schubert * M.I.T. makes no representations about the suitability of
23*7f2fe78bSCy Schubert * this software for any purpose. It is provided "as is" without express
24*7f2fe78bSCy Schubert * or implied warranty.
25*7f2fe78bSCy Schubert */
26*7f2fe78bSCy Schubert
27*7f2fe78bSCy Schubert #include "k5-int.h"
28*7f2fe78bSCy Schubert #include "com_err.h"
29*7f2fe78bSCy Schubert #include "utility.h"
30*7f2fe78bSCy Schubert
31*7f2fe78bSCy Schubert #include "ktest.h"
32*7f2fe78bSCy Schubert #include "debug.h"
33*7f2fe78bSCy Schubert
34*7f2fe78bSCy Schubert extern int current_appl_type;
35*7f2fe78bSCy Schubert
36*7f2fe78bSCy Schubert krb5_context test_context;
37*7f2fe78bSCy Schubert int error_count = 0;
38*7f2fe78bSCy Schubert int do_trval = 0;
39*7f2fe78bSCy Schubert int first_trval = 1;
40*7f2fe78bSCy Schubert int trval2();
41*7f2fe78bSCy Schubert
42*7f2fe78bSCy Schubert static void
encoder_print_results(krb5_data * code,char * typestring,char * description)43*7f2fe78bSCy Schubert encoder_print_results(krb5_data *code, char *typestring, char *description)
44*7f2fe78bSCy Schubert {
45*7f2fe78bSCy Schubert char *code_string = NULL;
46*7f2fe78bSCy Schubert int r, rlen;
47*7f2fe78bSCy Schubert
48*7f2fe78bSCy Schubert if (do_trval) {
49*7f2fe78bSCy Schubert if (first_trval)
50*7f2fe78bSCy Schubert first_trval = 0;
51*7f2fe78bSCy Schubert else
52*7f2fe78bSCy Schubert printf("\n");
53*7f2fe78bSCy Schubert printf("encode_krb5_%s%s:\n", typestring, description);
54*7f2fe78bSCy Schubert r = trval2(stdout, code->data, code->length, 0, &rlen);
55*7f2fe78bSCy Schubert printf("\n");
56*7f2fe78bSCy Schubert if (rlen < 0 || (unsigned int) rlen != code->length) {
57*7f2fe78bSCy Schubert printf("Error: length mismatch: was %d, parsed %d\n",
58*7f2fe78bSCy Schubert code->length, rlen);
59*7f2fe78bSCy Schubert exit(1);
60*7f2fe78bSCy Schubert }
61*7f2fe78bSCy Schubert if (r != 0) {
62*7f2fe78bSCy Schubert printf("Error: Return from trval2 is %d.\n", r);
63*7f2fe78bSCy Schubert exit(1);
64*7f2fe78bSCy Schubert }
65*7f2fe78bSCy Schubert current_appl_type = -1; /* Reset type */
66*7f2fe78bSCy Schubert } else {
67*7f2fe78bSCy Schubert asn1_krb5_data_unparse(code,&(code_string));
68*7f2fe78bSCy Schubert printf("encode_krb5_%s%s: %s\n", typestring, description,
69*7f2fe78bSCy Schubert code_string);
70*7f2fe78bSCy Schubert free(code_string);
71*7f2fe78bSCy Schubert }
72*7f2fe78bSCy Schubert ktest_destroy_data(&code);
73*7f2fe78bSCy Schubert }
74*7f2fe78bSCy Schubert
PRS(argc,argv)75*7f2fe78bSCy Schubert static void PRS(argc, argv)
76*7f2fe78bSCy Schubert int argc;
77*7f2fe78bSCy Schubert char **argv;
78*7f2fe78bSCy Schubert {
79*7f2fe78bSCy Schubert extern char *optarg;
80*7f2fe78bSCy Schubert int optchar;
81*7f2fe78bSCy Schubert extern int print_types, print_krb5_types, print_id_and_len,
82*7f2fe78bSCy Schubert print_constructed_length, print_skip_context,
83*7f2fe78bSCy Schubert print_skip_tagnum, print_context_shortcut;
84*7f2fe78bSCy Schubert
85*7f2fe78bSCy Schubert while ((optchar = getopt(argc, argv, "tp:")) != -1) {
86*7f2fe78bSCy Schubert switch(optchar) {
87*7f2fe78bSCy Schubert case 't':
88*7f2fe78bSCy Schubert do_trval = 1;
89*7f2fe78bSCy Schubert break;
90*7f2fe78bSCy Schubert case 'p':
91*7f2fe78bSCy Schubert sample_principal_name = optarg;
92*7f2fe78bSCy Schubert break;
93*7f2fe78bSCy Schubert case '?':
94*7f2fe78bSCy Schubert default:
95*7f2fe78bSCy Schubert fprintf(stderr, "Usage: %s [-t] [-p principal]\n",
96*7f2fe78bSCy Schubert argv[0]);
97*7f2fe78bSCy Schubert exit(1);
98*7f2fe78bSCy Schubert }
99*7f2fe78bSCy Schubert }
100*7f2fe78bSCy Schubert print_types = 1;
101*7f2fe78bSCy Schubert print_krb5_types = 1;
102*7f2fe78bSCy Schubert print_id_and_len = 0;
103*7f2fe78bSCy Schubert print_constructed_length = 0;
104*7f2fe78bSCy Schubert print_skip_context = 1;
105*7f2fe78bSCy Schubert print_skip_tagnum = 1;
106*7f2fe78bSCy Schubert print_context_shortcut = 1;
107*7f2fe78bSCy Schubert }
108*7f2fe78bSCy Schubert
109*7f2fe78bSCy Schubert int
main(argc,argv)110*7f2fe78bSCy Schubert main(argc, argv)
111*7f2fe78bSCy Schubert int argc;
112*7f2fe78bSCy Schubert char **argv;
113*7f2fe78bSCy Schubert {
114*7f2fe78bSCy Schubert krb5_data *code;
115*7f2fe78bSCy Schubert krb5_error_code retval;
116*7f2fe78bSCy Schubert
117*7f2fe78bSCy Schubert PRS(argc, argv);
118*7f2fe78bSCy Schubert
119*7f2fe78bSCy Schubert retval = krb5_init_context(&test_context);
120*7f2fe78bSCy Schubert if (retval) {
121*7f2fe78bSCy Schubert com_err(argv[0], retval, "while initializing krb5");
122*7f2fe78bSCy Schubert exit(1);
123*7f2fe78bSCy Schubert }
124*7f2fe78bSCy Schubert init_access(argv[0]);
125*7f2fe78bSCy Schubert
126*7f2fe78bSCy Schubert #define encode_run(value,typestring,description,encoder) \
127*7f2fe78bSCy Schubert retval = encoder(&(value),&(code)); \
128*7f2fe78bSCy Schubert if (retval) { \
129*7f2fe78bSCy Schubert com_err("krb5_encode_test", retval,"while encoding %s", typestring); \
130*7f2fe78bSCy Schubert exit(1); \
131*7f2fe78bSCy Schubert } \
132*7f2fe78bSCy Schubert encoder_print_results(code, typestring, description);
133*7f2fe78bSCy Schubert
134*7f2fe78bSCy Schubert /****************************************************************/
135*7f2fe78bSCy Schubert /* encode_krb5_authenticator */
136*7f2fe78bSCy Schubert {
137*7f2fe78bSCy Schubert krb5_authenticator authent;
138*7f2fe78bSCy Schubert ktest_make_sample_authenticator(&authent);
139*7f2fe78bSCy Schubert
140*7f2fe78bSCy Schubert encode_run(authent, "authenticator", "", encode_krb5_authenticator);
141*7f2fe78bSCy Schubert
142*7f2fe78bSCy Schubert ktest_destroy_checksum(&(authent.checksum));
143*7f2fe78bSCy Schubert ktest_destroy_keyblock(&(authent.subkey));
144*7f2fe78bSCy Schubert authent.seq_number = 0;
145*7f2fe78bSCy Schubert ktest_empty_authorization_data(authent.authorization_data);
146*7f2fe78bSCy Schubert encode_run(authent, "authenticator", "(optionals empty)",
147*7f2fe78bSCy Schubert encode_krb5_authenticator);
148*7f2fe78bSCy Schubert
149*7f2fe78bSCy Schubert ktest_destroy_authorization_data(&(authent.authorization_data));
150*7f2fe78bSCy Schubert encode_run(authent, "authenticator", "(optionals NULL)",
151*7f2fe78bSCy Schubert encode_krb5_authenticator);
152*7f2fe78bSCy Schubert ktest_empty_authenticator(&authent);
153*7f2fe78bSCy Schubert }
154*7f2fe78bSCy Schubert
155*7f2fe78bSCy Schubert /****************************************************************/
156*7f2fe78bSCy Schubert /* encode_krb5_ticket */
157*7f2fe78bSCy Schubert {
158*7f2fe78bSCy Schubert krb5_ticket tkt;
159*7f2fe78bSCy Schubert ktest_make_sample_ticket(&tkt);
160*7f2fe78bSCy Schubert encode_run(tkt, "ticket", "", encode_krb5_ticket);
161*7f2fe78bSCy Schubert ktest_empty_ticket(&tkt);
162*7f2fe78bSCy Schubert }
163*7f2fe78bSCy Schubert
164*7f2fe78bSCy Schubert /****************************************************************/
165*7f2fe78bSCy Schubert /* encode_krb5_encryption_key */
166*7f2fe78bSCy Schubert {
167*7f2fe78bSCy Schubert krb5_keyblock keyblk;
168*7f2fe78bSCy Schubert ktest_make_sample_keyblock(&keyblk);
169*7f2fe78bSCy Schubert current_appl_type = 1005;
170*7f2fe78bSCy Schubert encode_run(keyblk, "keyblock", "", encode_krb5_encryption_key);
171*7f2fe78bSCy Schubert ktest_empty_keyblock(&keyblk);
172*7f2fe78bSCy Schubert }
173*7f2fe78bSCy Schubert
174*7f2fe78bSCy Schubert /****************************************************************/
175*7f2fe78bSCy Schubert /* encode_krb5_enc_tkt_part */
176*7f2fe78bSCy Schubert {
177*7f2fe78bSCy Schubert krb5_ticket tkt;
178*7f2fe78bSCy Schubert memset(&tkt, 0, sizeof(krb5_ticket));
179*7f2fe78bSCy Schubert tkt.enc_part2 = ealloc(sizeof(krb5_enc_tkt_part));
180*7f2fe78bSCy Schubert ktest_make_sample_enc_tkt_part(tkt.enc_part2);
181*7f2fe78bSCy Schubert
182*7f2fe78bSCy Schubert encode_run(*tkt.enc_part2, "enc_tkt_part", "",
183*7f2fe78bSCy Schubert encode_krb5_enc_tkt_part);
184*7f2fe78bSCy Schubert
185*7f2fe78bSCy Schubert tkt.enc_part2->times.starttime = 0;
186*7f2fe78bSCy Schubert tkt.enc_part2->times.renew_till = 0;
187*7f2fe78bSCy Schubert ktest_destroy_address(&(tkt.enc_part2->caddrs[1]));
188*7f2fe78bSCy Schubert ktest_destroy_address(&(tkt.enc_part2->caddrs[0]));
189*7f2fe78bSCy Schubert ktest_destroy_authdata(&(tkt.enc_part2->authorization_data[1]));
190*7f2fe78bSCy Schubert ktest_destroy_authdata(&(tkt.enc_part2->authorization_data[0]));
191*7f2fe78bSCy Schubert
192*7f2fe78bSCy Schubert /* ISODE version fails on the empty caddrs field */
193*7f2fe78bSCy Schubert ktest_destroy_addresses(&(tkt.enc_part2->caddrs));
194*7f2fe78bSCy Schubert ktest_destroy_authorization_data(&(tkt.enc_part2->authorization_data));
195*7f2fe78bSCy Schubert
196*7f2fe78bSCy Schubert encode_run(*tkt.enc_part2, "enc_tkt_part", "(optionals NULL)",
197*7f2fe78bSCy Schubert encode_krb5_enc_tkt_part);
198*7f2fe78bSCy Schubert ktest_empty_ticket(&tkt);
199*7f2fe78bSCy Schubert }
200*7f2fe78bSCy Schubert
201*7f2fe78bSCy Schubert /****************************************************************/
202*7f2fe78bSCy Schubert /* encode_krb5_enc_kdc_rep_part */
203*7f2fe78bSCy Schubert {
204*7f2fe78bSCy Schubert krb5_kdc_rep kdcr;
205*7f2fe78bSCy Schubert
206*7f2fe78bSCy Schubert memset(&kdcr, 0, sizeof(kdcr));
207*7f2fe78bSCy Schubert
208*7f2fe78bSCy Schubert kdcr.enc_part2 = ealloc(sizeof(krb5_enc_kdc_rep_part));
209*7f2fe78bSCy Schubert ktest_make_sample_enc_kdc_rep_part(kdcr.enc_part2);
210*7f2fe78bSCy Schubert
211*7f2fe78bSCy Schubert encode_run(*kdcr.enc_part2, "enc_kdc_rep_part", "",
212*7f2fe78bSCy Schubert encode_krb5_enc_kdc_rep_part);
213*7f2fe78bSCy Schubert
214*7f2fe78bSCy Schubert kdcr.enc_part2->key_exp = 0;
215*7f2fe78bSCy Schubert kdcr.enc_part2->times.starttime = 0;
216*7f2fe78bSCy Schubert kdcr.enc_part2->flags &= ~TKT_FLG_RENEWABLE;
217*7f2fe78bSCy Schubert ktest_destroy_addresses(&(kdcr.enc_part2->caddrs));
218*7f2fe78bSCy Schubert
219*7f2fe78bSCy Schubert encode_run(*kdcr.enc_part2, "enc_kdc_rep_part", "(optionals NULL)",
220*7f2fe78bSCy Schubert encode_krb5_enc_kdc_rep_part);
221*7f2fe78bSCy Schubert
222*7f2fe78bSCy Schubert ktest_empty_kdc_rep(&kdcr);
223*7f2fe78bSCy Schubert }
224*7f2fe78bSCy Schubert
225*7f2fe78bSCy Schubert /****************************************************************/
226*7f2fe78bSCy Schubert /* encode_krb5_as_rep */
227*7f2fe78bSCy Schubert {
228*7f2fe78bSCy Schubert krb5_kdc_rep kdcr;
229*7f2fe78bSCy Schubert ktest_make_sample_kdc_rep(&kdcr);
230*7f2fe78bSCy Schubert
231*7f2fe78bSCy Schubert /* kdcr.msg_type = KRB5_TGS_REP;
232*7f2fe78bSCy Schubert test(encode_krb5_as_rep(&kdcr,&code) == KRB5_BADMSGTYPE,
233*7f2fe78bSCy Schubert "encode_krb5_as_rep type check\n");
234*7f2fe78bSCy Schubert ktest_destroy_data(&code);*/
235*7f2fe78bSCy Schubert
236*7f2fe78bSCy Schubert kdcr.msg_type = KRB5_AS_REP;
237*7f2fe78bSCy Schubert encode_run(kdcr, "as_rep", "", encode_krb5_as_rep);
238*7f2fe78bSCy Schubert
239*7f2fe78bSCy Schubert ktest_destroy_pa_data_array(&(kdcr.padata));
240*7f2fe78bSCy Schubert encode_run(kdcr, "as_rep", "(optionals NULL)", encode_krb5_as_rep);
241*7f2fe78bSCy Schubert
242*7f2fe78bSCy Schubert ktest_empty_kdc_rep(&kdcr);
243*7f2fe78bSCy Schubert
244*7f2fe78bSCy Schubert }
245*7f2fe78bSCy Schubert
246*7f2fe78bSCy Schubert /****************************************************************/
247*7f2fe78bSCy Schubert /* encode_krb5_tgs_rep */
248*7f2fe78bSCy Schubert {
249*7f2fe78bSCy Schubert krb5_kdc_rep kdcr;
250*7f2fe78bSCy Schubert ktest_make_sample_kdc_rep(&kdcr);
251*7f2fe78bSCy Schubert
252*7f2fe78bSCy Schubert /* kdcr.msg_type = KRB5_AS_REP;
253*7f2fe78bSCy Schubert test(encode_krb5_tgs_rep(&kdcr,&code) == KRB5_BADMSGTYPE,
254*7f2fe78bSCy Schubert "encode_krb5_tgs_rep type check\n");*/
255*7f2fe78bSCy Schubert
256*7f2fe78bSCy Schubert kdcr.msg_type = KRB5_TGS_REP;
257*7f2fe78bSCy Schubert encode_run(kdcr, "tgs_rep", "", encode_krb5_tgs_rep);
258*7f2fe78bSCy Schubert
259*7f2fe78bSCy Schubert ktest_destroy_pa_data_array(&(kdcr.padata));
260*7f2fe78bSCy Schubert encode_run(kdcr, "tgs_rep", "(optionals NULL)", encode_krb5_tgs_rep);
261*7f2fe78bSCy Schubert
262*7f2fe78bSCy Schubert ktest_empty_kdc_rep(&kdcr);
263*7f2fe78bSCy Schubert
264*7f2fe78bSCy Schubert }
265*7f2fe78bSCy Schubert
266*7f2fe78bSCy Schubert /****************************************************************/
267*7f2fe78bSCy Schubert /* encode_krb5_ap_req */
268*7f2fe78bSCy Schubert {
269*7f2fe78bSCy Schubert krb5_ap_req apreq;
270*7f2fe78bSCy Schubert ktest_make_sample_ap_req(&apreq);
271*7f2fe78bSCy Schubert encode_run(apreq, "ap_req", "", encode_krb5_ap_req);
272*7f2fe78bSCy Schubert ktest_empty_ap_req(&apreq);
273*7f2fe78bSCy Schubert }
274*7f2fe78bSCy Schubert
275*7f2fe78bSCy Schubert /****************************************************************/
276*7f2fe78bSCy Schubert /* encode_krb5_ap_rep */
277*7f2fe78bSCy Schubert {
278*7f2fe78bSCy Schubert krb5_ap_rep aprep;
279*7f2fe78bSCy Schubert ktest_make_sample_ap_rep(&aprep);
280*7f2fe78bSCy Schubert encode_run(aprep, "ap_rep", "", encode_krb5_ap_rep);
281*7f2fe78bSCy Schubert ktest_empty_ap_rep(&aprep);
282*7f2fe78bSCy Schubert }
283*7f2fe78bSCy Schubert
284*7f2fe78bSCy Schubert /****************************************************************/
285*7f2fe78bSCy Schubert /* encode_krb5_ap_rep_enc_part */
286*7f2fe78bSCy Schubert {
287*7f2fe78bSCy Schubert krb5_ap_rep_enc_part apenc;
288*7f2fe78bSCy Schubert ktest_make_sample_ap_rep_enc_part(&apenc);
289*7f2fe78bSCy Schubert encode_run(apenc, "ap_rep_enc_part", "", encode_krb5_ap_rep_enc_part);
290*7f2fe78bSCy Schubert
291*7f2fe78bSCy Schubert ktest_destroy_keyblock(&(apenc.subkey));
292*7f2fe78bSCy Schubert apenc.seq_number = 0;
293*7f2fe78bSCy Schubert encode_run(apenc, "ap_rep_enc_part", "(optionals NULL)",
294*7f2fe78bSCy Schubert encode_krb5_ap_rep_enc_part);
295*7f2fe78bSCy Schubert ktest_empty_ap_rep_enc_part(&apenc);
296*7f2fe78bSCy Schubert }
297*7f2fe78bSCy Schubert
298*7f2fe78bSCy Schubert /****************************************************************/
299*7f2fe78bSCy Schubert /* encode_krb5_as_req */
300*7f2fe78bSCy Schubert {
301*7f2fe78bSCy Schubert krb5_kdc_req asreq;
302*7f2fe78bSCy Schubert ktest_make_sample_kdc_req(&asreq);
303*7f2fe78bSCy Schubert asreq.msg_type = KRB5_AS_REQ;
304*7f2fe78bSCy Schubert asreq.kdc_options &= ~KDC_OPT_ENC_TKT_IN_SKEY;
305*7f2fe78bSCy Schubert encode_run(asreq, "as_req", "", encode_krb5_as_req);
306*7f2fe78bSCy Schubert
307*7f2fe78bSCy Schubert ktest_destroy_pa_data_array(&(asreq.padata));
308*7f2fe78bSCy Schubert ktest_destroy_principal(&(asreq.client));
309*7f2fe78bSCy Schubert #ifndef ISODE_SUCKS
310*7f2fe78bSCy Schubert ktest_destroy_principal(&(asreq.server));
311*7f2fe78bSCy Schubert #endif
312*7f2fe78bSCy Schubert asreq.kdc_options |= KDC_OPT_ENC_TKT_IN_SKEY;
313*7f2fe78bSCy Schubert asreq.from = 0;
314*7f2fe78bSCy Schubert asreq.rtime = 0;
315*7f2fe78bSCy Schubert ktest_destroy_addresses(&(asreq.addresses));
316*7f2fe78bSCy Schubert ktest_destroy_enc_data(&(asreq.authorization_data));
317*7f2fe78bSCy Schubert encode_run(asreq, "as_req", "(optionals NULL except second_ticket)",
318*7f2fe78bSCy Schubert encode_krb5_as_req);
319*7f2fe78bSCy Schubert ktest_destroy_sequence_of_ticket(&(asreq.second_ticket));
320*7f2fe78bSCy Schubert #ifndef ISODE_SUCKS
321*7f2fe78bSCy Schubert ktest_make_sample_principal(&(asreq.server));
322*7f2fe78bSCy Schubert #endif
323*7f2fe78bSCy Schubert asreq.kdc_options &= ~KDC_OPT_ENC_TKT_IN_SKEY;
324*7f2fe78bSCy Schubert encode_run(asreq, "as_req", "(optionals NULL except server)",
325*7f2fe78bSCy Schubert encode_krb5_as_req);
326*7f2fe78bSCy Schubert ktest_empty_kdc_req(&asreq);
327*7f2fe78bSCy Schubert }
328*7f2fe78bSCy Schubert
329*7f2fe78bSCy Schubert /****************************************************************/
330*7f2fe78bSCy Schubert /* encode_krb5_tgs_req */
331*7f2fe78bSCy Schubert {
332*7f2fe78bSCy Schubert krb5_kdc_req tgsreq;
333*7f2fe78bSCy Schubert ktest_make_sample_kdc_req(&tgsreq);
334*7f2fe78bSCy Schubert tgsreq.msg_type = KRB5_TGS_REQ;
335*7f2fe78bSCy Schubert tgsreq.kdc_options &= ~KDC_OPT_ENC_TKT_IN_SKEY;
336*7f2fe78bSCy Schubert encode_run(tgsreq, "tgs_req", "", encode_krb5_tgs_req);
337*7f2fe78bSCy Schubert
338*7f2fe78bSCy Schubert ktest_destroy_pa_data_array(&(tgsreq.padata));
339*7f2fe78bSCy Schubert ktest_destroy_principal(&(tgsreq.client));
340*7f2fe78bSCy Schubert #ifndef ISODE_SUCKS
341*7f2fe78bSCy Schubert ktest_destroy_principal(&(tgsreq.server));
342*7f2fe78bSCy Schubert #endif
343*7f2fe78bSCy Schubert tgsreq.kdc_options |= KDC_OPT_ENC_TKT_IN_SKEY;
344*7f2fe78bSCy Schubert tgsreq.from = 0;
345*7f2fe78bSCy Schubert tgsreq.rtime = 0;
346*7f2fe78bSCy Schubert ktest_destroy_addresses(&(tgsreq.addresses));
347*7f2fe78bSCy Schubert ktest_destroy_enc_data(&(tgsreq.authorization_data));
348*7f2fe78bSCy Schubert encode_run(tgsreq, "tgs_req", "(optionals NULL except second_ticket)",
349*7f2fe78bSCy Schubert encode_krb5_tgs_req);
350*7f2fe78bSCy Schubert
351*7f2fe78bSCy Schubert ktest_destroy_sequence_of_ticket(&(tgsreq.second_ticket));
352*7f2fe78bSCy Schubert #ifndef ISODE_SUCKS
353*7f2fe78bSCy Schubert ktest_make_sample_principal(&(tgsreq.server));
354*7f2fe78bSCy Schubert #endif
355*7f2fe78bSCy Schubert tgsreq.kdc_options &= ~KDC_OPT_ENC_TKT_IN_SKEY;
356*7f2fe78bSCy Schubert encode_run(tgsreq, "tgs_req", "(optionals NULL except server)",
357*7f2fe78bSCy Schubert encode_krb5_tgs_req);
358*7f2fe78bSCy Schubert
359*7f2fe78bSCy Schubert ktest_empty_kdc_req(&tgsreq);
360*7f2fe78bSCy Schubert }
361*7f2fe78bSCy Schubert
362*7f2fe78bSCy Schubert /****************************************************************/
363*7f2fe78bSCy Schubert /* encode_krb5_kdc_req_body */
364*7f2fe78bSCy Schubert {
365*7f2fe78bSCy Schubert krb5_kdc_req kdcrb;
366*7f2fe78bSCy Schubert memset(&kdcrb, 0, sizeof(kdcrb));
367*7f2fe78bSCy Schubert ktest_make_sample_kdc_req_body(&kdcrb);
368*7f2fe78bSCy Schubert kdcrb.kdc_options &= ~KDC_OPT_ENC_TKT_IN_SKEY;
369*7f2fe78bSCy Schubert current_appl_type = 1007; /* Force interpretation as kdc-req-body */
370*7f2fe78bSCy Schubert encode_run(kdcrb, "kdc_req_body", "", encode_krb5_kdc_req_body);
371*7f2fe78bSCy Schubert
372*7f2fe78bSCy Schubert ktest_destroy_principal(&(kdcrb.client));
373*7f2fe78bSCy Schubert #ifndef ISODE_SUCKS
374*7f2fe78bSCy Schubert ktest_destroy_principal(&(kdcrb.server));
375*7f2fe78bSCy Schubert #endif
376*7f2fe78bSCy Schubert kdcrb.kdc_options |= KDC_OPT_ENC_TKT_IN_SKEY;
377*7f2fe78bSCy Schubert kdcrb.from = 0;
378*7f2fe78bSCy Schubert kdcrb.rtime = 0;
379*7f2fe78bSCy Schubert ktest_destroy_addresses(&(kdcrb.addresses));
380*7f2fe78bSCy Schubert ktest_destroy_enc_data(&(kdcrb.authorization_data));
381*7f2fe78bSCy Schubert current_appl_type = 1007; /* Force interpretation as kdc-req-body */
382*7f2fe78bSCy Schubert encode_run(kdcrb, "kdc_req_body",
383*7f2fe78bSCy Schubert "(optionals NULL except second_ticket)",
384*7f2fe78bSCy Schubert encode_krb5_kdc_req_body);
385*7f2fe78bSCy Schubert
386*7f2fe78bSCy Schubert ktest_destroy_sequence_of_ticket(&(kdcrb.second_ticket));
387*7f2fe78bSCy Schubert #ifndef ISODE_SUCKS
388*7f2fe78bSCy Schubert ktest_make_sample_principal(&(kdcrb.server));
389*7f2fe78bSCy Schubert #endif
390*7f2fe78bSCy Schubert kdcrb.kdc_options &= ~KDC_OPT_ENC_TKT_IN_SKEY;
391*7f2fe78bSCy Schubert current_appl_type = 1007; /* Force interpretation as kdc-req-body */
392*7f2fe78bSCy Schubert encode_run(kdcrb, "kdc_req_body", "(optionals NULL except server)",
393*7f2fe78bSCy Schubert encode_krb5_kdc_req_body);
394*7f2fe78bSCy Schubert
395*7f2fe78bSCy Schubert ktest_empty_kdc_req(&kdcrb);
396*7f2fe78bSCy Schubert }
397*7f2fe78bSCy Schubert
398*7f2fe78bSCy Schubert /****************************************************************/
399*7f2fe78bSCy Schubert /* encode_krb5_safe */
400*7f2fe78bSCy Schubert {
401*7f2fe78bSCy Schubert krb5_safe s;
402*7f2fe78bSCy Schubert ktest_make_sample_safe(&s);
403*7f2fe78bSCy Schubert encode_run(s, "safe", "", encode_krb5_safe);
404*7f2fe78bSCy Schubert
405*7f2fe78bSCy Schubert s.timestamp = 0;
406*7f2fe78bSCy Schubert /* s.usec should be opted out by the timestamp */
407*7f2fe78bSCy Schubert s.seq_number = 0;
408*7f2fe78bSCy Schubert ktest_destroy_address(&(s.r_address));
409*7f2fe78bSCy Schubert encode_run(s, "safe", "(optionals NULL)", encode_krb5_safe);
410*7f2fe78bSCy Schubert
411*7f2fe78bSCy Schubert ktest_empty_safe(&s);
412*7f2fe78bSCy Schubert }
413*7f2fe78bSCy Schubert
414*7f2fe78bSCy Schubert /****************************************************************/
415*7f2fe78bSCy Schubert /* encode_krb5_priv */
416*7f2fe78bSCy Schubert {
417*7f2fe78bSCy Schubert krb5_priv p;
418*7f2fe78bSCy Schubert ktest_make_sample_priv(&p);
419*7f2fe78bSCy Schubert encode_run(p, "priv", "", encode_krb5_priv);
420*7f2fe78bSCy Schubert ktest_empty_priv(&p);
421*7f2fe78bSCy Schubert }
422*7f2fe78bSCy Schubert
423*7f2fe78bSCy Schubert /****************************************************************/
424*7f2fe78bSCy Schubert /* encode_krb5_enc_priv_part */
425*7f2fe78bSCy Schubert {
426*7f2fe78bSCy Schubert krb5_priv_enc_part ep;
427*7f2fe78bSCy Schubert ktest_make_sample_priv_enc_part(&ep);
428*7f2fe78bSCy Schubert encode_run(ep, "enc_priv_part", "", encode_krb5_enc_priv_part);
429*7f2fe78bSCy Schubert
430*7f2fe78bSCy Schubert ep.timestamp = 0;
431*7f2fe78bSCy Schubert /* ep.usec should be opted out along with timestamp */
432*7f2fe78bSCy Schubert ep.seq_number = 0;
433*7f2fe78bSCy Schubert ktest_destroy_address(&(ep.r_address));
434*7f2fe78bSCy Schubert encode_run(ep, "enc_priv_part", "(optionals NULL)",
435*7f2fe78bSCy Schubert encode_krb5_enc_priv_part);
436*7f2fe78bSCy Schubert
437*7f2fe78bSCy Schubert ktest_empty_priv_enc_part(&ep);
438*7f2fe78bSCy Schubert }
439*7f2fe78bSCy Schubert
440*7f2fe78bSCy Schubert /****************************************************************/
441*7f2fe78bSCy Schubert /* encode_krb5_cred */
442*7f2fe78bSCy Schubert {
443*7f2fe78bSCy Schubert krb5_cred c;
444*7f2fe78bSCy Schubert ktest_make_sample_cred(&c);
445*7f2fe78bSCy Schubert encode_run(c, "cred", "", encode_krb5_cred);
446*7f2fe78bSCy Schubert ktest_empty_cred(&c);
447*7f2fe78bSCy Schubert }
448*7f2fe78bSCy Schubert
449*7f2fe78bSCy Schubert /****************************************************************/
450*7f2fe78bSCy Schubert /* encode_krb5_enc_cred_part */
451*7f2fe78bSCy Schubert {
452*7f2fe78bSCy Schubert krb5_cred_enc_part cep;
453*7f2fe78bSCy Schubert ktest_make_sample_cred_enc_part(&cep);
454*7f2fe78bSCy Schubert encode_run(cep, "enc_cred_part", "", encode_krb5_enc_cred_part);
455*7f2fe78bSCy Schubert
456*7f2fe78bSCy Schubert ktest_destroy_principal(&(cep.ticket_info[0]->client));
457*7f2fe78bSCy Schubert ktest_destroy_principal(&(cep.ticket_info[0]->server));
458*7f2fe78bSCy Schubert cep.ticket_info[0]->flags = 0;
459*7f2fe78bSCy Schubert cep.ticket_info[0]->times.authtime = 0;
460*7f2fe78bSCy Schubert cep.ticket_info[0]->times.starttime = 0;
461*7f2fe78bSCy Schubert cep.ticket_info[0]->times.endtime = 0;
462*7f2fe78bSCy Schubert cep.ticket_info[0]->times.renew_till = 0;
463*7f2fe78bSCy Schubert ktest_destroy_addresses(&(cep.ticket_info[0]->caddrs));
464*7f2fe78bSCy Schubert cep.nonce = 0;
465*7f2fe78bSCy Schubert cep.timestamp = 0;
466*7f2fe78bSCy Schubert ktest_destroy_address(&(cep.s_address));
467*7f2fe78bSCy Schubert ktest_destroy_address(&(cep.r_address));
468*7f2fe78bSCy Schubert encode_run(cep, "enc_cred_part", "(optionals NULL)",
469*7f2fe78bSCy Schubert encode_krb5_enc_cred_part);
470*7f2fe78bSCy Schubert
471*7f2fe78bSCy Schubert ktest_empty_cred_enc_part(&cep);
472*7f2fe78bSCy Schubert }
473*7f2fe78bSCy Schubert
474*7f2fe78bSCy Schubert /****************************************************************/
475*7f2fe78bSCy Schubert /* encode_krb5_error */
476*7f2fe78bSCy Schubert {
477*7f2fe78bSCy Schubert krb5_error kerr;
478*7f2fe78bSCy Schubert ktest_make_sample_error(&kerr);
479*7f2fe78bSCy Schubert encode_run(kerr, "error", "", encode_krb5_error);
480*7f2fe78bSCy Schubert
481*7f2fe78bSCy Schubert kerr.ctime = 0;
482*7f2fe78bSCy Schubert ktest_destroy_principal(&(kerr.client));
483*7f2fe78bSCy Schubert ktest_empty_data(&(kerr.text));
484*7f2fe78bSCy Schubert ktest_empty_data(&(kerr.e_data));
485*7f2fe78bSCy Schubert encode_run(kerr, "error", "(optionals NULL)", encode_krb5_error);
486*7f2fe78bSCy Schubert
487*7f2fe78bSCy Schubert ktest_empty_error(&kerr);
488*7f2fe78bSCy Schubert }
489*7f2fe78bSCy Schubert
490*7f2fe78bSCy Schubert /****************************************************************/
491*7f2fe78bSCy Schubert /* encode_krb5_authdata */
492*7f2fe78bSCy Schubert {
493*7f2fe78bSCy Schubert krb5_authdata **ad;
494*7f2fe78bSCy Schubert ktest_make_sample_authorization_data(&ad);
495*7f2fe78bSCy Schubert
496*7f2fe78bSCy Schubert retval = encode_krb5_authdata(ad,&(code));
497*7f2fe78bSCy Schubert if (retval) {
498*7f2fe78bSCy Schubert com_err("encoding authorization_data",retval,"");
499*7f2fe78bSCy Schubert exit(1);
500*7f2fe78bSCy Schubert }
501*7f2fe78bSCy Schubert current_appl_type = 1004; /* Force type to be authdata */
502*7f2fe78bSCy Schubert encoder_print_results(code, "authorization_data", "");
503*7f2fe78bSCy Schubert
504*7f2fe78bSCy Schubert ktest_destroy_authorization_data(&ad);
505*7f2fe78bSCy Schubert }
506*7f2fe78bSCy Schubert
507*7f2fe78bSCy Schubert /****************************************************************/
508*7f2fe78bSCy Schubert /* encode_padata_sequence and encode_krb5_typed_data */
509*7f2fe78bSCy Schubert {
510*7f2fe78bSCy Schubert krb5_pa_data **pa;
511*7f2fe78bSCy Schubert
512*7f2fe78bSCy Schubert ktest_make_sample_pa_data_array(&pa);
513*7f2fe78bSCy Schubert encode_run(*pa, "padata_sequence", "", encode_krb5_padata_sequence);
514*7f2fe78bSCy Schubert encode_run(*pa, "typed_data", "", encode_krb5_typed_data);
515*7f2fe78bSCy Schubert ktest_destroy_pa_data_array(&pa);
516*7f2fe78bSCy Schubert
517*7f2fe78bSCy Schubert ktest_make_sample_empty_pa_data_array(&pa);
518*7f2fe78bSCy Schubert encode_run(*pa, "padata_sequence", "(empty)",
519*7f2fe78bSCy Schubert encode_krb5_padata_sequence);
520*7f2fe78bSCy Schubert ktest_destroy_pa_data_array(&pa);
521*7f2fe78bSCy Schubert }
522*7f2fe78bSCy Schubert
523*7f2fe78bSCy Schubert /****************************************************************/
524*7f2fe78bSCy Schubert /* encode_etype_info */
525*7f2fe78bSCy Schubert {
526*7f2fe78bSCy Schubert krb5_etype_info_entry **info;
527*7f2fe78bSCy Schubert
528*7f2fe78bSCy Schubert ktest_make_sample_etype_info(&info);
529*7f2fe78bSCy Schubert encode_run(*info, "etype_info", "", encode_krb5_etype_info);
530*7f2fe78bSCy Schubert
531*7f2fe78bSCy Schubert ktest_destroy_etype_info_entry(info[2]); info[2] = 0;
532*7f2fe78bSCy Schubert ktest_destroy_etype_info_entry(info[1]); info[1] = 0;
533*7f2fe78bSCy Schubert encode_run(*info, "etype_info", "(only 1)", encode_krb5_etype_info);
534*7f2fe78bSCy Schubert
535*7f2fe78bSCy Schubert ktest_destroy_etype_info_entry(info[0]); info[0] = 0;
536*7f2fe78bSCy Schubert encode_run(*info, "etype_info", "(no info)", encode_krb5_etype_info);
537*7f2fe78bSCy Schubert
538*7f2fe78bSCy Schubert ktest_destroy_etype_info(info);
539*7f2fe78bSCy Schubert }
540*7f2fe78bSCy Schubert
541*7f2fe78bSCy Schubert /* encode_etype_info2 */
542*7f2fe78bSCy Schubert {
543*7f2fe78bSCy Schubert krb5_etype_info_entry **info;
544*7f2fe78bSCy Schubert
545*7f2fe78bSCy Schubert ktest_make_sample_etype_info2(&info);
546*7f2fe78bSCy Schubert encode_run(*info, "etype_info2", "", encode_krb5_etype_info2);
547*7f2fe78bSCy Schubert
548*7f2fe78bSCy Schubert ktest_destroy_etype_info_entry(info[2]); info[2] = 0;
549*7f2fe78bSCy Schubert ktest_destroy_etype_info_entry(info[1]); info[1] = 0;
550*7f2fe78bSCy Schubert encode_run(*info, "etype_info2", "(only 1)", encode_krb5_etype_info2);
551*7f2fe78bSCy Schubert
552*7f2fe78bSCy Schubert /* etype_info2 sequences aren't allowed to be empty. */
553*7f2fe78bSCy Schubert
554*7f2fe78bSCy Schubert ktest_destroy_etype_info(info);
555*7f2fe78bSCy Schubert }
556*7f2fe78bSCy Schubert
557*7f2fe78bSCy Schubert /****************************************************************/
558*7f2fe78bSCy Schubert /* encode_pa_enc_ts */
559*7f2fe78bSCy Schubert {
560*7f2fe78bSCy Schubert krb5_pa_enc_ts pa_enc;
561*7f2fe78bSCy Schubert ktest_make_sample_pa_enc_ts(&pa_enc);
562*7f2fe78bSCy Schubert encode_run(pa_enc, "pa_enc_ts", "", encode_krb5_pa_enc_ts);
563*7f2fe78bSCy Schubert pa_enc.pausec = 0;
564*7f2fe78bSCy Schubert encode_run(pa_enc, "pa_enc_ts (no usec)", "", encode_krb5_pa_enc_ts);
565*7f2fe78bSCy Schubert }
566*7f2fe78bSCy Schubert
567*7f2fe78bSCy Schubert /****************************************************************/
568*7f2fe78bSCy Schubert /* encode_enc_data */
569*7f2fe78bSCy Schubert {
570*7f2fe78bSCy Schubert krb5_enc_data enc_data;
571*7f2fe78bSCy Schubert ktest_make_sample_enc_data(&enc_data);
572*7f2fe78bSCy Schubert current_appl_type = 1001;
573*7f2fe78bSCy Schubert encode_run(enc_data, "enc_data", "", encode_krb5_enc_data);
574*7f2fe78bSCy Schubert enc_data.kvno = 0xFF000000;
575*7f2fe78bSCy Schubert current_appl_type = 1001;
576*7f2fe78bSCy Schubert encode_run(enc_data, "enc_data", "(MSB-set kvno)",
577*7f2fe78bSCy Schubert encode_krb5_enc_data);
578*7f2fe78bSCy Schubert enc_data.kvno = 0xFFFFFFFF;
579*7f2fe78bSCy Schubert current_appl_type = 1001;
580*7f2fe78bSCy Schubert encode_run(enc_data, "enc_data", "(kvno=-1)", encode_krb5_enc_data);
581*7f2fe78bSCy Schubert ktest_destroy_enc_data(&enc_data);
582*7f2fe78bSCy Schubert }
583*7f2fe78bSCy Schubert /****************************************************************/
584*7f2fe78bSCy Schubert /* encode_krb5_sam_challenge_2 */
585*7f2fe78bSCy Schubert {
586*7f2fe78bSCy Schubert krb5_sam_challenge_2 sam_ch2;
587*7f2fe78bSCy Schubert ktest_make_sample_sam_challenge_2(&sam_ch2);
588*7f2fe78bSCy Schubert encode_run(sam_ch2, "sam_challenge_2", "",
589*7f2fe78bSCy Schubert encode_krb5_sam_challenge_2);
590*7f2fe78bSCy Schubert ktest_empty_sam_challenge_2(&sam_ch2);
591*7f2fe78bSCy Schubert }
592*7f2fe78bSCy Schubert /****************************************************************/
593*7f2fe78bSCy Schubert /* encode_krb5_sam_challenge_2_body */
594*7f2fe78bSCy Schubert {
595*7f2fe78bSCy Schubert krb5_sam_challenge_2_body body;
596*7f2fe78bSCy Schubert ktest_make_sample_sam_challenge_2_body(&body);
597*7f2fe78bSCy Schubert encode_run(body, "sam_challenge_2_body", "",
598*7f2fe78bSCy Schubert encode_krb5_sam_challenge_2_body);
599*7f2fe78bSCy Schubert ktest_empty_sam_challenge_2_body(&body);
600*7f2fe78bSCy Schubert }
601*7f2fe78bSCy Schubert /****************************************************************/
602*7f2fe78bSCy Schubert /* encode_krb5_sam_response_2 */
603*7f2fe78bSCy Schubert {
604*7f2fe78bSCy Schubert krb5_sam_response_2 sam_ch2;
605*7f2fe78bSCy Schubert ktest_make_sample_sam_response_2(&sam_ch2);
606*7f2fe78bSCy Schubert encode_run(sam_ch2, "sam_response_2", "", encode_krb5_sam_response_2);
607*7f2fe78bSCy Schubert ktest_empty_sam_response_2(&sam_ch2);
608*7f2fe78bSCy Schubert }
609*7f2fe78bSCy Schubert /****************************************************************/
610*7f2fe78bSCy Schubert /* encode_krb5_sam_response_enc_2 */
611*7f2fe78bSCy Schubert {
612*7f2fe78bSCy Schubert krb5_enc_sam_response_enc_2 sam_ch2;
613*7f2fe78bSCy Schubert ktest_make_sample_enc_sam_response_enc_2(&sam_ch2);
614*7f2fe78bSCy Schubert encode_run(sam_ch2, "enc_sam_response_enc_2", "",
615*7f2fe78bSCy Schubert encode_krb5_enc_sam_response_enc_2);
616*7f2fe78bSCy Schubert ktest_empty_enc_sam_response_enc_2(&sam_ch2);
617*7f2fe78bSCy Schubert }
618*7f2fe78bSCy Schubert /****************************************************************/
619*7f2fe78bSCy Schubert /* encode_krb5_pa_for_user */
620*7f2fe78bSCy Schubert {
621*7f2fe78bSCy Schubert krb5_pa_for_user s4u;
622*7f2fe78bSCy Schubert ktest_make_sample_pa_for_user(&s4u);
623*7f2fe78bSCy Schubert encode_run(s4u, "pa_for_user", "", encode_krb5_pa_for_user);
624*7f2fe78bSCy Schubert ktest_empty_pa_for_user(&s4u);
625*7f2fe78bSCy Schubert }
626*7f2fe78bSCy Schubert /****************************************************************/
627*7f2fe78bSCy Schubert /* encode_krb5_pa_s4u_x509_user */
628*7f2fe78bSCy Schubert {
629*7f2fe78bSCy Schubert krb5_pa_s4u_x509_user s4u;
630*7f2fe78bSCy Schubert ktest_make_sample_pa_s4u_x509_user(&s4u);
631*7f2fe78bSCy Schubert encode_run(s4u, "pa_s4u_x509_user", "", encode_krb5_pa_s4u_x509_user);
632*7f2fe78bSCy Schubert ktest_empty_pa_s4u_x509_user(&s4u);
633*7f2fe78bSCy Schubert }
634*7f2fe78bSCy Schubert /****************************************************************/
635*7f2fe78bSCy Schubert /* encode_krb5_ad_kdcissued */
636*7f2fe78bSCy Schubert {
637*7f2fe78bSCy Schubert krb5_ad_kdcissued kdci;
638*7f2fe78bSCy Schubert ktest_make_sample_ad_kdcissued(&kdci);
639*7f2fe78bSCy Schubert encode_run(kdci, "ad_kdcissued", "", encode_krb5_ad_kdcissued);
640*7f2fe78bSCy Schubert ktest_empty_ad_kdcissued(&kdci);
641*7f2fe78bSCy Schubert }
642*7f2fe78bSCy Schubert /****************************************************************/
643*7f2fe78bSCy Schubert /* encode_krb5_iakerb_header */
644*7f2fe78bSCy Schubert {
645*7f2fe78bSCy Schubert krb5_iakerb_header ih;
646*7f2fe78bSCy Schubert ktest_make_sample_iakerb_header(&ih);
647*7f2fe78bSCy Schubert encode_run(ih, "iakerb_header", "", encode_krb5_iakerb_header);
648*7f2fe78bSCy Schubert ktest_empty_iakerb_header(&ih);
649*7f2fe78bSCy Schubert }
650*7f2fe78bSCy Schubert /****************************************************************/
651*7f2fe78bSCy Schubert /* encode_krb5_iakerb_finished */
652*7f2fe78bSCy Schubert {
653*7f2fe78bSCy Schubert krb5_iakerb_finished ih;
654*7f2fe78bSCy Schubert ktest_make_sample_iakerb_finished(&ih);
655*7f2fe78bSCy Schubert encode_run(ih, "iakerb_finished", "", encode_krb5_iakerb_finished);
656*7f2fe78bSCy Schubert ktest_empty_iakerb_finished(&ih);
657*7f2fe78bSCy Schubert }
658*7f2fe78bSCy Schubert /****************************************************************/
659*7f2fe78bSCy Schubert /* encode_krb5_fast_response */
660*7f2fe78bSCy Schubert {
661*7f2fe78bSCy Schubert krb5_fast_response fr;
662*7f2fe78bSCy Schubert ktest_make_sample_fast_response(&fr);
663*7f2fe78bSCy Schubert encode_run(fr, "fast_response", "", encode_krb5_fast_response);
664*7f2fe78bSCy Schubert ktest_empty_fast_response(&fr);
665*7f2fe78bSCy Schubert }
666*7f2fe78bSCy Schubert /****************************************************************/
667*7f2fe78bSCy Schubert /* encode_krb5_pa_fx_fast_reply */
668*7f2fe78bSCy Schubert {
669*7f2fe78bSCy Schubert krb5_enc_data enc_data;
670*7f2fe78bSCy Schubert ktest_make_sample_enc_data(&enc_data);
671*7f2fe78bSCy Schubert encode_run(enc_data, "pa_fx_fast_reply", "",
672*7f2fe78bSCy Schubert encode_krb5_pa_fx_fast_reply);
673*7f2fe78bSCy Schubert ktest_destroy_enc_data(&enc_data);
674*7f2fe78bSCy Schubert }
675*7f2fe78bSCy Schubert /****************************************************************/
676*7f2fe78bSCy Schubert /* encode_krb5_otp_tokeninfo */
677*7f2fe78bSCy Schubert {
678*7f2fe78bSCy Schubert krb5_otp_tokeninfo ti;
679*7f2fe78bSCy Schubert ktest_make_minimal_otp_tokeninfo(&ti);
680*7f2fe78bSCy Schubert encode_run(ti, "otp_tokeninfo", "(optionals NULL)",
681*7f2fe78bSCy Schubert encode_krb5_otp_tokeninfo);
682*7f2fe78bSCy Schubert ktest_empty_otp_tokeninfo(&ti);
683*7f2fe78bSCy Schubert ktest_make_maximal_otp_tokeninfo(&ti);
684*7f2fe78bSCy Schubert encode_run(ti, "otp_tokeninfo", "", encode_krb5_otp_tokeninfo);
685*7f2fe78bSCy Schubert ktest_empty_otp_tokeninfo(&ti);
686*7f2fe78bSCy Schubert }
687*7f2fe78bSCy Schubert /****************************************************************/
688*7f2fe78bSCy Schubert /* encode_krb5_pa_otp_challenge */
689*7f2fe78bSCy Schubert {
690*7f2fe78bSCy Schubert krb5_pa_otp_challenge ch;
691*7f2fe78bSCy Schubert ktest_make_minimal_pa_otp_challenge(&ch);
692*7f2fe78bSCy Schubert encode_run(ch, "pa_otp_challenge", "(optionals NULL)",
693*7f2fe78bSCy Schubert encode_krb5_pa_otp_challenge);
694*7f2fe78bSCy Schubert ktest_empty_pa_otp_challenge(&ch);
695*7f2fe78bSCy Schubert ktest_make_maximal_pa_otp_challenge(&ch);
696*7f2fe78bSCy Schubert encode_run(ch, "pa_otp_challenge", "", encode_krb5_pa_otp_challenge);
697*7f2fe78bSCy Schubert ktest_empty_pa_otp_challenge(&ch);
698*7f2fe78bSCy Schubert }
699*7f2fe78bSCy Schubert /****************************************************************/
700*7f2fe78bSCy Schubert /* encode_krb5_pa_otp_req */
701*7f2fe78bSCy Schubert {
702*7f2fe78bSCy Schubert krb5_pa_otp_req req;
703*7f2fe78bSCy Schubert ktest_make_minimal_pa_otp_req(&req);
704*7f2fe78bSCy Schubert encode_run(req, "pa_otp_req", "(optionals NULL)",
705*7f2fe78bSCy Schubert encode_krb5_pa_otp_req);
706*7f2fe78bSCy Schubert ktest_empty_pa_otp_req(&req);
707*7f2fe78bSCy Schubert ktest_make_maximal_pa_otp_req(&req);
708*7f2fe78bSCy Schubert encode_run(req, "pa_otp_req", "", encode_krb5_pa_otp_req);
709*7f2fe78bSCy Schubert ktest_empty_pa_otp_req(&req);
710*7f2fe78bSCy Schubert }
711*7f2fe78bSCy Schubert /****************************************************************/
712*7f2fe78bSCy Schubert /* encode_krb5_pa_otp_enc_request */
713*7f2fe78bSCy Schubert {
714*7f2fe78bSCy Schubert krb5_data d;
715*7f2fe78bSCy Schubert ktest_make_sample_data(&d);
716*7f2fe78bSCy Schubert encode_run(d, "pa_otp_enc_req", "", encode_krb5_pa_otp_enc_req);
717*7f2fe78bSCy Schubert ktest_empty_data(&d);
718*7f2fe78bSCy Schubert }
719*7f2fe78bSCy Schubert /****************************************************************/
720*7f2fe78bSCy Schubert /* encode_krb5_kkdcp_message */
721*7f2fe78bSCy Schubert {
722*7f2fe78bSCy Schubert krb5_kkdcp_message info;
723*7f2fe78bSCy Schubert ktest_make_sample_kkdcp_message(&info);
724*7f2fe78bSCy Schubert encode_run(info, "kkdcp_message", "", encode_krb5_kkdcp_message);
725*7f2fe78bSCy Schubert ktest_empty_kkdcp_message(&info);
726*7f2fe78bSCy Schubert }
727*7f2fe78bSCy Schubert /* encode_krb5_cammac */
728*7f2fe78bSCy Schubert {
729*7f2fe78bSCy Schubert krb5_cammac req;
730*7f2fe78bSCy Schubert ktest_make_minimal_cammac(&req);
731*7f2fe78bSCy Schubert encode_run(req, "cammac", "(optionals NULL)", encode_krb5_cammac);
732*7f2fe78bSCy Schubert ktest_empty_cammac(&req);
733*7f2fe78bSCy Schubert ktest_make_maximal_cammac(&req);
734*7f2fe78bSCy Schubert encode_run(req, "cammac", "", encode_krb5_cammac);
735*7f2fe78bSCy Schubert ktest_empty_cammac(&req);
736*7f2fe78bSCy Schubert }
737*7f2fe78bSCy Schubert /****************************************************************/
738*7f2fe78bSCy Schubert /* encode_krb5_secure_cookie */
739*7f2fe78bSCy Schubert {
740*7f2fe78bSCy Schubert krb5_secure_cookie cookie;
741*7f2fe78bSCy Schubert ktest_make_sample_secure_cookie(&cookie);
742*7f2fe78bSCy Schubert encode_run(cookie, "secure_cookie", "", encode_krb5_secure_cookie);
743*7f2fe78bSCy Schubert ktest_empty_secure_cookie(&cookie);
744*7f2fe78bSCy Schubert }
745*7f2fe78bSCy Schubert /****************************************************************/
746*7f2fe78bSCy Schubert /* encode_krb5_spake_factor */
747*7f2fe78bSCy Schubert {
748*7f2fe78bSCy Schubert krb5_spake_factor factor;
749*7f2fe78bSCy Schubert ktest_make_minimal_spake_factor(&factor);
750*7f2fe78bSCy Schubert encode_run(factor, "spake_factor", "(optionals NULL)",
751*7f2fe78bSCy Schubert encode_krb5_spake_factor);
752*7f2fe78bSCy Schubert ktest_empty_spake_factor(&factor);
753*7f2fe78bSCy Schubert ktest_make_maximal_spake_factor(&factor);
754*7f2fe78bSCy Schubert encode_run(factor, "spake_factor", "", encode_krb5_spake_factor);
755*7f2fe78bSCy Schubert ktest_empty_spake_factor(&factor);
756*7f2fe78bSCy Schubert }
757*7f2fe78bSCy Schubert /****************************************************************/
758*7f2fe78bSCy Schubert /* encode_krb5_pa_spake */
759*7f2fe78bSCy Schubert {
760*7f2fe78bSCy Schubert krb5_pa_spake pa_spake;
761*7f2fe78bSCy Schubert ktest_make_support_pa_spake(&pa_spake);
762*7f2fe78bSCy Schubert encode_run(pa_spake, "pa_spake", "(support)", encode_krb5_pa_spake);
763*7f2fe78bSCy Schubert ktest_empty_pa_spake(&pa_spake);
764*7f2fe78bSCy Schubert ktest_make_challenge_pa_spake(&pa_spake);
765*7f2fe78bSCy Schubert encode_run(pa_spake, "pa_spake", "(challenge)", encode_krb5_pa_spake);
766*7f2fe78bSCy Schubert ktest_empty_pa_spake(&pa_spake);
767*7f2fe78bSCy Schubert ktest_make_response_pa_spake(&pa_spake);
768*7f2fe78bSCy Schubert encode_run(pa_spake, "pa_spake", "(response)", encode_krb5_pa_spake);
769*7f2fe78bSCy Schubert ktest_empty_pa_spake(&pa_spake);
770*7f2fe78bSCy Schubert ktest_make_encdata_pa_spake(&pa_spake);
771*7f2fe78bSCy Schubert encode_run(pa_spake, "pa_spake", "(encdata)", encode_krb5_pa_spake);
772*7f2fe78bSCy Schubert ktest_empty_pa_spake(&pa_spake);
773*7f2fe78bSCy Schubert }
774*7f2fe78bSCy Schubert #ifndef DISABLE_PKINIT
775*7f2fe78bSCy Schubert /****************************************************************/
776*7f2fe78bSCy Schubert /* encode_krb5_pa_pk_as_req */
777*7f2fe78bSCy Schubert {
778*7f2fe78bSCy Schubert krb5_pa_pk_as_req req;
779*7f2fe78bSCy Schubert ktest_make_sample_pa_pk_as_req(&req);
780*7f2fe78bSCy Schubert encode_run(req, "pa_pk_as_req", "", acc.encode_krb5_pa_pk_as_req);
781*7f2fe78bSCy Schubert ktest_empty_pa_pk_as_req(&req);
782*7f2fe78bSCy Schubert }
783*7f2fe78bSCy Schubert /****************************************************************/
784*7f2fe78bSCy Schubert /* encode_krb5_pa_pk_as_rep */
785*7f2fe78bSCy Schubert {
786*7f2fe78bSCy Schubert krb5_pa_pk_as_rep rep;
787*7f2fe78bSCy Schubert ktest_make_sample_pa_pk_as_rep_dhInfo(&rep);
788*7f2fe78bSCy Schubert encode_run(rep, "pa_pk_as_rep", "(dhInfo)",
789*7f2fe78bSCy Schubert acc.encode_krb5_pa_pk_as_rep);
790*7f2fe78bSCy Schubert ktest_empty_pa_pk_as_rep(&rep);
791*7f2fe78bSCy Schubert ktest_make_sample_pa_pk_as_rep_encKeyPack(&rep);
792*7f2fe78bSCy Schubert encode_run(rep, "pa_pk_as_rep", "(encKeyPack)",
793*7f2fe78bSCy Schubert acc.encode_krb5_pa_pk_as_rep);
794*7f2fe78bSCy Schubert ktest_empty_pa_pk_as_rep(&rep);
795*7f2fe78bSCy Schubert }
796*7f2fe78bSCy Schubert /****************************************************************/
797*7f2fe78bSCy Schubert /* encode_krb5_auth_pack */
798*7f2fe78bSCy Schubert {
799*7f2fe78bSCy Schubert krb5_auth_pack pack;
800*7f2fe78bSCy Schubert ktest_make_sample_auth_pack(&pack);
801*7f2fe78bSCy Schubert encode_run(pack, "auth_pack", "", acc.encode_krb5_auth_pack);
802*7f2fe78bSCy Schubert ktest_empty_auth_pack(&pack);
803*7f2fe78bSCy Schubert }
804*7f2fe78bSCy Schubert /****************************************************************/
805*7f2fe78bSCy Schubert /* encode_krb5_kdc_dh_key_info */
806*7f2fe78bSCy Schubert {
807*7f2fe78bSCy Schubert krb5_kdc_dh_key_info ki;
808*7f2fe78bSCy Schubert ktest_make_sample_kdc_dh_key_info(&ki);
809*7f2fe78bSCy Schubert encode_run(ki, "kdc_dh_key_info", "", acc.encode_krb5_kdc_dh_key_info);
810*7f2fe78bSCy Schubert ktest_empty_kdc_dh_key_info(&ki);
811*7f2fe78bSCy Schubert }
812*7f2fe78bSCy Schubert /****************************************************************/
813*7f2fe78bSCy Schubert /* encode_krb5_reply_key_pack */
814*7f2fe78bSCy Schubert {
815*7f2fe78bSCy Schubert krb5_reply_key_pack pack;
816*7f2fe78bSCy Schubert ktest_make_sample_reply_key_pack(&pack);
817*7f2fe78bSCy Schubert encode_run(pack, "reply_key_pack", "", acc.encode_krb5_reply_key_pack);
818*7f2fe78bSCy Schubert ktest_empty_reply_key_pack(&pack);
819*7f2fe78bSCy Schubert }
820*7f2fe78bSCy Schubert /****************************************************************/
821*7f2fe78bSCy Schubert /* encode_krb5_sp80056a_other_info */
822*7f2fe78bSCy Schubert {
823*7f2fe78bSCy Schubert krb5_sp80056a_other_info info;
824*7f2fe78bSCy Schubert ktest_make_sample_sp80056a_other_info(&info);
825*7f2fe78bSCy Schubert encode_run(info, "sp80056a_other_info", "",
826*7f2fe78bSCy Schubert encode_krb5_sp80056a_other_info);
827*7f2fe78bSCy Schubert ktest_empty_sp80056a_other_info(&info);
828*7f2fe78bSCy Schubert }
829*7f2fe78bSCy Schubert /****************************************************************/
830*7f2fe78bSCy Schubert /* encode_krb5_pkinit_supp_pub_info */
831*7f2fe78bSCy Schubert {
832*7f2fe78bSCy Schubert krb5_pkinit_supp_pub_info info;
833*7f2fe78bSCy Schubert ktest_make_sample_pkinit_supp_pub_info(&info);
834*7f2fe78bSCy Schubert encode_run(info, "pkinit_supp_pub_info", "",
835*7f2fe78bSCy Schubert encode_krb5_pkinit_supp_pub_info);
836*7f2fe78bSCy Schubert ktest_empty_pkinit_supp_pub_info(&info);
837*7f2fe78bSCy Schubert }
838*7f2fe78bSCy Schubert #endif /* not DISABLE_PKINIT */
839*7f2fe78bSCy Schubert #ifdef ENABLE_LDAP
840*7f2fe78bSCy Schubert {
841*7f2fe78bSCy Schubert ldap_seqof_key_data skd;
842*7f2fe78bSCy Schubert
843*7f2fe78bSCy Schubert ktest_make_sample_ldap_seqof_key_data(&skd);
844*7f2fe78bSCy Schubert encode_run(skd, "ldap_seqof_key_data", "",
845*7f2fe78bSCy Schubert acc.asn1_ldap_encode_sequence_of_keys);
846*7f2fe78bSCy Schubert ktest_empty_ldap_seqof_key_data(test_context, &skd);
847*7f2fe78bSCy Schubert }
848*7f2fe78bSCy Schubert #endif
849*7f2fe78bSCy Schubert
850*7f2fe78bSCy Schubert krb5_free_context(test_context);
851*7f2fe78bSCy Schubert exit(error_count);
852*7f2fe78bSCy Schubert return(error_count);
853*7f2fe78bSCy Schubert }
854