blob: 20d1d8b91adf7ce799aa70b35637ccd170c65275 [file] [log] [blame]
Joakim Bech8e5c5b32018-10-25 08:18:32 +02001.. _libraries:
2
3#########
4Libraries
5#########
6
Etienne Carriere7b780182023-11-10 10:25:02 +01007.. _libutils:
8
9libutils
10********
11
12OP-TEE core and OP-TEE development kit for Trusted Application provide a
13standard C library that is named **libutils**. It implements many
14standard functions like ``snprintf()``, ``strncmp()``, ``memcpy()``,
15``malloc()``. ``qsort()``, and many more but not all standard C library
16functions.
17
18Note however that Trusted Applications implemented in C should use GP TEE
19Internal Core API functions rather than their standard C library function
20equivalent (e.g. ``TEE_MemMove()`` instead of ``memcpy()`` and
21``memmove()``, or ``TEE_Malloc()`` instead of ``malloc()`` and friends).
22This makes those TAs implementation more portable to other GP
23TEE compliant environments.
24
Etienne Carrierec75d19d2023-11-10 14:29:28 +010025When ``CFG_ULIBS_SHARED`` is enabled, **libutils** is assigned UUID
26**71855bba-6055-4293-a63f-b0963a737360**.
27
Joakim Bech8e5c5b32018-10-25 08:18:32 +020028.. _libutee:
29
30libutee
31*******
32The :ref:`tee_internal_core_api` describes services that are provided to Trusted
33Applications. **libutee** is a library that implements this API.
34
Etienne Carrierec75d19d2023-11-10 14:29:28 +010035libutee is designed as a userland library specifically dedicated to OP-TEE
36Trusted Applications and aims at being executed in the non-privileged secure
37userspace.
Joakim Bech8e5c5b32018-10-25 08:18:32 +020038
39Some services for this API are fully statically implemented inside the libutee
40library while some services for the API are implemented inside the OP-TEE core
41(privileged level) and libutee calls such services through system calls.
42
Etienne Carrierec75d19d2023-11-10 14:29:28 +010043When ``CFG_ULIBS_SHARED`` is enabled, **libutee** is assigned UUID
44**4b3d937e-d57e-418b-8673-1c04f2420226**.
45
46.. _statci_or_shared_lib:
47
48Static vs Shared libraries
49**************************
50
51OP-TEE core supports only static libraries that are linked at build time to
52produce the monolithic OP-TEE core image.
53
54OP-TEE Trusted Applications can support both static and shared libraries. In
55the latter case, each shared library is identified by a UUID and OP-TEE OS
56is in charge of dynamically loading the required shared libraries in the
57address space of the Trusted Application when this one uses a resource of
58the related library.
59
60In order to support shared library, OP-TEE OS shall be built with
61``CFG_ULIBS_SHARED=y``. Shared library binary images are generated as
62**.elf** and **.ta** files, like Trusted Applications are, and shall be
63installed the same way as Trusted Applications are, see ref:`ta_locations`.
64