| 71cbe6bd | 17-May-2021 |
Etienne Carriere <etienne.carriere@linaro.org> |
core: rpmb: remove CFG_RPMB_FS_NO_MAC
Remove CFG_RPMB_FS_NO_MAC that disabled authentication of RPMB frames read from the device. The switch was not documented never enabled in the project hence it
core: rpmb: remove CFG_RPMB_FS_NO_MAC
Remove CFG_RPMB_FS_NO_MAC that disabled authentication of RPMB frames read from the device. The switch was not documented never enabled in the project hence it simply removed.
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 3cc2413a | 11-May-2021 |
Jerome Forissier <jerome@forissier.org> |
core: allow configuration without any secure storage
Support a configuration with no secure storage (CFG_REE_FS=n and CFG_RPMB_FS=n). In such a case, user TAs will get error code TEEC_ERROR_ITEM_NOT
core: allow configuration without any secure storage
Support a configuration with no secure storage (CFG_REE_FS=n and CFG_RPMB_FS=n). In such a case, user TAs will get error code TEEC_ERROR_ITEM_NOT_FOUND when trying to access persistent objects.
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 ...
|
| c1bdf4fc | 25-Feb-2021 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: spmc: FF-A ABI updates
Updates structs and definitions to follow FF-A version 1.0.
Use the special hard coded UUID (486178e0-e7f8-11e3-bc5e-0002a5d5c51b) for the SP OP-TEE is when compiled fo
core: spmc: FF-A ABI updates
Updates structs and definitions to follow FF-A version 1.0.
Use the special hard coded UUID (486178e0-e7f8-11e3-bc5e-0002a5d5c51b) for the SP OP-TEE is when compiled for FF-A.
Updates the FF-A OP-TEE message ABI to make room for struct optee_msg_arg to be used for RPC for OPTEE_FFA_YIELDING_CALL_WITH_ARG.
struct thread_ctx::rpc_arg for the current thread will always hold a pointer to the struct optee_msg_arg to be used for RPC.
With this allocation of shared memory can be pushed up one layer and be done via the struct optee_msg_arg so the OPTEE_FFA_YIELDING_CALL_RETURN_ALLOC_*_SHM and OPTEE_FFA_YIELDING_CALL_RETURN_FREE_*_SHM can be removed making the FF-A ABI a bit less complicated.
Changes OPTEE_FFA_UNREGISTER_SHM to be a blocking call instead of a yielding call.
Removes the unused OPTEE_FFA_YIELDING_CALL_REGISTER_SHM.
Updates the return values from yielding calls to use the TEE_Result values instead of FF-A one to use the error code from the correct layer.
Defines OPTEE_MSG_FMEM_INVALID_GLOBAL_ID to 0xffffffffffffffffff which is used as an invalid global id instead of 0.
This is an ABI breakage which must be done in sync with the FF-A v4 patchset in the Linux kernel.
Acked-by: Jerome Forissier <jerome@forissier.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 2b758a1a | 21-Apr-2021 |
Jerome Forissier <jerome@forissier.org> |
core: tee_pobj_get(): detect access conflict
When tee_pobj_get() is called with TEE_POBJ_USAGE_CREATE and without TEE_DATA_FLAG_OVERWRITE, and the persistent object is found in the list of open obje
core: tee_pobj_get(): detect access conflict
When tee_pobj_get() is called with TEE_POBJ_USAGE_CREATE and without TEE_DATA_FLAG_OVERWRITE, and the persistent object is found in the list of open objects, the function should return TEE_ERROR_ACCESS_CONFLICT immediately. There is no need to call into the FS layer since we know the object exists at this point.
Fixes: https://github.com/OP-TEE/optee_os/issues/4560 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 ...
|
| 25c76675 | 29-Mar-2021 |
Marouene Boubakri <marouene.boubakri@nxp.com> |
core: tee: move entry_std.c to core/tee
entry_std.* are not architecture-specific codes, therefore move entry_std.c to core/tee and entry_std.h to core/include/tee.
Signed-off-by: Marouene Boubakri
core: tee: move entry_std.c to core/tee
entry_std.* are not architecture-specific codes, therefore move entry_std.c to core/tee and entry_std.h to core/include/tee.
Signed-off-by: Marouene Boubakri <marouene.boubakri@nxp.com> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-by: Jerome Forissier <jerome@forissier.org>
show more ...
|
| c9366c1e | 26-Mar-2021 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: fix rsa public exponent check
Fixes the check of the RSA Public Exponent in check_pub_rsa_key(). Prior to this patch was the wrong byte used to check if the bignum was odd. With this patch is
core: fix rsa public exponent check
Fixes the check of the RSA Public Exponent in check_pub_rsa_key(). Prior to this patch was the wrong byte used to check if the bignum was odd. With this patch is the correct byte selected in the big-endian bignum.
Fixes: 338b123ee66c ("core: syscall_obj_generate_key() check public rsa exponent") Reviewed-by: Jerome Forissier <jerome@forissier.org> Suggested-by: Cedric Neveux <cedric.neveux@nxp.com> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 586d5740 | 22-Mar-2021 |
Jerome Forissier <jerome@forissier.org> |
core: fs: remove unused functions from tee_fs_rpc.c
Remove unused functions from core/tee/tee_fs_rpc.c. As a result, several sub-commands of the OPTEE_RPC_CMD_FS command are now unused: OPTEE_RPC_FS
core: fs: remove unused functions from tee_fs_rpc.c
Remove unused functions from core/tee/tee_fs_rpc.c. As a result, several sub-commands of the OPTEE_RPC_CMD_FS command are now unused: OPTEE_RPC_FS_OPENDIR, OPTEE_RPC_FS_CLOSEDIR and OPTEE_RPC_FS_READDIR. These macros are kept unmodified in the header file core/include/optee_rpc_cmd.h because they are still implemented in tee-supplicant.
Signed-off-by: Jerome Forissier <jerome@forissier.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| e55ecd13 | 16-Mar-2021 |
Stefan Schmidt <snst@meek.de> |
core: use memzero_explicit() to clear sensitive data of tee object
Using preferred memzero_explicit() to clear the sensitive attribute data, which prevents the compiler from optimizing the call away
core: use memzero_explicit() to clear sensitive data of tee object
Using preferred memzero_explicit() to clear the sensitive attribute data, which prevents the compiler from optimizing the call away.
Signed-off-by: Stefan Schmidt <snst@meek.de> Reviewed-by: Jerome Forissier <jerome@forissier.org>
show more ...
|
| 785da9b0 | 03-Mar-2021 |
Marouene Boubakri <marouene.boubakri@nxp.com> |
core: tee: sub.mk: don't build tee_ta_enc_manager.c when CFG_WITH_USER_TA=n
This commit makes tee_ta_enc_manager.c source file depend on CFG_WITH_USER_TA flag. Building it when CFG_WITH_USER_TA=n le
core: tee: sub.mk: don't build tee_ta_enc_manager.c when CFG_WITH_USER_TA=n
This commit makes tee_ta_enc_manager.c source file depend on CFG_WITH_USER_TA flag. Building it when CFG_WITH_USER_TA=n leads to an inconsistency (extra unresolved symbols). Moreover it adds unused code.
Signed-off-by: Marouene Boubakri <marouene.boubakri@nxp.com> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
show more ...
|
| 913847f3 | 19-Feb-2021 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: assert result in file_num_to_str()
Adds an assert() that snprintf() succeeds in file_num_to_str().
This fixes coverity scan: CID 1501823 (#1 of 1): Unchecked return value (CHECKED_RETURN)
R
core: assert result in file_num_to_str()
Adds an assert() that snprintf() succeeds in file_num_to_str().
This fixes coverity scan: CID 1501823 (#1 of 1): Unchecked return value (CHECKED_RETURN)
Reviewed-by: Jerome Forissier <jerome@forissier.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| eee637e7 | 10-Feb-2021 |
Alexander Zakharov <uglym8@gmail.com> |
Add 3DES CMAC implementation
CMAC is a Cipher-Based MAC that improves some of the security deficiencies found in CBC-MAC. It is described in NIST SP800-38B as a mode of operation for approved symmet
Add 3DES CMAC implementation
CMAC is a Cipher-Based MAC that improves some of the security deficiencies found in CBC-MAC. It is described in NIST SP800-38B as a mode of operation for approved symmetric block chipers, namely AES and TDEA.
CMAC has similar use cases and security guarantees as HMAC, with the difference that it uses a different primitive (symmetric cipher instead of hash function). CMAC may be appropriate for information systems in which an approved block cipher is more readily available than an approved hash function.
Commonly it is used for symmetric key diversification (ASC X9 TR 31-2018), data integrity assurance (ICV).
CMAC is public domain.
OP-TEE core already supports for AES CMAC, but not TDEA CMAC. This commit adds TDEA CMAC support.
Signed-off-by: Alexander Zakharov <uglym8@gmail.com> Reviewed-by: Jerome Forissier <jerome@forissier.org> Acked-by: Etienne Carriere <etienne.carriere@linaro.org> [jf: wrap commit description at 75 characters] Signed-off-by: Jerome Forissier <jerome@forissier.org>
show more ...
|
| 7e35937a | 25-Jan-2021 |
Jerome Forissier <jerome@forissier.org> |
core: crypto: sm2: do not panic core if key allocation fails
During SM2 key derivation via syscall_cryp_derive_key(), if crypto_acipher_alloc_ecc_public_key() fails for whatever reason in get_sm2_ke
core: crypto: sm2: do not panic core if key allocation fails
During SM2 key derivation via syscall_cryp_derive_key(), if crypto_acipher_alloc_ecc_public_key() fails for whatever reason in get_sm2_kep_params(), peer_key and/or peer_eph_key are left in an invalid state and it is incorrect to call crypto_acipher_free_ecc_public_key() in this case. Doing so causes a core panic:
E/TC:? 0 assertion 'key->ops && key->ops->free' failed at core/crypto/crypto.c:702 <crypto_acipher_free_ecc_public_key> E/TC:1 0 Panic at core/kernel/assert.c:28 <_assert_break>
Fix the get_sm2_kep_params() cleanup code to avoid this situation.
Signed-off-by: Jerome Forissier <jerome@forissier.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
show more ...
|
| f97ae380 | 08-Dec-2020 |
Aleksandr Anisimov <a.anisimov@omprussia.ru> |
core: add a new RPC as an interface to tee-supplicant plugins
Any external TEE services can be designed as a tee-supplicant plugin. The plugins will be loaded by the supplicant during startup proces
core: add a new RPC as an interface to tee-supplicant plugins
Any external TEE services can be designed as a tee-supplicant plugin. The plugins will be loaded by the supplicant during startup process using libdl. It makes it easy to: - add new features in the supplicant that aren't needed in upstream, e.g. Rich OS specific services; - sync upstream version with own fork;
This patch adds a new RPC - 'OPTEE_RPC_CMD_SUPP_PLUGIN' as an unified interface between OP-TEE and any plugins. Kernel code can use it to call for execution of some command in plugins.
Every plugin has own name based on UUID. OP-TEE has access to plugins by it.
See definition of protocol for the plugin RPC command in 'core/include/optee_rpc_cmd.h' file.
Signed-off-by: Aleksandr Anisimov <a.anisimov@omprussia.ru> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| d53897cd | 14-Jan-2021 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: fix bad memset() in update_write_helper()
update_write_helper() is clearing uninitialized parts of blk_buf. There's an error in the logic calculating how much should be cleared resulting in a
core: fix bad memset() in update_write_helper()
update_write_helper() is clearing uninitialized parts of blk_buf. There's an error in the logic calculating how much should be cleared resulting in a negative size being supplied to memset(). Fix this by always clearing blk_buf before usage.
Fixes: cd799689cd3d ("core: rpmb: fix initialization of new rpmb data") Acked-by: Rouven Czerwinski <r.czerwinski@pengutronix.de> Tested-by: Jerome Forissier <jerome@forissier.org> (HiKey) Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 19cb73dd | 14-Jan-2021 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: fix file handle leakage in syscall_storage_next_enum()
Prior to this patch was syscall_storage_next_enum() opening a file handle with tee_svc_storage_read_head() but never freeing the handle.
core: fix file handle leakage in syscall_storage_next_enum()
Prior to this patch was syscall_storage_next_enum() opening a file handle with tee_svc_storage_read_head() but never freeing the handle. Fix this by closing the file handle as part of cleaning up before returning.
Fixes: 928efd065222 ("core: syscall_storage_next_enum() use live pobj") Reviewed-by: Joakim Bech <joakim.bech@linaro.org> Tested-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| cd799689 | 08-Jan-2021 |
Etienne Carriere <etienne.carriere@linaro.org> |
core: rpmb: fix initialization of new rpmb data
Add memset() calls to ensure added object is extended with byte value 0 as specified in GPD TEE specification.
Fixes: 64c6d2917d12 ("core: rpmb fs us
core: rpmb: fix initialization of new rpmb data
Add memset() calls to ensure added object is extended with byte value 0 as specified in GPD TEE specification.
Fixes: 64c6d2917d12 ("core: rpmb fs uses mempool for temporary transfer buffers") Tested-by: Jerome Forissier <jerome@forissier.org> (QEMU) Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
show more ...
|
| a1bc38c8 | 30-Nov-2020 |
Robin van der Gracht <robin@protonic.nl> |
core: tee_rpmb_fs: Return error when block decryption fails
When decrypt_block fails (although unlikely) it shouldn't be silently ignored. In such case the data in the buffer pointed to by *out is u
core: tee_rpmb_fs: Return error when block decryption fails
When decrypt_block fails (although unlikely) it shouldn't be silently ignored. In such case the data in the buffer pointed to by *out is unmodified or bogus while the return code is TEE_SUCCESS.
Signed-off-by: Robin van der Gracht <robin@protonic.nl> Reviewed-by: Jerome Forissier <jerome@forissier.org>
show more ...
|
| 64c6d291 | 13-Dec-2020 |
Etienne Carriere <etienne.carriere@linaro.org> |
core: rpmb fs uses mempool for temporary transfer buffers
RPMB FS driver may allocates a temporary buffer of size the one provided by userland caller. These may be big buffer of dozens of kbytes and
core: rpmb fs uses mempool for temporary transfer buffers
RPMB FS driver may allocates a temporary buffer of size the one provided by userland caller. These may be big buffer of dozens of kbytes and may exhaust the heap capacities. Change the implementation to use a 4kByte temporary buffer to update RPMB data instead of an allocated buffer of the object target size. RPMB FAT entry data is updated by chunks of the temporary buffer size, and RPMB FAT meta data is updated afterwards as prior this change.
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
show more ...
|
| 3c534211 | 05-Dec-2020 |
Stefan Schmidt <snst@meek.de> |
core: rpmb: return TEE_ERROR_STORAGE_NO_SPACE if no space left
So far the error TEE_ERROR_OUT_OF_MEMORY was returned if no free memory could be allocated in the RPMB to store new data. According to
core: rpmb: return TEE_ERROR_STORAGE_NO_SPACE if no space left
So far the error TEE_ERROR_OUT_OF_MEMORY was returned if no free memory could be allocated in the RPMB to store new data. According to TEE Internal Core API Specification the error TEE_ERROR_STORAGE_NO_SPACE shall be returned if insufficient space is available to create the persistent object.
Signed-off-by: Stefan Schmidt <snst@meek.de> Reviewed-by: Jerome Forissier <jerome@forissier.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
show more ...
|
| 1defc238 | 14-Dec-2020 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: copy ctx_finalize in syscall_cryp_state_copy()
Copies the ctx_finalize() when a state is copied using syscall_cryp_state_copy() in order to support proper cleanup of the state once it's remove
core: copy ctx_finalize in syscall_cryp_state_copy()
Copies the ctx_finalize() when a state is copied using syscall_cryp_state_copy() in order to support proper cleanup of the state once it's removed.
Acked-by: Jerome Forissier <jerome@forissier.org> Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Suggested-by: Tony He <tony.he@armchina.com> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 5dfe86d0 | 25-Aug-2020 |
Jorge Ramirez-Ortiz <jorge@foundries.io> |
core: svc store: delete keys from secure elements
The cryptographic API provides an interface for the creation of cryptographic keys.
These keys can be stored in secure elements and handlers to the
core: svc store: delete keys from secure elements
The cryptographic API provides an interface for the creation of cryptographic keys.
These keys can be stored in secure elements and handlers to these keys (since the keys themselves can not be read from the secure elements) given back to the caller.
When the object holding a key is being deleted, the cryptographic API must be informed in order to proceed with the deletion of the real key from the secure element.
Signed-off-by: Jorge Ramirez-Ortiz <jorge@foundries.io> Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
show more ...
|
| a8fb1651 | 13-Nov-2020 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: fix RPMB rollback vulnerability
Normal world is used to pass the RPMB request to the eMMC. If normal world saves a write request and returns an error instead it can be used at a later stage wh
core: fix RPMB rollback vulnerability
Normal world is used to pass the RPMB request to the eMMC. If normal world saves a write request and returns an error instead it can be used at a later stage where OP-TEE doesn't expect a certain block to be updated. For more details on possible attacks and mitigations see [1] and [2].
The mitigation consists of two parts, while initializing and later how each write request is handled.
While initializing the RPMB file system we don't have a spare dummy block so the alternative method of reading a block and writing it again is used instead.
For normal write request all errors after the request message has been created will be retried 10 times. If a write request fails after 10 retries RPMB is disabled entirely until next boot. An eventual requesting TA is with an unexpected error code since we can't tell if the request has been committed to storage or not.
Link: [1] https://www.westerndigital.com/support/productsecurity/wdc-20008-replay-attack-vulnerabilities-rpmb-protocol-applications Link: [2] https://documents.westerndigital.com/content/dam/doc-library/en_us/assets/public/western-digital/collateral/white-paper/white-paper-replay-protected-memory-block-protocol-vulernabilities.pdf
Acked-by: Joakim Bech <joakim.bech@linaro.org> Acked-by: Ruchika Gupta <ruchika.gupta@linaro.org> Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Jerome Forissier <jerome@forissier.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 08e47d6b | 07-Oct-2020 |
Cedric Neveux <cedric.neveux@nxp.com> |
core: crypto: unify ECC and SM2_DSA sign/verify
Remove the crypto_acipher_sm2_dsa_sign/crypto_acipher_sm2_dsa_verify functions and call the crypto_acipher_ecc_sign/crypto_acipher_ecc_verify function
core: crypto: unify ECC and SM2_DSA sign/verify
Remove the crypto_acipher_sm2_dsa_sign/crypto_acipher_sm2_dsa_verify functions and call the crypto_acipher_ecc_sign/crypto_acipher_ecc_verify functions that are calling the ecc key operations set.
Signed-off-by: Cedric Neveux <cedric.neveux@nxp.com> Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| df00cf59 | 06-Oct-2020 |
Cedric Neveux <cedric.neveux@nxp.com> |
core: crypto: add struct crypto_ecc_[public/keypair]_ops
In order to enable one ECC HW driver and one ECC SW library at build and runtime, introduces struct crypto_ecc_public_ops and struct crypto_e
core: crypto: add struct crypto_ecc_[public/keypair]_ops
In order to enable one ECC HW driver and one ECC SW library at build and runtime, introduces struct crypto_ecc_public_ops and struct crypto_ecc_keypair_ops respectively to the struct ecc_public_key and struct ecc_keypair.
At key (public/keypair) allocation, the HW driver is first called and if key type/size not supported, the SW library is then called. When key is allocated with success, the key->ops is set with the cryptographic functions pointer to call when using keys to: - Generate keypair - Sign with keypair - Shared secret with keypair - Verify with public key - Free public key
Signed-off-by: Cedric Neveux <cedric.neveux@nxp.com> Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 89c9728d | 19-Oct-2020 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: replace tee_mmu prefix with vm
Replaces the tee_mmu prefix with vm. tee_mmu.h is renamed to vm.h and core/arch/arm/mm/tee_mmu.c is moved to core/mm/vm.c. Public functions belonging to these fi
core: replace tee_mmu prefix with vm
Replaces the tee_mmu prefix with vm. tee_mmu.h is renamed to vm.h and core/arch/arm/mm/tee_mmu.c is moved to core/mm/vm.c. Public functions belonging to these files are renamed with a vm prefix.
Introduces: vm_map_param(), vm_clean_param(), vm_buf_is_inside_private(), vm_buf_intersects_private(), vm_buf_to_mboj_offs(), vm_buf_is_inside_um_private(), vm_buf_intersects_um_private(), vm_add_rwmem(), vm_rem_rwmem(), vm_va2pa(), vm_pa2va(), vm_check_access_rights(), vm_set_ctx() replacing their tee_mmu_*() counterpart.
Acked-by: Joakim Bech <joakim.bech@linaro.org> Acked-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 ...
|