Rate This Document
Findability
Accuracy
Completeness
Readability

revealShare

Reveals the shares to obtain the final calculation result.

int revealShare(
    DG_TeeCtx *dgTeeCtx,
    DG_MpcMatShare *share,
    DG_TeeMatOutput **output
)

Parameters

Parameter

Description

Value Range

Input/Output

dgTeeCtx

KCAL context

Context initialized in section initTeeCtx.

Input

share

Result of the successful calculate function call.

The type is DG_MpcMatShare. For details, see negotiateSeeds.

The value is not null.

Input

output

The type of the final calculation result:

DG_TeeMatOutput

It is null as a single pointer and cannot be null as a double pointer.

Output

Table 1 DG_TeeMatOutput

Name

Type

Description

data

DG_MpcDataUnion

The types of the input data strings, doubleNumbers, and u64Numbers are respectively DG_String *, double *, and u64 *.

row

uint32_t

Number of rows in a matrix

col

uint32_t

Number of columns in a matrix

dataType

DG_MpcDataType

The enumerated data type is as follows:

MPC_DOUBLE (cryptographic matrix addition, subtraction, and multiplication)

Table 2 DG_MpcDataUnion

Name

Type

Description

strings

DG_String

String array

u64Numbers

u64

u64 array

doubleNumbers

double

Double array

Return Values

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

Error Codes

Error Code

Value

Description

Remarks

DG_ERR_MPC_TEE_INVALID_PARAM

4501

Failed to verify the parameters.

dgTeeCtx is null.

share is null.

The share size is 0.

The output double pointer is null.

DG_ERR_MPC_NET_SEND_FAIL

4012

Failed to send network request.

-

DG_ERR_MPC_RECV_DATA_FAIL

4015

Failed to receive serialized data.

-

Dependency

  • dgTeeCtx depends on the successful initialization of initTeeCtx.
  • #include "data_guard_mpc.h": required header file

Example

#include  "data_guard_mpc.h"
// The output is not null.
DG_MpcMatShare *share_out = nullptr;
res = aritOpts.revealShare(dgTee, share_out, &output);

Calculation result: res is 0.

  • When retrieving results from the output, you need to access appropriate data within its data field based on the type specified in DG_MpcDataType. If the type is MPC_INT, retrieve the u64Numbers-type output. If the type is MPC_DOUBLE, retrieve the doubleNumbers-type output. If the type is MPC_STRING, retrieve strings-type output.
  • #include "data_guard_mpc.h": required header file