• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include "hitls_build.h"
17 #ifdef HITLS_CRYPTO_PROVIDER
18 
19 #include "crypt_eal_implprovider.h"
20 #include "crypt_curve25519.h"
21 #include "crypt_dh.h"
22 #include "crypt_ecdh.h"
23 #include "crypt_sm2.h"
24 
25 typedef struct {
26     void *pkeyCtx;
27     int32_t algId;
28     int32_t index;
29 } CRYPT_EAL_DefPkeyCtx;
30 
31 const CRYPT_EAL_Func g_defEalExchX25519[] = {
32 #ifdef HITLS_CRYPTO_X25519
33     {CRYPT_EAL_IMPLPKEYEXCH_EXCH, (CRYPT_EAL_ImplPkeyExch)CRYPT_CURVE25519_ComputeSharedKey},
34 #endif
35     CRYPT_EAL_FUNC_END
36 };
37 
38 const CRYPT_EAL_Func g_defEalExchDh[] = {
39 #ifdef HITLS_CRYPTO_DH
40     {CRYPT_EAL_IMPLPKEYEXCH_EXCH, (CRYPT_EAL_ImplPkeyExch)CRYPT_DH_ComputeShareKey},
41 #endif
42     CRYPT_EAL_FUNC_END
43 };
44 
45 const CRYPT_EAL_Func g_defEalExchEcdh[] = {
46 #ifdef HITLS_CRYPTO_ECDH
47     {CRYPT_EAL_IMPLPKEYEXCH_EXCH, (CRYPT_EAL_ImplPkeyExch)CRYPT_ECDH_ComputeShareKey},
48 #endif
49     CRYPT_EAL_FUNC_END
50 };
51 
52 const CRYPT_EAL_Func g_defEalExchSm2[] = {
53 #if defined(HITLS_CRYPTO_SM2_EXCH)
54     {CRYPT_EAL_IMPLPKEYEXCH_EXCH, (CRYPT_EAL_ImplPkeyExch)CRYPT_SM2_KapComputeKey},
55 #endif
56     CRYPT_EAL_FUNC_END
57 };
58 
59 #endif /* HITLS_CRYPTO_PROVIDER */