xref: /illumos-gate/usr/src/lib/libslp/clib/slp_ami.h (revision 1da57d551424de5a9d469760be7c4b4d4f10a755)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate #ifndef	_SLP_AMI_H
28*7c478bd9Sstevel@tonic-gate #define	_SLP_AMI_H
29*7c478bd9Sstevel@tonic-gate 
30*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
31*7c478bd9Sstevel@tonic-gate extern "C" {
32*7c478bd9Sstevel@tonic-gate #endif
33*7c478bd9Sstevel@tonic-gate 
34*7c478bd9Sstevel@tonic-gate #include <sys/types.h>
35*7c478bd9Sstevel@tonic-gate 
36*7c478bd9Sstevel@tonic-gate typedef struct ami_oid {
37*7c478bd9Sstevel@tonic-gate     unsigned short  count;
38*7c478bd9Sstevel@tonic-gate     unsigned long   *value;
39*7c478bd9Sstevel@tonic-gate } ami_oid;
40*7c478bd9Sstevel@tonic-gate 
41*7c478bd9Sstevel@tonic-gate typedef struct Any {
42*7c478bd9Sstevel@tonic-gate     unsigned long   length;
43*7c478bd9Sstevel@tonic-gate     unsigned char   *value;
44*7c478bd9Sstevel@tonic-gate } Any;
45*7c478bd9Sstevel@tonic-gate 
46*7c478bd9Sstevel@tonic-gate typedef struct ami_rdn_seq *ami_dname;
47*7c478bd9Sstevel@tonic-gate 
48*7c478bd9Sstevel@tonic-gate typedef struct ami_name {
49*7c478bd9Sstevel@tonic-gate     unsigned short choice;
50*7c478bd9Sstevel@tonic-gate #define	distinguishedName_chosen 1
51*7c478bd9Sstevel@tonic-gate 	union {
52*7c478bd9Sstevel@tonic-gate 		struct ami_rdn_seq *distinguishedName;
53*7c478bd9Sstevel@tonic-gate 	} u;
54*7c478bd9Sstevel@tonic-gate } ami_name;
55*7c478bd9Sstevel@tonic-gate 
56*7c478bd9Sstevel@tonic-gate typedef struct ami_rdn_seq {
57*7c478bd9Sstevel@tonic-gate     struct ami_rdn_seq *next;
58*7c478bd9Sstevel@tonic-gate     struct ami_rdname *value;
59*7c478bd9Sstevel@tonic-gate } *ami_rdn_seq;
60*7c478bd9Sstevel@tonic-gate 
61*7c478bd9Sstevel@tonic-gate typedef struct ami_rdname {
62*7c478bd9Sstevel@tonic-gate     struct ami_rdname *next;
63*7c478bd9Sstevel@tonic-gate     struct ami_ava  *value;
64*7c478bd9Sstevel@tonic-gate } *ami_rdname;
65*7c478bd9Sstevel@tonic-gate 
66*7c478bd9Sstevel@tonic-gate typedef Any ami_attr_value;
67*7c478bd9Sstevel@tonic-gate 
68*7c478bd9Sstevel@tonic-gate typedef struct ami_ava {
69*7c478bd9Sstevel@tonic-gate     struct ami_oid *objid;
70*7c478bd9Sstevel@tonic-gate     ami_attr_value  *value;
71*7c478bd9Sstevel@tonic-gate } ami_ava;
72*7c478bd9Sstevel@tonic-gate 
73*7c478bd9Sstevel@tonic-gate typedef struct ami_attr_list {
74*7c478bd9Sstevel@tonic-gate     struct ami_attr_list *next;
75*7c478bd9Sstevel@tonic-gate     struct ami_attr *value;
76*7c478bd9Sstevel@tonic-gate } *ami_attr_list;
77*7c478bd9Sstevel@tonic-gate 
78*7c478bd9Sstevel@tonic-gate typedef struct ami_attr {
79*7c478bd9Sstevel@tonic-gate     struct ami_oid *type;
80*7c478bd9Sstevel@tonic-gate     struct ami_attr_value_set *values;
81*7c478bd9Sstevel@tonic-gate } ami_attr;
82*7c478bd9Sstevel@tonic-gate 
83*7c478bd9Sstevel@tonic-gate typedef struct ami_attr_value_set {
84*7c478bd9Sstevel@tonic-gate     struct ami_attr_value_set *next;
85*7c478bd9Sstevel@tonic-gate     ami_attr_value  *value;
86*7c478bd9Sstevel@tonic-gate } *ami_attr_value_set;
87*7c478bd9Sstevel@tonic-gate 
88*7c478bd9Sstevel@tonic-gate typedef struct CaseIgnoreString {
89*7c478bd9Sstevel@tonic-gate     unsigned short choice;
90*7c478bd9Sstevel@tonic-gate #define	CaseIgnoreString_t61String_chosen 1
91*7c478bd9Sstevel@tonic-gate #define	CaseIgnoreString_printableString_chosen 2
92*7c478bd9Sstevel@tonic-gate 	union {
93*7c478bd9Sstevel@tonic-gate 		char *CaseIgnoreString_t61String;
94*7c478bd9Sstevel@tonic-gate 		char *CaseIgnoreString_printableString;
95*7c478bd9Sstevel@tonic-gate 	} u;
96*7c478bd9Sstevel@tonic-gate } CaseIgnoreString;
97*7c478bd9Sstevel@tonic-gate 
98*7c478bd9Sstevel@tonic-gate typedef CaseIgnoreString ami_case_ignore_string;
99*7c478bd9Sstevel@tonic-gate 
100*7c478bd9Sstevel@tonic-gate typedef char *ami_printable_string;
101*7c478bd9Sstevel@tonic-gate 
102*7c478bd9Sstevel@tonic-gate typedef struct ami_cert_pair {
103*7c478bd9Sstevel@tonic-gate     struct ami_cert *forward;  /* NULL for not present */
104*7c478bd9Sstevel@tonic-gate     struct ami_cert *reverse;  /* NULL for not present */
105*7c478bd9Sstevel@tonic-gate } ami_cert_pair;
106*7c478bd9Sstevel@tonic-gate 
107*7c478bd9Sstevel@tonic-gate typedef struct ami_cert_serialnum {
108*7c478bd9Sstevel@tonic-gate     unsigned short  length;
109*7c478bd9Sstevel@tonic-gate     unsigned char   *value;
110*7c478bd9Sstevel@tonic-gate } ami_cert_serialnum;
111*7c478bd9Sstevel@tonic-gate 
112*7c478bd9Sstevel@tonic-gate typedef struct ami_cert_info {
113*7c478bd9Sstevel@tonic-gate     unsigned char bit_mask;
114*7c478bd9Sstevel@tonic-gate #define	version_present 0x80
115*7c478bd9Sstevel@tonic-gate #define	extensions_present 0x40
116*7c478bd9Sstevel@tonic-gate     int version; /* default assumed if omitted */
117*7c478bd9Sstevel@tonic-gate #define	version_v1 0
118*7c478bd9Sstevel@tonic-gate #define	version_v2 1
119*7c478bd9Sstevel@tonic-gate #define	version_v3 2
120*7c478bd9Sstevel@tonic-gate     ami_cert_serialnum serial;
121*7c478bd9Sstevel@tonic-gate     struct ami_algid *signature;
122*7c478bd9Sstevel@tonic-gate     struct ami_name *issuer;
123*7c478bd9Sstevel@tonic-gate     struct ami_validity *validity;
124*7c478bd9Sstevel@tonic-gate     struct ami_name *subject;
125*7c478bd9Sstevel@tonic-gate     struct ami_pubkey_info *pubKeyInfo;
126*7c478bd9Sstevel@tonic-gate     struct ami_uid  *issuerUID;  /* NULL for not present */
127*7c478bd9Sstevel@tonic-gate     struct ami_uid  *subjectUID;  /* NULL for not present */
128*7c478bd9Sstevel@tonic-gate     struct ami_cert_extn_list *extensions;  /* optional */
129*7c478bd9Sstevel@tonic-gate } ami_cert_info;
130*7c478bd9Sstevel@tonic-gate 
131*7c478bd9Sstevel@tonic-gate typedef struct ami_bitstring {
132*7c478bd9Sstevel@tonic-gate     unsigned int    length;  /* number of significant bits */
133*7c478bd9Sstevel@tonic-gate     unsigned char   *value;
134*7c478bd9Sstevel@tonic-gate } ami_bitstring;
135*7c478bd9Sstevel@tonic-gate 
136*7c478bd9Sstevel@tonic-gate typedef struct ami_cert {
137*7c478bd9Sstevel@tonic-gate     ami_cert_info   info;
138*7c478bd9Sstevel@tonic-gate     struct ami_algid *algorithm;
139*7c478bd9Sstevel@tonic-gate     ami_bitstring   signature;
140*7c478bd9Sstevel@tonic-gate } ami_cert;
141*7c478bd9Sstevel@tonic-gate 
142*7c478bd9Sstevel@tonic-gate typedef struct ami_uid {
143*7c478bd9Sstevel@tonic-gate     unsigned int    length;  /* number of significant bits */
144*7c478bd9Sstevel@tonic-gate     unsigned char   *value;
145*7c478bd9Sstevel@tonic-gate } ami_uid;
146*7c478bd9Sstevel@tonic-gate 
147*7c478bd9Sstevel@tonic-gate typedef struct ami_octetstring {
148*7c478bd9Sstevel@tonic-gate     unsigned int    length;
149*7c478bd9Sstevel@tonic-gate     unsigned char   *value;
150*7c478bd9Sstevel@tonic-gate } ami_octetstring;
151*7c478bd9Sstevel@tonic-gate 
152*7c478bd9Sstevel@tonic-gate typedef int ami_cert_version;
153*7c478bd9Sstevel@tonic-gate #define	CertificateVersion_v1 0
154*7c478bd9Sstevel@tonic-gate #define	CertificateVersion_v2 1
155*7c478bd9Sstevel@tonic-gate #define	CertificateVersion_v3 2
156*7c478bd9Sstevel@tonic-gate 
157*7c478bd9Sstevel@tonic-gate typedef char amiBoolean;
158*7c478bd9Sstevel@tonic-gate 
159*7c478bd9Sstevel@tonic-gate typedef struct {
160*7c478bd9Sstevel@tonic-gate     short year; /* YYYY format when used for GeneralizedTime */
161*7c478bd9Sstevel@tonic-gate 			/* YY format when used for UTCTime */
162*7c478bd9Sstevel@tonic-gate     short month;
163*7c478bd9Sstevel@tonic-gate     short day;
164*7c478bd9Sstevel@tonic-gate     short hour;
165*7c478bd9Sstevel@tonic-gate     short minute;
166*7c478bd9Sstevel@tonic-gate     short second;
167*7c478bd9Sstevel@tonic-gate     short millisec;
168*7c478bd9Sstevel@tonic-gate     short mindiff;  /* UTC +/- minute differential */
169*7c478bd9Sstevel@tonic-gate     amiBoolean utc; /* TRUE means UTC time */
170*7c478bd9Sstevel@tonic-gate } GeneralizedTime;
171*7c478bd9Sstevel@tonic-gate 
172*7c478bd9Sstevel@tonic-gate typedef GeneralizedTime UTCTime;
173*7c478bd9Sstevel@tonic-gate 
174*7c478bd9Sstevel@tonic-gate typedef struct ami_validity {
175*7c478bd9Sstevel@tonic-gate     UTCTime *notBefore;
176*7c478bd9Sstevel@tonic-gate     UTCTime *notAfter;
177*7c478bd9Sstevel@tonic-gate } ami_validity;
178*7c478bd9Sstevel@tonic-gate 
179*7c478bd9Sstevel@tonic-gate typedef struct ami_pubkey_info {
180*7c478bd9Sstevel@tonic-gate     struct ami_algid *algorithm;
181*7c478bd9Sstevel@tonic-gate     ami_bitstring   pubKey;
182*7c478bd9Sstevel@tonic-gate } ami_pubkey_info;
183*7c478bd9Sstevel@tonic-gate 
184*7c478bd9Sstevel@tonic-gate typedef Any ami_alg_params;
185*7c478bd9Sstevel@tonic-gate 
186*7c478bd9Sstevel@tonic-gate typedef struct ami_algid {
187*7c478bd9Sstevel@tonic-gate     struct ami_oid *algorithm;
188*7c478bd9Sstevel@tonic-gate     ami_alg_params *parameters;  /* NULL for not present */
189*7c478bd9Sstevel@tonic-gate } ami_algid;
190*7c478bd9Sstevel@tonic-gate 
191*7c478bd9Sstevel@tonic-gate 
192*7c478bd9Sstevel@tonic-gate typedef struct ami_cert_extn {
193*7c478bd9Sstevel@tonic-gate     unsigned char bit_mask;
194*7c478bd9Sstevel@tonic-gate #define	critical_present 0x80
195*7c478bd9Sstevel@tonic-gate     struct ami_oid *extend;
196*7c478bd9Sstevel@tonic-gate     amiBoolean critical;
197*7c478bd9Sstevel@tonic-gate     ami_octetstring extnValue;
198*7c478bd9Sstevel@tonic-gate } ami_cert_extn;
199*7c478bd9Sstevel@tonic-gate 
200*7c478bd9Sstevel@tonic-gate typedef struct ami_cert_extn_list {
201*7c478bd9Sstevel@tonic-gate     struct ami_cert_extn_list *next;
202*7c478bd9Sstevel@tonic-gate     struct ami_cert_extn *value;
203*7c478bd9Sstevel@tonic-gate } *ami_cert_extn_list;
204*7c478bd9Sstevel@tonic-gate 
205*7c478bd9Sstevel@tonic-gate typedef struct ami_cert_list_contents {
206*7c478bd9Sstevel@tonic-gate     unsigned char bit_mask;
207*7c478bd9Sstevel@tonic-gate #define	nextUpdate_present 0x80
208*7c478bd9Sstevel@tonic-gate #define	CertListContents_revokedCertificates_present 0x40
209*7c478bd9Sstevel@tonic-gate     ami_algid signature;
210*7c478bd9Sstevel@tonic-gate     ami_name issuer;
211*7c478bd9Sstevel@tonic-gate     UTCTime thisUpdate;
212*7c478bd9Sstevel@tonic-gate     UTCTime nextUpdate;
213*7c478bd9Sstevel@tonic-gate 	struct _seqof1 {
214*7c478bd9Sstevel@tonic-gate 		struct _seqof1  *next;
215*7c478bd9Sstevel@tonic-gate 		struct {
216*7c478bd9Sstevel@tonic-gate 			ami_cert_serialnum userCertificate;
217*7c478bd9Sstevel@tonic-gate 			UTCTime revocationDate;
218*7c478bd9Sstevel@tonic-gate 		} value;
219*7c478bd9Sstevel@tonic-gate 	} *CertListContents_revokedCertificates;
220*7c478bd9Sstevel@tonic-gate } ami_cert_list_contents;
221*7c478bd9Sstevel@tonic-gate 
222*7c478bd9Sstevel@tonic-gate typedef struct ami_cert_list {
223*7c478bd9Sstevel@tonic-gate     ami_cert_list_contents certListContents;
224*7c478bd9Sstevel@tonic-gate     ami_algid algId;
225*7c478bd9Sstevel@tonic-gate     ami_bitstring signature;
226*7c478bd9Sstevel@tonic-gate } ami_cert_list;
227*7c478bd9Sstevel@tonic-gate 
228*7c478bd9Sstevel@tonic-gate typedef struct ami_rc2_cbc_param {
229*7c478bd9Sstevel@tonic-gate     unsigned short choice;
230*7c478bd9Sstevel@tonic-gate #define	 iv_chosen 1
231*7c478bd9Sstevel@tonic-gate #define	sequence_chosen 2
232*7c478bd9Sstevel@tonic-gate 	union {
233*7c478bd9Sstevel@tonic-gate 		ami_octetstring iv;
234*7c478bd9Sstevel@tonic-gate 		struct _seq1 {
235*7c478bd9Sstevel@tonic-gate 			int version;
236*7c478bd9Sstevel@tonic-gate 			ami_octetstring iv;
237*7c478bd9Sstevel@tonic-gate 		} sequence;
238*7c478bd9Sstevel@tonic-gate 	} u;
239*7c478bd9Sstevel@tonic-gate } ami_rc2_cbc_param;
240*7c478bd9Sstevel@tonic-gate 
241*7c478bd9Sstevel@tonic-gate typedef int INT;
242*7c478bd9Sstevel@tonic-gate 
243*7c478bd9Sstevel@tonic-gate typedef struct ami_keypkg_info {
244*7c478bd9Sstevel@tonic-gate     unsigned char bit_mask;
245*7c478bd9Sstevel@tonic-gate #define	keypkgAttrs_present 0x80
246*7c478bd9Sstevel@tonic-gate #define	tKeys_present 0x40
247*7c478bd9Sstevel@tonic-gate     char *version;
248*7c478bd9Sstevel@tonic-gate     char *keypkgId;
249*7c478bd9Sstevel@tonic-gate     struct ami_name *owner;
250*7c478bd9Sstevel@tonic-gate     struct ami_pubkey_info *pubKeyInfo;
251*7c478bd9Sstevel@tonic-gate     struct ami_encr_privkey_info *encrPrivKeyInfo;
252*7c478bd9Sstevel@tonic-gate     struct ami_attr_list *keypkgAttrs;  /* optional */
253*7c478bd9Sstevel@tonic-gate     int usage;
254*7c478bd9Sstevel@tonic-gate     struct ami_tkey_list *tKeys;  /* optional */
255*7c478bd9Sstevel@tonic-gate } ami_keypkg_info;
256*7c478bd9Sstevel@tonic-gate 
257*7c478bd9Sstevel@tonic-gate typedef struct ami_keypkg {
258*7c478bd9Sstevel@tonic-gate     ami_keypkg_info info;
259*7c478bd9Sstevel@tonic-gate     struct ami_algid *algorithm;
260*7c478bd9Sstevel@tonic-gate     ami_bitstring   signature;
261*7c478bd9Sstevel@tonic-gate } ami_keypkg;
262*7c478bd9Sstevel@tonic-gate 
263*7c478bd9Sstevel@tonic-gate typedef struct ami_tkey_list {
264*7c478bd9Sstevel@tonic-gate     struct ami_tkey_list *next;
265*7c478bd9Sstevel@tonic-gate     struct ami_tkey *value;
266*7c478bd9Sstevel@tonic-gate } *ami_tkey_list;
267*7c478bd9Sstevel@tonic-gate 
268*7c478bd9Sstevel@tonic-gate typedef struct ami_tkey {
269*7c478bd9Sstevel@tonic-gate     unsigned char bit_mask;
270*7c478bd9Sstevel@tonic-gate #define	TrustedKey_extensions_present 0x80
271*7c478bd9Sstevel@tonic-gate     struct ami_name *owner;
272*7c478bd9Sstevel@tonic-gate     struct ami_pubkey_info *pubKeyInfo;
273*7c478bd9Sstevel@tonic-gate     struct ami_name *issuer;  /* NULL for not present */
274*7c478bd9Sstevel@tonic-gate     struct ami_validity *validity;  /* NULL for not present */
275*7c478bd9Sstevel@tonic-gate     struct ami_cert_serialnum *serial;  /* NULL for not present */
276*7c478bd9Sstevel@tonic-gate     struct ami_cert_extn_list *TrustedKey_extensions;  /* optional */
277*7c478bd9Sstevel@tonic-gate } ami_tkey;
278*7c478bd9Sstevel@tonic-gate 
279*7c478bd9Sstevel@tonic-gate typedef struct ami_serv_key_info {
280*7c478bd9Sstevel@tonic-gate     Any keyAlgId;
281*7c478bd9Sstevel@tonic-gate     int uid;
282*7c478bd9Sstevel@tonic-gate     int flags;
283*7c478bd9Sstevel@tonic-gate     Any privKey;
284*7c478bd9Sstevel@tonic-gate     char *keypkgId;
285*7c478bd9Sstevel@tonic-gate     char *hostIP;
286*7c478bd9Sstevel@tonic-gate     Any keypkg;
287*7c478bd9Sstevel@tonic-gate } ami_serv_key_info;
288*7c478bd9Sstevel@tonic-gate 
289*7c478bd9Sstevel@tonic-gate typedef struct _octet1 {
290*7c478bd9Sstevel@tonic-gate     unsigned int    length;
291*7c478bd9Sstevel@tonic-gate     unsigned char   *value;
292*7c478bd9Sstevel@tonic-gate } _octet1;
293*7c478bd9Sstevel@tonic-gate 
294*7c478bd9Sstevel@tonic-gate typedef struct ami_digest_info {
295*7c478bd9Sstevel@tonic-gate     struct ami_algid *digestAlgorithm;
296*7c478bd9Sstevel@tonic-gate     _octet1 digest;
297*7c478bd9Sstevel@tonic-gate } ami_digest_info;
298*7c478bd9Sstevel@tonic-gate 
299*7c478bd9Sstevel@tonic-gate typedef struct ami_crl_set {
300*7c478bd9Sstevel@tonic-gate     struct ami_crl_set *next;
301*7c478bd9Sstevel@tonic-gate     struct ami_crl  *value;
302*7c478bd9Sstevel@tonic-gate } *ami_crl_set;
303*7c478bd9Sstevel@tonic-gate 
304*7c478bd9Sstevel@tonic-gate typedef struct ami_crl_entry {
305*7c478bd9Sstevel@tonic-gate     int userCertificate;
306*7c478bd9Sstevel@tonic-gate     UTCTime *revocationDate;
307*7c478bd9Sstevel@tonic-gate } ami_crl_entry;
308*7c478bd9Sstevel@tonic-gate 
309*7c478bd9Sstevel@tonic-gate typedef struct ami_crl_info {
310*7c478bd9Sstevel@tonic-gate     unsigned char bit_mask;
311*7c478bd9Sstevel@tonic-gate #define	CertificateRevocationListInfo_revokedCertificates_present 0x80
312*7c478bd9Sstevel@tonic-gate     struct ami_algid *signature;
313*7c478bd9Sstevel@tonic-gate     struct ami_name *issuer;
314*7c478bd9Sstevel@tonic-gate     UTCTime *lastUpdate;
315*7c478bd9Sstevel@tonic-gate     UTCTime  *nextUpdate;
316*7c478bd9Sstevel@tonic-gate 	struct _seqof2 {
317*7c478bd9Sstevel@tonic-gate 		struct _seqof2 *next;
318*7c478bd9Sstevel@tonic-gate 		ami_crl_entry value;
319*7c478bd9Sstevel@tonic-gate 	} *CertificateRevocationListInfo_revokedCertificates;
320*7c478bd9Sstevel@tonic-gate } ami_crl_info;
321*7c478bd9Sstevel@tonic-gate 
322*7c478bd9Sstevel@tonic-gate typedef struct ami_crl {
323*7c478bd9Sstevel@tonic-gate     ami_crl_info info;
324*7c478bd9Sstevel@tonic-gate     struct ami_algid *algorithm;
325*7c478bd9Sstevel@tonic-gate     ami_bitstring signature;
326*7c478bd9Sstevel@tonic-gate } ami_crl;
327*7c478bd9Sstevel@tonic-gate 
328*7c478bd9Sstevel@tonic-gate typedef struct ami_pbe_param {
329*7c478bd9Sstevel@tonic-gate 	struct {
330*7c478bd9Sstevel@tonic-gate 		unsigned short  length;
331*7c478bd9Sstevel@tonic-gate 		unsigned char   value[8];
332*7c478bd9Sstevel@tonic-gate 	} salt;
333*7c478bd9Sstevel@tonic-gate     int iterationCount;
334*7c478bd9Sstevel@tonic-gate } ami_pbe_param;
335*7c478bd9Sstevel@tonic-gate 
336*7c478bd9Sstevel@tonic-gate typedef struct ami_extcert_info {
337*7c478bd9Sstevel@tonic-gate     int version;
338*7c478bd9Sstevel@tonic-gate     struct ami_cert *certificate;
339*7c478bd9Sstevel@tonic-gate     struct ami_attr_list *attributes;
340*7c478bd9Sstevel@tonic-gate } ami_extcert_info;
341*7c478bd9Sstevel@tonic-gate 
342*7c478bd9Sstevel@tonic-gate typedef struct ami_extcert {
343*7c478bd9Sstevel@tonic-gate     struct ami_extcert_info *extendedCertificateInfo;
344*7c478bd9Sstevel@tonic-gate     struct ami_algid *signatureAlgorithm;
345*7c478bd9Sstevel@tonic-gate     ami_bitstring signature;
346*7c478bd9Sstevel@tonic-gate } ami_extcert;
347*7c478bd9Sstevel@tonic-gate 
348*7c478bd9Sstevel@tonic-gate typedef struct ami_extcerts_and_certs {
349*7c478bd9Sstevel@tonic-gate     struct ami_extcerts_and_certs *next;
350*7c478bd9Sstevel@tonic-gate     struct ami_extcert_or_cert *value;
351*7c478bd9Sstevel@tonic-gate } *ami_extcerts_and_certs;
352*7c478bd9Sstevel@tonic-gate 
353*7c478bd9Sstevel@tonic-gate typedef struct ami_extcert_or_cert {
354*7c478bd9Sstevel@tonic-gate     unsigned short choice;
355*7c478bd9Sstevel@tonic-gate #define	cert_chosen 1
356*7c478bd9Sstevel@tonic-gate #define	 extendedCert_chosen 2
357*7c478bd9Sstevel@tonic-gate 	union {
358*7c478bd9Sstevel@tonic-gate 		struct ami_cert *cert;
359*7c478bd9Sstevel@tonic-gate 		struct ami_extcert *extendedCert;
360*7c478bd9Sstevel@tonic-gate 	} u;
361*7c478bd9Sstevel@tonic-gate } ami_extcert_or_cert;
362*7c478bd9Sstevel@tonic-gate 
363*7c478bd9Sstevel@tonic-gate typedef Any Content;
364*7c478bd9Sstevel@tonic-gate 
365*7c478bd9Sstevel@tonic-gate typedef struct ami_content_info {
366*7c478bd9Sstevel@tonic-gate     struct ami_oid *contentType;
367*7c478bd9Sstevel@tonic-gate     Content *content;  /* NULL for not present */
368*7c478bd9Sstevel@tonic-gate } ami_content_info;
369*7c478bd9Sstevel@tonic-gate 
370*7c478bd9Sstevel@tonic-gate typedef struct ami_content_info_fm {
371*7c478bd9Sstevel@tonic-gate     struct ami_oid *contentType;
372*7c478bd9Sstevel@tonic-gate     Content *content;  /* NULL for not present */
373*7c478bd9Sstevel@tonic-gate } ami_content_info_fm;
374*7c478bd9Sstevel@tonic-gate 
375*7c478bd9Sstevel@tonic-gate typedef struct ami_enveloped_data {
376*7c478bd9Sstevel@tonic-gate     int version;
377*7c478bd9Sstevel@tonic-gate     struct ami_rcpt_info_list *recipientInfos;
378*7c478bd9Sstevel@tonic-gate     struct ami_encr_content_info *encryptedContentInfo;
379*7c478bd9Sstevel@tonic-gate } ami_enveloped_data;
380*7c478bd9Sstevel@tonic-gate 
381*7c478bd9Sstevel@tonic-gate typedef struct ami_encr_data {
382*7c478bd9Sstevel@tonic-gate     int version;
383*7c478bd9Sstevel@tonic-gate     struct ami_encr_content_info *encryptedContentInfo;
384*7c478bd9Sstevel@tonic-gate } ami_encr_data;
385*7c478bd9Sstevel@tonic-gate 
386*7c478bd9Sstevel@tonic-gate typedef struct ami_signed_data {
387*7c478bd9Sstevel@tonic-gate     unsigned char bit_mask;
388*7c478bd9Sstevel@tonic-gate #define	SignedData_certs_present 0x80
389*7c478bd9Sstevel@tonic-gate #define	SignedData_crls_present 0x40
390*7c478bd9Sstevel@tonic-gate     int version;
391*7c478bd9Sstevel@tonic-gate     struct ami_digest_alg_list *digestAlgorithms;
392*7c478bd9Sstevel@tonic-gate     struct ami_content_info *contentInfo;
393*7c478bd9Sstevel@tonic-gate     struct ami_extcerts_and_certs *SignedData_certs;  /* optional */
394*7c478bd9Sstevel@tonic-gate     struct ami_crl_set *SignedData_crls;  /* optional */
395*7c478bd9Sstevel@tonic-gate     struct ami_signer_info_list *signerInfos;
396*7c478bd9Sstevel@tonic-gate } ami_signed_data;
397*7c478bd9Sstevel@tonic-gate 
398*7c478bd9Sstevel@tonic-gate typedef struct ami_signed_data_fm {
399*7c478bd9Sstevel@tonic-gate     unsigned char bit_mask;
400*7c478bd9Sstevel@tonic-gate #define	SignedDataFm_certs_present 0x80
401*7c478bd9Sstevel@tonic-gate #define	SignedDataFm_crls_present 0x40
402*7c478bd9Sstevel@tonic-gate     int version;
403*7c478bd9Sstevel@tonic-gate     struct ami_digest_alg_list *digestAlgorithms;
404*7c478bd9Sstevel@tonic-gate     struct ami_content_info_fm *contentInfo;
405*7c478bd9Sstevel@tonic-gate     struct ami_extcerts_and_certs *SignedDataFm_certs;  /* optional */
406*7c478bd9Sstevel@tonic-gate     struct ami_crl_set *SignedDataFm_crls;  /* optional */
407*7c478bd9Sstevel@tonic-gate     struct ami_signer_info_list *signerInfos;
408*7c478bd9Sstevel@tonic-gate } ami_signed_data_fm;
409*7c478bd9Sstevel@tonic-gate 
410*7c478bd9Sstevel@tonic-gate typedef struct ami_rcpt_info_list {
411*7c478bd9Sstevel@tonic-gate     struct ami_rcpt_info_list *next;
412*7c478bd9Sstevel@tonic-gate     struct ami_rcpt_info *value;
413*7c478bd9Sstevel@tonic-gate } *ami_rcpt_info_list;
414*7c478bd9Sstevel@tonic-gate 
415*7c478bd9Sstevel@tonic-gate typedef struct ami_encr_content_info {
416*7c478bd9Sstevel@tonic-gate     struct ami_oid *contentType;
417*7c478bd9Sstevel@tonic-gate     struct ami_algid *contentEncryptionAlgorithm;
418*7c478bd9Sstevel@tonic-gate     struct ami_encr_content *encryptedContent;  /* NULL for not present */
419*7c478bd9Sstevel@tonic-gate } ami_encr_content_info;
420*7c478bd9Sstevel@tonic-gate 
421*7c478bd9Sstevel@tonic-gate typedef struct ami_pkcs_data {
422*7c478bd9Sstevel@tonic-gate     unsigned int length;
423*7c478bd9Sstevel@tonic-gate     unsigned char *value;
424*7c478bd9Sstevel@tonic-gate } ami_pkcs_data;
425*7c478bd9Sstevel@tonic-gate 
426*7c478bd9Sstevel@tonic-gate typedef struct ami_pkcs_data_fm {
427*7c478bd9Sstevel@tonic-gate     unsigned int length;
428*7c478bd9Sstevel@tonic-gate     unsigned char *value;
429*7c478bd9Sstevel@tonic-gate } ami_pkcs_data_fm;
430*7c478bd9Sstevel@tonic-gate 
431*7c478bd9Sstevel@tonic-gate typedef struct ami_encr_content {
432*7c478bd9Sstevel@tonic-gate     unsigned int length;
433*7c478bd9Sstevel@tonic-gate     unsigned char *value;
434*7c478bd9Sstevel@tonic-gate } ami_encr_content;
435*7c478bd9Sstevel@tonic-gate 
436*7c478bd9Sstevel@tonic-gate typedef struct ami_rcpt_info {
437*7c478bd9Sstevel@tonic-gate     int version;
438*7c478bd9Sstevel@tonic-gate     struct ami_issuer_and_serialnum *issuerAndSerialNumber;
439*7c478bd9Sstevel@tonic-gate     struct ami_algid *keyEncryptionAlgorithm;
440*7c478bd9Sstevel@tonic-gate     _octet1 encryptedKey;
441*7c478bd9Sstevel@tonic-gate } ami_rcpt_info;
442*7c478bd9Sstevel@tonic-gate 
443*7c478bd9Sstevel@tonic-gate typedef struct ami_signer_info {
444*7c478bd9Sstevel@tonic-gate     unsigned char bit_mask;
445*7c478bd9Sstevel@tonic-gate #define	authenticatedAttributes_present 0x80
446*7c478bd9Sstevel@tonic-gate #define	unauthenticatedAttributes_present 0x40
447*7c478bd9Sstevel@tonic-gate     int version;
448*7c478bd9Sstevel@tonic-gate     struct ami_issuer_and_serialnum *issuerAndSerialNumber;
449*7c478bd9Sstevel@tonic-gate     struct ami_algid *digestAlgorithm;
450*7c478bd9Sstevel@tonic-gate     struct ami_attr_list *authenticatedAttributes;  /* optional */
451*7c478bd9Sstevel@tonic-gate     struct ami_algid *digestEncryptionAlgorithm;
452*7c478bd9Sstevel@tonic-gate     _octet1 encryptedDigest;
453*7c478bd9Sstevel@tonic-gate     struct ami_attr_list *unauthenticatedAttributes;  /* optional */
454*7c478bd9Sstevel@tonic-gate } ami_signer_info;
455*7c478bd9Sstevel@tonic-gate 
456*7c478bd9Sstevel@tonic-gate typedef struct ami_signer_info_list {
457*7c478bd9Sstevel@tonic-gate     struct ami_signer_info_list *next;
458*7c478bd9Sstevel@tonic-gate     struct ami_signer_info *value;
459*7c478bd9Sstevel@tonic-gate } *ami_signer_info_list;
460*7c478bd9Sstevel@tonic-gate 
461*7c478bd9Sstevel@tonic-gate typedef struct ami_issuer_and_serialnum {
462*7c478bd9Sstevel@tonic-gate     struct ami_name *issuer;
463*7c478bd9Sstevel@tonic-gate     ami_cert_serialnum serial;
464*7c478bd9Sstevel@tonic-gate } ami_issuer_and_serialnum;
465*7c478bd9Sstevel@tonic-gate 
466*7c478bd9Sstevel@tonic-gate typedef struct ami_digest_alg_list {
467*7c478bd9Sstevel@tonic-gate     struct ami_digest_alg_list *next;
468*7c478bd9Sstevel@tonic-gate     struct ami_algid *value;
469*7c478bd9Sstevel@tonic-gate } *ami_digest_alg_list;
470*7c478bd9Sstevel@tonic-gate 
471*7c478bd9Sstevel@tonic-gate typedef struct ami_privkey_info {
472*7c478bd9Sstevel@tonic-gate     unsigned char   bit_mask;
473*7c478bd9Sstevel@tonic-gate #define	attributes_present 0x80
474*7c478bd9Sstevel@tonic-gate     int version;
475*7c478bd9Sstevel@tonic-gate     struct ami_algid *privateKeyAlgorithm;
476*7c478bd9Sstevel@tonic-gate     _octet1 privateKey;
477*7c478bd9Sstevel@tonic-gate     struct ami_attr_list *attributes;  /* optional */
478*7c478bd9Sstevel@tonic-gate } ami_privkey_info;
479*7c478bd9Sstevel@tonic-gate 
480*7c478bd9Sstevel@tonic-gate typedef struct ami_encr_privkey_info {
481*7c478bd9Sstevel@tonic-gate     struct ami_algid *encryptionAlgorithm;
482*7c478bd9Sstevel@tonic-gate     ami_octetstring encryptedData;
483*7c478bd9Sstevel@tonic-gate } ami_encr_privkey_info;
484*7c478bd9Sstevel@tonic-gate 
485*7c478bd9Sstevel@tonic-gate typedef struct ami_certreq_info {
486*7c478bd9Sstevel@tonic-gate     int version;
487*7c478bd9Sstevel@tonic-gate     struct ami_name *subject;
488*7c478bd9Sstevel@tonic-gate     struct ami_pubkey_info *pubKeyInfo;
489*7c478bd9Sstevel@tonic-gate     struct ami_attr_list *attributes;
490*7c478bd9Sstevel@tonic-gate } ami_certreq_info;
491*7c478bd9Sstevel@tonic-gate 
492*7c478bd9Sstevel@tonic-gate typedef struct ami_certreq {
493*7c478bd9Sstevel@tonic-gate     ami_certreq_info info;
494*7c478bd9Sstevel@tonic-gate     struct ami_algid *algorithm;
495*7c478bd9Sstevel@tonic-gate     ami_bitstring   signature;
496*7c478bd9Sstevel@tonic-gate } ami_certreq;
497*7c478bd9Sstevel@tonic-gate 
498*7c478bd9Sstevel@tonic-gate typedef struct ami_challenge_pwd {
499*7c478bd9Sstevel@tonic-gate     unsigned short  choice;
500*7c478bd9Sstevel@tonic-gate #define	ChallengePassword_printableString_chosen 1
501*7c478bd9Sstevel@tonic-gate #define	ChallengePassword_t61String_chosen 2
502*7c478bd9Sstevel@tonic-gate 	union {
503*7c478bd9Sstevel@tonic-gate 		char *ChallengePassword_printableString;
504*7c478bd9Sstevel@tonic-gate 		char *ChallengePassword_t61String;
505*7c478bd9Sstevel@tonic-gate 	} u;
506*7c478bd9Sstevel@tonic-gate } ami_challenge_pwd;
507*7c478bd9Sstevel@tonic-gate 
508*7c478bd9Sstevel@tonic-gate typedef char *ami_email_addr;
509*7c478bd9Sstevel@tonic-gate 
510*7c478bd9Sstevel@tonic-gate typedef struct ami_pubkey_and_challenge {
511*7c478bd9Sstevel@tonic-gate 	struct ami_pubkey_info *spki;
512*7c478bd9Sstevel@tonic-gate 	char *challenge;
513*7c478bd9Sstevel@tonic-gate } ami_pubkey_and_challenge;
514*7c478bd9Sstevel@tonic-gate 
515*7c478bd9Sstevel@tonic-gate typedef struct ami_signed_pubkey_and_challenge {
516*7c478bd9Sstevel@tonic-gate     ami_pubkey_and_challenge pubKeyAndChallenge;
517*7c478bd9Sstevel@tonic-gate     struct ami_algid *sigAlg;
518*7c478bd9Sstevel@tonic-gate     ami_bitstring   signature;
519*7c478bd9Sstevel@tonic-gate } ami_signed_pubkey_and_challenge;
520*7c478bd9Sstevel@tonic-gate 
521*7c478bd9Sstevel@tonic-gate extern ami_oid *AMI_MD2_OID;
522*7c478bd9Sstevel@tonic-gate extern ami_oid *AMI_MD4_OID;
523*7c478bd9Sstevel@tonic-gate extern ami_oid *AMI_MD5_OID;
524*7c478bd9Sstevel@tonic-gate extern ami_oid *AMI_SHA_1_OID;
525*7c478bd9Sstevel@tonic-gate extern ami_oid *AMI_RSA_ENCR_OID;
526*7c478bd9Sstevel@tonic-gate extern ami_oid *AMI_MD2WithRSAEncryption_OID;
527*7c478bd9Sstevel@tonic-gate extern ami_oid *AMI_MD5WithRSAEncryption_OID;
528*7c478bd9Sstevel@tonic-gate extern ami_oid *AMI_DSA_OID;
529*7c478bd9Sstevel@tonic-gate extern ami_oid *AMI_SHA1WithDSASignature_OID;
530*7c478bd9Sstevel@tonic-gate extern ami_oid *AMI_DES_ECB_OID;
531*7c478bd9Sstevel@tonic-gate extern ami_oid *AMI_DES_CBC_OID;
532*7c478bd9Sstevel@tonic-gate extern ami_oid *AMI_DES3_CBC_OID;
533*7c478bd9Sstevel@tonic-gate extern ami_oid *AMI_DES_MAC_OID;
534*7c478bd9Sstevel@tonic-gate extern ami_oid *AMI_RC2_CBC_OID;
535*7c478bd9Sstevel@tonic-gate extern ami_oid *AMI_RC4_OID;
536*7c478bd9Sstevel@tonic-gate 
537*7c478bd9Sstevel@tonic-gate /*
538*7c478bd9Sstevel@tonic-gate  * Misc. AlgIDs
539*7c478bd9Sstevel@tonic-gate  */
540*7c478bd9Sstevel@tonic-gate extern struct ami_algid *AMI_RSA_ENCR_AID;
541*7c478bd9Sstevel@tonic-gate extern struct ami_algid *AMI_MD2WithRSAEncryption_AID;
542*7c478bd9Sstevel@tonic-gate extern struct ami_algid *AMI_MD5WithRSAEncryption_AID;
543*7c478bd9Sstevel@tonic-gate extern struct ami_algid *AMI_DSA_AID;
544*7c478bd9Sstevel@tonic-gate extern struct ami_algid *AMI_SHA1WithDSASignature_AID;
545*7c478bd9Sstevel@tonic-gate extern struct ami_algid *AMI_DH_AID;
546*7c478bd9Sstevel@tonic-gate extern struct ami_algid *AMI_MD2_AID;
547*7c478bd9Sstevel@tonic-gate extern struct ami_algid *AMI_MD4_AID;
548*7c478bd9Sstevel@tonic-gate extern struct ami_algid *AMI_MD5_AID;
549*7c478bd9Sstevel@tonic-gate extern struct ami_algid *AMI_SHA1_AID;
550*7c478bd9Sstevel@tonic-gate extern struct ami_algid *AMI_RC4_AID;
551*7c478bd9Sstevel@tonic-gate 
552*7c478bd9Sstevel@tonic-gate /* Algorithm types */
553*7c478bd9Sstevel@tonic-gate typedef enum {
554*7c478bd9Sstevel@tonic-gate 	AMI_OTHER_ALG = -1,
555*7c478bd9Sstevel@tonic-gate 	AMI_SYM_ENC_ALG,
556*7c478bd9Sstevel@tonic-gate 	AMI_ASYM_ENC_ALG,
557*7c478bd9Sstevel@tonic-gate 	AMI_HASH_ALG,
558*7c478bd9Sstevel@tonic-gate 	AMI_SIG_ALG,
559*7c478bd9Sstevel@tonic-gate 	AMI_KEYED_INTEGRITY_ALG
560*7c478bd9Sstevel@tonic-gate } ami_alg_type;
561*7c478bd9Sstevel@tonic-gate 
562*7c478bd9Sstevel@tonic-gate /* Parameter types */
563*7c478bd9Sstevel@tonic-gate typedef enum {
564*7c478bd9Sstevel@tonic-gate 	AMI_PARM_OTHER = -1,
565*7c478bd9Sstevel@tonic-gate 	AMI_PARM_ABSENT,
566*7c478bd9Sstevel@tonic-gate 	AMI_PARM_INTEGER,
567*7c478bd9Sstevel@tonic-gate 	AMI_PARM_OCTETSTRING,
568*7c478bd9Sstevel@tonic-gate 	AMI_PARM_NULL,
569*7c478bd9Sstevel@tonic-gate 	AMI_PARM_RC2_CBC,
570*7c478bd9Sstevel@tonic-gate 	AMI_PARM_PBE
571*7c478bd9Sstevel@tonic-gate } ami_parm_type;
572*7c478bd9Sstevel@tonic-gate 
573*7c478bd9Sstevel@tonic-gate /* Algorithm table */
574*7c478bd9Sstevel@tonic-gate #define	AMI_NO_EXPORT_KEYSIZE_LIMIT	0
575*7c478bd9Sstevel@tonic-gate typedef struct ami_alg_list {
576*7c478bd9Sstevel@tonic-gate 	ami_oid	*oid;
577*7c478bd9Sstevel@tonic-gate 	char		*name;
578*7c478bd9Sstevel@tonic-gate 	ami_alg_type	algType;
579*7c478bd9Sstevel@tonic-gate 	ami_parm_type	parmType;
580*7c478bd9Sstevel@tonic-gate 	size_t		keysize_limit;
581*7c478bd9Sstevel@tonic-gate } ami_alg_list;
582*7c478bd9Sstevel@tonic-gate 
583*7c478bd9Sstevel@tonic-gate /*
584*7c478bd9Sstevel@tonic-gate  * AMI function return values
585*7c478bd9Sstevel@tonic-gate  */
586*7c478bd9Sstevel@tonic-gate 
587*7c478bd9Sstevel@tonic-gate #define	AMI_OK				0
588*7c478bd9Sstevel@tonic-gate #define	AMI_EBUFSIZE			1
589*7c478bd9Sstevel@tonic-gate #define	AMI_ENOMEM			2	/* ENOMEM MUST be 2 */
590*7c478bd9Sstevel@tonic-gate #define	AMI_BAD_FILE			3
591*7c478bd9Sstevel@tonic-gate #define	AMI_FILE_NOT_FOUND		4
592*7c478bd9Sstevel@tonic-gate #define	AMI_FILE_IO_ERR			5
593*7c478bd9Sstevel@tonic-gate #define	AMI_BAD_PASSWD			6
594*7c478bd9Sstevel@tonic-gate #define	AMI_UNKNOWN_USER		7
595*7c478bd9Sstevel@tonic-gate #define	AMI_ALGORITHM_UNKNOWN		8
596*7c478bd9Sstevel@tonic-gate #define	AMI_ASN1_ENCODE_ERR		9
597*7c478bd9Sstevel@tonic-gate #define	AMI_ASN1_DECODE_ERR		10
598*7c478bd9Sstevel@tonic-gate #define	AMI_BAD_KEY			11
599*7c478bd9Sstevel@tonic-gate #define	AMI_KEYGEN_ERR			12
600*7c478bd9Sstevel@tonic-gate #define	AMI_ENCRYPT_ERR			13
601*7c478bd9Sstevel@tonic-gate #define	AMI_DECRYPT_ERR			14
602*7c478bd9Sstevel@tonic-gate #define	AMI_SIGN_ERR			15
603*7c478bd9Sstevel@tonic-gate #define	AMI_VERIFY_ERR			16
604*7c478bd9Sstevel@tonic-gate #define	AMI_DIGEST_ERR			17
605*7c478bd9Sstevel@tonic-gate #define	AMI_OUTPUT_FORMAT_ERR		18
606*7c478bd9Sstevel@tonic-gate #define	AMI_SYSTEM_ERR			19	/* General Errors */
607*7c478bd9Sstevel@tonic-gate #define	AMI_ATTRIBUTE_UNKNOWN		20
608*7c478bd9Sstevel@tonic-gate #define	AMI_AMILOGIN_ERR		21
609*7c478bd9Sstevel@tonic-gate #define	AMI_AMILOGOUT_ERR		22
610*7c478bd9Sstevel@tonic-gate #define	AMI_NO_SUCH_ENTRY		23
611*7c478bd9Sstevel@tonic-gate #define	AMI_ENTRY_ALREADY_EXISTS	24
612*7c478bd9Sstevel@tonic-gate #define	AMI_AMISERV_DECRYPT_ERR		25
613*7c478bd9Sstevel@tonic-gate #define	AMI_AMISERV_SIGN_ERR		26
614*7c478bd9Sstevel@tonic-gate #define	AMI_USER_DID_NOT_AMILOGIN	27
615*7c478bd9Sstevel@tonic-gate #define	AMI_AMISERV_CONNECT		28
616*7c478bd9Sstevel@tonic-gate #define	AMI_KEYPKG_NOT_FOUND		29
617*7c478bd9Sstevel@tonic-gate #define	AMI_TIME_INVALID		30
618*7c478bd9Sstevel@tonic-gate #define	AMI_UNTRUSTED_PUBLIC_KEY	31
619*7c478bd9Sstevel@tonic-gate #define	AMI_EPARM			32	/* EPARM MUST be 32 */
620*7c478bd9Sstevel@tonic-gate #define	AMI_BINARY_TO_RFC1421_ERR	33
621*7c478bd9Sstevel@tonic-gate #define	AMI_RFC1421_TO_BINARY_ERR	34
622*7c478bd9Sstevel@tonic-gate #define	AMI_RANDOM_NUM_ERR		35
623*7c478bd9Sstevel@tonic-gate #define	AMI_XFN_ERR			36
624*7c478bd9Sstevel@tonic-gate #define	AMI_CERT_CHAIN_ERR		37
625*7c478bd9Sstevel@tonic-gate #define	AMI_RDN_MISSING_EQUAL		38
626*7c478bd9Sstevel@tonic-gate #define	AMI_AVA_TYPE_MISSING		39
627*7c478bd9Sstevel@tonic-gate #define	AMI_AVA_VALUE_MISSING		40
628*7c478bd9Sstevel@tonic-gate #define	AMI_CERT_NOT_FOUND		41
629*7c478bd9Sstevel@tonic-gate #define	AMI_DN_NOT_FOUND		42
630*7c478bd9Sstevel@tonic-gate #define	AMI_CRITICAL_EXTNS_ERR		43
631*7c478bd9Sstevel@tonic-gate #define	AMI_ASN1_INIT_ERROR		44
632*7c478bd9Sstevel@tonic-gate #define	AMI_WRAP_ERROR			45
633*7c478bd9Sstevel@tonic-gate #define	AMI_UNWRAP_ERROR		46
634*7c478bd9Sstevel@tonic-gate #define	AMI_UNSUPPORTED_KEY_TYPE	47
635*7c478bd9Sstevel@tonic-gate #define	AMI_DH_PART1_ERR		48
636*7c478bd9Sstevel@tonic-gate #define	AMI_DH_PART2_ERR		49
637*7c478bd9Sstevel@tonic-gate #define	AMI_DOUBLE_ENCRYPT		50
638*7c478bd9Sstevel@tonic-gate #define	AMI_AMISERV_KEYPKG_UPDATE	51
639*7c478bd9Sstevel@tonic-gate #define	AMI_AMISERV_STAT_ERR		52
640*7c478bd9Sstevel@tonic-gate #define	AMI_GLOBAL_ERR			53
641*7c478bd9Sstevel@tonic-gate #define	AMI_TRUSTED_KEY_EXPIRED		54
642*7c478bd9Sstevel@tonic-gate #define	AMI_OPEN_ERR		55
643*7c478bd9Sstevel@tonic-gate #define	AMI_TOTAL_ERRNUM		56
644*7c478bd9Sstevel@tonic-gate #define	AMI_CERT_ERR		57
645*7c478bd9Sstevel@tonic-gate #define	AMI_KEYPKG_ERR		58
646*7c478bd9Sstevel@tonic-gate 
647*7c478bd9Sstevel@tonic-gate /* flags for ami_encrypt, ami_decrypt, ami_sign, ami_verify, ami_digest */
648*7c478bd9Sstevel@tonic-gate #define	AMI_ADD_DATA	1
649*7c478bd9Sstevel@tonic-gate #define	AMI_END_DATA	2
650*7c478bd9Sstevel@tonic-gate #define	AMI_DIGESTED_DATA 3 /* for ami_verify for digested data */
651*7c478bd9Sstevel@tonic-gate 
652*7c478bd9Sstevel@tonic-gate /* AMI Handle and status */
653*7c478bd9Sstevel@tonic-gate typedef struct ami_handle ami_handle_t;
654*7c478bd9Sstevel@tonic-gate 
655*7c478bd9Sstevel@tonic-gate /* AMI return variable */
656*7c478bd9Sstevel@tonic-gate typedef int AMI_STATUS;
657*7c478bd9Sstevel@tonic-gate 
658*7c478bd9Sstevel@tonic-gate /*
659*7c478bd9Sstevel@tonic-gate  * Parameter
660*7c478bd9Sstevel@tonic-gate  */
661*7c478bd9Sstevel@tonic-gate 
662*7c478bd9Sstevel@tonic-gate typedef struct ami_rsa_keygen_param_t {
663*7c478bd9Sstevel@tonic-gate 	uint_t modulusBits;
664*7c478bd9Sstevel@tonic-gate 	uchar_t *publicExponent; /* const */
665*7c478bd9Sstevel@tonic-gate 	size_t publicExponentLen;
666*7c478bd9Sstevel@tonic-gate } ami_rsa_keygen_param;
667*7c478bd9Sstevel@tonic-gate 
668*7c478bd9Sstevel@tonic-gate typedef struct ami_des_keygen_param_t {
669*7c478bd9Sstevel@tonic-gate 	uchar_t *saltVal; /* const */
670*7c478bd9Sstevel@tonic-gate 	size_t saltLen;
671*7c478bd9Sstevel@tonic-gate 	char *passwd; /* const */
672*7c478bd9Sstevel@tonic-gate 	int iterationCount;
673*7c478bd9Sstevel@tonic-gate } ami_des_keygen_param;
674*7c478bd9Sstevel@tonic-gate 
675*7c478bd9Sstevel@tonic-gate /*
676*7c478bd9Sstevel@tonic-gate  * PROTOTYPES should be set to one if and only if the compiler supports
677*7c478bd9Sstevel@tonic-gate  * function argument prototyping.
678*7c478bd9Sstevel@tonic-gate  * The following makes PROTOTYPES default to 1 if it has not already been
679*7c478bd9Sstevel@tonic-gate  * defined as 0 with C compiler flags.
680*7c478bd9Sstevel@tonic-gate  */
681*7c478bd9Sstevel@tonic-gate #ifndef	PROTOTYPES
682*7c478bd9Sstevel@tonic-gate #define	PROTOTYPES	1
683*7c478bd9Sstevel@tonic-gate #endif
684*7c478bd9Sstevel@tonic-gate 
685*7c478bd9Sstevel@tonic-gate /*
686*7c478bd9Sstevel@tonic-gate  * PROTO_LIST is defined depending on how PROTOTYPES is defined above.
687*7c478bd9Sstevel@tonic-gate  * If using PROTOTYPES, then PROTO_LIST returns the list, otherwise it
688*7c478bd9Sstevel@tonic-gate  * returns an empty list.
689*7c478bd9Sstevel@tonic-gate  */
690*7c478bd9Sstevel@tonic-gate 
691*7c478bd9Sstevel@tonic-gate #if PROTOTYPES
692*7c478bd9Sstevel@tonic-gate #define	PROTO_LIST(list) list
693*7c478bd9Sstevel@tonic-gate #else
694*7c478bd9Sstevel@tonic-gate #define	PROTO_LIST(list) ()
695*7c478bd9Sstevel@tonic-gate #endif
696*7c478bd9Sstevel@tonic-gate 
697*7c478bd9Sstevel@tonic-gate /*
698*7c478bd9Sstevel@tonic-gate  * AMI prototypes
699*7c478bd9Sstevel@tonic-gate  */
700*7c478bd9Sstevel@tonic-gate 
701*7c478bd9Sstevel@tonic-gate /* Init and Terminate a AMI session */
702*7c478bd9Sstevel@tonic-gate AMI_STATUS ami_init PROTO_LIST((
703*7c478bd9Sstevel@tonic-gate 	ami_handle_t **,
704*7c478bd9Sstevel@tonic-gate 	const char *,
705*7c478bd9Sstevel@tonic-gate 	const char *,
706*7c478bd9Sstevel@tonic-gate 	const uint_t,
707*7c478bd9Sstevel@tonic-gate 	const uint_t,
708*7c478bd9Sstevel@tonic-gate 	const char *));
709*7c478bd9Sstevel@tonic-gate 
710*7c478bd9Sstevel@tonic-gate AMI_STATUS ami_end PROTO_LIST((
711*7c478bd9Sstevel@tonic-gate 	ami_handle_t *));
712*7c478bd9Sstevel@tonic-gate 
713*7c478bd9Sstevel@tonic-gate char *ami_strerror PROTO_LIST((
714*7c478bd9Sstevel@tonic-gate 	ami_handle_t *,
715*7c478bd9Sstevel@tonic-gate 	const AMI_STATUS));	/* errno */
716*7c478bd9Sstevel@tonic-gate 
717*7c478bd9Sstevel@tonic-gate /* Key generation */
718*7c478bd9Sstevel@tonic-gate AMI_STATUS ami_gen_des_key PROTO_LIST((
719*7c478bd9Sstevel@tonic-gate 	const ami_handle_t *,	/* IN:	ami handle */
720*7c478bd9Sstevel@tonic-gate 	uchar_t **,		/* OUT: DES session key */
721*7c478bd9Sstevel@tonic-gate 	ami_alg_params **));	/* OUT: IV */
722*7c478bd9Sstevel@tonic-gate 
723*7c478bd9Sstevel@tonic-gate AMI_STATUS ami_gen_des3_key PROTO_LIST((
724*7c478bd9Sstevel@tonic-gate 	const ami_handle_t *,	/* IN:	ami handle */
725*7c478bd9Sstevel@tonic-gate 	uchar_t **,		/* OUT: triple DES session key */
726*7c478bd9Sstevel@tonic-gate 	ami_alg_params **));	/* OUT: IV */
727*7c478bd9Sstevel@tonic-gate 
728*7c478bd9Sstevel@tonic-gate AMI_STATUS ami_gen_rc2_key PROTO_LIST((
729*7c478bd9Sstevel@tonic-gate 	const ami_handle_t *,	/* IN:  AMI handle */
730*7c478bd9Sstevel@tonic-gate 	const size_t,		/* IN:  key length */
731*7c478bd9Sstevel@tonic-gate 	const uint_t,		/* IN:  effective key size in bits */
732*7c478bd9Sstevel@tonic-gate 	uchar_t **,		/* OUT: RC2 session key */
733*7c478bd9Sstevel@tonic-gate 	ami_alg_params **));	/* OUT: RC2 parameter */
734*7c478bd9Sstevel@tonic-gate 
735*7c478bd9Sstevel@tonic-gate AMI_STATUS ami_gen_rc4_key PROTO_LIST((
736*7c478bd9Sstevel@tonic-gate 	const ami_handle_t *,	/* IN:	ami handle */
737*7c478bd9Sstevel@tonic-gate 	const size_t,		/* IN:  key length in bytes */
738*7c478bd9Sstevel@tonic-gate 	uchar_t **));		/* OUT: RC4 key */
739*7c478bd9Sstevel@tonic-gate 
740*7c478bd9Sstevel@tonic-gate AMI_STATUS ami_gen_rsa_keypair PROTO_LIST((
741*7c478bd9Sstevel@tonic-gate 	const ami_handle_t *,		/* IN:	ami handle */
742*7c478bd9Sstevel@tonic-gate 	const ami_rsa_keygen_param *,	/* IN:  keypair generation parameters */
743*7c478bd9Sstevel@tonic-gate 	const uchar_t *,
744*7c478bd9Sstevel@tonic-gate 	const size_t,
745*7c478bd9Sstevel@tonic-gate 	uchar_t **,			/* OUT: public key */
746*7c478bd9Sstevel@tonic-gate 	size_t *,			/* OUT: public key length */
747*7c478bd9Sstevel@tonic-gate 	uchar_t **,			/* OUT: private key */
748*7c478bd9Sstevel@tonic-gate 	size_t *));			/* OUT: private key length */
749*7c478bd9Sstevel@tonic-gate 
750*7c478bd9Sstevel@tonic-gate /* crypto */
751*7c478bd9Sstevel@tonic-gate AMI_STATUS ami_digest PROTO_LIST((
752*7c478bd9Sstevel@tonic-gate 	ami_handle_t *,			/* IN:	ami handle */
753*7c478bd9Sstevel@tonic-gate 	const uchar_t *,		/* IN:  input data  */
754*7c478bd9Sstevel@tonic-gate 	const size_t,			/* IN:  length of data in bytes */
755*7c478bd9Sstevel@tonic-gate 	const int,			/* IN:  more input data flag */
756*7c478bd9Sstevel@tonic-gate 	const ami_algid *,		/* IN:  digest algorithm */
757*7c478bd9Sstevel@tonic-gate 	uchar_t **,			/* OUT: digest */
758*7c478bd9Sstevel@tonic-gate 	size_t *));			/* OUT: length of digest */
759*7c478bd9Sstevel@tonic-gate AMI_STATUS ami_sign PROTO_LIST((
760*7c478bd9Sstevel@tonic-gate 	ami_handle_t *,			/* IN:	ami handle */
761*7c478bd9Sstevel@tonic-gate 	const uchar_t *,		/* IN:  data to be signed */
762*7c478bd9Sstevel@tonic-gate 	const size_t,			/* IN:  data length */
763*7c478bd9Sstevel@tonic-gate 	const int,			/* IN:  more input data flag */
764*7c478bd9Sstevel@tonic-gate 	const ami_algid *,		/* IN:  signature key algorithm */
765*7c478bd9Sstevel@tonic-gate 	const uchar_t *,		/* IN:  signature key */
766*7c478bd9Sstevel@tonic-gate 	const size_t,			/* IN:  signature key length */
767*7c478bd9Sstevel@tonic-gate 	const ami_algid *,		/* IN:  signature algorithm */
768*7c478bd9Sstevel@tonic-gate 	uchar_t **, 			/* OUT: signature */
769*7c478bd9Sstevel@tonic-gate 	size_t *));			/* OUT: signature length */
770*7c478bd9Sstevel@tonic-gate AMI_STATUS ami_verify PROTO_LIST((
771*7c478bd9Sstevel@tonic-gate 	ami_handle_t *,			/* IN: ami handle */
772*7c478bd9Sstevel@tonic-gate 	const uchar_t *, 		/* IN: data to be verified */
773*7c478bd9Sstevel@tonic-gate 	const size_t,			/* IN: data length */
774*7c478bd9Sstevel@tonic-gate 	const int,			/* IN: more input data flag */
775*7c478bd9Sstevel@tonic-gate 	const ami_algid *,		/* IN: verification key algorithm */
776*7c478bd9Sstevel@tonic-gate 	const uchar_t *,		/* IN: verification key */
777*7c478bd9Sstevel@tonic-gate 	const size_t,			/* IN: verification key length */
778*7c478bd9Sstevel@tonic-gate 	const ami_algid *,		/* IN: verification algorithm */
779*7c478bd9Sstevel@tonic-gate 	const uchar_t *, 		/* IN: signature */
780*7c478bd9Sstevel@tonic-gate 	const size_t));			/* IN: signature length */
781*7c478bd9Sstevel@tonic-gate AMI_STATUS ami_encrypt PROTO_LIST((
782*7c478bd9Sstevel@tonic-gate 	ami_handle_t *,			/* IN:	ami handle */
783*7c478bd9Sstevel@tonic-gate 	const uchar_t *,		/* IN:  input data */
784*7c478bd9Sstevel@tonic-gate 	const size_t,			/* IN:  input data length */
785*7c478bd9Sstevel@tonic-gate 	const int,			/* IN:	more input data flag */
786*7c478bd9Sstevel@tonic-gate 	const ami_algid *,		/* IN:  encryption key algorithm */
787*7c478bd9Sstevel@tonic-gate 	const uchar_t *,		/* IN:  encryption key */
788*7c478bd9Sstevel@tonic-gate 	const size_t,			/* IN:  encryption key length */
789*7c478bd9Sstevel@tonic-gate 	const ami_algid *,		/* IN:  encryption algorithm */
790*7c478bd9Sstevel@tonic-gate 	uchar_t **,			/* OUT: ciphertext */
791*7c478bd9Sstevel@tonic-gate 	size_t *));			/* OUT: ciphertext length */
792*7c478bd9Sstevel@tonic-gate AMI_STATUS ami_decrypt PROTO_LIST((
793*7c478bd9Sstevel@tonic-gate 	ami_handle_t *,			/* IN:	ami handle */
794*7c478bd9Sstevel@tonic-gate 	const uchar_t *,		/* IN:  ciphertext */
795*7c478bd9Sstevel@tonic-gate 	const size_t,			/* IN:  ciphertext length */
796*7c478bd9Sstevel@tonic-gate 	const int,			/* IN:  more input data flag */
797*7c478bd9Sstevel@tonic-gate 	const ami_algid *,		/* IN:  decryption key algorithm */
798*7c478bd9Sstevel@tonic-gate 	const uchar_t *,		/* IN:  decryption key */
799*7c478bd9Sstevel@tonic-gate 	const size_t,			/* IN:  decryption key length */
800*7c478bd9Sstevel@tonic-gate 	const ami_algid *,		/* IN:  decryption algorithm */
801*7c478bd9Sstevel@tonic-gate 	uchar_t **,			/* OUT: cleartext */
802*7c478bd9Sstevel@tonic-gate 	size_t *));			/* OUT: cleartext length */
803*7c478bd9Sstevel@tonic-gate AMI_STATUS ami_wrap_key PROTO_LIST((
804*7c478bd9Sstevel@tonic-gate 	const ami_handle_t *,		/* IN:  ami handle */
805*7c478bd9Sstevel@tonic-gate 	const uchar_t *,		/* IN:	key to be wrapped  */
806*7c478bd9Sstevel@tonic-gate 	const size_t,			/* IN:	length of key to be wrapped */
807*7c478bd9Sstevel@tonic-gate 	const ami_algid *,		/* IN:	wrapping key algorithm */
808*7c478bd9Sstevel@tonic-gate 	const uchar_t *,		/* IN:	wrapping key */
809*7c478bd9Sstevel@tonic-gate 	const size_t,			/* IN:	wrapping key length */
810*7c478bd9Sstevel@tonic-gate 	const ami_algid *,		/* IN:	wrapping algorithm */
811*7c478bd9Sstevel@tonic-gate 	uchar_t **,			/* OUT: wrapped key */
812*7c478bd9Sstevel@tonic-gate 	size_t *));			/* IN/OUT: wrapped key length */
813*7c478bd9Sstevel@tonic-gate AMI_STATUS ami_unwrap_key PROTO_LIST((
814*7c478bd9Sstevel@tonic-gate 	const ami_handle_t *,		/* IN:  ami handle */
815*7c478bd9Sstevel@tonic-gate 	const uchar_t *,		/* IN:  wrapped key */
816*7c478bd9Sstevel@tonic-gate 	const size_t,			/* IN:  wrapped key length */
817*7c478bd9Sstevel@tonic-gate 	const ami_algid *,		/* IN:  unwrapping key algorithm */
818*7c478bd9Sstevel@tonic-gate 	const uchar_t *,		/* IN:  unwrapping key */
819*7c478bd9Sstevel@tonic-gate 	const size_t,			/* IN:  unwrapping key length */
820*7c478bd9Sstevel@tonic-gate 	const ami_algid *,		/* IN:  unwrapping algorithm */
821*7c478bd9Sstevel@tonic-gate 	uchar_t **,			/* OUT: unwrapped key */
822*7c478bd9Sstevel@tonic-gate 	size_t *));			/* OUT: unwrapped key length */
823*7c478bd9Sstevel@tonic-gate 
824*7c478bd9Sstevel@tonic-gate /* certificate verification */
825*7c478bd9Sstevel@tonic-gate AMI_STATUS ami_verify_cert PROTO_LIST((
826*7c478bd9Sstevel@tonic-gate 	const ami_handle_t *,		/* IN: ami handle */
827*7c478bd9Sstevel@tonic-gate 	const ami_cert *, 		/* IN: certificate to be verified */
828*7c478bd9Sstevel@tonic-gate 	const ami_pubkey_info *,	/* IN: public verification key */
829*7c478bd9Sstevel@tonic-gate 	const int));			/* IN: flags (unused) */
830*7c478bd9Sstevel@tonic-gate AMI_STATUS ami_verify_cert_chain PROTO_LIST((
831*7c478bd9Sstevel@tonic-gate 	const ami_handle_t *,		/* IN: ami handle */
832*7c478bd9Sstevel@tonic-gate 	const ami_cert *, 	/* IN: certificate chain to be verified */
833*7c478bd9Sstevel@tonic-gate 	const int,			/* IN: length of cert chain */
834*7c478bd9Sstevel@tonic-gate 	const struct ami_tkey_list *,	/* IN: trusted key list */
835*7c478bd9Sstevel@tonic-gate 	const int,			/* IN: flags (unused) */
836*7c478bd9Sstevel@tonic-gate 	ami_cert **));		/* OUT: first expired certificate */
837*7c478bd9Sstevel@tonic-gate AMI_STATUS ami_verify_cert_est_chain PROTO_LIST((
838*7c478bd9Sstevel@tonic-gate 	const ami_handle_t *,		/* IN: ami handle */
839*7c478bd9Sstevel@tonic-gate 	const ami_cert *, 		/* IN: certificate to be verified */
840*7c478bd9Sstevel@tonic-gate 	const struct ami_tkey_list *,	/* IN: trusted key list */
841*7c478bd9Sstevel@tonic-gate 	const char **,			/* IN: CA Name list */
842*7c478bd9Sstevel@tonic-gate 	const int,			/* IN: flags (unused) */
843*7c478bd9Sstevel@tonic-gate 	ami_cert **,			/* OUT: first expired certificate */
844*7c478bd9Sstevel@tonic-gate 	ami_cert **,			/* OUT: certificate chain */
845*7c478bd9Sstevel@tonic-gate 	int *));			/* OUT: length of cert chain */
846*7c478bd9Sstevel@tonic-gate 
847*7c478bd9Sstevel@tonic-gate /* certificate chain establishment */
848*7c478bd9Sstevel@tonic-gate AMI_STATUS ami_get_cert_chain PROTO_LIST((
849*7c478bd9Sstevel@tonic-gate 	const ami_handle_t *,	/* IN: ami handle */
850*7c478bd9Sstevel@tonic-gate 	const ami_cert *,	/* IN: user certificate */
851*7c478bd9Sstevel@tonic-gate 	const char **,		/* IN: CA name list */
852*7c478bd9Sstevel@tonic-gate 	int flags,		/* IN: flags (unused) */
853*7c478bd9Sstevel@tonic-gate 	ami_cert **,		/* OUT: certificate chain */
854*7c478bd9Sstevel@tonic-gate 	int *));		/* OUT: length of cert chain */
855*7c478bd9Sstevel@tonic-gate 
856*7c478bd9Sstevel@tonic-gate /* I/O */
857*7c478bd9Sstevel@tonic-gate AMI_STATUS ami_set_keypkg PROTO_LIST((
858*7c478bd9Sstevel@tonic-gate 	const ami_handle_t *,	/* IN: ami handle */
859*7c478bd9Sstevel@tonic-gate 	const char *,		/* IN: keypkg filename or repository index */
860*7c478bd9Sstevel@tonic-gate 	const ami_keypkg *));	/* IN: keypkg to be stored */
861*7c478bd9Sstevel@tonic-gate AMI_STATUS ami_get_keypkg PROTO_LIST((
862*7c478bd9Sstevel@tonic-gate 	const ami_handle_t *,	/* IN:	ami handle */
863*7c478bd9Sstevel@tonic-gate 	const char *,		/* IN:  keypkg_filename or repository index */
864*7c478bd9Sstevel@tonic-gate 	ami_keypkg **));		/* OUT: keypkg */
865*7c478bd9Sstevel@tonic-gate AMI_STATUS ami_set_cert PROTO_LIST((
866*7c478bd9Sstevel@tonic-gate 	const ami_handle_t *,	/* IN: ami handle */
867*7c478bd9Sstevel@tonic-gate 	const char *,		/* IN: cert filename or repository index */
868*7c478bd9Sstevel@tonic-gate 	const ami_cert *));	/* IN: certificate */
869*7c478bd9Sstevel@tonic-gate AMI_STATUS ami_get_cert PROTO_LIST((
870*7c478bd9Sstevel@tonic-gate 	const ami_handle_t *,	/* IN:	ami handle */
871*7c478bd9Sstevel@tonic-gate 	const char *,		/* IN:  certificate filename, rep index, DN */
872*7c478bd9Sstevel@tonic-gate 	ami_cert **,		/* OUT: set of certificates */
873*7c478bd9Sstevel@tonic-gate 	int *));		/* OUT: certificate set length */
874*7c478bd9Sstevel@tonic-gate 
875*7c478bd9Sstevel@tonic-gate /* generate random bytes */
876*7c478bd9Sstevel@tonic-gate AMI_STATUS ami_random PROTO_LIST((
877*7c478bd9Sstevel@tonic-gate 	const ushort_t,		/* IN:  requested number of random bytes */
878*7c478bd9Sstevel@tonic-gate 	uchar_t **));		/* OUT: random byte buffer */
879*7c478bd9Sstevel@tonic-gate 
880*7c478bd9Sstevel@tonic-gate 
881*7c478bd9Sstevel@tonic-gate /* Free */
882*7c478bd9Sstevel@tonic-gate void ami_free_keypkg PROTO_LIST((ami_keypkg **));
883*7c478bd9Sstevel@tonic-gate void ami_free_cert PROTO_LIST((ami_cert **));
884*7c478bd9Sstevel@tonic-gate void ami_free_cert_list PROTO_LIST((ami_cert **, int));
885*7c478bd9Sstevel@tonic-gate void ami_free_dn PROTO_LIST((ami_name **));
886*7c478bd9Sstevel@tonic-gate 
887*7c478bd9Sstevel@tonic-gate /* DN */
888*7c478bd9Sstevel@tonic-gate AMI_STATUS ami_str2dn PROTO_LIST((
889*7c478bd9Sstevel@tonic-gate 	const ami_handle_t *, char *, ami_name **));
890*7c478bd9Sstevel@tonic-gate AMI_STATUS ami_dn2str PROTO_LIST((
891*7c478bd9Sstevel@tonic-gate 	const ami_handle_t *, ami_name *, char **));
892*7c478bd9Sstevel@tonic-gate 
893*7c478bd9Sstevel@tonic-gate /* Supported algorithms */
894*7c478bd9Sstevel@tonic-gate AMI_STATUS ami_get_alglist PROTO_LIST((ami_alg_list **));
895*7c478bd9Sstevel@tonic-gate 
896*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
897*7c478bd9Sstevel@tonic-gate }
898*7c478bd9Sstevel@tonic-gate #endif
899*7c478bd9Sstevel@tonic-gate 
900*7c478bd9Sstevel@tonic-gate #endif	/* _SLP_AMI_H */
901