• 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 // Source code for the test .so file
17 
18 #include <stdio.h>
19 #include <stdint.h>
20 #include <stdlib.h>
21 #include <string.h>
22 
23 #define CRYPT_EAL_FUNCEND_ID  0
24 #define CRYPT_EAL_FUNC_END     {CRYPT_EAL_FUNCEND_ID, NULL}
25 #define CRYPT_EAL_ALGINFO_END  {CRYPT_EAL_FUNCEND_ID, NULL, NULL}
26 
27 #define CRYPT_EAL_PROVCB_FREE     1
28 #define CRYPT_EAL_PROVCB_QUERY    2
29 #define CRYPT_EAL_PROVCB_CTRL     3
30 
31 typedef struct {
32     int32_t id;
33     void *func;
34 } CRYPT_EAL_Func;
35 
36 
37 typedef struct {
38     int32_t algId; // implemented algorithm id, such as aes128cbc, rsa sign
39     const CRYPT_EAL_Func *implFunc; // implemented algorithm callback
40     const char *attr; // implemented algorithm attribute
41 } CRYPT_EAL_AlgInfo;
42 
43 typedef struct EAL_ProviderMgrCtx CRYPT_EAL_ProvMgrCtx;
44 
CRYPT_EAL_ProvFreeCb(void * provCtx)45 void CRYPT_EAL_ProvFreeCb(void *provCtx)
46 {
47     return;
48 }
49 
CRYPT_EAL_ProvQueryCb(void * provCtx,int32_t operaId,CRYPT_EAL_AlgInfo ** algInfos)50 int32_t CRYPT_EAL_ProvQueryCb(void *provCtx, int32_t operaId, CRYPT_EAL_AlgInfo **algInfos)
51 {
52     return 0;
53 }
54 
CRYPT_EAL_ProvCtrlCb(void * provCtx,int32_t cmd,void * val,uint32_t valLen)55 int32_t CRYPT_EAL_ProvCtrlCb(void *provCtx, int32_t cmd, void *val, uint32_t valLen)
56 {
57     return 0;
58 }
59 
60 static CRYPT_EAL_Func g_outFuncs[] = {
61     {CRYPT_EAL_PROVCB_FREE, CRYPT_EAL_ProvFreeCb},
62     {CRYPT_EAL_PROVCB_QUERY, CRYPT_EAL_ProvQueryCb},
63     {CRYPT_EAL_PROVCB_CTRL, CRYPT_EAL_ProvCtrlCb},
64     CRYPT_EAL_FUNC_END
65 };
66