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 2004 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 * 26 * Copyright 2020 Joyent, Inc. 27 */ 28 29 #ifndef _SOFTKEYS_H 30 #define _SOFTKEYS_H 31 32 #ifdef __cplusplus 33 extern "C" { 34 #endif 35 36 #include <security/pkcs11t.h> 37 #include "softObject.h" 38 #include "softSession.h" 39 40 #define KEYGEN_RETRY 3 41 42 /* 43 * Function Prototypes. 44 */ 45 CK_RV soft_genkey(soft_session_t *, CK_MECHANISM_PTR, 46 CK_ATTRIBUTE_PTR, CK_ULONG, CK_OBJECT_HANDLE_PTR); 47 48 CK_RV soft_genkey_pair(soft_session_t *, CK_MECHANISM_PTR, CK_ATTRIBUTE_PTR, 49 CK_ULONG, CK_ATTRIBUTE_PTR, CK_ULONG, CK_OBJECT_HANDLE_PTR, 50 CK_OBJECT_HANDLE_PTR); 51 52 CK_RV soft_derivekey(soft_session_t *, CK_MECHANISM_PTR, soft_object_t *, 53 CK_ATTRIBUTE_PTR, CK_ULONG, CK_OBJECT_HANDLE_PTR); 54 55 void soft_derive_enforce_flags(soft_object_t *, soft_object_t *); 56 57 CK_RV soft_gen_keyobject(CK_ATTRIBUTE_PTR, CK_ULONG, 58 soft_object_t **, soft_session_t *, CK_OBJECT_CLASS, CK_KEY_TYPE, 59 CK_ULONG, CK_ULONG, boolean_t); 60 61 CK_RV soft_generate_pkcs5_pbkdf2_key(soft_session_t *, CK_MECHANISM_PTR, 62 soft_object_t *); 63 64 CK_RV soft_wrapkey(soft_session_t *, CK_MECHANISM_PTR, soft_object_t *, 65 soft_object_t *, CK_BYTE_PTR, CK_ULONG_PTR); 66 67 CK_RV soft_unwrapkey(soft_session_t *, CK_MECHANISM_PTR, soft_object_t *, 68 CK_BYTE_PTR, CK_ULONG, CK_ATTRIBUTE_PTR, CK_ULONG, 69 CK_OBJECT_HANDLE_PTR); 70 71 #ifdef __cplusplus 72 } 73 #endif 74 75 #endif /* _SOFTKEYS_H */ 76