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

release

Releases DataGuard configuration.

int release ( 
    DG_Cfg *config
)

Parameters

Table 1 Description

Parameter

Description

Value Range

Input/Output

config

Initialized configuration.

The input is the initialized configuration.

Input

Return Values

Success: 0 is returned.

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"
// opts is the result of the successful DG_InitConfigOpts call, and teeCfg is the result of the successful initialization.
int res = opts->release(&teeCfg);

Running result: res is 0.

The following is an example of setting the KCAL configuration.

#include "data_guard_config.h"
#include "data_guard_mpc.h"
 
DG_ConfigOpts *opts = NULL;
int rv = DG_InitConfigOpts(DG_BusinessType::MPC, &opts);
if (rv != 0) {
    printf("DG_InitConfigOpts error!code:%d\n", rv);
    return rv;
}
void *teeCfg = NULL;
rv = opts->init(&teeCfg);
if (rv != 0) {
    printf(" opts->init(dgCfg)!-%d\n", rv);
    return rv;
}
rv = opts->setIntValue(teeCfg, DG_CON_MPC_TEE_INT_NODEID, nodeId);
if (rv != 0) {
    printf(" opts-> setIntValue(dgCfg)!-%d\n", rv);
    return rv;
}
rv = opts->setIntValue(teeCfg, DG_CON_MPC_TEE_INT_FXP_BITS, 2);
if (rv != 0) {
    printf(" opts-> setIntValue(dgCfg)!-%d\n", rv);
    return rv;
}
rv = opts->setIntValue(teeCfg, DG_CON_MPC_TEE_INT_THREAD_COUNT, 16);
if (rv != 0) {
    printf(" opts-> setIntValue(dgCfg)!-%d\n", rv);
    return rv;
}
// SM algorithm flag. 0: non-SM algorithm; 1: SM algorithm.
rv = opts->setIntValue(teeCfg, DG_CON_MPC_TEE_INT_IS_SM_ALGORITHM, 1);
if (rv != 0) {
    printf(" opts-> setIntValue(dgCfg)!-%d\n", rv);
    return rv;
}  
// SendData and RecvData are implemented by the product.
TEE_NET_RES teeNet = {SendData, RecvData};
DG_Void netFunc;
netFunc.data = &teeNet;
netFunc.size = sizeof(TEE_NET_RES);
rv = opts->setVoidValue(teeCfg, DG_CON_MPC_TEE_VOID_NET_API, &netFunc);
if (rv != 0) {
    printf(" opts-> setVoidValue(dgCfg)!-%d\n", rv);
    return rv;
}
// Release resources after all services are complete.
DG_ReleaseConfigOpts(&opts);

Running result: The value of each rv is 0.

Call the release API using the opts output of the successful DG_InitConfigOpts call.