| 47645577 | 13-Dec-2019 |
Jerome Forissier <jerome@forissier.org> |
core: crypto: add support for SM3
Adds support for the SM3 cryptographic hash function [1] using the API defined in the GlobalPlatform TEE Internal Core API v1.2, as well as the HMAC based on this h
core: crypto: add support for SM3
Adds support for the SM3 cryptographic hash function [1] using the API defined in the GlobalPlatform TEE Internal Core API v1.2, as well as the HMAC based on this hash.
This implementation is based on code published on Gitlab [2]. See commit ade6f848e084 ("core: crypto: add support for SM4") for details.
[1] https://tools.ietf.org/html/draft-sca-cfrg-sm3-02 [2] https://gitlab.com/otpfree/sm234
Signed-off-by: Jerome Forissier <jerome@forissier.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
show more ...
|
| ade6f848 | 12-Dec-2019 |
Jerome Forissier <jerome@forissier.org> |
core: crypto: add support for SM4
Adds support for the SM4 cipher [1] using the API defined in the GlobalPlatform TEE Internal Core API v1.2.
ECB, CBC and CTR modes are implemented. Other modes are
core: crypto: add support for SM4
Adds support for the SM4 cipher [1] using the API defined in the GlobalPlatform TEE Internal Core API v1.2.
ECB, CBC and CTR modes are implemented. Other modes are valid but are not included in the GP specification, so they are not considered here.
This implementation is based on code published on Gitlab [2]. The project contains no licensing terms, so I contacted the author (goldboar@163.com), asking for permission to re-use the code in OP-TEE under a BSD-2-Clause license. I received the following reply:
"[...] If you like you can use it [...]"
I have reworked the source to better fit the OP-TEE coding style. I have also added the CTR mode of operation.
I do not think we will need to merge any change from upstream in the future.
[1] https://tools.ietf.org/html/draft-ribose-cfrg-sm4-10 [2] https://gitlab.com/otpfree/sm234
Signed-off-by: Jerome Forissier <jerome@forissier.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
show more ...
|
| 1936dfc7 | 07-Oct-2019 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: add struct user_mode_ctx
Adds struct user_mode_ctx which replaces user mode specific fields used for memory mapping.
Acked-by: Pipat Methavanitpong <pipat.methavanitpong@linaro.org> Acked-by:
core: add struct user_mode_ctx
Adds struct user_mode_ctx which replaces user mode specific fields used for memory mapping.
Acked-by: Pipat Methavanitpong <pipat.methavanitpong@linaro.org> Acked-by: Jerome Forissier <jerome@forissier.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| bc6f3bf2 | 20-Nov-2019 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: remove unreachable code from tee_tadb_ta_open()
Prior to this patch tee_tadb_ta_open() had some unreachable code. With this patch remove that code, but retain the behaviour of tee_tadb_ta_open
core: remove unreachable code from tee_tadb_ta_open()
Prior to this patch tee_tadb_ta_open() had some unreachable code. With this patch remove that code, but retain the behaviour of tee_tadb_ta_open().
Reviewed-by: Jerome Forissier <jerome@forissier.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 2e42d8e7 | 19-Nov-2019 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: add description of struct tadb_entry
Adds description of the fields in struct tadb_entry.
Reviewed-by: Jerome Forissier <jerome@forissier.org> Signed-off-by: Jens Wiklander <jens.wiklander@li
core: add description of struct tadb_entry
Adds description of the fields in struct tadb_entry.
Reviewed-by: Jerome Forissier <jerome@forissier.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| e1afc439 | 18-Nov-2019 |
Sumit Garg <sumit.garg@linaro.org> |
core: add framework to load REE-FS encrypted TAs
Add framework to support loading of encrypted TAs from REE-FS using symmetric authenticated encryption scheme supported by OP-TEE.
The default encry
core: add framework to load REE-FS encrypted TAs
Add framework to support loading of encrypted TAs from REE-FS using symmetric authenticated encryption scheme supported by OP-TEE.
The default encryption key is derived from hardware unique key which can be overridden via platform specific encryption key.
Signed-off-by: Sumit Garg <sumit.garg@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| b9651492 | 11-Nov-2019 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: reference count struct mobj
The mobj interface is changed to use reference counting of mobjs, the direct mobj_free() call is replaced by mobj_put(). As expected a mobj_get() is also added to h
core: reference count struct mobj
The mobj interface is changed to use reference counting of mobjs, the direct mobj_free() call is replaced by mobj_put(). As expected a mobj_get() is also added to handle multiple references to the same mobj.
This also changes already present reference counting in struct mobj_reg_shm to use the reference counting mechanism now available in struct mobj.
The VM_FLAG_EXCLUSIVE_MOBJ flag is removed since the referenced mobj is put instead when a struct vm_region is removed.
Tested-by: Jerome Forissier <jerome@forissier.org> (HiKey960) Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 52ee414b | 04-Mar-2019 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: remove algo from crypto_authenc_*()
Removes the algo parameters from all crypto_authenc_*() functions except crypto_authenc_alloc_ctx().
Reviewed-by: Etienne Carriere <etienne.carriere@linaro
core: remove algo from crypto_authenc_*()
Removes the algo parameters from all crypto_authenc_*() functions except crypto_authenc_alloc_ctx().
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Acked-by: Jerome Forissier <jerome@forissier.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| c69bc615 | 02-Mar-2019 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: remove algo from crypto_mac_*()
Removes the algo parameters from all crypto_mac_*() functions except crypto_mac_alloc_ctx().
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Acked-
core: remove algo from crypto_mac_*()
Removes the algo parameters from all crypto_mac_*() functions except crypto_mac_alloc_ctx().
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Acked-by: Jerome Forissier <jerome@forissier.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| cbda7091 | 02-Mar-2019 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: remove algo from crypto_cipher_*()
Removes the algo parameters from all crypto_cipher_*() functions except crypto_cipher_alloc_ctx().
tee_aes_cbc_cts_update() is moved into aes-cts.c and rena
core: remove algo from crypto_cipher_*()
Removes the algo parameters from all crypto_cipher_*() functions except crypto_cipher_alloc_ctx().
tee_aes_cbc_cts_update() is moved into aes-cts.c and renamed to cbc_cts_update().
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Acked-by: Jerome Forissier <jerome@forissier.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 6b3a371c | 01-Mar-2019 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: remove algo from crypto_hash_*()
Removes the algo parameters from all crypto_hash_*() functions except crypto_hash_alloc_ctx().
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Ack
core: remove algo from crypto_hash_*()
Removes the algo parameters from all crypto_hash_*() functions except crypto_hash_alloc_ctx().
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 34a08bec | 25-Jun-2019 |
Joakim Bech <joakim.bech@linaro.org> |
cryp: prevent direct calls to update and final functions
With inconsistent or malformed data it has been possible to call "update" and "final" crypto functions directly. Using a fuzzer tool [1] we h
cryp: prevent direct calls to update and final functions
With inconsistent or malformed data it has been possible to call "update" and "final" crypto functions directly. Using a fuzzer tool [1] we have seen that this results in asserts, i.e., a crash that potentially could leak sensitive information.
By setting the state (initialized) in the crypto context (i.e., the tee_cryp_state) at the end of all syscall_*_init functions and then add a check of the state at the beginning of all update and final functions, we prevent direct entrance to the "update" and "final" functions.
[1] https://github.com/MartijnB/optee_fuzzer
Fixes: OP-TEE-2019-0021
Signed-off-by: Joakim Bech <joakim.bech@linaro.org> Reported-by: Martijn Bogaard <bogaard@riscure.com> Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 28aa35f5 | 24-Jun-2019 |
Joakim Bech <joakim.bech@linaro.org> |
cryp: ensure that mode is cipher in syscall_cipher_init
When calling syscall_cipher_init there is no check being done that the state coming from the TA has been initialized to a valid cipher state.
cryp: ensure that mode is cipher in syscall_cipher_init
When calling syscall_cipher_init there is no check being done that the state coming from the TA has been initialized to a valid cipher state. By checking the class we prevent an assert in cipher_ops.
Fixes: OP-TEE-2019-0020
Signed-off-by: Joakim Bech <joakim.bech@linaro.org> Reported-by: Martijn Bogaard <bogaard@riscure.com> Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 45a367d8 | 20-Jun-2019 |
Joakim Bech <joakim.bech@linaro.org> |
cryp: ensure that mode is AE in syscall_authenc_ functions
When doing calls to syscall_authenc_xyz functions (all of them except syscall_authenc_init) there is no check being done that the state com
cryp: ensure that mode is AE in syscall_authenc_ functions
When doing calls to syscall_authenc_xyz functions (all of them except syscall_authenc_init) there is no check being done that the state coming from the TA has been initialized to a valid authenticated encryption state. As a consequence of that it's possible to redirect execution to other functions. Doing like that will make TEE core end up with a data abort.
Fixes: OP-TEE-2019-0019
Signed-off-by: Joakim Bech <joakim.bech@linaro.org> Reported-by: Martijn Bogaard <bogaard@riscure.com> Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 78155888 | 27-Sep-2019 |
Jerome Forissier <jerome@forissier.org> |
core: tadb.c: get rid of atomic reference counting
This commit changes the way the tadb_db global variable is protected against concurrent access on creation and deletion. Instead of using an atomic
core: tadb.c: get rid of atomic reference counting
This commit changes the way the tadb_db global variable is protected against concurrent access on creation and deletion. Instead of using an atomic reference counter (struct refcount) and a mutex, only the mutex is used and taken unconditionally. The reference count becomes a global integer protected by the same mutex.
Using a struct refcount was apparently an optimization to avoid taking the lock unless actual creation or deletion of the tadb_db was needed. Unfortunately this implementation was causing occasional crashes of the TEE core (easily reproducible on HiKey running 'xtest 1013' in a loop). The new implementation is simpler and appears to be rock solid with no measurable difference in performance.
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 ...
|
| 6e9e277f | 13-Sep-2019 |
Jerome Forissier <jerome@forissier.org> |
core: move sockets PTA to core/tee
The sockets pseudo-TA is architecture-independent. Move it to core/tee and drop the pta_ prefix which is not really useful.
Signed-off-by: Jerome Forissier <jerom
core: move sockets PTA to core/tee
The sockets pseudo-TA is architecture-independent. Move it to core/tee and drop the pta_ prefix which is not really useful.
Signed-off-by: Jerome Forissier <jerome@forissier.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| fcd00cea | 24-Jun-2019 |
Victor Chong <victor.chong@linaro.org> |
rpmb: fix parsing of op_result
From the eMMC spec, the "Operation result" (Table 19) -- 7 bit quantity -- is the LSB of "Operation Results data structure" -- 16-bit quantity -- minus the high order
rpmb: fix parsing of op_result
From the eMMC spec, the "Operation result" (Table 19) -- 7 bit quantity -- is the LSB of "Operation Results data structure" -- 16-bit quantity -- minus the high order bit. In other words it is 'rpmb_data_frame::op_result[1] & 0x7F' which is probably what we should be doing here instead of bytes_to_u16().
Signed-off-by: Victor Chong <victor.chong@linaro.org> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
show more ...
|
| c3d1e005 | 24-Jun-2019 |
Victor Chong <victor.chong@linaro.org> |
rpmb: Convert comment about error into EMSG
This will give users more details without having to sift through the code.
Signed-off-by: Victor Chong <victor.chong@linaro.org> Reviewed-by: Jerome Fori
rpmb: Convert comment about error into EMSG
This will give users more details without having to sift through the code.
Signed-off-by: Victor Chong <victor.chong@linaro.org> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
show more ...
|
| c192a4a1 | 21-Jun-2019 |
Victor Chong <victor.chong@linaro.org> |
rpmb: verify key: change DMSG to EMSG
Rather than printing all results with DMSG, it's more suitable to print only errors with EMSG.
Signed-off-by: Victor Chong <victor.chong@linaro.org> Reviewed-b
rpmb: verify key: change DMSG to EMSG
Rather than printing all results with DMSG, it's more suitable to print only errors with EMSG.
Signed-off-by: Victor Chong <victor.chong@linaro.org> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
show more ...
|
| ce925809 | 21-Jun-2019 |
Victor Chong <victor.chong@linaro.org> |
rpmb: print error if derive key fails
Let users know if an RPMB key fails to be generated during RPMB initializations instead of just exiting the function quietly.
Signed-off-by: Victor Chong <vict
rpmb: print error if derive key fails
Let users know if an RPMB key fails to be generated during RPMB initializations instead of just exiting the function quietly.
Signed-off-by: Victor Chong <victor.chong@linaro.org> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
show more ...
|
| e9ae33c4 | 21-Jun-2019 |
Victor Chong <victor.chong@linaro.org> |
rpmb: dump key if CFG_RPMB_WRITE_KEY=y
If we want to write key, then we'd want to write it down as well, so print it for records.
Note that the key is printed with severity TRACE_DEBUG hence a rele
rpmb: dump key if CFG_RPMB_WRITE_KEY=y
If we want to write key, then we'd want to write it down as well, so print it for records.
Note that the key is printed with severity TRACE_DEBUG hence a release build will not leak it.
Signed-off-by: Victor Chong <victor.chong@linaro.org> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
show more ...
|
| c340ba4b | 14-Jun-2019 |
Victor Chong <victor.chong@linaro.org> |
rpmb: write key only if not yet programmed
An RPMB key should only be written if the device returns RPMB_RESULT_AUTH_KEY_NOT_PROGRAMMED, not on any RPMB_RESULT* that is not RPMB_RESULT_OK.
Signed-o
rpmb: write key only if not yet programmed
An RPMB key should only be written if the device returns RPMB_RESULT_AUTH_KEY_NOT_PROGRAMMED, not on any RPMB_RESULT* that is not RPMB_RESULT_OK.
Signed-off-by: Victor Chong <victor.chong@linaro.org> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
show more ...
|
| 667b10f6 | 24-Jul-2019 |
Fangsuo Wu <fangsuowu@asrmicro.com> |
tee_ree_fs: create dirfile only when it's not found
Currently there's no check of return value of tee_fs_dirfile_open, it's reasonable to do this when dir file truely doesn't exist. However, if tee_
tee_ree_fs: create dirfile only when it's not found
Currently there's no check of return value of tee_fs_dirfile_open, it's reasonable to do this when dir file truely doesn't exist. However, if tee_fs_dirfile_open fails with other reason, calling tee_fs_dirfile_open(true..) will overlap the old dir file, thus file access in the future will fail.
Signed-off-by: Fangsuo Wu <fangsuowu@asrmicro.com> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| be847add | 19-Jun-2019 |
Joakim Bech <joakim.bech@linaro.org> |
core: fix enum restart with syscall_storage_start_enum()
According to the GlobalPlatform specification it should be possible to call TEE_StartPersistentObjectEnumerator(..) on an enumerator that alr
core: fix enum restart with syscall_storage_start_enum()
According to the GlobalPlatform specification it should be possible to call TEE_StartPersistentObjectEnumerator(..) on an enumerator that already has been started. When doing that we trigged an assert and ended up with a panic. This patch fixes that issue by ensuring that we are closing the currently open directory before re-opening or opening another directory in those cases where TEE_StartPersistentObjectEnumerator(..) are called again and again with no reset done in-between.
Fixes: https://github.com/OP-TEE/optee_os/issues/3093
Signed-off-by: Joakim Bech <joakim.bech@linaro.org> Reported-by: Daniel McIlvaney <damcilva@microsoft.com> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Tested-by: Jerome Forissier <jerome.forissier@linaro.org> (QEMU, GP)
show more ...
|
| 02d869c9 | 15-May-2019 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: REE FS: use mempool_default for temp alloc
Uses mempool_default for temporary block allocation.
This fixes one out of memory error when loading multiple TAs in parallel.
Acked-by: Jerome For
core: REE FS: use mempool_default for temp alloc
Uses mempool_default for temporary block allocation.
This fixes one out of memory error when loading multiple TAs in parallel.
Acked-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 ...
|