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 |
Member |
Type |
Description |
|---|---|---|
TeeNodeInfos |
Structure pointer |
Indicates node information in TeeNodeInfos*. |
teeNetRes |
Structure pointer |
Indicates the TEE_NET_RES* type input passed to the communication API. |
nodeIndex |
int |
Indicates the node indexes in TeeNodeInfos. |
seedInfoList |
Structure |
Indicates the negotiated seeds in SeedInfoList. |
threadCount |
int |
Indicates the number of threads. |
fxpBits |
int |
Indicates the number of fractional bits. |
serverSeed |
Data128 |
In the PIR protocol, the server stores the seeds. |
maxPaddingLen |
Unsigned long |
In the PIR protocol, the server sets the maximum padding length to handle null values. |
Return Values
- Success: 0 is returned.
- Failure: The error code is returned.
Error Codes
Error Code |
Value |
Description |
Remarks |
|---|---|---|---|
DG_ERR_MPC_TEE_INVALID_CPUID |
4511 |
The CPU ID is invalid. |
The CPU ID does not indicate a Kunpeng 920 or a new Kunpeng 920 processor model. |
DG_ERR_MPC_TEE_INVALID_PARAM |
4501 |
The parameter is invalid. |
The input parameter is null, or the input single pointer is null. |
DG_ERR_MPC_TEE_NET_API_CALLBACK_NOT_SET |
4507 |
The network send or receive function is not registered. |
- |
DG_ERR_MPC_TEE_NODEID_NOT_SET |
4506 |
The node ID is not set. |
- |
DG_ERR_MPC_TEE_FXP_BITS_NOT_SET |
4509 |
The number of fractional bits is not set. |
- |
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.
Call the initTeeCtx API using the aritOpts output of the successful DG_Arithmetic_Opts call.