17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * src/lib/krb5/asn.1/asn1_k_decode.h
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * Copyright 1994 by the Massachusetts Institute of Technology.
57c478bd9Sstevel@tonic-gate  * All Rights Reserved.
67c478bd9Sstevel@tonic-gate  *
77c478bd9Sstevel@tonic-gate  * Export of this software from the United States of America may
87c478bd9Sstevel@tonic-gate  *   require a specific license from the United States Government.
97c478bd9Sstevel@tonic-gate  *   It is the responsibility of any person or organization contemplating
107c478bd9Sstevel@tonic-gate  *   export to obtain such a license before exporting.
117c478bd9Sstevel@tonic-gate  *
127c478bd9Sstevel@tonic-gate  * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
137c478bd9Sstevel@tonic-gate  * distribute this software and its documentation for any purpose and
147c478bd9Sstevel@tonic-gate  * without fee is hereby granted, provided that the above copyright
157c478bd9Sstevel@tonic-gate  * notice appear in all copies and that both that copyright notice and
167c478bd9Sstevel@tonic-gate  * this permission notice appear in supporting documentation, and that
177c478bd9Sstevel@tonic-gate  * the name of M.I.T. not be used in advertising or publicity pertaining
187c478bd9Sstevel@tonic-gate  * to distribution of the software without specific, written prior
197c478bd9Sstevel@tonic-gate  * permission.  Furthermore if you modify this software you must label
207c478bd9Sstevel@tonic-gate  * your software as modified software and not distribute it in such a
217c478bd9Sstevel@tonic-gate  * fashion that it might be confused with the original M.I.T. software.
227c478bd9Sstevel@tonic-gate  * M.I.T. makes no representations about the suitability of
237c478bd9Sstevel@tonic-gate  * this software for any purpose.  It is provided "as is" without express
247c478bd9Sstevel@tonic-gate  * or implied warranty.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate 
277c478bd9Sstevel@tonic-gate #ifndef __ASN1_DECODE_KRB5_H__
287c478bd9Sstevel@tonic-gate #define __ASN1_DECODE_KRB5_H__
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate #include "k5-int.h"
317c478bd9Sstevel@tonic-gate #include "krbasn1.h"
327c478bd9Sstevel@tonic-gate #include "asn1buf.h"
337c478bd9Sstevel@tonic-gate 
347c478bd9Sstevel@tonic-gate /* asn1_error_code asn1_decode_scalar_type(asn1buf *buf, krb5_scalar *val); */
357c478bd9Sstevel@tonic-gate /* requires  *buf is allocated, *buf's current position points to the
367c478bd9Sstevel@tonic-gate               beginning of an encoding (<id> <len> <contents>),
377c478bd9Sstevel@tonic-gate 	      *val is allocated
387c478bd9Sstevel@tonic-gate    effects   Decodes the encoding in *buf, returning the result in *val.
397c478bd9Sstevel@tonic-gate              Returns ASN1_BAD_ID if the encoded id does not
407c478bd9Sstevel@tonic-gate 	      indicate the proper type.
417c478bd9Sstevel@tonic-gate              Returns ASN1_OVERRUN if the encoded length exceeds
427c478bd9Sstevel@tonic-gate 	      the bounds of *buf */
437c478bd9Sstevel@tonic-gate 
447c478bd9Sstevel@tonic-gate 
457c478bd9Sstevel@tonic-gate /* asn1_error_code asn1_decode_structure_type(asn1buf *buf,
467c478bd9Sstevel@tonic-gate                                               krb5_structure *val); */
477c478bd9Sstevel@tonic-gate /* requires  *buf is allocated, *buf's current position points to the
487c478bd9Sstevel@tonic-gate               beginning of an encoding (<id> <len> <contents>),
497c478bd9Sstevel@tonic-gate 	      *val is allocated
507c478bd9Sstevel@tonic-gate 	     Assumes that *val is a freshly-allocated structure (i.e.
517c478bd9Sstevel@tonic-gate 	      does not attempt to clean up or free *val).
527c478bd9Sstevel@tonic-gate    effects   Decodes the encoding in *buf, returning the result in *val.
537c478bd9Sstevel@tonic-gate              Returns ASN1_BAD_ID if the encoded id does not
547c478bd9Sstevel@tonic-gate 	      indicate the proper type.
557c478bd9Sstevel@tonic-gate              Returns ASN1_OVERRUN if the encoded length exceeds
567c478bd9Sstevel@tonic-gate 	      the bounds of *buf */
577c478bd9Sstevel@tonic-gate 
587c478bd9Sstevel@tonic-gate /* asn1_error_code asn1_decode_array_type(asn1buf *buf, krb5_scalar ***val); */
597c478bd9Sstevel@tonic-gate /* requires  *buf is allocated, *buf's current position points to the
607c478bd9Sstevel@tonic-gate               beginning of an encoding (<id> <len> <contents>)
617c478bd9Sstevel@tonic-gate 	     Assumes that *val is empty (i.e. does not attempt to
627c478bd9Sstevel@tonic-gate 	      clean up or free *val).
637c478bd9Sstevel@tonic-gate    effects   Decodes the encoding in *buf, returning the result in *val.
647c478bd9Sstevel@tonic-gate              Returns ASN1_BAD_ID if the encoded id does not
657c478bd9Sstevel@tonic-gate 	      indicate the proper type.
667c478bd9Sstevel@tonic-gate              Returns ASN1_OVERRUN if the encoded length exceeds
677c478bd9Sstevel@tonic-gate 	      the bounds of *buf */
687c478bd9Sstevel@tonic-gate 
697c478bd9Sstevel@tonic-gate /* scalars */
707c478bd9Sstevel@tonic-gate asn1_error_code asn1_decode_int
717c478bd9Sstevel@tonic-gate 	(asn1buf *buf, int *val);
727c478bd9Sstevel@tonic-gate asn1_error_code asn1_decode_int32
737c478bd9Sstevel@tonic-gate 	(asn1buf *buf, krb5_int32 *val);
747c478bd9Sstevel@tonic-gate asn1_error_code asn1_decode_kvno
757c478bd9Sstevel@tonic-gate 	(asn1buf *buf, krb5_kvno *val);
767c478bd9Sstevel@tonic-gate asn1_error_code asn1_decode_enctype
777c478bd9Sstevel@tonic-gate 	(asn1buf *buf, krb5_enctype *val);
787c478bd9Sstevel@tonic-gate asn1_error_code asn1_decode_msgtype
797c478bd9Sstevel@tonic-gate 	(asn1buf *buf, krb5_msgtype *val);
807c478bd9Sstevel@tonic-gate asn1_error_code asn1_decode_cksumtype
817c478bd9Sstevel@tonic-gate 	(asn1buf *buf, krb5_cksumtype *val);
827c478bd9Sstevel@tonic-gate asn1_error_code asn1_decode_octet
837c478bd9Sstevel@tonic-gate 	(asn1buf *buf, krb5_octet *val);
847c478bd9Sstevel@tonic-gate asn1_error_code asn1_decode_addrtype
857c478bd9Sstevel@tonic-gate 	(asn1buf *buf, krb5_addrtype *val);
867c478bd9Sstevel@tonic-gate asn1_error_code asn1_decode_authdatatype
877c478bd9Sstevel@tonic-gate 	(asn1buf *buf, krb5_authdatatype *val);
887c478bd9Sstevel@tonic-gate asn1_error_code asn1_decode_ui_2
897c478bd9Sstevel@tonic-gate 	(asn1buf *buf, krb5_ui_2 *val);
907c478bd9Sstevel@tonic-gate asn1_error_code asn1_decode_ui_4
917c478bd9Sstevel@tonic-gate 	(asn1buf *buf, krb5_ui_4 *val);
927c478bd9Sstevel@tonic-gate asn1_error_code asn1_decode_seqnum
937c478bd9Sstevel@tonic-gate 	(asn1buf *buf, krb5_ui_4 *val);
947c478bd9Sstevel@tonic-gate asn1_error_code asn1_decode_kerberos_time
957c478bd9Sstevel@tonic-gate 	(asn1buf *buf, krb5_timestamp *val);
967c478bd9Sstevel@tonic-gate asn1_error_code asn1_decode_sam_flags
977c478bd9Sstevel@tonic-gate 	(asn1buf *buf, krb5_flags *val);
987c478bd9Sstevel@tonic-gate 
997c478bd9Sstevel@tonic-gate /* structures */
1007c478bd9Sstevel@tonic-gate asn1_error_code asn1_decode_realm
1017c478bd9Sstevel@tonic-gate 	(asn1buf *buf, krb5_principal *val);
1027c478bd9Sstevel@tonic-gate asn1_error_code asn1_decode_principal_name
1037c478bd9Sstevel@tonic-gate 	(asn1buf *buf, krb5_principal *val);
1047c478bd9Sstevel@tonic-gate asn1_error_code asn1_decode_checksum
1057c478bd9Sstevel@tonic-gate 	(asn1buf *buf, krb5_checksum *val);
1067c478bd9Sstevel@tonic-gate asn1_error_code asn1_decode_encryption_key
1077c478bd9Sstevel@tonic-gate 	(asn1buf *buf, krb5_keyblock *val);
1087c478bd9Sstevel@tonic-gate asn1_error_code asn1_decode_encrypted_data
1097c478bd9Sstevel@tonic-gate 	(asn1buf *buf, krb5_enc_data *val);
1107c478bd9Sstevel@tonic-gate asn1_error_code asn1_decode_ticket_flags
1117c478bd9Sstevel@tonic-gate 	(asn1buf *buf, krb5_flags *val);
1127c478bd9Sstevel@tonic-gate asn1_error_code asn1_decode_transited_encoding
1137c478bd9Sstevel@tonic-gate 	(asn1buf *buf, krb5_transited *val);
1147c478bd9Sstevel@tonic-gate asn1_error_code asn1_decode_enc_kdc_rep_part
1157c478bd9Sstevel@tonic-gate 	(asn1buf *buf, krb5_enc_kdc_rep_part *val);
1167c478bd9Sstevel@tonic-gate asn1_error_code asn1_decode_krb5_flags
1177c478bd9Sstevel@tonic-gate 	(asn1buf *buf, krb5_flags *val);
1187c478bd9Sstevel@tonic-gate asn1_error_code asn1_decode_ap_options
1197c478bd9Sstevel@tonic-gate 	(asn1buf *buf, krb5_flags *val);
1207c478bd9Sstevel@tonic-gate asn1_error_code asn1_decode_kdc_options
1217c478bd9Sstevel@tonic-gate 	(asn1buf *buf, krb5_flags *val);
1227c478bd9Sstevel@tonic-gate asn1_error_code asn1_decode_ticket
1237c478bd9Sstevel@tonic-gate 	(asn1buf *buf, krb5_ticket *val);
1247c478bd9Sstevel@tonic-gate asn1_error_code asn1_decode_kdc_req
1257c478bd9Sstevel@tonic-gate 	(asn1buf *buf, krb5_kdc_req *val);
1267c478bd9Sstevel@tonic-gate asn1_error_code asn1_decode_kdc_req_body
1277c478bd9Sstevel@tonic-gate 	(asn1buf *buf, krb5_kdc_req *val);
1287c478bd9Sstevel@tonic-gate asn1_error_code asn1_decode_krb_safe_body
1297c478bd9Sstevel@tonic-gate 	(asn1buf *buf, krb5_safe *val);
1307c478bd9Sstevel@tonic-gate asn1_error_code asn1_decode_host_address
1317c478bd9Sstevel@tonic-gate 	(asn1buf *buf, krb5_address *val);
1327c478bd9Sstevel@tonic-gate asn1_error_code asn1_decode_kdc_rep
1337c478bd9Sstevel@tonic-gate 	(asn1buf *buf, krb5_kdc_rep *val);
1347c478bd9Sstevel@tonic-gate asn1_error_code asn1_decode_last_req_entry
1357c478bd9Sstevel@tonic-gate 	(asn1buf *buf, krb5_last_req_entry *val);
1367c478bd9Sstevel@tonic-gate asn1_error_code asn1_decode_authdata_elt
1377c478bd9Sstevel@tonic-gate 	(asn1buf *buf, krb5_authdata *val);
1387c478bd9Sstevel@tonic-gate asn1_error_code asn1_decode_krb_cred_info
1397c478bd9Sstevel@tonic-gate 	(asn1buf *buf, krb5_cred_info *val);
1407c478bd9Sstevel@tonic-gate asn1_error_code asn1_decode_pa_data
1417c478bd9Sstevel@tonic-gate 	(asn1buf *buf, krb5_pa_data *val);
1427c478bd9Sstevel@tonic-gate asn1_error_code asn1_decode_passwdsequence
1437c478bd9Sstevel@tonic-gate 	(asn1buf *buf, passwd_phrase_element *val);
1447c478bd9Sstevel@tonic-gate asn1_error_code asn1_decode_sam_challenge
1457c478bd9Sstevel@tonic-gate 	(asn1buf *buf, krb5_sam_challenge *val);
1467c478bd9Sstevel@tonic-gate asn1_error_code asn1_decode_sam_challenge_2
1477c478bd9Sstevel@tonic-gate 	(asn1buf *buf, krb5_sam_challenge_2 *val);
1487c478bd9Sstevel@tonic-gate asn1_error_code asn1_decode_sam_challenge_2_body
1497c478bd9Sstevel@tonic-gate 	(asn1buf *buf, krb5_sam_challenge_2_body *val);
1507c478bd9Sstevel@tonic-gate asn1_error_code asn1_decode_enc_sam_key
1517c478bd9Sstevel@tonic-gate 	(asn1buf *buf, krb5_sam_key *val);
1527c478bd9Sstevel@tonic-gate asn1_error_code asn1_decode_enc_sam_response_enc
1537c478bd9Sstevel@tonic-gate 	(asn1buf *buf, krb5_enc_sam_response_enc *val);
1547c478bd9Sstevel@tonic-gate asn1_error_code asn1_decode_enc_sam_response_enc_2
1557c478bd9Sstevel@tonic-gate 	(asn1buf *buf, krb5_enc_sam_response_enc_2 *val);
1567c478bd9Sstevel@tonic-gate asn1_error_code asn1_decode_sam_response
1577c478bd9Sstevel@tonic-gate 	(asn1buf *buf, krb5_sam_response *val);
1587c478bd9Sstevel@tonic-gate asn1_error_code asn1_decode_sam_response_2
1597c478bd9Sstevel@tonic-gate 	(asn1buf *buf, krb5_sam_response_2 *val);
1607c478bd9Sstevel@tonic-gate asn1_error_code asn1_decode_predicted_sam_response
1617c478bd9Sstevel@tonic-gate 	(asn1buf *buf, krb5_predicted_sam_response *val);
162*159d09a2SMark Phalan asn1_error_code asn1_decode_external_principal_identifier
163*159d09a2SMark Phalan 	(asn1buf *buf, krb5_external_principal_identifier *val);
164*159d09a2SMark Phalan asn1_error_code asn1_decode_pa_pk_as_req
165*159d09a2SMark Phalan 	(asn1buf *buf, krb5_pa_pk_as_req *val);
166*159d09a2SMark Phalan asn1_error_code asn1_decode_trusted_ca
167*159d09a2SMark Phalan 	(asn1buf *buf, krb5_trusted_ca *val);
168*159d09a2SMark Phalan asn1_error_code asn1_decode_pa_pk_as_req_draft9
169*159d09a2SMark Phalan 	(asn1buf *buf, krb5_pa_pk_as_req_draft9 *val);
170*159d09a2SMark Phalan asn1_error_code asn1_decode_dh_rep_info
171*159d09a2SMark Phalan 	(asn1buf *buf, krb5_dh_rep_info *val);
172*159d09a2SMark Phalan asn1_error_code asn1_decode_pk_authenticator
173*159d09a2SMark Phalan 	(asn1buf *buf, krb5_pk_authenticator *val);
174*159d09a2SMark Phalan asn1_error_code asn1_decode_pk_authenticator_draft9
175*159d09a2SMark Phalan 	(asn1buf *buf, krb5_pk_authenticator_draft9 *val);
176*159d09a2SMark Phalan asn1_error_code asn1_decode_subject_pk_info
177*159d09a2SMark Phalan 	(asn1buf *buf, krb5_subject_pk_info *val);
178*159d09a2SMark Phalan asn1_error_code asn1_decode_algorithm_identifier
179*159d09a2SMark Phalan 	(asn1buf *buf, krb5_algorithm_identifier *val);
180*159d09a2SMark Phalan asn1_error_code asn1_decode_auth_pack
181*159d09a2SMark Phalan 	(asn1buf *buf, krb5_auth_pack *val);
182*159d09a2SMark Phalan asn1_error_code asn1_decode_auth_pack_draft9
183*159d09a2SMark Phalan 	(asn1buf *buf, krb5_auth_pack_draft9 *val);
184*159d09a2SMark Phalan asn1_error_code asn1_decode_pa_pk_as_rep
185*159d09a2SMark Phalan 	(asn1buf *buf, krb5_pa_pk_as_rep *val);
186*159d09a2SMark Phalan asn1_error_code asn1_decode_pa_pk_as_rep_draft9
187*159d09a2SMark Phalan 	(asn1buf *buf, krb5_pa_pk_as_rep_draft9 *val);
188*159d09a2SMark Phalan asn1_error_code asn1_decode_kdc_dh_key_info
189*159d09a2SMark Phalan         (asn1buf *buf, krb5_kdc_dh_key_info *val);
190*159d09a2SMark Phalan asn1_error_code asn1_decode_krb5_principal_name
191*159d09a2SMark Phalan 	(asn1buf *buf, krb5_principal *val);
192*159d09a2SMark Phalan asn1_error_code asn1_decode_reply_key_pack
193*159d09a2SMark Phalan         (asn1buf *buf, krb5_reply_key_pack *val);
194*159d09a2SMark Phalan asn1_error_code asn1_decode_reply_key_pack_draft9
195*159d09a2SMark Phalan         (asn1buf *buf, krb5_reply_key_pack_draft9 *val);
196*159d09a2SMark Phalan asn1_error_code asn1_decode_sequence_of_typed_data
197*159d09a2SMark Phalan         (asn1buf *buf, krb5_typed_data ***val);
198*159d09a2SMark Phalan asn1_error_code asn1_decode_typed_data
199*159d09a2SMark Phalan         (asn1buf *buf, krb5_typed_data *val);
2007c478bd9Sstevel@tonic-gate 
2017c478bd9Sstevel@tonic-gate /* arrays */
2027c478bd9Sstevel@tonic-gate asn1_error_code asn1_decode_authorization_data
2037c478bd9Sstevel@tonic-gate 	(asn1buf *buf, krb5_authdata ***val);
2047c478bd9Sstevel@tonic-gate asn1_error_code asn1_decode_host_addresses
2057c478bd9Sstevel@tonic-gate 	(asn1buf *buf, krb5_address ***val);
2067c478bd9Sstevel@tonic-gate asn1_error_code asn1_decode_sequence_of_ticket
2077c478bd9Sstevel@tonic-gate 	(asn1buf *buf, krb5_ticket ***val);
2087c478bd9Sstevel@tonic-gate asn1_error_code asn1_decode_sequence_of_krb_cred_info
2097c478bd9Sstevel@tonic-gate 	(asn1buf *buf, krb5_cred_info ***val);
2107c478bd9Sstevel@tonic-gate asn1_error_code asn1_decode_sequence_of_pa_data
2117c478bd9Sstevel@tonic-gate 	(asn1buf *buf, krb5_pa_data ***val);
2127c478bd9Sstevel@tonic-gate asn1_error_code asn1_decode_last_req
2137c478bd9Sstevel@tonic-gate 	(asn1buf *buf, krb5_last_req_entry ***val);
2147c478bd9Sstevel@tonic-gate 
2157c478bd9Sstevel@tonic-gate asn1_error_code asn1_decode_sequence_of_enctype
2167c478bd9Sstevel@tonic-gate 	(asn1buf *buf, int *num, krb5_enctype **val);
2177c478bd9Sstevel@tonic-gate 
2187c478bd9Sstevel@tonic-gate asn1_error_code asn1_decode_sequence_of_checksum
2197c478bd9Sstevel@tonic-gate 	(asn1buf *buf, krb5_checksum ***val);
2207c478bd9Sstevel@tonic-gate 
2217c478bd9Sstevel@tonic-gate asn1_error_code asn1_decode_sequence_of_passwdsequence
2227c478bd9Sstevel@tonic-gate 	(asn1buf *buf, passwd_phrase_element ***val);
2237c478bd9Sstevel@tonic-gate 
2247c478bd9Sstevel@tonic-gate asn1_error_code asn1_decode_etype_info
2257c478bd9Sstevel@tonic-gate 	(asn1buf *buf, krb5_etype_info_entry ***val);
2267c478bd9Sstevel@tonic-gate asn1_error_code asn1_decode_etype_info2
2277c478bd9Sstevel@tonic-gate 	(asn1buf *buf, krb5_etype_info_entry ***val, krb5_boolean v1_3_behavior);
228*159d09a2SMark Phalan asn1_error_code asn1_decode_sequence_of_external_principal_identifier
229*159d09a2SMark Phalan 	(asn1buf *buf, krb5_external_principal_identifier ***val);
230*159d09a2SMark Phalan asn1_error_code asn1_decode_sequence_of_trusted_ca
231*159d09a2SMark Phalan 	(asn1buf *buf, krb5_trusted_ca ***val);
232*159d09a2SMark Phalan asn1_error_code asn1_decode_sequence_of_algorithm_identifier
233*159d09a2SMark Phalan 	(asn1buf *buf, krb5_algorithm_identifier ***val);
2347c478bd9Sstevel@tonic-gate 
2357c478bd9Sstevel@tonic-gate #endif
236