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