| fe8db355 | 06-Mar-2019 |
Jerome Forissier <jerome.forissier@linaro.org> |
core: ignore deprecated TA flags EXEC_DDR and USER_MODE
Commit 387b0ee39b1b ("core: deprecate TA property flags EXEC_DDR and USER_MODE") removes the requirement for user TAs to set the flags TA_FLAG
core: ignore deprecated TA flags EXEC_DDR and USER_MODE
Commit 387b0ee39b1b ("core: deprecate TA property flags EXEC_DDR and USER_MODE") removes the requirement for user TAs to set the flags TA_FLAG_EXEC_DDR (bit 0) and TA_FLAG_USER_MODE (bit 1), the rationale being that they are meaningless in the current implementation. The macros are re-defined to be zero to reflect the fact that they have no use. But, instead of ignoring the previous values, the TEE core now requires that bits 0 and 1 must *not* be set. This is a problem because it needlessly breaks backward compatibility. A TA built against OP-TEE 3.0.0 will not work with 3.1.0 or later:
E/TC:? 0 tee_ta_init_user_ta_session:1040 Invalid TA flag(s) 0x3
This commit changes the acceptable flags mask (TA_FLAGS_MASK) to include the previous EXEC_DDR and USER_MODE bits, thus restoring backward compatibility.
Fixes: 387b0ee39b1b ("core: deprecate TA property flags EXEC_DDR and USER_MODE") Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
show more ...
|
| bb80916b | 25-Feb-2019 |
Etienne Carriere <etienne.carriere@linaro.org> |
core: use PTA as acronym for pseudo TA
Make inline comments and trace messages more consistent by using PTA as acronym for pseudo TA, rather than using pTA, PTA and pta at various places.
Signed-of
core: use PTA as acronym for pseudo TA
Make inline comments and trace messages more consistent by using PTA as acronym for pseudo TA, rather than using pTA, PTA and pta at various places.
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 48e10604 | 14-Feb-2019 |
Jerome Forissier <jerome.forissier@linaro.org> |
libutils: remove buf_compare_ct()
Now that we have consttime_memcmp(), buf_compare_ct() is redundant. Every time buf_compare_ct() is used, consttime_memcmp() may be used instead.
This commit remove
libutils: remove buf_compare_ct()
Now that we have consttime_memcmp(), buf_compare_ct() is redundant. Every time buf_compare_ct() is used, consttime_memcmp() may be used instead.
This commit removes buf_compare_ct(). A compatibility wrapper is kept in <string_ext.h> to avoid knowingly breaking the build of any TA that may use it.
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 65551e69 | 06-Feb-2019 |
Jerome Forissier <jerome.forissier@linaro.org> |
libutee: TEE_MemCompare(): use constant time algorithm
TEE_MemCompare() currently calls memcmp() which returns as soon as a difference is found in the compared buffers. The fact that the comparison
libutee: TEE_MemCompare(): use constant time algorithm
TEE_MemCompare() currently calls memcmp() which returns as soon as a difference is found in the compared buffers. The fact that the comparison is not constant time for a given buffer size can reveal information on the buffer content and lead to side-channel attacks. Although the GlobalPlatform TEE Internal Core API specification says nothing about this timing aspect, it is unsafe not to propose a constant time implementation to TAs. A member of the GP specification working group confirmed in an informal discussion.
Therefore, replace memcmp() with consttime_memcmp() for constant time comparison. If a TA needs the fastest possible buffer comparison it can call the C library function memcmp() (from <string.h>), which we provide in libutils.
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reported-by: Bastien Simondi <bsimondi@netflix.com> [3.2] Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Joakim Bech <joakim.bech@linaro.org>
show more ...
|
| 69a3d6be | 18-Feb-2019 |
Daniel Glöckner <dg@emlix.com> |
libutee: fix TEE_OpenPersistentObject() error behavior
The TEE spec says about TEE_OpenPersistentObject(): "If this function fails for any reason, the value pointed to by object is set to TEE_HANDLE
libutee: fix TEE_OpenPersistentObject() error behavior
The TEE spec says about TEE_OpenPersistentObject(): "If this function fails for any reason, the value pointed to by object is set to TEE_HANDLE_NULL."
Signed-off-by: Daniel Glöckner <dg@emlix.com> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
show more ...
|
| b2dd8747 | 05-Feb-2019 |
Jens Wiklander <jens.wiklander@linaro.org> |
Fix alignment of data for mempool_alloc_pool()
Prior to this patch was _TEE_MathAPI_Init() in lib/libutee/tee_api_arith_mpi.c supplying a data buffer which was only 4 byte aligned while mempool_allo
Fix alignment of data for mempool_alloc_pool()
Prior to this patch was _TEE_MathAPI_Init() in lib/libutee/tee_api_arith_mpi.c supplying a data buffer which was only 4 byte aligned while mempool_alloc_pool() requires the alignment of long. This will work in 32-bit mode, but could lead to alignment problem in 64-bit mode. The same problem can happen with lib/libutee/tee_api_arith_mpa.c, but so far it has remained hidden.
Incorrect alignment can result in errors like: E/TA: assertion '!((vaddr_t)data & (POOL_ALIGN - 1))' failed at lib/libutils/ext/mempool.c:134 in mempool_alloc_pool()
This fix introduces MEMPOOL_ALIGN which specifies required alignment of data supplied to mempool_alloc_pool().
Fixes: 062e3d01c039 ("ta: switch to to mbedtls for bignum") Reviewed-by: Joakim Bech <joakim.bech@linaro.org> Tested-by: Joakim Bech <joakim.bech@linaro.org> (QEMU v8) Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 98efc118 | 17-Jan-2019 |
Jerome Forissier <jerome.forissier@linaro.org> |
mbedtls: TEE_BigIntMul(): use temporary
mbedtls_mpi_mul_mpi() checks the allocated size of the output number before starting to multiply the numbers. It makes a conservative guess by requiring the r
mbedtls: TEE_BigIntMul(): use temporary
mbedtls_mpi_mul_mpi() checks the allocated size of the output number before starting to multiply the numbers. It makes a conservative guess by requiring the result to be at least as large as the sum of the sizes of the input numbers. For instance, if A fits in one "limb" and B fits in two, then the result is expected to have nblimbs = 3 at least. This is sometimes too restrictive. Consider A = 1 (can be represented with nblimbs == 1 32-bit words) and B = 0x0FFFFFFFFFFFFFFF (fits in a bignum with nblimbs == 2 32-bit words). A * B is equal to B and fits in 2 limbs, but the current code requires 3. This patch fixes the problem by allocating a big enough temporary result.
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 0b611081 | 07-Jan-2019 |
Sumit Garg <sumit.garg@linaro.org> |
core: pta: Add device pseudo TA
This pseudo TA enumerates OP-TEE pseudo TAs which can act as devices/ services for Linux TEE bus driver. For differentiation of such devices, added TA_FLAG_DEVICE_ENU
core: pta: Add device pseudo TA
This pseudo TA enumerates OP-TEE pseudo TAs which can act as devices/ services for Linux TEE bus driver. For differentiation of such devices, added TA_FLAG_DEVICE_ENUM optional flag in pseudo TA header.
Signed-off-by: Sumit Garg <sumit.garg@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 062e3d01 | 13-Nov-2018 |
Jens Wiklander <jens.wiklander@linaro.org> |
ta: switch to to mbedtls for bignum
Adds tee_api_arith_mpi.c wrapper providing the TEE Arithmetical API around the big (mpi) routines from mbedtls.
CFG_TA_MBEDTLS_MPI=y (default y) enables the usag
ta: switch to to mbedtls for bignum
Adds tee_api_arith_mpi.c wrapper providing the TEE Arithmetical API around the big (mpi) routines from mbedtls.
CFG_TA_MBEDTLS_MPI=y (default y) enables the usage of the bignum routines in libutee.
Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| ec812024 | 12-Nov-2018 |
Jens Wiklander <jens.wiklander@linaro.org> |
libutee: rename to tee_api_arith_mpa.c
Renames tee_api_arith.c to tee_api_arith_mpa.c to make room for using other bignum implementations.
Acked-by: Etienne Carriere <etienne.carriere@linaro.org> S
libutee: rename to tee_api_arith_mpa.c
Renames tee_api_arith.c to tee_api_arith_mpa.c to make room for using other bignum implementations.
Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| e147a447 | 05-Dec-2018 |
Jerome Forissier <jerome.forissier@linaro.org> |
Remove Secure Element API support
There is probably no-one using the Secure Element API. We have never heard anyone asking questions about it, have no way to test it and we believe it is not even wo
Remove Secure Element API support
There is probably no-one using the Secure Element API. We have never heard anyone asking questions about it, have no way to test it and we believe it is not even working right now. Therefore, remove it.
- The reserved syscalls are still present, but return TEE_ERROR_NOT_SUPPORTED - The TEE_SE* functions (GlobalPlatform TEE Secure Element API, GPD_SPE_024) are removed from libutee.a and the header file tee_internal_se_api.h is removed as well
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Joakim Bech <joakim.bech@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
show more ...
|
| b31756b3 | 15-Nov-2018 |
Jerome Forissier <jerome.forissier@linaro.org> |
lib.mk: centralize profiling flag (-pg)
Code cleanup, no functional change. This commit avoids the duplication of the -pg flag in the library makefiles.
Signed-off-by: Jerome Forissier <jerome.fori
lib.mk: centralize profiling flag (-pg)
Code cleanup, no functional change. This commit avoids the duplication of the -pg flag in the library makefiles.
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 6a2e0a9f | 14-Sep-2018 |
Gabor Szekely <szvgabor@gmail.com> |
utee: support prehashed RSA sign/ver without ASN.1
Add TEE Core Internal API extension TEE_ALG_RSASSA_PKCS1_V1_5 to sign/verify pre-hashed PKCS#1 v1.5 EMSA without ASN.1 around the hash. This relies
utee: support prehashed RSA sign/ver without ASN.1
Add TEE Core Internal API extension TEE_ALG_RSASSA_PKCS1_V1_5 to sign/verify pre-hashed PKCS#1 v1.5 EMSA without ASN.1 around the hash. This relies on libtomcrypt LTC_PKCS_1_V1_5_NA1. The extension can be turned on with CFG_CRYPTO_RSASSA_NA1.
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Signed-off-by: Gabor Szekely <szvgabor@gmail.com>
show more ...
|
| b3fd78c4 | 14-Sep-2018 |
Jerome Forissier <jerome.forissier@linaro.org> |
core: introduce lockdep algorithm
This commit introduces an algorithm that may be used to detect improper usage of locks at runtime. It can detect two kinds errors:
1. A thread tries to release a
core: introduce lockdep algorithm
This commit introduces an algorithm that may be used to detect improper usage of locks at runtime. It can detect two kinds errors:
1. A thread tries to release a lock it does not own, 2. A thread tries to aquire a lock and the operation could *potentially* result in a deadlock.
The potential deadlock detection assumes that the code adheres to a strict locking hierarchy, in other word, that there is a partial ordering on the locks so that there can be no situation where circular waits can occur. To put things simply, any two locks should be acquired in the same order in the same thread. This addresses the following case:
[Thread #1] [Thread #2]
lock(A) lock(B) lock(B) lock(A) <-- deadlock! ...
The algorithm builds the lock hierarchy dynamically and reports as soon as a violation is detected.
The interface is made of two functions: lockdep_lock_acquire() and lockdep_lock_release(), which are meant to be introduced in the implementation of the actual lock objects. The "acquire" hook tells the algorithm that a particular lock is about to be requested by a particular thread, while the "release" hook is meant to be called before the lock is actually released. If an error is detected, debugging information is sent to the console, and panic() is called. The debugging information includes the lock cycle that was detected (in the above example, {A, B}), as well as the call stacks at the points where the locks were acquired.
The good thing with such an instrumentation of the locking code is that there is no need to wait for an actual deadlock to occur in order to detect potential problems. For instance, the timing of execution in the above example could be different but the problem would still be detected:
[Thread #1] [Thread #2]
lock(A) lock(B) unlock(B) unlock(A) lock(B) lock(A) <-- error!
A pseudo-TA is added for testing (pta/core_lockdep_tests.c).
This code is based on two sources: - A presentation called "Dl-Check: dynamic potential deadlock detection tool for Java programs" [1], although the somewhat complex MNR algorithm for topological ordering of a DAG was not used; - A depth-first search algorithm [2] was used instead.
Link: [1] https://www.slideshare.net/IosifItkin/tmpa2017-dlcheck-dynamic-potential-deadlock-detection-tool-for-java-programs Link: [2] https://en.wikipedia.org/wiki/Topological_sorting#Depth-first_search Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Joakim Bech <joakim.bech@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 70df09b8 | 08-Oct-2018 |
Krzysztof Jackiewicz <k.jackiewicz@samsung.com> |
libutee: Fix base64 encoding function
Bitwise OR of unsigned int and a signed char is machine dependent and could lead to invalid base64 encoding.
This commit makes it use unsigned char instead.
S
libutee: Fix base64 encoding function
Bitwise OR of unsigned int and a signed char is machine dependent and could lead to invalid base64 encoding.
This commit makes it use unsigned char instead.
Signed-off-by: Krzysztof Jackiewicz <k.jackiewicz@samsung.com> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 8a076f79 | 20-Jun-2018 |
Jens Wiklander <jens.wiklander@linaro.org> |
Use inttypes.h over stdint.h on some .h files
Uses inttypes.h over stdint.h on some .h files to be nice to U-boot.
Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Jens Wikla
Use inttypes.h over stdint.h on some .h files
Uses inttypes.h over stdint.h on some .h files to be nice to U-boot.
Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 2d8739bd | 03-Jan-2018 |
Igor Opaniuk <igor.opaniuk@linaro.org> |
benchmark: change the way of timestamp buffer allocation.
In case if timestamp buffer is allocated in userspace and new register user memory API is used for its registering in OP-TEE (introduced in
benchmark: change the way of timestamp buffer allocation.
In case if timestamp buffer is allocated in userspace and new register user memory API is used for its registering in OP-TEE (introduced in optee_client commit 27888d73d156 ("tee_client_api: register user memory")), there is no possibility to keep this mapping permanent among different TEEC_InvokeCommand invocations, as all SHM are automatically unmapped from OP-TEE VA space after TEEC_InvokeCommand is handled by OP-TEE.
Timestamp buffer is now allocated with thread_rpc_alloc_global_payload().
Fixes: https://github.com/OP-TEE/optee_os/issues/1979 Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Joakim Bech <joakim.bech@linaro.org> Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>
show more ...
|
| 249c24a3 | 14-Jun-2018 |
Jens Wiklander <jens.wiklander@linaro.org> |
libmpa: remove mpa_set_random_generator()
MPA is used in two configurations, either in kernel mode or in user mode.
In kernel mode random is always drawn with crypto_rng_read() and in user mode ute
libmpa: remove mpa_set_random_generator()
MPA is used in two configurations, either in kernel mode or in user mode.
In kernel mode random is always drawn with crypto_rng_read() and in user mode utee_cryp_random_number_generate() is used instead.
This patch makes the code easier to follow by replacing the call via a function pointer to a normal function call instead.
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 746dcfb5 | 05-Jun-2018 |
Andrew Gabbasov <andrew_gabbasov@mentor.com> |
libutee: Fix the keepalive condition on last session close
Keepalive condition check should involve single instance flag too, since the keepalive flag is meaningless if the TA is not single instance
libutee: Fix the keepalive condition on last session close
Keepalive condition check should involve single instance flag too, since the keepalive flag is meaningless if the TA is not single instance. The same fix was done earlier in the core by commit f9a64f12b542 ("core: fix the keepalive condition in close session").
Fixes: b7ea03ff2963 ("libutee: fix TA_CreateEntryPoint() and TA_DestroyEntryPoint()") Signed-off-by: Andrew Gabbasov <andrew_gabbasov@mentor.com> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 4bca302a | 22-May-2018 |
Igor Opaniuk <igor.opaniuk@linaro.org> |
pta: add system pTA
Add system pTA, which provides misc. auxiliary services, extending existing GlobalPlatform Core API. Add a call for seeding entropy to the default RNG pool.
Reviewed-by: Jens Wi
pta: add system pTA
Add system pTA, which provides misc. auxiliary services, extending existing GlobalPlatform Core API. Add a call for seeding entropy to the default RNG pool.
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>
show more ...
|
| 433c4257 | 07-May-2018 |
Jens Wiklander <jens.wiklander@linaro.org> |
Add rand() for TA usage
Adds rand() by declaring it in stdlib.h where it's expected to be found. Implementation is provided in libutee since it depends on TEE_GenerateRandom().
Reviewed-by: Joakim
Add rand() for TA usage
Adds rand() by declaring it in stdlib.h where it's expected to be found. Implementation is provided in libutee since it depends on TEE_GenerateRandom().
Reviewed-by: Joakim Bech <joakim.bech@linaro.org> Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| dc0f4ec2 | 16-May-2018 |
Etienne Carriere <etienne.carriere@st.com> |
Remove license notice from STMicroelectronics files
Since a while the source files license info are defined by SPDX identifiers. We can safely remove the verbose license text from the files that are
Remove license notice from STMicroelectronics files
Since a while the source files license info are defined by SPDX identifiers. We can safely remove the verbose license text from the files that are owned by either only STMicroelectronics or only both Linaro and STMicroelectronics.
Signed-off-by: Etienne Carriere <etienne.carriere@st.com> Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| f6eaffba | 24-Apr-2018 |
Jens Wiklander <jens.wiklander@linaro.org> |
libutee: remove redundant malloc() layers
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Jens Wiklander <jens.
libutee: remove redundant malloc() layers
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 96c1d8c5 | 24-Apr-2018 |
Jens Wiklander <jens.wiklander@linaro.org> |
ta: TEE_Malloc() and friend: skips layers
Prior to this patch TEE_Malloc(), TEE_Realloc() and TEE_Free() were using two extra layers implemented on top of the well known malloc(), realloc(), calloc(
ta: TEE_Malloc() and friend: skips layers
Prior to this patch TEE_Malloc(), TEE_Realloc() and TEE_Free() were using two extra layers implemented on top of the well known malloc(), realloc(), calloc() and free() functions. With this patch the extra layers are skipped.
When compiled for user TAs realloc() clears all memory that otherwise would be uninitialized memory since it's required by the spec [1] if TEE_Malloc() is called with the hint TEE_MALLOC_FILL_ZERO. Since that's the only recognized hint in the spec realloc() assumes that it's always needed.
[1] GP TEE Internal Core API Specification v1.1
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| c0ce02ed | 24-Apr-2018 |
Jens Wiklander <jens.wiklander@linaro.org> |
TEE_Realloc(): fix invalid declaration
Prior to this was TEE_Realloc() declared as:
void *TEE_Realloc(const void *buffer, uint32_t newSize);
This does not make sense as the argument buffer can and
TEE_Realloc(): fix invalid declaration
Prior to this was TEE_Realloc() declared as:
void *TEE_Realloc(const void *buffer, uint32_t newSize);
This does not make sense as the argument buffer can and will be changed as a result of calling this function. Instead fix the declaration to be:
void *TEE_Realloc(void *buffer, uint32_t newSize);
This is also more in line with realloc().
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|