2N/A/*
2N/A * CDDL HEADER START
2N/A *
2N/A * The contents of this file are subject to the terms of the
2N/A * Common Development and Distribution License (the "License").
2N/A * You may not use this file except in compliance with the License.
2N/A *
2N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A * or http://www.opensolaris.org/os/licensing.
2N/A * See the License for the specific language governing permissions
2N/A * and limitations under the License.
2N/A *
2N/A * When distributing Covered Code, include this CDDL HEADER in each
2N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A * If applicable, add the following below this CDDL HEADER, with the
2N/A * fields enclosed by brackets "[]" replaced with your own identifying
2N/A * information: Portions Copyright [yyyy] [name of copyright owner]
2N/A *
2N/A * CDDL HEADER END
2N/A */
2N/A
2N/A/*
2N/A * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
2N/A */
2N/A
2N/A#ifndef _SOFTRSA_H
2N/A#define _SOFTRSA_H
2N/A
2N/A#ifdef __cplusplus
2N/Aextern "C" {
2N/A#endif
2N/A
2N/A#include <sys/types.h>
2N/A#include <security/pkcs11t.h>
2N/A#include <padding/padding.h>
2N/A#include <rsa/rsa_impl.h>
2N/A#include "softObject.h"
2N/A#include "softSession.h"
2N/A
2N/A
2N/Atypedef struct soft_rsa_ctx {
2N/A soft_object_t *key;
2N/A} soft_rsa_ctx_t;
2N/A
2N/A/*
2N/A * Function Prototypes.
2N/A */
2N/A
2N/ACK_RV soft_rsa_genkey_pair(soft_object_t *pubkey, soft_object_t *prikey);
2N/A
2N/ACK_RV soft_rsa_crypt_init_common(soft_session_t *session_p,
2N/A CK_MECHANISM_PTR pMechanism, soft_object_t *key_p, soft_session_op_t op);
2N/A
2N/ACK_RV soft_rsa_encrypt(soft_object_t *key, CK_BYTE_PTR in, uint32_t in_len,
2N/A CK_BYTE_PTR out, int realpublic);
2N/A
2N/ACK_RV soft_rsa_decrypt(soft_object_t *key, CK_BYTE_PTR in, uint32_t in_len,
2N/A CK_BYTE_PTR out);
2N/A
2N/ACK_RV soft_rsa_encrypt_common(soft_session_t *session_p,
2N/A CK_BYTE_PTR pData, CK_ULONG ulDataLen,
2N/A CK_BYTE_PTR pEncrypted, CK_ULONG_PTR pulEncryptedLen,
2N/A CK_MECHANISM_TYPE mechanism);
2N/A
2N/ACK_RV soft_rsa_decrypt_common(soft_session_t *session_p,
2N/A CK_BYTE_PTR pEncrypted, CK_ULONG ulEncryptedLen,
2N/A CK_BYTE_PTR pData, CK_ULONG_PTR pulDataLen,
2N/A CK_MECHANISM_TYPE mechanism);
2N/A
2N/ACK_RV soft_rsa_sign_verify_init_common(soft_session_t *session_p,
2N/A CK_MECHANISM_PTR pMechanism, soft_object_t *key_p, boolean_t sign);
2N/A
2N/ACK_RV soft_rsa_sign_common(soft_session_t *session_p,
2N/A CK_BYTE_PTR pData, CK_ULONG ulDataLen,
2N/A CK_BYTE_PTR pSigned, CK_ULONG_PTR pulSignedLen,
2N/A CK_MECHANISM_TYPE mechanism);
2N/A
2N/ACK_RV soft_rsa_verify_common(soft_session_t *session_p,
2N/A CK_BYTE_PTR pData, CK_ULONG ulDataLen,
2N/A CK_BYTE_PTR pSignature, CK_ULONG ulSignatureLen,
2N/A CK_MECHANISM_TYPE mechanism);
2N/A
2N/ACK_RV soft_rsa_digest_sign_common(soft_session_t *session_p,
2N/A CK_BYTE_PTR pData, CK_ULONG ulDataLen,
2N/A CK_BYTE_PTR pSigned, CK_ULONG_PTR pulSignedLen,
2N/A CK_MECHANISM_TYPE mechanism, boolean_t Final);
2N/A
2N/ACK_RV soft_rsa_digest_verify_common(soft_session_t *session_p,
2N/A CK_BYTE_PTR pData, CK_ULONG ulDataLen,
2N/A CK_BYTE_PTR pSigned, CK_ULONG ulSignedLen,
2N/A CK_MECHANISM_TYPE mechanism, boolean_t Final);
2N/A
2N/ACK_RV soft_rsa_verify_recover(soft_session_t *session_p,
2N/A CK_BYTE_PTR pSignature, CK_ULONG ulSignatureLen,
2N/A CK_BYTE_PTR pData, CK_ULONG_PTR pulDataLen);
2N/A
2N/A
2N/A#ifdef __cplusplus
2N/A}
2N/A#endif
2N/A
2N/A#endif /* _SOFTRSA_H */