/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SLP_AMI_H
#define _SLP_AMI_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct ami_oid {
unsigned short count;
unsigned long *value;
} ami_oid;
typedef struct Any {
unsigned long length;
unsigned char *value;
} Any;
typedef struct ami_name {
unsigned short choice;
union {
} u;
} ami_name;
typedef struct ami_rdn_seq {
} *ami_rdn_seq;
typedef struct ami_rdname {
} *ami_rdname;
typedef struct ami_ava {
} ami_ava;
typedef struct ami_attr_list {
} *ami_attr_list;
typedef struct ami_attr {
} ami_attr;
typedef struct ami_attr_value_set {
typedef struct CaseIgnoreString {
unsigned short choice;
union {
char *CaseIgnoreString_t61String;
} u;
typedef char *ami_printable_string;
typedef struct ami_cert_pair {
typedef struct ami_cert_serialnum {
unsigned short length;
unsigned char *value;
typedef struct ami_cert_info {
unsigned char bit_mask;
#define version_v1 0
typedef struct ami_bitstring {
unsigned char *value;
typedef struct ami_cert {
} ami_cert;
typedef struct ami_uid {
unsigned char *value;
} ami_uid;
typedef struct ami_octetstring {
unsigned int length;
unsigned char *value;
typedef int ami_cert_version;
#define CertificateVersion_v1 0
typedef char amiBoolean;
typedef struct {
/* YY format when used for UTCTime */
short month;
short day;
short hour;
short minute;
short second;
short millisec;
typedef struct ami_validity {
} ami_validity;
typedef struct ami_pubkey_info {
typedef struct ami_algid {
} ami_algid;
typedef struct ami_cert_extn {
unsigned char bit_mask;
typedef struct ami_cert_extn_list {
typedef struct ami_cert_list_contents {
unsigned char bit_mask;
struct _seqof1 {
struct {
} value;
typedef struct ami_cert_list {
typedef struct ami_rc2_cbc_param {
unsigned short choice;
union {
struct _seq1 {
int version;
} sequence;
} u;
typedef int INT;
typedef struct ami_keypkg_info {
unsigned char bit_mask;
char *version;
char *keypkgId;
int usage;
typedef struct ami_keypkg {
} ami_keypkg;
typedef struct ami_tkey_list {
} *ami_tkey_list;
typedef struct ami_tkey {
unsigned char bit_mask;
} ami_tkey;
typedef struct ami_serv_key_info {
int uid;
int flags;
char *keypkgId;
char *hostIP;
typedef struct _octet1 {
unsigned int length;
unsigned char *value;
} _octet1;
typedef struct ami_digest_info {
typedef struct ami_crl_set {
} *ami_crl_set;
typedef struct ami_crl_entry {
int userCertificate;
typedef struct ami_crl_info {
unsigned char bit_mask;
struct _seqof2 {
} ami_crl_info;
typedef struct ami_crl {
} ami_crl;
typedef struct ami_pbe_param {
struct {
unsigned short length;
} salt;
int iterationCount;
typedef struct ami_extcert_info {
int version;
typedef struct ami_extcert {
} ami_extcert;
typedef struct ami_extcerts_and_certs {
typedef struct ami_extcert_or_cert {
unsigned short choice;
union {
} u;
typedef struct ami_content_info {
typedef struct ami_content_info_fm {
typedef struct ami_enveloped_data {
int version;
typedef struct ami_encr_data {
int version;
typedef struct ami_signed_data {
unsigned char bit_mask;
int version;
typedef struct ami_signed_data_fm {
unsigned char bit_mask;
int version;
typedef struct ami_rcpt_info_list {
typedef struct ami_encr_content_info {
typedef struct ami_pkcs_data {
unsigned int length;
unsigned char *value;
typedef struct ami_pkcs_data_fm {
unsigned int length;
unsigned char *value;
typedef struct ami_encr_content {
unsigned int length;
unsigned char *value;
typedef struct ami_rcpt_info {
int version;
typedef struct ami_signer_info {
unsigned char bit_mask;
int version;
typedef struct ami_signer_info_list {
typedef struct ami_issuer_and_serialnum {
typedef struct ami_digest_alg_list {
typedef struct ami_privkey_info {
unsigned char bit_mask;
int version;
typedef struct ami_encr_privkey_info {
typedef struct ami_certreq_info {
int version;
typedef struct ami_certreq {
} ami_certreq;
typedef struct ami_challenge_pwd {
unsigned short choice;
union {
char *ChallengePassword_t61String;
} u;
typedef char *ami_email_addr;
typedef struct ami_pubkey_and_challenge {
char *challenge;
typedef struct ami_signed_pubkey_and_challenge {
extern ami_oid *AMI_MD2_OID;
extern ami_oid *AMI_MD4_OID;
extern ami_oid *AMI_MD5_OID;
extern ami_oid *AMI_SHA_1_OID;
extern ami_oid *AMI_RSA_ENCR_OID;
extern ami_oid *AMI_MD2WithRSAEncryption_OID;
extern ami_oid *AMI_MD5WithRSAEncryption_OID;
extern ami_oid *AMI_DSA_OID;
extern ami_oid *AMI_SHA1WithDSASignature_OID;
extern ami_oid *AMI_DES_ECB_OID;
extern ami_oid *AMI_DES_CBC_OID;
extern ami_oid *AMI_DES3_CBC_OID;
extern ami_oid *AMI_DES_MAC_OID;
extern ami_oid *AMI_RC2_CBC_OID;
extern ami_oid *AMI_RC4_OID;
/*
* Misc. AlgIDs
*/
extern struct ami_algid *AMI_RSA_ENCR_AID;
extern struct ami_algid *AMI_MD2WithRSAEncryption_AID;
extern struct ami_algid *AMI_MD5WithRSAEncryption_AID;
extern struct ami_algid *AMI_DSA_AID;
extern struct ami_algid *AMI_SHA1WithDSASignature_AID;
extern struct ami_algid *AMI_DH_AID;
extern struct ami_algid *AMI_MD2_AID;
extern struct ami_algid *AMI_MD4_AID;
extern struct ami_algid *AMI_MD5_AID;
extern struct ami_algid *AMI_SHA1_AID;
extern struct ami_algid *AMI_RC4_AID;
/* Algorithm types */
typedef enum {
} ami_alg_type;
/* Parameter types */
typedef enum {
/* Algorithm table */
#define AMI_NO_EXPORT_KEYSIZE_LIMIT 0
typedef struct ami_alg_list {
char *name;
} ami_alg_list;
/*
* AMI function return values
*/
#define AMI_OK 0
/* flags for ami_encrypt, ami_decrypt, ami_sign, ami_verify, ami_digest */
/* AMI Handle and status */
/* AMI return variable */
typedef int AMI_STATUS;
/*
* Parameter
*/
typedef struct ami_rsa_keygen_param_t {
typedef struct ami_des_keygen_param_t {
int iterationCount;
/*
* PROTOTYPES should be set to one if and only if the compiler supports
* function argument prototyping.
* The following makes PROTOTYPES default to 1 if it has not already been
* defined as 0 with C compiler flags.
*/
#ifndef PROTOTYPES
#endif
/*
* PROTO_LIST is defined depending on how PROTOTYPES is defined above.
* If using PROTOTYPES, then PROTO_LIST returns the list, otherwise it
* returns an empty list.
*/
#if PROTOTYPES
#else
#endif
/*
* AMI prototypes
*/
/* Init and Terminate a AMI session */
ami_handle_t **,
const char *,
const char *,
const uint_t,
const uint_t,
const char *));
ami_handle_t *));
char *ami_strerror PROTO_LIST((
ami_handle_t *,
const AMI_STATUS)); /* errno */
/* Key generation */
const ami_handle_t *, /* IN: ami handle */
uchar_t **, /* OUT: DES session key */
ami_alg_params **)); /* OUT: IV */
const ami_handle_t *, /* IN: ami handle */
uchar_t **, /* OUT: triple DES session key */
ami_alg_params **)); /* OUT: IV */
const ami_handle_t *, /* IN: AMI handle */
const size_t, /* IN: key length */
const uint_t, /* IN: effective key size in bits */
uchar_t **, /* OUT: RC2 session key */
ami_alg_params **)); /* OUT: RC2 parameter */
const ami_handle_t *, /* IN: ami handle */
const size_t, /* IN: key length in bytes */
uchar_t **)); /* OUT: RC4 key */
const ami_handle_t *, /* IN: ami handle */
const ami_rsa_keygen_param *, /* IN: keypair generation parameters */
const uchar_t *,
const size_t,
uchar_t **, /* OUT: public key */
size_t *, /* OUT: public key length */
uchar_t **, /* OUT: private key */
size_t *)); /* OUT: private key length */
/* crypto */
ami_handle_t *, /* IN: ami handle */
const uchar_t *, /* IN: input data */
const size_t, /* IN: length of data in bytes */
const int, /* IN: more input data flag */
const ami_algid *, /* IN: digest algorithm */
uchar_t **, /* OUT: digest */
size_t *)); /* OUT: length of digest */
ami_handle_t *, /* IN: ami handle */
const uchar_t *, /* IN: data to be signed */
const size_t, /* IN: data length */
const int, /* IN: more input data flag */
const ami_algid *, /* IN: signature key algorithm */
const uchar_t *, /* IN: signature key */
const size_t, /* IN: signature key length */
const ami_algid *, /* IN: signature algorithm */
uchar_t **, /* OUT: signature */
size_t *)); /* OUT: signature length */
ami_handle_t *, /* IN: ami handle */
const uchar_t *, /* IN: data to be verified */
const size_t, /* IN: data length */
const int, /* IN: more input data flag */
const ami_algid *, /* IN: verification key algorithm */
const uchar_t *, /* IN: verification key */
const size_t, /* IN: verification key length */
const ami_algid *, /* IN: verification algorithm */
const uchar_t *, /* IN: signature */
const size_t)); /* IN: signature length */
ami_handle_t *, /* IN: ami handle */
const uchar_t *, /* IN: input data */
const size_t, /* IN: input data length */
const int, /* IN: more input data flag */
const ami_algid *, /* IN: encryption key algorithm */
const uchar_t *, /* IN: encryption key */
const size_t, /* IN: encryption key length */
const ami_algid *, /* IN: encryption algorithm */
uchar_t **, /* OUT: ciphertext */
size_t *)); /* OUT: ciphertext length */
ami_handle_t *, /* IN: ami handle */
const uchar_t *, /* IN: ciphertext */
const size_t, /* IN: ciphertext length */
const int, /* IN: more input data flag */
const ami_algid *, /* IN: decryption key algorithm */
const uchar_t *, /* IN: decryption key */
const size_t, /* IN: decryption key length */
const ami_algid *, /* IN: decryption algorithm */
uchar_t **, /* OUT: cleartext */
size_t *)); /* OUT: cleartext length */
const ami_handle_t *, /* IN: ami handle */
const uchar_t *, /* IN: key to be wrapped */
const size_t, /* IN: length of key to be wrapped */
const ami_algid *, /* IN: wrapping key algorithm */
const uchar_t *, /* IN: wrapping key */
const size_t, /* IN: wrapping key length */
const ami_algid *, /* IN: wrapping algorithm */
uchar_t **, /* OUT: wrapped key */
const ami_handle_t *, /* IN: ami handle */
const uchar_t *, /* IN: wrapped key */
const size_t, /* IN: wrapped key length */
const ami_algid *, /* IN: unwrapping key algorithm */
const uchar_t *, /* IN: unwrapping key */
const size_t, /* IN: unwrapping key length */
const ami_algid *, /* IN: unwrapping algorithm */
uchar_t **, /* OUT: unwrapped key */
size_t *)); /* OUT: unwrapped key length */
/* certificate verification */
const ami_handle_t *, /* IN: ami handle */
const ami_cert *, /* IN: certificate to be verified */
const ami_pubkey_info *, /* IN: public verification key */
const int)); /* IN: flags (unused) */
const ami_handle_t *, /* IN: ami handle */
const ami_cert *, /* IN: certificate chain to be verified */
const int, /* IN: length of cert chain */
const struct ami_tkey_list *, /* IN: trusted key list */
const int, /* IN: flags (unused) */
ami_cert **)); /* OUT: first expired certificate */
const ami_handle_t *, /* IN: ami handle */
const ami_cert *, /* IN: certificate to be verified */
const struct ami_tkey_list *, /* IN: trusted key list */
const char **, /* IN: CA Name list */
const int, /* IN: flags (unused) */
ami_cert **, /* OUT: first expired certificate */
ami_cert **, /* OUT: certificate chain */
int *)); /* OUT: length of cert chain */
/* certificate chain establishment */
const ami_handle_t *, /* IN: ami handle */
const ami_cert *, /* IN: user certificate */
const char **, /* IN: CA name list */
int flags, /* IN: flags (unused) */
ami_cert **, /* OUT: certificate chain */
int *)); /* OUT: length of cert chain */
/* I/O */
const ami_handle_t *, /* IN: ami handle */
const char *, /* IN: keypkg filename or repository index */
const ami_keypkg *)); /* IN: keypkg to be stored */
const ami_handle_t *, /* IN: ami handle */
const char *, /* IN: keypkg_filename or repository index */
ami_keypkg **)); /* OUT: keypkg */
const ami_handle_t *, /* IN: ami handle */
const char *, /* IN: cert filename or repository index */
const ami_cert *)); /* IN: certificate */
const ami_handle_t *, /* IN: ami handle */
const char *, /* IN: certificate filename, rep index, DN */
ami_cert **, /* OUT: set of certificates */
int *)); /* OUT: certificate set length */
/* generate random bytes */
const ushort_t, /* IN: requested number of random bytes */
uchar_t **)); /* OUT: random byte buffer */
/* Free */
/* DN */
const ami_handle_t *, char *, ami_name **));
const ami_handle_t *, ami_name *, char **));
/* Supported algorithms */
#ifdef __cplusplus
}
#endif
#endif /* _SLP_AMI_H */