initTeeCtx
Initializes dgTeeCtx.
int initTeeCtx (
DG_Cfg dgCfg,
DG_TeeCtx **dgTeeCtx
)
Parameters
Parameter |
Description |
Value Range |
Input/Output |
|---|---|---|---|
dgCfg |
The KCAL configuration type is void*. |
The value is not null and has been initialized. |
Input |
dgTeeCtx |
The KCAL context is DG_TeeCtx **. |
It is null as a single pointer and cannot be null as a double pointer. |
Output |
Return Values
- Success: 0 is returned.
- Failure: The error code is returned.
Error Codes
Error Code |
Value |
Description |
Remarks |
|---|---|---|---|
DG_SUCCESS |
0 |
Success. |
- |
DG_ERR_MPC_TEE_INVALID_PARAM |
4501 |
Failed to verify the parameters. |
dgCfg is null or the dgTeeCtx double pointer is null. |
DG_ERR_MPC_TEE_NODEID_NOT_SET |
4506 |
The node ID is not set. |
Each node needs to set its node information. |
DG_ERR_MPC_TEE_NET_API_CALLBACK_NOT_SET |
4507 |
The network send or receive function is not registered. |
The communication callback is registered by the product. |
DG_ERR_MPC_TEE_FXP_BITS_NOT_SET DG_ERR_MPC_TEE_INVALID_ENVIRONMENT |
4509 4511 |
The number of decimal places is not set. The CPU ID or cVM environment is invalid. |
- The cryptographic computing feature can run only on servers with the Kunpeng 920 or new Kunpeng 920 model. |
Dependency
#include "data_guard_mpc.h": required header file
Example
#include "data_guard_mpc.h"
// It is assumed that teeCfg has been initialized.
DG_Arithmetic_Opts aritOpts = DG_InitArithmeticOpts();
struct DG_TeeCtx *dgTee = nullptr;
int rv = aritOpts.initTeeCtx(teeCfg, &dgTee);
if (rv != 0) {
printf("tee init error.-%d\n", rv);
return rv;
}
Running result: rv is 0.
This function is used to create the dgTeeCtx structure. The initTeeCtx API is called by using the aritOpts output of the successful DG_InitArithmeticOpts call.