我要评分
获取效率
正确性
完整性
易理解

setTeeNodeInfos

Sets the global node information. For two-party operations, only nodes 0 and 1 are supported.

int setTeeNodeInfos(
    DG_TeeCtx *dgTeeCtx, 
    struct TeeNodeInfos *teeNodeInfos
)

Parameters

Parameter

Description

Value Range

Input/Output

dgTeeCtx

MPC context

Context initialized in section initTeeCtx.

Input

teeNodeInfos

Global node information

The value is not null.

Input

Table 1 TeeNodeInfo structure

Name

Type

Description

nodeId

int

Compute node ID, which can be 0 or 1.

Table 2 TeeNodeInfos structure

Name

Type

Description

nodeInfo

TeeNodeInfo *

Information about multiple nodes.

size

unsigned long

Node count. Only two nodes are supported.

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

Invalid node information.

The setting of the network parameters is incorrect, or the node ID or IP address verified based on size 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.

Dependency

  • teeOpts depends on the successful initialization in section DG_InitPsiOpts of the function group for the PSU operator.
  • #include "data_guard_mpc.h": required header file

Example

#include  "data_guard_mpc.h" 
  
struct TeeNodeInfo teeNodes[2];
teeNodes[0].nodeId = 0;
teeNodes[1].nodeId = 1;
struct TeeNodeInfos allNodes;
allNodes.nodeInfo = teeNodes;
allNodes.size = 2;
// teeOpts is the result of the successful DG_InitPsiOpts call, and dgTee is the result of the successful initTeeCtx call.
rv = teeOpts.setTeeNodeInfos(dgTee, &allNodes);

The number of nodes is set to 2.

Running result: rv is 0.

Call the setTeeNodeInfos API using the teeOpts output of the successful DG_InitPsiOpts call.