client

Description

There are 5 modules in the directory: libteec.so, teecd, tlogcat, tee_teleport, agentd. libteec.so & teecd are used in comunications between REE & TEE, tlogcat is used for saving logs. tee_teleport is used to support high-level language. agentd is used to support secure storage in container.

Depend on

These modules depend on open source libboundscheck, please download it here: https://atomgit.com/openeuler/libboundscheck , and unzip it in current directory like this. libteec_vendor |--libboundscheck |--- include |--- src |--- Makefile |--- ...

Build

compile all 5 files, do like this

make

if only need one file, compile like this

make libteec.so
make teecd
make tlogcat
make agentd
make tee_teleport

at the same time, we can get a library libboundscheck.so. All the generated files are stored in the newly created directory dist.

Users can specify the output logs for the teeos/ta/agentd process/libteec.so at compile time, as follows: a. The TEE_LOG_PATH_BASE parameter can specify the log storage path for TEE OS and TAs, provided that the path exists. This method also applies to single compilation tlogcat scenarios. b. The CUSTOM_AGENTD_LOGGING option can specify the file where the agentd process logs are saved. This file directory needs to be created in advance. If the file does not exist, it will be created during runtime c. Set CONFIG_CUSTOM_LIBTEEC_LOGGING=true, and implement the LogPrint function (input/output references tee_custom_log.c) for CA. This allows libteec.so to output logs using the custom LogPrint function. Compilation method example: TEE_LOG_PATH_BASE=/test/log CUSTOM_AGENTD_LOGGING=/test/agentd/agentd.log CONFIG_CUSTOM_LIBTEEC_LOGGING=true make

How to use

Run teecd or tlogcat

  1. Copy teecd or tlogcat to usr/bin, copy libteec.so & libboundscheck.so to usr/lib[64]. Change teecd or tlogcat mode to 700: chmod 700 teecd chmod 700 tlogcat
  2. Make sure tzdriver.ko is already running, execute the cmd: lsmod | grep tzdriver If tzdriver is found, means tzdriver,ko is running.
  3. Execute the cmd to start teecd or tlogcat: /usr/bin/teecd & /usr/bin/tlogcat -f & If it started succseccfully, we can find it here: ps -A | grep teecd ps -A | grep tlogcat If printed 'Exit 255', it means something wrong, you can find infos in dmesg logs. Nomorly, reasons for failure may be like these: i)teecd or tlogcat dose not have the right permission; ii)system dose not find the libaries which teecd or tlogcat includes; iii)tzdriver,ko dose not start succseccfully.
  4. Run your test case.

The log path stored by tlogcat is /var/log/tee. You can also directly execute /usr/bin/tlogcat to print the log on the screen. Get help information: /usr/bin/tlogcat -h Print iTrustee version: /usr/bin/tlogcat -v Only print the new log: /usr/bin/tlogcat -t Print cpu irq information: /usr/bin/tlogcat -h