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 /** 17 * @defgroup crypt_eal_provider 18 * @ingroup crypt 19 * @brief Internal use of provider 20 */ 21 22 #ifndef CRYPT_EAL_PROVIDER_LOCAL_H 23 #define CRYPT_EAL_PROVIDER_LOCAL_H 24 25 #ifdef HITLS_CRYPTO_PROVIDER 26 #include <stdint.h> 27 #include "sal_atomic.h" 28 #include "crypt_eal_implprovider.h" 29 #include "bsl_list.h" 30 #include "crypt_drbg_local.h" 31 32 #ifdef __cplusplus 33 extern "C" { 34 #endif // __cplusplus 35 36 struct EAL_ProviderMgrCtx { 37 void *handle; // so handle 38 void *provCtx; 39 BSL_SAL_RefCount ref; 40 char *providerName; 41 char *providerPath; 42 EAL_SeedDrbg providerSeed; // entropy ctx 43 struct EAL_LibCtx *libCtx; 44 CRYPT_EAL_ImplProviderInit provInitFunc; 45 46 // out funcs 47 CRYPT_EAL_ProvFreeCb provFreeCb; 48 CRYPT_EAL_ProvQueryCb provQueryCb; 49 CRYPT_EAL_ProvCtrlCb provCtrlCb; 50 CRYPT_EAL_ProvGetCapsCb provGetCap; 51 }; 52 53 int32_t CRYPT_EAL_InitProviderMethod(CRYPT_EAL_ProvMgrCtx *ctx, BSL_Param *param, 54 CRYPT_EAL_ImplProviderInit providerInit); 55 CRYPT_EAL_LibCtx *CRYPT_EAL_LibCtxNewInternal(void); 56 int32_t CRYPT_EAL_CompareAlgAndAttr(CRYPT_EAL_LibCtx *localCtx, int32_t operaId, 57 int32_t algId, const char *attribute, const CRYPT_EAL_Func **funcs, CRYPT_EAL_ProvMgrCtx **mgrCtx); 58 59 void CRYPT_EAL_ProviderMgrCtxFree(CRYPT_EAL_ProvMgrCtx *ctx); 60 61 #ifdef __cplusplus 62 } 63 #endif // __cplusplus 64 65 #endif /* HITLS_CRYPTO_PROVIDER */ 66 #endif // CRYPT_EAL_PROVIDER_LOCAL_H