serverCalculateByFile
int calculateByFile (
DG_TeeCtx *dgTeeCtx,
DG_AlgorithmsType type,
DG_MpcFileInput *input,
DG_MpcFileOutput *output
)
Parameters
Parameter |
Description |
Value Range |
Input/Output |
|---|---|---|---|
dgTeeCtx |
KCAL context |
Context initialized in section initTeeCtx. |
Input |
dataPath |
DG_MpcFileInput |
The value is not null. |
Input |
isDeleteCache |
int |
isDeleteCache (whether to delete the cache. 0: false; 1: true) |
Output |
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 |
4501 |
Invalid parameter |
- |
DG_ERR_MPC_TEE_INVALID_ALGORITHM_TYPE |
4502 |
Invalid algorithm type |
- |
DG_ERR_MALLOC_FAIL |
51 |
Memory allocation failure |
- |
DG_ERR_MPC_TEE_DIV_IS_ZERO |
4512 |
Division-by-zero error |
- |
DG_FAILURE |
1 |
Operator execution failure |
- |
Dependency
- dgTeeCtx depends on the successful initialization of initTeeCtx.
- The dependent header file is data_guard_mpc.h.
Example
Call the serverCalculateByFile API using the teeOpts output of the successful DG_InitPsiOpts call.
#include "data_guard_mpc.h" DG_MpcFileInput teeFileInput; teeFileInput.filePath = const_cast<char *>(cacheFilePath.c_str()); teeFileInput.pathLen = static_cast<uint32_t>(cacheFilePath.length());return pirOpts->serverCalculateByFile(dgTeeCtx_, &teeFileInput, isDeleteCache);
Running result: res is 0 and output is not null.