1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 /* 23 * Copyright 2003 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 #ifndef _SOFTRSA_H 28 #define _SOFTRSA_H 29 30 #pragma ident "%Z%%M% %I% %E% SMI" 31 32 #ifdef __cplusplus 33 extern "C" { 34 #endif 35 36 #include <sys/types.h> 37 #include <security/pkcs11t.h> 38 #include <bignum.h> 39 #include "softObject.h" 40 #include "softSession.h" 41 #include "rsa_impl.h" 42 43 44 /* defined in bignumimpl.c */ 45 extern BIGNUM One, Two; 46 47 typedef struct soft_rsa_ctx { 48 soft_object_t *key; 49 } soft_rsa_ctx_t; 50 51 /* 52 * Function Prototypes. 53 */ 54 55 /* RSA */ 56 57 CK_RV soft_rsa_encrypt(soft_object_t *, CK_BYTE_PTR, uint32_t, CK_BYTE_PTR, 58 int); 59 60 CK_RV soft_rsa_decrypt(soft_object_t *, CK_BYTE_PTR, uint32_t, CK_BYTE_PTR); 61 62 CK_RV soft_rsa_crypt_init_common(soft_session_t *, CK_MECHANISM_PTR, 63 soft_object_t *, boolean_t); 64 65 CK_RV soft_rsa_encrypt_common(soft_session_t *, CK_BYTE_PTR, CK_ULONG, 66 CK_BYTE_PTR, CK_ULONG_PTR, CK_MECHANISM_TYPE); 67 68 CK_RV soft_rsa_decrypt_common(soft_session_t *, CK_BYTE_PTR, CK_ULONG, 69 CK_BYTE_PTR, CK_ULONG_PTR, CK_MECHANISM_TYPE); 70 71 CK_RV soft_rsa_sign_verify_init_common(soft_session_t *, CK_MECHANISM_PTR, 72 soft_object_t *, boolean_t); 73 74 CK_RV soft_rsa_verify_common(soft_session_t *, CK_BYTE_PTR, CK_ULONG, 75 CK_BYTE_PTR, CK_ULONG, CK_MECHANISM_TYPE); 76 77 CK_RV soft_rsa_sign_common(soft_session_t *, CK_BYTE_PTR, CK_ULONG, 78 CK_BYTE_PTR, CK_ULONG_PTR, CK_MECHANISM_TYPE); 79 80 CK_RV soft_rsa_digest_sign_common(soft_session_t *, CK_BYTE_PTR, 81 CK_ULONG, CK_BYTE_PTR, CK_ULONG_PTR, CK_MECHANISM_TYPE, boolean_t); 82 83 CK_RV soft_rsa_digest_verify_common(soft_session_t *, CK_BYTE_PTR, 84 CK_ULONG, CK_BYTE_PTR, CK_ULONG, CK_MECHANISM_TYPE, boolean_t); 85 86 CK_RV soft_rsa_genkey_pair(soft_object_t *, soft_object_t *); 87 88 CK_RV soft_rsa_verify_recover(soft_session_t *, CK_BYTE_PTR, CK_ULONG, 89 CK_BYTE_PTR, CK_ULONG_PTR); 90 91 92 #ifdef __cplusplus 93 } 94 #endif 95 96 #endif /* _SOFTRSA_H */ 97