| 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 ...
|
| 0949602c | 27-May-2020 |
Etienne Carriere <etienne.carriere@linaro.org> |
libutee: base64: initialize local variables
Initialize local variables where defined in base64 coding functions as per OP-TEE coding style directives.
Signed-off-by: Etienne Carriere <etienne.carri
libutee: base64: initialize local variables
Initialize local variables where defined in base64 coding functions as per OP-TEE coding style directives.
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 522a1fc3 | 25-May-2020 |
Etienne Carriere <etienne.carriere@linaro.org> |
libutee: fix base64 to support strictly well sized buffer
Before this change base64 decoding helper function base64_dec() could mandated caller to provide an output buffer that was at least 1 byte l
libutee: fix base64 to support strictly well sized buffer
Before this change base64 decoding helper function base64_dec() could mandated caller to provide an output buffer that was at least 1 byte larger than the expected size, depending on the base64 encoded data. This change fixes the issue as this is obviously not the expected behavior.
Fixes: https://github.com/OP-TEE/optee_os/issues/3876 Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Tested-by Jean-Pierre Miceli <jean-pierre.miceli@heig-vd.ch>
show more ...
|
| 614e8b8a | 26-May-2020 |
Etienne Carriere <etienne.carriere@linaro.org> |
libutee: fix size query for property as binary block
Fix TEE_GetPropertyAsBinaryBlock() to allow caller to query property size by providing a NULL output buffer reference.
Fixes: https://github.com
libutee: fix size query for property as binary block
Fix TEE_GetPropertyAsBinaryBlock() to allow caller to query property size by providing a NULL output buffer reference.
Fixes: https://github.com/OP-TEE/optee_os/issues/3876 Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| bc5921cd | 05-May-2020 |
Maxim Uvarov <maxim.uvarov@linaro.org> |
core: device pta: add flag to indicate dependency on tee-supplicant
Some TAs require tee-supplicant to be run. For example fTPM requires storage services provided by tee-supplicant. When scanning an
core: device pta: add flag to indicate dependency on tee-supplicant
Some TAs require tee-supplicant to be run. For example fTPM requires storage services provided by tee-supplicant. When scanning and probe() devices on tee bus we can initialize early drivers which do not require tee-supplicant and after mount fs and tee-supplicant run do probe() drivers witch require tee-supplicant.
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> Suggested-by: Sumit Garg <sumit.garg@linaro.org> Reviewed-by: Sumit Garg <sumit.garg@linaro.org> Reviewed-by: Jerome Forissier <jerome@forissier.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| f2674567 | 06-May-2020 |
Sumit Garg <sumit.garg@linaro.org> |
libutee: crypto: AE: Explicitly initialize buffer_offs
Explicitly initialize operation param buffer_offs in TEE_AEInit() instead of relying on TEE_AllocateOperation() as it may cause issues while us
libutee: crypto: AE: Explicitly initialize buffer_offs
Explicitly initialize operation param buffer_offs in TEE_AEInit() instead of relying on TEE_AllocateOperation() as it may cause issues while using operation handle allocated once and used in subsequent authenticated encryption operations.
It is quite similar to how TEE_CipherInit() and init_hash_operation() initializes buffer_offs.
Signed-off-by: Sumit Garg <sumit.garg@linaro.org> Reviewed-by: Jerome Forissier <jerome@forissier.org>
show more ...
|
| b213d8bd | 08-Apr-2020 |
Etienne Carriere <etienne.carriere@linaro.org> |
pta: invoke_test.pta: add test on null memref parameter
Add command PTA_INVOKE_TESTS_CMD_MEMREF_NULL to test invocation of a PTA with a memref parameter with a NULL buffer reference. The PTA should
pta: invoke_test.pta: add test on null memref parameter
Add command PTA_INVOKE_TESTS_CMD_MEMREF_NULL to test invocation of a PTA with a memref parameter with a NULL buffer reference. The PTA should successfully be invoked with a valid memref parameter yet referring to a NULL buffer pointer.
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org> Acked-by: Cedric Neveux <cedric.neveux@nxp.com>
show more ...
|