/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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
*/
/*
*/
#ifndef _CRYPTOUTIL_H
#define _CRYPTOUTIL_H
#ifdef __cplusplus
extern "C" {
#endif
#include <syslog.h>
#include <security/cryptoki.h>
#define SUCCESS 0
/* $ISA substitution for parsing pkcs11.conf data */
#if defined(_LP64)
#if defined(__sparcv9)
#else
#endif
#else /* 32-bit */
#endif /* _LP64 */
/* keywords and delimiters for parsing configuration files */
#define CRYPTO_FIPS_MODE_DISABLED 0
/*
* Define the following softtoken values that are used by softtoken
* library, cryptoadm and pktool command.
*/
#define SOFT_SLOT_DESCRIPTION \
"Sun Crypto Softtoken " \
" "
typedef struct umechlist {
} umechlist_t;
typedef struct uentry {
int count;
} uentry_t;
typedef struct uentrylist {
} uentrylist_t;
/* Return codes for pkcs11_parse_uri() */
#define PK11_URI_OK 0
/*
* There is no limit for the attribute length in the spec. 256 bytes should be
* enough for the object name.
*/
/*
* CKA_ID is of type "byte array" which can be of arbitrary length. 256 bytes
* should be sufficient though.
*/
/* Structure for the PKCS#11 URI. */
typedef struct pkcs11_uri_t {
/* CKA_LABEL attribute to the C_FindObjectsInit function. */
/*
* CKA_CLASS attribute to the C_FindObjectsInit function. The
* "objecttype" URI attribute can have a value one of "private",
* "public", "cert", "secretkey", and "data". The "objecttype" field can
* have a value of CKO_PUBLIC_KEY, CKO_PRIVATE_KEY, CKO_CERTIFICATE,
* CKO_SECRET_KEY, and CKO_DATA. This attribute cannot be empty in the
* URI.
*/
/* CKO_DATA is 0 so we need this flag. Not part of the URI itself. */
/*
* Token, manufacturer, serial and model are of fixed size length in
* the specification. We allocate memory on the fly to distinguish
* between an attribute not present and an empty value. We check for
* overflows. We always terminate the string with '\0' even when that is
* not used in the PKCS#11's CK_TOKEN_INFO structure (fields are padded
* with spaces).
*/
/* Token label from CK_TOKEN_INFO. */
/* ManufacturerID from CK_TOKEN_INFO. */
/* SerialNumber from CK_TOKEN_INFO. */
/* Model from CK_TOKEN_INFO. */
/* This is a byte array, we need a length parameter as well. */
int id_len;
/*
* Location of the file with a token PIN. Application can overload this,
* the pkcs11_parse_uri() function does not interpret this field in any
* way.
*/
char *pinfile;
} pkcs11_uri_t;
extern void cryptodebug(const char *fmt, ...);
extern void cryptodebug_init(const char *prefix);
extern void cryptoerror_off(void);
extern void cryptoerror_on(void);
CK_KEY_TYPE *ktype);
extern int
char **objectstore_slot_info, char **objectstore_token_info);
extern char *pkcs11_default_token(void);
extern void pkcs11_close_random(void);
extern void pkcs11_close_urandom(void);
extern void pkcs11_close_random_seed(void);
extern void pkcs11_close_urandom_seed(void);
#ifdef __cplusplus
}
#endif
#endif /* _CRYPTOUTIL_H */