Rate This Document
Findability
Accuracy
Completeness
Readability

serverCalculate

The server receives the query data from the client and returns the corresponding value to the client.

int serverCalculate(
     DG_TeeCtx *dgTeeCtx, 
     DG_BucketMap *bucketMap
)

Parameters

Table 1 Description

Parameter

Description

Value Range

Input/Output

dgTeeCtx

KCAL context

Context initialized in section initTeeCtx.

Input

bucketMap

Internal bucket structure

The external key-value data is stored in the internal bucket structure to optimize query efficiency.

Input

Return Values

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

Error Codes

Table 2 Error codes

Error Code

Value

Description

Remarks

DG_SUCCESS

0

Success

-

DG_FAILURE

1

Communication failure

-

DG_ERR_MPC_TEE_INVALID_NODE_INFO

4503

Invalid TEE node information

-

DG_ERR_MPC_TEE_INVALID_PARAM

4501

Failed to verify the parameters.

dgCfg is null or the dgTeeCtx double pointer is null.

Dependency

  • This API depends on the KCAL configuration in section DataGuard APIs for Configuring an Operation Set, and the configured dgCfg is used as the input parameter of this API.
  • pirOpts depends on the successful initialization in section DG_InitPirOpts of the function group for the PIR operator.
  • #include "data_guard_mpc.h": required header file

Example

#include  "data_guard_mpc.h" 

// pirOpts is the result of the successful DG_InitPirOpts call, and dgTee is the result of the successful initTeeCtx call.
// bucketMap is the output result of offlineCalculate.
 int res = pirOpts.serverCalculate(dgTee,bucketMap);
 if (rv != 0) {
        return rv;
  }

Call the serverCalculate API using the pirOpts output of the successful DG_InitPirOpts call.