forked from openenclave/openenclave
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtraceh_enclave.c
59 lines (52 loc) · 1.68 KB
/
traceh_enclave.c
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
49
50
51
52
53
54
55
56
57
58
59
// Copyright (c) Open Enclave SDK contributors.
// Licensed under the MIT License.
#include <openenclave/internal/calls.h>
#include <openenclave/internal/trace.h>
#if defined(__x86_64__) || defined(_M_X64)
#include "sgx/enclave.h"
#elif defined(__aarch64__) || defined(_M_ARM64)
#if defined(__linux__)
#include "optee/linux/enclave.h"
#else
#error "OP-TEE is not yet supported on non-Linux platforms."
#endif
#else
#error "Open Enclave is not supported on this architecture."
#endif
#include "core_u.h"
/**
* Declare the prototype of the following function to avoid the
* missing-prototypes warning.
*/
oe_result_t _oe_log_init_ecall(
oe_enclave_t* enclave,
const char* enclave_path,
uint32_t log_level);
/**
* Make the following ECALL weak to support the system EDL opt-in.
* When the user does not opt into (import) the EDL, the linker will pick
* the following default implementation. If the user opts into the EDL,
* the implemention (which is also weak) in the oeedger8r-generated code will
* be used. This behavior is guaranteed by the linker; i.e., the linker will
* pick the symbols defined in the object before those in the library.
*/
oe_result_t _oe_log_init_ecall(
oe_enclave_t* enclave,
const char* enclave_path,
uint32_t log_level)
{
OE_UNUSED(enclave);
OE_UNUSED(enclave_path);
OE_UNUSED(log_level);
return OE_UNSUPPORTED;
}
OE_WEAK_ALIAS(_oe_log_init_ecall, oe_log_init_ecall);
/*
* This file is separated from traceh.c since the host verification library
* should not depend on ECALLS.
*/
oe_result_t oe_log_enclave_init(oe_enclave_t* enclave)
{
initialize_log_config();
return oe_log_init_ecall(enclave, enclave->path, _log_level);
}