1 /* -*- mode: c; indent-tabs-mode: nil -*- */
2 /*
3  * src/lib/krb5/asn.1/asn1_k_encode.h
4  *
5  * Copyright 1994, 2008 by the Massachusetts Institute of Technology.
6  * All Rights Reserved.
7  *
8  * Export of this software from the United States of America may
9  *   require a specific license from the United States Government.
10  *   It is the responsibility of any person or organization contemplating
11  *   export to obtain such a license before exporting.
12  *
13  * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
14  * distribute this software and its documentation for any purpose and
15  * without fee is hereby granted, provided that the above copyright
16  * notice appear in all copies and that both that copyright notice and
17  * this permission notice appear in supporting documentation, and that
18  * the name of M.I.T. not be used in advertising or publicity pertaining
19  * to distribution of the software without specific, written prior
20  * permission.  Furthermore if you modify this software you must label
21  * your software as modified software and not distribute it in such a
22  * fashion that it might be confused with the original M.I.T. software.
23  * M.I.T. makes no representations about the suitability of
24  * this software for any purpose.  It is provided "as is" without express
25  * or implied warranty.
26  */
27 
28 #ifndef __ASN1_ENCODE_KRB5_H__
29 #define __ASN1_ENCODE_KRB5_H__
30 
31 #include "k5-int.h"
32 #include <stdio.h>
33 #include "asn1buf.h"
34 
35 /*
36 **** for simple val's ****
37 asn1_error_code asn1_encode_asn1_type(asn1buf *buf,
38                                       const krb5_type val,
39                                       int *retlen);
40    requires  *buf is allocated
41    effects   Inserts the encoding of val into *buf and
42               returns the length of this encoding in *retlen.
43              Returns ASN1_MISSING_FIELD if a required field is empty in val.
44              Returns ENOMEM if memory runs out.
45 
46 **** for struct val's ****
47 asn1_error_code asn1_encode_asn1_type(asn1buf *buf,
48                                       const krb5_type *val,
49                                       int *retlen);
50    requires  *buf is allocated
51    effects   Inserts the encoding of *val into *buf and
52               returns the length of this encoding in *retlen.
53              Returns ASN1_MISSING_FIELD if a required field is empty in val.
54              Returns ENOMEM if memory runs out.
55 
56 **** for array val's ****
57 asn1_error_code asn1_encode_asn1_type(asn1buf *buf,
58                                       const krb5_type **val,
59                                       int *retlen);
60    requires  *buf is allocated, **val != NULL, *val[0] != NULL,
61               **val is a NULL-terminated array of pointers to krb5_type
62    effects   Inserts the encoding of **val into *buf and
63               returns the length of this encoding in *retlen.
64              Returns ASN1_MISSING_FIELD if a required field is empty in val.
65              Returns ENOMEM if memory runs out.
66 */
67 
68 /* PKINIT */
69 
70 asn1_error_code asn1_encode_pk_authenticator
71         (asn1buf *buf, const krb5_pk_authenticator *val, unsigned int *retlen);
72 
73 asn1_error_code asn1_encode_pk_authenticator_draft9
74         (asn1buf *buf, const krb5_pk_authenticator_draft9 *val, unsigned int *retlen);
75 
76 asn1_error_code asn1_encode_algorithm_identifier
77         (asn1buf *buf, const krb5_algorithm_identifier *val, unsigned int *retlen);
78 
79 asn1_error_code asn1_encode_subject_pk_info
80         (asn1buf *buf, const krb5_subject_pk_info *val, unsigned int *retlen);
81 
82 asn1_error_code asn1_encode_sequence_of_algorithm_identifier
83         (asn1buf *buf, const krb5_algorithm_identifier **val, unsigned int *retlen);
84 
85 asn1_error_code asn1_encode_auth_pack
86         (asn1buf *buf, const krb5_auth_pack *val, unsigned int *retlen);
87 
88 asn1_error_code asn1_encode_auth_pack_draft9
89         (asn1buf *buf, const krb5_auth_pack_draft9 *val, unsigned int *retlen);
90 
91 asn1_error_code asn1_encode_external_principal_identifier
92         (asn1buf *buf, const krb5_external_principal_identifier *val, unsigned int *retlen);
93 
94 asn1_error_code asn1_encode_sequence_of_external_principal_identifier
95         (asn1buf *buf, const krb5_external_principal_identifier **val, unsigned int *retlen);
96 
97 asn1_error_code asn1_encode_pa_pk_as_req
98         (asn1buf *buf, const krb5_pa_pk_as_req *val, unsigned int *retlen);
99 
100 asn1_error_code asn1_encode_trusted_ca
101         (asn1buf *buf, const krb5_trusted_ca *val, unsigned int *retlen);
102 
103 asn1_error_code asn1_encode_sequence_of_trusted_ca
104         (asn1buf *buf, const krb5_trusted_ca **val, unsigned int *retlen);
105 
106 asn1_error_code asn1_encode_pa_pk_as_req_draft9
107         (asn1buf *buf, const krb5_pa_pk_as_req_draft9 *val, unsigned int *retlen);
108 
109 asn1_error_code asn1_encode_dh_rep_info
110         (asn1buf *buf, const krb5_dh_rep_info *val, unsigned int *retlen);
111 
112 asn1_error_code asn1_encode_kdc_dh_key_info
113         (asn1buf *buf, const krb5_kdc_dh_key_info *val, unsigned int *retlen);
114 
115 asn1_error_code asn1_encode_reply_key_pack
116         (asn1buf *buf, const krb5_reply_key_pack *val, unsigned int *retlen);
117 
118 asn1_error_code asn1_encode_reply_key_pack_draft9
119         (asn1buf *buf, const krb5_reply_key_pack_draft9 *val, unsigned int *retlen);
120 
121 asn1_error_code asn1_encode_pa_pk_as_rep
122         (asn1buf *buf, const krb5_pa_pk_as_rep *val, unsigned int *retlen);
123 
124 asn1_error_code asn1_encode_pa_pk_as_rep_draft9
125         (asn1buf *buf, const krb5_pa_pk_as_rep_draft9 *val, unsigned int *retlen);
126 
127 asn1_error_code asn1_encode_td_trusted_certifiers
128         (asn1buf *buf, const krb5_external_principal_identifier **val, unsigned int *retlen);
129 
130 asn1_error_code asn1_encode_typed_data
131         (asn1buf *buf, const krb5_typed_data *val, unsigned int *retlen);
132 
133 asn1_error_code asn1_encode_sequence_of_typed_data
134         (asn1buf *buf, const krb5_typed_data **val, unsigned int *retlen);
135 
136 #endif
137