summaryrefslogtreecommitdiffstats
path: root/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/core/iwasm/libraries/lib-rats/lib_rats_wrapper.h
blob: e334983e9aa51601b2fb5c8ccc11336042ef1622 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
 * Copyright (c) 2022 Intel Corporation
 * Copyright (c) 2020-2021 Alibaba Cloud
 *
 * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 */

#ifndef _RATS_WAMR_API_H
#define _RATS_WAMR_API_H

#include <stdint.h>
#include <string.h>

#include "lib_rats_common.h"

#ifdef __cplusplus
extern "C" {
#endif

int
librats_collect(char **evidence_json, const char *buffer, uint32_t buffer_size);

int
librats_verify(const char *evidence_json, uint32_t evidence_size,
               const uint8_t *hash, uint32_t hash_size);

int
librats_parse_evidence(const char *evidence_json, uint32_t json_size,
                       rats_sgx_evidence_t *evidence, uint32_t evidence_size);

#define librats_collect(evidence_json, buffer) \
    librats_collect(evidence_json, buffer, buffer ? strlen(buffer) + 1 : 0)

#define librats_verify(evidence_json, hash)                             \
    librats_verify(evidence_json,                                       \
                   evidence_json ? strlen(evidence_json) + 1 : 0, hash, \
                   hash ? strlen((const char *)hash) + 1 : 0)

#define librats_parse_evidence(evidence_json, evidence)                   \
    librats_parse_evidence(evidence_json,                                 \
                           evidence_json ? strlen(evidence_json) + 1 : 0, \
                           evidence, sizeof(rats_sgx_evidence_t))

#ifdef __cplusplus
}
#endif

#endif