1 /* 2 * This file is part of the openHiTLS project. 3 * 4 * openHiTLS is licensed under the Mulan PSL v2. 5 * You can use this software according to the terms and conditions of the Mulan PSL v2. 6 * You may obtain a copy of Mulan PSL v2 at: 7 * 8 * http://license.coscl.org.cn/MulanPSL2 9 * 10 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 11 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 12 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 13 * See the Mulan PSL v2 for more details. 14 */ 15 16 #ifndef EAL_PKEY_LOCAL_H 17 #define EAL_PKEY_LOCAL_H 18 19 #include "hitls_build.h" 20 #if defined(HITLS_CRYPTO_EAL) && defined(HITLS_CRYPTO_PKEY) 21 22 #include <stdint.h> 23 #include "crypt_algid.h" 24 #include "crypt_local_types.h" 25 #include "crypt_eal_pkey.h" 26 #include "sal_atomic.h" 27 28 #ifdef __cplusplus 29 extern "C" { 30 #endif // __cplusplus 31 32 /** 33 * @ingroup EAL 34 * 35 * Pkey session structure 36 */ 37 struct EAL_PkeyCtx { 38 bool isProvider; 39 EAL_PkeyUnitaryMethod *method; 40 void *key; 41 void *extData; 42 CRYPT_PKEY_AlgId id; 43 BSL_SAL_RefCount references; 44 }; 45 46 /** 47 * @ingroup crypt_method 48 * @brief Generate the default method of the signature algorithm. 49 * 50 * @param id [IN] Algorithm ID. 51 * 52 * @return success: Pointer to EAL_PkeyMethod 53 * For other error codes, see crypt_errno.h. 54 */ 55 const EAL_PkeyMethod *CRYPT_EAL_PkeyFindMethod(CRYPT_PKEY_AlgId id); 56 #ifdef __cplusplus 57 } 58 #endif // __cplusplus 59 60 #endif // HITLS_CRYPTO_PKEY 61 62 #endif // EAL_PKEY_LOCAL_H 63