Rate This Document
Findability
Accuracy
Completeness
Readability

revealShare

Reveals the shares to obtain the final calculation result.

int revealShare ( 
	DG_TeeCtx *dgTeeCtx,
        DG_MpcShare *share,
        DG_TeeMpcOutput **output
)

Parameters

Table 1 Description

Parameter

Description

Value Range

Input/Output

dgTeeCtx

KCAL context

Context initialized in section initTeeCtx.

Input

share

Result of the successful makeShare call. The type is DG_MpcShare. For details, see section 3.2.6.

The value is not null.

Input

output

The type of the final calculation result:

DG_TeeOutput

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

Table 2 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

  • This function depends on dgTeeCtx initialized in section initTeeCtx.
  • #include "data_guard_mpc.h": required header file

Example

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

Calculation result: res = 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.