setTeeNodeInfos
Sets the global node information for dgTeeCtx. For two-party computation, only nodes 0 and 1 are supported.
int setTeeNodeInfos (
DG_TeeCtx *dgTeeCtx,
struct TeeNodeInfos *teeNodeInfos
)
Parameters
Parameter |
Description |
Value Range |
Input/Output |
|---|---|---|---|
dgTeeCtx |
TEE context |
Context initialized in section initTeeCtx. |
Input |
teeNodeInfos |
Global node information |
The value is not null. |
Input |
Member |
Type |
Description |
|---|---|---|
nodeInfo |
TeeNodeInfo * |
Information about multiple nodes. |
size |
unsigned long |
Number of nodes. Constraints: Only two nodes are supported. |
Member |
Type |
Description |
|---|---|---|
nodeId |
int |
The node IDs are 0 and 1. |
Return Values
- Success: 0 is returned.
- Failure: The error code is returned.
Error Codes
Error Code |
Value |
Description |
Remarks |
|---|---|---|---|
DG_ERR_MPC_TEE_INVALID_PARAM |
4501 |
Failed to verify the parameters. |
dgTeeCtx or teeNodeInfos is null. |
DG_ERR_MPC_TEE_INVALID_NODE_INFO |
4503 |
The node information is invalid. |
The setting of the network parameters or the number of global nodes is incorrect. |
DG_ERR_MPC_TEE_NODE_NOT_SORT_AND_START_0 |
4505 |
The node IDs are not numbered from 0. |
The node IDs must be numbered from 0 and increment sequentially. |
DG_ERR_MEMCPY_FAIL |
52 |
Failed to copy from memory. |
Failed to copy the node information. |
Dependency
- aritOpts depends on the KCAL function group successfully initialized in section initTeeCtx.
- #include "data_guard_mpc.h": required header file
Example
#include "data_guard_mpc.h"
// It is assumed that dgTee has been initialized.
struct TeeNodeInfo teeNodes[2];
teeNodes[0].nodeId = 0;
teeNodes[1].nodeId = 1;
struct TeeNodeInfos allNodes;
allNodes.nodeInfo = teeNodes;
allNodes.size = 2;
rv = aritOpts.setTeeNodeInfos(dgTee, &allNodes);rv = aritOpts.setTeeNodeInfos(dgTee, &allNodes);
if (rv != 0) {
printf("tee set node info error.-%d\n", rv);
return rv;
}
The node ID is set to 2.
Running result: rv is 0.
dgTeeCtx returned after the successful initTeeCtx call is used as the input to call the setTeeNodeInfos API.