setVoidValue
Sets the void value of the configuration, assigns the value of TEE_NET_RES to config through DG_Void, and registers config with KCAL.
int setVoidValue (
DG_Cfg config,
const char *key,
const DG_Void *value
)
Parameters
Parameter |
Description |
Value Range |
Input/Output |
|---|---|---|---|
config |
Initialized configuration. |
The input is the initialized config. |
Output |
key |
A unique identifier for the value, used when setting the communication API. |
DG_CON_MPC_TEE_VOID_NET_API |
Input |
value |
Communication structure |
TEE_NET_RES structure |
Input |
Member |
Type |
Description |
|---|---|---|
data |
void * |
Structure pointer |
size |
long |
Memory size of the structure |
Member |
Type |
Description |
|---|---|---|
funcSendData |
Pointer to the data sending function |
int (*funcSendData)(struct TeeNodeInfo *nodeInfo, unsigned char *buf, u64 len); |
funcRecvData |
Pointer to the data receiving function |
int (*funcRecvData)(struct TeeNodeInfo *nodeInfo, unsigned char *buf, u64 *len); |
Return Values
- Success: 0 is returned.
- Failure: The error code is returned.
Error Codes
Error Code |
Value |
Description |
Remarks |
|---|---|---|---|
DG_ERR_CONFIG_PARAM |
62 |
Failed to verify the parameters. |
config, key, or value is null. |
Dependency
#include "data_guard_config.h": the header file where the API declaration is stored.
Example
#include "data_guard_config.h"
#include "data_guard_mpc.h"
// Senddata and Recvdata are the data sending and receiving functions implemented by the product.
TEE_NET_RES teeNet = {SendData, RecvData};
DG_Void netFunc;
netFunc.data = &teeNet;
netFunc.size = sizeof(TEE_NET_RES);
// opts is the result of the successful DG_InitConfigOpts call.
int res = opts->setVoidValue(teeCfg, DG_CON_MPC_TEE_VOID_NET_API, &netFunc);
Running result: res is 0.
Call the setVoidValue API using the opts output of the successful DG_InitConfigOpts call.