rsa_impl.h revision 6ea3c0609e50782557505b88bb391b786bca32c9
/*
* 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 _RSA_IMPL_H
#define _RSA_IMPL_H
#ifdef __cplusplus
extern "C" {
#endif
#include <bignum.h>
#define MIN_RSA_KEYLENGTH_IN_BYTES 32
#define MAX_RSA_KEYLENGTH_IN_BYTES 512
#ifdef _KERNEL
#define CK_RV int
#define CKR_OK CRYPTO_SUCCESS
#define CKR_DEVICE_ERROR CRYPTO_DEVICE_ERROR
#define CKR_HOST_MEMORY CRYPTO_HOST_MEMORY
#else
#include <security/cryptoki.h>
#endif /* _KERNEL */
#define MD5_DER_PREFIX_Len 18
#define SHA1_DER_PREFIX_Len 15
#define SHA1_DER_PREFIX_OID_Len 13
#define SHA2_DER_PREFIX_Len 19
#define DEFAULT_PUB_EXPO_Len 3
/* RSA key using BIGNUM representations */
typedef struct {
int size; /* key size in bits */
BIGNUM p; /* p */
BIGNUM q; /* q */
BIGNUM n; /* n = p * q (the modulus) */
BIGNUM d; /* private exponent */
BIGNUM e; /* public exponent */
} RSAkey;
/* RSA key using byte string representations, useful for parameter lists */
typedef struct {
} RSAbytekey;
#ifdef __cplusplus
}
#endif
#endif /* _RSA_IMPL_H */