Rate This Document
Findability
Accuracy
Completeness
Readability

setIntValue

Sets the int value of the configuration, and assigns the configuration information (the node ID, the number of decimal places, number of enabled threads, and SM algorithm parameters) to config through setIntValue, and then registers config with the KCAL instance.

int setIntValue ( 
    DG_Cfg config,
        const char *key,
        int value
)

Parameters

Table 1 Description

Parameter

Description

Value Range

Input/Output

config

Initialized configuration.

Key and value.

Output

key

A unique identifier for the value, used when setting the node ID.

Key values:

  • DG_CON_MPC_TEE_INT_NODEID for nodeId, whose value is an integer starting from 0 and incrementing sequentially. For two-party operations, only nodes 0 and 1 are supported. For three-party operations, nodes 0, 1, and 2 are supported.
  • DG_CON_MPC_TEE_INT_FXP_BITS for fxpBits, whose value is an integer indicating the number of decimal places, with a range of [0, 9) and a recommended range of [2, 3].
  • DG_CON_MPC_TEE_INT_THREAD_COUNT for threadNumbers, whose value represents the number of threads to be enabled. If the value is not obtained, the thread count is subject to the number of CPU cores. If set, the specified number of threads will be used, where the number is greater than 0. This is an optional configuration.
  • DG_CON_MPC_TEE_INT_IS_SM_ALGORITHM for isSmAlgorithm, whose value is an integer indicating whether to use the SM algorithm. The value 1 indicates that the SM algorithm is used, and the default value 0 indicates that the National Institute of Standards and Technology (NIST) algorithm is used.

Input

value

Value in the int type.

The value is set based on the key.

Input

Return Values

  • Success: 0 is returned.
  • Failure: The error code is returned.

Error Codes

Table 2 Error code

Error Code

Value

Description

Remarks

DG_ERR_CONFIG_PARAM

62

Failed to verify the parameters.

config or key is null.

Dependency

#include "data_guard_config.h": the header file where the API declaration is stored.

Example

#include  "data_guard_config.h"
// opts is the result of the successful DG_InitConfigOpts call.
int nodeId = 0; //This is the node ID of compute node 0. For compute node 1, the value is set to 1.
int res = opts->setIntValue(teeCfg, DG_CON_MPC_TEE_INT_NODEID, nodeId);

Running result: res is 0.

  • Call the setIntValue API using the opts output of the successful DG_InitConfigOpts call.
  • Set the node ID of each node.