Rate This Document
Findability
Accuracy
Completeness
Readability

revealShareByFile

Reveals the shares to obtain the final calculation result.
int revealShareByFile(
    DG_TeeCtx *dgTeeCtx, 
    const DG_MpcFileInput *input, 
    DG_MpcFileOutput *output
)

Parameters

Parameter

Description

Value Range

Input/Output

dgTeeCtx

KCAL context

Context initialized in section initTeeCtx.

Input

input

DG_MpcFileInput

The value is not null.

Input

output

DG_MpcFileOutput

The value is not null.

Output

Table 1 DG_MpcFileInputSet structure

Name

Type

Description

shareInputSet

DG_MpcFileInput

File shares of each participant

size

unsigned long

Number of participants

Table 2 DG_MpcFileInput structure

Name

Type

Description

filePath

char*

File path

pathLen

uint32_t

Path length

dataSize

uint64_t

Data size

Table 3 DG_MpcFileOutput structure

Name

Type

Description

filePath

char*

File path

pathLen

uint32_t

Path length

dataSize

uint64_t

Data size

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

4516

4501

DG_ERR_MPC_TEE_TMP_PATH_SET_ERROR

Invalid parameter

Incorrect temporary directory settings

-

DG_ERR_MPC_TEE_INVALID_ALGORITHM_TYPE

4514

4502

DG_ERR_MPC_TEE_CHUNK_SIZE_SET_ERROR

Invalid algorithm type

Incorrect file chunk size

-

Dependency

  • dgTeeCtx depends on the successful initialization of initTeeCtx.
  • The dependent header file is data_guard_mpc.h.

Example

Obtain the output result based on the path in output.

#include  "data_guard_mpc.h" 
 // Compute party
DG_MpcFileInput teeFileInput;
teeFileInput.filePath = const_cast<char *>(shareFilePath.c_str());
teeFileInput.pathLen = static_cast<uint32_t>(shareFilePath.length());

DG_MpcFileOutput teeFileOutput;
teeFileOutput.filePath = const_cast<char *>(outputFilePath.c_str());
teeFileOutput.pathLen = static_cast<uint32_t>(outputFilePath.length());
int ret = opts_->revealShareByFile(dgTeeCtx_, &teeFileInput, &teeFileOutput);