| 376db81e | 07-Dec-2020 |
Jerome Forissier <jerome@forissier.org> |
libutee: user_ta_header.h: remove unused enum user_ta_core_service_id
enum user_ta_core_service_id is unused, remove it.
Signed-off-by: Jerome Forissier <jerome@forissier.org> Reviewed-by: Etienne
libutee: user_ta_header.h: remove unused enum user_ta_core_service_id
enum user_ta_core_service_id is unused, remove it.
Signed-off-by: Jerome Forissier <jerome@forissier.org> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 9bf34bd7 | 04-Dec-2020 |
Jerome Forissier <jerome@forissier.org> |
Remove unused file lib/libutee/errno.c
lib/libutee/errno.c is not built or used in any way so remove it.
Signed-off-by: Jerome Forissier <jerome@forissier.org> Acked-by: Jens Wiklander <jens.wiklan
Remove unused file lib/libutee/errno.c
lib/libutee/errno.c is not built or used in any way so remove it.
Signed-off-by: Jerome Forissier <jerome@forissier.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| cb1b1ecd | 25-Aug-2020 |
Jorge Ramirez-Ortiz <jorge@foundries.io> |
core: pta: SCP03 pseudo trusted application
Implement GlobalPlatform Secure Channel Protocol 3 control from REE. Secure boot requires that SCP03 is enabled as soon as secure storage is available (ie
core: pta: SCP03 pseudo trusted application
Implement GlobalPlatform Secure Channel Protocol 3 control from REE. Secure boot requires that SCP03 is enabled as soon as secure storage is available (ie RPMB).
Host side example: github.com/foundriesio/optee-scp03
Signed-off-by: Jorge Ramirez-Ortiz <jorge@foundries.io> Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
show more ...
|
| 919a5a68 | 06-Oct-2020 |
Jerome Forissier <jerome@forissier.org> |
Use fallthrough pseudo-keyword in switch/case statements
Use fallthrough; in switch/case statements. Imported libraries (libtomcrypt, libmbedtls) are not modified to minimize differences with upstre
Use fallthrough pseudo-keyword in switch/case statements
Use fallthrough; in switch/case statements. Imported libraries (libtomcrypt, libmbedtls) are not modified to minimize differences with upstream.
Signed-off-by: Jerome Forissier <jerome@forissier.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| b9416909 | 24-Sep-2020 |
Jens Wiklander <jens.wiklander@linaro.org> |
Provide TEE_ATTR_FLAG_VALUE and TEE_ATTR_FLAG_PUBLIC
Provides TEE_ATTR_FLAG_VALUE and TEE_ATTR_FLAG_PUBLIC which are defined already in GP v1.0 [1] and also expected in GP v1.1 [2]. The old TEE_ATTR
Provide TEE_ATTR_FLAG_VALUE and TEE_ATTR_FLAG_PUBLIC
Provides TEE_ATTR_FLAG_VALUE and TEE_ATTR_FLAG_PUBLIC which are defined already in GP v1.0 [1] and also expected in GP v1.1 [2]. The old TEE_ATTR_BIT_VALUE and TEE_ATTR_BIT_PROTECTED are kept for backwards compatibility for now.
[1]: GlobalPlatform TEE Internal API Specification v1.0 [2]: GlobalPlatform TEE Internal Core API Specification v1.1
Reviewed-by: Jerome Forissier <jerome@forissier.org> Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| ee2f75af | 09-Sep-2020 |
Jens Wiklander <jens.wiklander@linaro.org> |
libutee: fix TEE_GetOperationInfoMultiple()
The size parameter passed to TEE_GetOperationInfoMultiple() tells the size of the op_info buffer. The maximum number of keys which can be contained in the
libutee: fix TEE_GetOperationInfoMultiple()
The size parameter passed to TEE_GetOperationInfoMultiple() tells the size of the op_info buffer. The maximum number of keys which can be contained in the struct can be calculated from this size parameter.
Prior to this patch is was assumed that the caller by this specified the exact number of keys to report. This is not correct as the size parameter is only the upper limit. Fix this by instead figuring out how many keys (one or two) needs to be returned and after that check if the buffer is large enough.
Fixes: 05304565f188 ("GP11 : TEE_GetOperationInfoMultiple") Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 6c4ea258 | 09-Sep-2020 |
Jens Wiklander <jens.wiklander@linaro.org> |
libutee: fix TEE_SetOperationKey() and TEE_SetOperationKey2()
Supplying TEE_HANDLE_NULL instead of a valid key handle is supposed to clear an eventual already present key from the operation handle a
libutee: fix TEE_SetOperationKey() and TEE_SetOperationKey2()
Supplying TEE_HANDLE_NULL instead of a valid key handle is supposed to clear an eventual already present key from the operation handle and return TEE_SUCCESS. Prior to this patch the key(s) where halfway cleared and then functions panicked with TEE_ERROR_BAD_PARAMETERS. So fix this.
Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| bac3a8a7 | 10-Sep-2020 |
Jens Wiklander <jens.wiklander@linaro.org> |
libutee: TEE_GetOperationInfo() v1.1 update
In the v1.1 specification [1] TEE_GetOperationInfo() is required to set keySize and requiredKeyUsage to 0 if TEE_HANDLE_FLAG_EXPECT_TWO_KEYS is set in han
libutee: TEE_GetOperationInfo() v1.1 update
In the v1.1 specification [1] TEE_GetOperationInfo() is required to set keySize and requiredKeyUsage to 0 if TEE_HANDLE_FLAG_EXPECT_TWO_KEYS is set in handleState.
This is a clarification compared to the v1.0 [2] specification where nothing special was noted for those fields when TEE_HANDLE_FLAG_EXPECT_TWO_KEYS is set.
[1]: GlobalPlatform TEE Internal Core API Specification v1.1 [2]: GlobalPlatform TEE Internal API Specification v1.0 Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| cf5c060c | 10-Sep-2020 |
Jens Wiklander <jens.wiklander@linaro.org> |
libutee: TEE_AllocateOperation(): digest operations must have 0 max key size
Make sure that the "maxKeySize" parameter supplied to TEE_AllocateOperation() is 0 for digest operations since they don't
libutee: TEE_AllocateOperation(): digest operations must have 0 max key size
Make sure that the "maxKeySize" parameter supplied to TEE_AllocateOperation() is 0 for digest operations since they don't accept any keys.
Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 46cfd17c | 13-Aug-2020 |
Jens Wiklander <jens.wiklander@linaro.org> |
libutee: fix TEE_CloseAndDeletePersistentObject1() with TEE_HANDLE_NULL
Fixing TEE_CloseAndDeletePersistentObject1() to return TEE_SUCCESS if called with TEE_HANDLE_NULL as required in the v1.1 spec
libutee: fix TEE_CloseAndDeletePersistentObject1() with TEE_HANDLE_NULL
Fixing TEE_CloseAndDeletePersistentObject1() to return TEE_SUCCESS if called with TEE_HANDLE_NULL as required in the v1.1 specification [1] where the function was introduced.
[1]: GlobalPlatform TEE Internal Core API Specification v1.1 Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 6915bbbb | 18-Jun-2020 |
Jens Wiklander <jens.wiklander@linaro.org> |
GP 1.1: Check parameters annotated in the specification
Checks that all the function parameters which are annotated in the specification [1] are compliant with regards to memory access and memory lo
GP 1.1: Check parameters annotated in the specification
Checks that all the function parameters which are annotated in the specification [1] are compliant with regards to memory access and memory location. In case the check fails the TA panics to help debugging. The more precise and expensive checks can be disabled with CFG_TA_STRICT_ANNOTATION_CHECKS=n.
TEE_Realloc(), TEE_MemMove(), TEE_MemCompare(), TEE_MemFill() are skipped for performance reasons. The TA will instead die with a fatal exception if buffers supplied to these functions do not follow the annotation rules.
[1]: GlobalPlatform TEE Internal Core API Specification v1.1
Reviewed-by: Jerome Forissier <jerome@forissier.org> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 4d09568d | 08-Sep-2020 |
Clement Faure <clement.faure@nxp.com> |
libutils: Fix fputs() when CFG_TEE_TA_LOG_LEVEL=0
When Optee OS is compiled with CFG_TEE_TA_LOG_LEVEL=0, Optee test fails to compile properly:
arm-none-linux-gnueabihf-ld.bfd: libutils.a(fputs.o):
libutils: Fix fputs() when CFG_TEE_TA_LOG_LEVEL=0
When Optee OS is compiled with CFG_TEE_TA_LOG_LEVEL=0, Optee test fails to compile properly:
arm-none-linux-gnueabihf-ld.bfd: libutils.a(fputs.o): in function `fputs': fputs.c:15: undefined reference to `trace_ext_puts' link.mk:109: recipe for target '5b9e0e40-2636-11e1-ad9e-0002a5d5c51b.elf' failed
fputs is referenced by libstdc++.a which is used by the os_test TA for the C++ tests.
Signed-off-by: Clement Faure <clement.faure@nxp.com> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Acked-by: Jerome Forissier <jerome@forissier.org>
show more ...
|
| 3513f961 | 03-Sep-2020 |
Jerome Forissier <jerome@forissier.org> |
arm32: fold UNWIND(.fnstart/.fnend) into the FUNC macros
This change applies to arm32 assembler sources.
Instead of using UNWIND(.fnstart) after FUNC or LOCAL_FUNC and UNWIND(.fnend) before END_FUN
arm32: fold UNWIND(.fnstart/.fnend) into the FUNC macros
This change applies to arm32 assembler sources.
Instead of using UNWIND(.fnstart) after FUNC or LOCAL_FUNC and UNWIND(.fnend) before END_FUNC, let's fold these statements into the FUNC macros.
The .fnstart/.fnend directives mark the start and end of a function with an unwind table entry (.ARM.exidx) and therefore a function without them has no entry and cannot be unwound. This means that a stack dump (on abort or panic) would stop when reaching such a function.
As a result of this patch, a small number of functions now have an entry in the unwind table when they had none before (the functions which were using FUNC or LOCAL_FUNC but had no .fnstart/.fnend). It was almost always a bug and this pacth only increases the size of the .ARM.exidx section by a few bytes (tested on QEMU).
Signed-off-by: Jerome Forissier <jerome@forissier.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
show more ...
|
| 827be46c | 03-Sep-2020 |
Jerome Forissier <jerome@forissier.org> |
arm32: move the UNWIND() macro to <asm.S>
All the users of the UNWIND() macro include <asm.S> already, which is therefore a good place to define this macro. Let's move it from <kernel/unwind.h> to <
arm32: move the UNWIND() macro to <asm.S>
All the users of the UNWIND() macro include <asm.S> already, which is therefore a good place to define this macro. Let's move it from <kernel/unwind.h> to <asm.S>, remove a couple of duplicates in assembler files, and drop the useless includes.
Signed-off-by: Jerome Forissier <jerome@forissier.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
show more ...
|
| a874dbbd | 25-Aug-2020 |
Jens Wiklander <jens.wiklander@linaro.org> |
libutee: fix TEE_BigIntDiv(): dest_q or dest_r may be NULL
Fixes TEE_BigIntDiv() to allow NULL values for dest_q and dest_r as required by the GlobalPlatform spec.
Reviewed-by: Jerome Forissier <je
libutee: fix TEE_BigIntDiv(): dest_q or dest_r may be NULL
Fixes TEE_BigIntDiv() to allow NULL values for dest_q and dest_r as required by the GlobalPlatform spec.
Reviewed-by: Jerome Forissier <jerome@forissier.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 7bc927fa | 24-Aug-2020 |
Jerome Forissier <jerome@forissier.org> |
ldelf: arm64: support R_AARCH64_TLSDESC relocations
When compiling the __thread test in optee_test (xtest 1029), GCC 8.3 emits R_AARCH64_TLS_TPREL relocations while GCC 6 and 7 generate R_AARCH64_TL
ldelf: arm64: support R_AARCH64_TLSDESC relocations
When compiling the __thread test in optee_test (xtest 1029), GCC 8.3 emits R_AARCH64_TLS_TPREL relocations while GCC 6 and 7 generate R_AARCH64_TLSDESC instead. The latter are quite easy to implement once the former are done so add the required code to ldelf. This also enables the C++ tests (xtest 1031) to pass with the older compilers.
Signed-off-by: Jerome Forissier <jerome@forissier.org> Tested-by: Jerome Forissier <jerome@forissier.org> (QEMUv8, GCC 6.2/7.2) Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 01b02a16 | 21-Jul-2020 |
Jerome Forissier <jerome@forissier.org> |
ldelf, libutee: rework support of DT_INIT_ARRAY/DT_FINI_ARRAY
Now that we have the standard function dl_iterate_phdr() in libutee, we can use it to process the initialization and finalization arrays
ldelf, libutee: rework support of DT_INIT_ARRAY/DT_FINI_ARRAY
Now that we have the standard function dl_iterate_phdr() in libutee, we can use it to process the initialization and finalization arrays in the ELF files and deprecate the ad-hoc structure __init_fini_info introduced in commit dd655cb9906c ("ldelf, ta: add support for DT_INIT_ARRAY and DT_FINI_ARRAY") [1]. Unfortunately, removing __init_fini_info is not an option if we want to ensure backward compatibility. This concerns only TAs which use ELF initialization and/or finalization functions.
[1] Released in version 3.9.0.
Signed-off-by: Jerome Forissier <jerome@forissier.org> Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 9d224046 | 21-Jul-2020 |
Jerome Forissier <jerome@forissier.org> |
ldelf, libutee: add minimal Thread Local Storage support
Preparing for C++ support in TAs.
Adds enough runtime Thread Local Storage (TLS) support for the GNU C++ compilers (arm-linux-gnueabihf-g++,
ldelf, libutee: add minimal Thread Local Storage support
Preparing for C++ support in TAs.
Adds enough runtime Thread Local Storage (TLS) support for the GNU C++ compilers (arm-linux-gnueabihf-g++, aarch64-linux-gnu-g++) to work with OP-TEE. That is:
- A Thread Control Block, - The __tls_get_addr() and dl_iterate_phdr() functions.
Note that __tls_get_addr() is an ABI helper so it has no prototype in a user-accessible header file. dl_iterate_phdr() however is defined in <link.h> and may be used in a TA. The file lib/libutee/include/link.h is borrowed from Android's Bionic [1] with minor changes (added the required #include statement and named the function parameters). A similar <link.h> header is provided by other C libraries such as GNU libc, musl and FreeBSD/NetBSD/OpenBSD.
Link: [1] https://android.googlesource.com/platform/bionic/+/master/libc/include/link.h Signed-off-by: Jerome Forissier <jerome@forissier.org> Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| cc4de916 | 21-Jul-2020 |
Jerome Forissier <jerome@forissier.org> |
libutee: add <elf.h>
Preparing for C++ support in TAs.
Adds header file <elf.h> in addition to <elf32.h> and <elf64.h>. This file defines the various Elf types depending on the current architecture
libutee: add <elf.h>
Preparing for C++ support in TAs.
Adds header file <elf.h> in addition to <elf32.h> and <elf64.h>. This file defines the various Elf types depending on the current architecture. In other words: when building for Aarch32 Elf_* is defined as Elf32_*, but when building for Aarch64 it is defined as Elf64_*. This will be useful for programs which need to examine their own structure via dl_iterate_phdr() (which will come in a later commit).
Note: <elf.h> serves the same purpose as FreeBSD's <sys/elf.h> but does it differently; the file is not imported from FreeBSD.
Signed-off-by: Jerome Forissier <jerome@forissier.org> Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 9f84b6f2 | 21-Jul-2020 |
Jerome Forissier <jerome@forissier.org> |
Move ELF headers from ldelf/ to lib/libutee/
Preparing for C++ support in TAs.
Moves the ELF headers (elf32.h, elf64.h, elf_common.h) from ldelf/include to lib/libutee/include so that they may be u
Move ELF headers from ldelf/ to lib/libutee/
Preparing for C++ support in TAs.
Moves the ELF headers (elf32.h, elf64.h, elf_common.h) from ldelf/include to lib/libutee/include so that they may be used by libutee to implement the dl_iterate_phdr() function. This will be done in a later commit.
Signed-off-by: Jerome Forissier <jerome@forissier.org> Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| e9c00824 | 21-Jul-2020 |
Jerome Forissier <jerome@forissier.org> |
libutee: arm64: add read_tpidr_el0() and write_tpidr_el0() macros
Preparing for C++ support in TAs.
Adds macros to <arm64_user_sysreg.h> to access TPIDR_EL0, the EL0 Read/ Write Software Thread ID
libutee: arm64: add read_tpidr_el0() and write_tpidr_el0() macros
Preparing for C++ support in TAs.
Adds macros to <arm64_user_sysreg.h> to access TPIDR_EL0, the EL0 Read/ Write Software Thread ID Register.
Signed-off-by: Jerome Forissier <jerome@forissier.org> Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 9c86da3c | 24-Jul-2020 |
Ricardo Salveti <ricardo@foundries.io> |
libutee: TEE_AsymmetricSignDigest support 0 signature len
User can call TEE_AsymmetricSignDigest with a NULL signature and a valid zero signatureLen in order to discover the size of the required sig
libutee: TEE_AsymmetricSignDigest support 0 signature len
User can call TEE_AsymmetricSignDigest with a NULL signature and a valid zero signatureLen in order to discover the size of the required signature buffer (function should then return TEE_ERROR_SHORT_BUFFER and update signatureLen with the required amount).
Signed-off-by: Ricardo Salveti <ricardo@foundries.io> Reviewed-by: Jerome Forissier <jerome@forissier.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 97b8ba50 | 23-Jun-2020 |
Jerome Forissier <jerome@forissier.org> |
libutee: add leading underscore to base64 functions
Add a leading underscore to global functions: base64_dec(), base64_enc(), base64_enc_len() to avoid the risk of conflicts with user programs.
Sig
libutee: add leading underscore to base64 functions
Add a leading underscore to global functions: base64_dec(), base64_enc(), base64_enc_len() to avoid the risk of conflicts with user programs.
Signed-off-by: Jerome Forissier <jerome@forissier.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
show more ...
|
| ec930cae | 23-Jun-2020 |
Jerome Forissier <jerome@forissier.org> |
libutee: remove unnecessary parentheses
checkpatch warns about unnecessary parentheses, remove them.
Signed-off-by: Jerome Forissier <jerome@forissier.org> Acked-by: Jens Wiklander <jens.wiklander@
libutee: remove unnecessary parentheses
checkpatch warns about unnecessary parentheses, remove them.
Signed-off-by: Jerome Forissier <jerome@forissier.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
show more ...
|
| 2c028fde | 23-Jun-2020 |
Jerome Forissier <jerome@forissier.org> |
libutee, ldelf: add leading underscore to syscall wrappers
libutee defines assembler wrapper functions for each OP-TEE system call. These wrappers have a utee_ prefix. This commit adds a leading und
libutee, ldelf: add leading underscore to syscall wrappers
libutee defines assembler wrapper functions for each OP-TEE system call. These wrappers have a utee_ prefix. This commit adds a leading underscore so that the names cannot clash with user-defined symbols. Doing so is common practice for "system" libraries, as defined by the C standard in a set of requirements that can be summarized as follows (excerpt from the GNU libc documentation [1]):
[R]eserved names include all external identifiers (global functions and variables) that begin with an underscore (‘_’) and all identifiers regardless of use that begin with either two underscores or an underscore followed by a capital letter are reserved names. This is so that the library and header files can define functions, variables, and macros for internal purposes without risk of conflict with names in user programs.
The utee_*() wrappers are internal to OP-TEE and are not supposed to be called directly by TAs so this should not have any user-visible impact.
Link: [1] https://www.gnu.org/software/libc/manual/html_node/Reserved-Names.html Signed-off-by: Jerome Forissier <jerome@forissier.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
show more ...
|