1*ba7b222eSGlenn Barry /* -*- mode: c; indent-tabs-mode: nil -*- */
27c478bd9Sstevel@tonic-gate /*
37c478bd9Sstevel@tonic-gate  * src/lib/krb5/asn.1/asn1_k_encode.h
4*ba7b222eSGlenn Barry  *
5*ba7b222eSGlenn Barry  * Copyright 1994, 2008 by the Massachusetts Institute of Technology.
67c478bd9Sstevel@tonic-gate  * All Rights Reserved.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * Export of this software from the United States of America may
97c478bd9Sstevel@tonic-gate  *   require a specific license from the United States Government.
107c478bd9Sstevel@tonic-gate  *   It is the responsibility of any person or organization contemplating
117c478bd9Sstevel@tonic-gate  *   export to obtain such a license before exporting.
12*ba7b222eSGlenn Barry  *
137c478bd9Sstevel@tonic-gate  * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
147c478bd9Sstevel@tonic-gate  * distribute this software and its documentation for any purpose and
157c478bd9Sstevel@tonic-gate  * without fee is hereby granted, provided that the above copyright
167c478bd9Sstevel@tonic-gate  * notice appear in all copies and that both that copyright notice and
177c478bd9Sstevel@tonic-gate  * this permission notice appear in supporting documentation, and that
187c478bd9Sstevel@tonic-gate  * the name of M.I.T. not be used in advertising or publicity pertaining
197c478bd9Sstevel@tonic-gate  * to distribution of the software without specific, written prior
207c478bd9Sstevel@tonic-gate  * permission.  Furthermore if you modify this software you must label
217c478bd9Sstevel@tonic-gate  * your software as modified software and not distribute it in such a
227c478bd9Sstevel@tonic-gate  * fashion that it might be confused with the original M.I.T. software.
237c478bd9Sstevel@tonic-gate  * M.I.T. makes no representations about the suitability of
247c478bd9Sstevel@tonic-gate  * this software for any purpose.  It is provided "as is" without express
257c478bd9Sstevel@tonic-gate  * or implied warranty.
267c478bd9Sstevel@tonic-gate  */
277c478bd9Sstevel@tonic-gate 
287c478bd9Sstevel@tonic-gate #ifndef __ASN1_ENCODE_KRB5_H__
297c478bd9Sstevel@tonic-gate #define __ASN1_ENCODE_KRB5_H__
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate #include "k5-int.h"
327c478bd9Sstevel@tonic-gate #include <stdio.h>
337c478bd9Sstevel@tonic-gate #include "asn1buf.h"
347c478bd9Sstevel@tonic-gate 
357c478bd9Sstevel@tonic-gate /*
367c478bd9Sstevel@tonic-gate **** for simple val's ****
377c478bd9Sstevel@tonic-gate asn1_error_code asn1_encode_asn1_type(asn1buf *buf,
387c478bd9Sstevel@tonic-gate                                       const krb5_type val,
39*ba7b222eSGlenn Barry                                       int *retlen);
407c478bd9Sstevel@tonic-gate    requires  *buf is allocated
417c478bd9Sstevel@tonic-gate    effects   Inserts the encoding of val into *buf and
427c478bd9Sstevel@tonic-gate               returns the length of this encoding in *retlen.
43*ba7b222eSGlenn Barry              Returns ASN1_MISSING_FIELD if a required field is empty in val.
44*ba7b222eSGlenn Barry              Returns ENOMEM if memory runs out.
457c478bd9Sstevel@tonic-gate 
467c478bd9Sstevel@tonic-gate **** for struct val's ****
477c478bd9Sstevel@tonic-gate asn1_error_code asn1_encode_asn1_type(asn1buf *buf,
487c478bd9Sstevel@tonic-gate                                       const krb5_type *val,
49*ba7b222eSGlenn Barry                                       int *retlen);
507c478bd9Sstevel@tonic-gate    requires  *buf is allocated
517c478bd9Sstevel@tonic-gate    effects   Inserts the encoding of *val into *buf and
527c478bd9Sstevel@tonic-gate               returns the length of this encoding in *retlen.
53*ba7b222eSGlenn Barry              Returns ASN1_MISSING_FIELD if a required field is empty in val.
54*ba7b222eSGlenn Barry              Returns ENOMEM if memory runs out.
557c478bd9Sstevel@tonic-gate 
567c478bd9Sstevel@tonic-gate **** for array val's ****
577c478bd9Sstevel@tonic-gate asn1_error_code asn1_encode_asn1_type(asn1buf *buf,
587c478bd9Sstevel@tonic-gate                                       const krb5_type **val,
59*ba7b222eSGlenn Barry                                       int *retlen);
607c478bd9Sstevel@tonic-gate    requires  *buf is allocated, **val != NULL, *val[0] != NULL,
617c478bd9Sstevel@tonic-gate               **val is a NULL-terminated array of pointers to krb5_type
627c478bd9Sstevel@tonic-gate    effects   Inserts the encoding of **val into *buf and
637c478bd9Sstevel@tonic-gate               returns the length of this encoding in *retlen.
64*ba7b222eSGlenn Barry              Returns ASN1_MISSING_FIELD if a required field is empty in val.
65*ba7b222eSGlenn Barry              Returns ENOMEM if memory runs out.
667c478bd9Sstevel@tonic-gate */
677c478bd9Sstevel@tonic-gate 
68159d09a2SMark Phalan /* PKINIT */
69159d09a2SMark Phalan 
70159d09a2SMark Phalan asn1_error_code asn1_encode_pk_authenticator
71*ba7b222eSGlenn Barry         (asn1buf *buf, const krb5_pk_authenticator *val, unsigned int *retlen);
72159d09a2SMark Phalan 
73159d09a2SMark Phalan asn1_error_code asn1_encode_pk_authenticator_draft9
74*ba7b222eSGlenn Barry         (asn1buf *buf, const krb5_pk_authenticator_draft9 *val, unsigned int *retlen);
75159d09a2SMark Phalan 
76159d09a2SMark Phalan asn1_error_code asn1_encode_algorithm_identifier
77*ba7b222eSGlenn Barry         (asn1buf *buf, const krb5_algorithm_identifier *val, unsigned int *retlen);
78159d09a2SMark Phalan 
79159d09a2SMark Phalan asn1_error_code asn1_encode_subject_pk_info
80*ba7b222eSGlenn Barry         (asn1buf *buf, const krb5_subject_pk_info *val, unsigned int *retlen);
81159d09a2SMark Phalan 
82159d09a2SMark Phalan asn1_error_code asn1_encode_sequence_of_algorithm_identifier
83*ba7b222eSGlenn Barry         (asn1buf *buf, const krb5_algorithm_identifier **val, unsigned int *retlen);
84159d09a2SMark Phalan 
85159d09a2SMark Phalan asn1_error_code asn1_encode_auth_pack
86*ba7b222eSGlenn Barry         (asn1buf *buf, const krb5_auth_pack *val, unsigned int *retlen);
87159d09a2SMark Phalan 
88159d09a2SMark Phalan asn1_error_code asn1_encode_auth_pack_draft9
89*ba7b222eSGlenn Barry         (asn1buf *buf, const krb5_auth_pack_draft9 *val, unsigned int *retlen);
90159d09a2SMark Phalan 
91159d09a2SMark Phalan asn1_error_code asn1_encode_external_principal_identifier
92*ba7b222eSGlenn Barry         (asn1buf *buf, const krb5_external_principal_identifier *val, unsigned int *retlen);
93159d09a2SMark Phalan 
94159d09a2SMark Phalan asn1_error_code asn1_encode_sequence_of_external_principal_identifier
95*ba7b222eSGlenn Barry         (asn1buf *buf, const krb5_external_principal_identifier **val, unsigned int *retlen);
96159d09a2SMark Phalan 
97159d09a2SMark Phalan asn1_error_code asn1_encode_pa_pk_as_req
98*ba7b222eSGlenn Barry         (asn1buf *buf, const krb5_pa_pk_as_req *val, unsigned int *retlen);
99159d09a2SMark Phalan 
100159d09a2SMark Phalan asn1_error_code asn1_encode_trusted_ca
101*ba7b222eSGlenn Barry         (asn1buf *buf, const krb5_trusted_ca *val, unsigned int *retlen);
102159d09a2SMark Phalan 
103159d09a2SMark Phalan asn1_error_code asn1_encode_sequence_of_trusted_ca
104*ba7b222eSGlenn Barry         (asn1buf *buf, const krb5_trusted_ca **val, unsigned int *retlen);
105159d09a2SMark Phalan 
106159d09a2SMark Phalan asn1_error_code asn1_encode_pa_pk_as_req_draft9
107*ba7b222eSGlenn Barry         (asn1buf *buf, const krb5_pa_pk_as_req_draft9 *val, unsigned int *retlen);
108159d09a2SMark Phalan 
109159d09a2SMark Phalan asn1_error_code asn1_encode_dh_rep_info
110*ba7b222eSGlenn Barry         (asn1buf *buf, const krb5_dh_rep_info *val, unsigned int *retlen);
111159d09a2SMark Phalan 
112159d09a2SMark Phalan asn1_error_code asn1_encode_kdc_dh_key_info
113*ba7b222eSGlenn Barry         (asn1buf *buf, const krb5_kdc_dh_key_info *val, unsigned int *retlen);
114159d09a2SMark Phalan 
115159d09a2SMark Phalan asn1_error_code asn1_encode_reply_key_pack
116*ba7b222eSGlenn Barry         (asn1buf *buf, const krb5_reply_key_pack *val, unsigned int *retlen);
117159d09a2SMark Phalan 
118159d09a2SMark Phalan asn1_error_code asn1_encode_reply_key_pack_draft9
119*ba7b222eSGlenn Barry         (asn1buf *buf, const krb5_reply_key_pack_draft9 *val, unsigned int *retlen);
120159d09a2SMark Phalan 
121159d09a2SMark Phalan asn1_error_code asn1_encode_pa_pk_as_rep
122*ba7b222eSGlenn Barry         (asn1buf *buf, const krb5_pa_pk_as_rep *val, unsigned int *retlen);
123159d09a2SMark Phalan 
124159d09a2SMark Phalan asn1_error_code asn1_encode_pa_pk_as_rep_draft9
125*ba7b222eSGlenn Barry         (asn1buf *buf, const krb5_pa_pk_as_rep_draft9 *val, unsigned int *retlen);
126159d09a2SMark Phalan 
127159d09a2SMark Phalan asn1_error_code asn1_encode_td_trusted_certifiers
128*ba7b222eSGlenn Barry         (asn1buf *buf, const krb5_external_principal_identifier **val, unsigned int *retlen);
129159d09a2SMark Phalan 
130159d09a2SMark Phalan asn1_error_code asn1_encode_typed_data
131*ba7b222eSGlenn Barry         (asn1buf *buf, const krb5_typed_data *val, unsigned int *retlen);
132159d09a2SMark Phalan 
133159d09a2SMark Phalan asn1_error_code asn1_encode_sequence_of_typed_data
134*ba7b222eSGlenn Barry         (asn1buf *buf, const krb5_typed_data **val, unsigned int *retlen);
135*ba7b222eSGlenn Barry 
1367c478bd9Sstevel@tonic-gate #endif
137