1 #pragma ident "%Z%%M% %I% %E% SMI" 2 3 /* 4 * src/lib/krb5/asn.1/asn1_k_decode.h 5 * 6 * Copyright 1994 by the Massachusetts Institute of Technology. 7 * All Rights Reserved. 8 * 9 * Export of this software from the United States of America may 10 * require a specific license from the United States Government. 11 * It is the responsibility of any person or organization contemplating 12 * export to obtain such a license before exporting. 13 * 14 * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and 15 * distribute this software and its documentation for any purpose and 16 * without fee is hereby granted, provided that the above copyright 17 * notice appear in all copies and that both that copyright notice and 18 * this permission notice appear in supporting documentation, and that 19 * the name of M.I.T. not be used in advertising or publicity pertaining 20 * to distribution of the software without specific, written prior 21 * permission. Furthermore if you modify this software you must label 22 * your software as modified software and not distribute it in such a 23 * fashion that it might be confused with the original M.I.T. software. 24 * M.I.T. makes no representations about the suitability of 25 * this software for any purpose. It is provided "as is" without express 26 * or implied warranty. 27 */ 28 29 #ifndef __ASN1_DECODE_KRB5_H__ 30 #define __ASN1_DECODE_KRB5_H__ 31 32 #include "k5-int.h" 33 #include "krbasn1.h" 34 #include "asn1buf.h" 35 36 /* asn1_error_code asn1_decode_scalar_type(asn1buf *buf, krb5_scalar *val); */ 37 /* requires *buf is allocated, *buf's current position points to the 38 beginning of an encoding (<id> <len> <contents>), 39 *val is allocated 40 effects Decodes the encoding in *buf, returning the result in *val. 41 Returns ASN1_BAD_ID if the encoded id does not 42 indicate the proper type. 43 Returns ASN1_OVERRUN if the encoded length exceeds 44 the bounds of *buf */ 45 46 47 /* asn1_error_code asn1_decode_structure_type(asn1buf *buf, 48 krb5_structure *val); */ 49 /* requires *buf is allocated, *buf's current position points to the 50 beginning of an encoding (<id> <len> <contents>), 51 *val is allocated 52 Assumes that *val is a freshly-allocated structure (i.e. 53 does not attempt to clean up or free *val). 54 effects Decodes the encoding in *buf, returning the result in *val. 55 Returns ASN1_BAD_ID if the encoded id does not 56 indicate the proper type. 57 Returns ASN1_OVERRUN if the encoded length exceeds 58 the bounds of *buf */ 59 60 /* asn1_error_code asn1_decode_array_type(asn1buf *buf, krb5_scalar ***val); */ 61 /* requires *buf is allocated, *buf's current position points to the 62 beginning of an encoding (<id> <len> <contents>) 63 Assumes that *val is empty (i.e. does not attempt to 64 clean up or free *val). 65 effects Decodes the encoding in *buf, returning the result in *val. 66 Returns ASN1_BAD_ID if the encoded id does not 67 indicate the proper type. 68 Returns ASN1_OVERRUN if the encoded length exceeds 69 the bounds of *buf */ 70 71 /* scalars */ 72 asn1_error_code asn1_decode_int 73 (asn1buf *buf, int *val); 74 asn1_error_code asn1_decode_int32 75 (asn1buf *buf, krb5_int32 *val); 76 asn1_error_code asn1_decode_kvno 77 (asn1buf *buf, krb5_kvno *val); 78 asn1_error_code asn1_decode_enctype 79 (asn1buf *buf, krb5_enctype *val); 80 asn1_error_code asn1_decode_msgtype 81 (asn1buf *buf, krb5_msgtype *val); 82 asn1_error_code asn1_decode_cksumtype 83 (asn1buf *buf, krb5_cksumtype *val); 84 asn1_error_code asn1_decode_octet 85 (asn1buf *buf, krb5_octet *val); 86 asn1_error_code asn1_decode_addrtype 87 (asn1buf *buf, krb5_addrtype *val); 88 asn1_error_code asn1_decode_authdatatype 89 (asn1buf *buf, krb5_authdatatype *val); 90 asn1_error_code asn1_decode_ui_2 91 (asn1buf *buf, krb5_ui_2 *val); 92 asn1_error_code asn1_decode_ui_4 93 (asn1buf *buf, krb5_ui_4 *val); 94 asn1_error_code asn1_decode_seqnum 95 (asn1buf *buf, krb5_ui_4 *val); 96 asn1_error_code asn1_decode_kerberos_time 97 (asn1buf *buf, krb5_timestamp *val); 98 asn1_error_code asn1_decode_sam_flags 99 (asn1buf *buf, krb5_flags *val); 100 101 /* structures */ 102 asn1_error_code asn1_decode_realm 103 (asn1buf *buf, krb5_principal *val); 104 asn1_error_code asn1_decode_principal_name 105 (asn1buf *buf, krb5_principal *val); 106 asn1_error_code asn1_decode_checksum 107 (asn1buf *buf, krb5_checksum *val); 108 asn1_error_code asn1_decode_encryption_key 109 (asn1buf *buf, krb5_keyblock *val); 110 asn1_error_code asn1_decode_encrypted_data 111 (asn1buf *buf, krb5_enc_data *val); 112 asn1_error_code asn1_decode_ticket_flags 113 (asn1buf *buf, krb5_flags *val); 114 asn1_error_code asn1_decode_transited_encoding 115 (asn1buf *buf, krb5_transited *val); 116 asn1_error_code asn1_decode_enc_kdc_rep_part 117 (asn1buf *buf, krb5_enc_kdc_rep_part *val); 118 asn1_error_code asn1_decode_krb5_flags 119 (asn1buf *buf, krb5_flags *val); 120 asn1_error_code asn1_decode_ap_options 121 (asn1buf *buf, krb5_flags *val); 122 asn1_error_code asn1_decode_kdc_options 123 (asn1buf *buf, krb5_flags *val); 124 asn1_error_code asn1_decode_ticket 125 (asn1buf *buf, krb5_ticket *val); 126 asn1_error_code asn1_decode_kdc_req 127 (asn1buf *buf, krb5_kdc_req *val); 128 asn1_error_code asn1_decode_kdc_req_body 129 (asn1buf *buf, krb5_kdc_req *val); 130 asn1_error_code asn1_decode_krb_safe_body 131 (asn1buf *buf, krb5_safe *val); 132 asn1_error_code asn1_decode_host_address 133 (asn1buf *buf, krb5_address *val); 134 asn1_error_code asn1_decode_kdc_rep 135 (asn1buf *buf, krb5_kdc_rep *val); 136 asn1_error_code asn1_decode_last_req_entry 137 (asn1buf *buf, krb5_last_req_entry *val); 138 asn1_error_code asn1_decode_authdata_elt 139 (asn1buf *buf, krb5_authdata *val); 140 asn1_error_code asn1_decode_krb_cred_info 141 (asn1buf *buf, krb5_cred_info *val); 142 asn1_error_code asn1_decode_pa_data 143 (asn1buf *buf, krb5_pa_data *val); 144 asn1_error_code asn1_decode_passwdsequence 145 (asn1buf *buf, passwd_phrase_element *val); 146 asn1_error_code asn1_decode_sam_challenge 147 (asn1buf *buf, krb5_sam_challenge *val); 148 asn1_error_code asn1_decode_sam_challenge_2 149 (asn1buf *buf, krb5_sam_challenge_2 *val); 150 asn1_error_code asn1_decode_sam_challenge_2_body 151 (asn1buf *buf, krb5_sam_challenge_2_body *val); 152 asn1_error_code asn1_decode_enc_sam_key 153 (asn1buf *buf, krb5_sam_key *val); 154 asn1_error_code asn1_decode_enc_sam_response_enc 155 (asn1buf *buf, krb5_enc_sam_response_enc *val); 156 asn1_error_code asn1_decode_enc_sam_response_enc_2 157 (asn1buf *buf, krb5_enc_sam_response_enc_2 *val); 158 asn1_error_code asn1_decode_sam_response 159 (asn1buf *buf, krb5_sam_response *val); 160 asn1_error_code asn1_decode_sam_response_2 161 (asn1buf *buf, krb5_sam_response_2 *val); 162 asn1_error_code asn1_decode_predicted_sam_response 163 (asn1buf *buf, krb5_predicted_sam_response *val); 164 165 /* arrays */ 166 asn1_error_code asn1_decode_authorization_data 167 (asn1buf *buf, krb5_authdata ***val); 168 asn1_error_code asn1_decode_host_addresses 169 (asn1buf *buf, krb5_address ***val); 170 asn1_error_code asn1_decode_sequence_of_ticket 171 (asn1buf *buf, krb5_ticket ***val); 172 asn1_error_code asn1_decode_sequence_of_krb_cred_info 173 (asn1buf *buf, krb5_cred_info ***val); 174 asn1_error_code asn1_decode_sequence_of_pa_data 175 (asn1buf *buf, krb5_pa_data ***val); 176 asn1_error_code asn1_decode_last_req 177 (asn1buf *buf, krb5_last_req_entry ***val); 178 179 asn1_error_code asn1_decode_sequence_of_enctype 180 (asn1buf *buf, int *num, krb5_enctype **val); 181 182 asn1_error_code asn1_decode_sequence_of_checksum 183 (asn1buf *buf, krb5_checksum ***val); 184 185 asn1_error_code asn1_decode_sequence_of_passwdsequence 186 (asn1buf *buf, passwd_phrase_element ***val); 187 188 asn1_error_code asn1_decode_etype_info 189 (asn1buf *buf, krb5_etype_info_entry ***val); 190 asn1_error_code asn1_decode_etype_info2 191 (asn1buf *buf, krb5_etype_info_entry ***val, krb5_boolean v1_3_behavior); 192 193 194 #endif 195