| 6885abf2 | 18-Aug-2020 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: tee_pobj_get() takes an enum tee_pobj_usage
Changes tee_pobj_get() to take an enum tee_pobj_usage usage instead of a bool temporary.
Reviewed-by: Jerome Forissier <jerome@forissier.org> Signe
core: tee_pobj_get() takes an enum tee_pobj_usage
Changes tee_pobj_get() to take an enum tee_pobj_usage usage instead of a bool temporary.
Reviewed-by: Jerome Forissier <jerome@forissier.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 06b0fe08 | 14-Aug-2020 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: remove struct tee_obj::flags
struct tee_obj keeps a TEE_ObjectInfo which has a flags field with the same meaning as the flags field in struct tee_obj. To avoid the two fields getting out of sy
core: remove struct tee_obj::flags
struct tee_obj keeps a TEE_ObjectInfo which has a flags field with the same meaning as the flags field in struct tee_obj. To avoid the two fields getting out of sync remove struct tee_obj::flags and only use TEE_ObjectInfo::handleFlags.
Additional checks are added in syscall_storage_obj_open() and syscall_storage_obj_create() to make sure that no undefined flags are added to TEE_ObjectInfo::handleFlags.
Reviewed-by: Jerome Forissier <jerome@forissier.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 5e817523 | 13-Aug-2020 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: syscall_storage_obj_create(): check that the attributes object is initialized
Adds a check in syscall_storage_obj_create() to see that the attributes object is initialized.
Reviewed-by: Jerom
core: syscall_storage_obj_create(): check that the attributes object is initialized
Adds a check in syscall_storage_obj_create() to see that the attributes object is initialized.
Reviewed-by: Jerome Forissier <jerome@forissier.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 1a7d8eae | 17-Aug-2020 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: add user parameter thread_rpc_shm_cache_alloc()
Adds a user parameter to thread_rpc_shm_cache_alloc() to make sure that different callers of thread_rpc_shm_cache_alloc() doesn't interfere with
core: add user parameter thread_rpc_shm_cache_alloc()
Adds a user parameter to thread_rpc_shm_cache_alloc() to make sure that different callers of thread_rpc_shm_cache_alloc() doesn't interfere with each other. The FS allocation could perhaps be intertwined with I2C allocations if crypto operations are done over I2C.
Fixes: 9bee8f2a5af7 ("core: add generic rpc shared memory buffer caching") Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| ce9a20c1 | 30-Jul-2020 |
Jerome Forissier <jerome@forissier.org> |
rmpb: fix infinite recursion in dump_fat() when CFG_TEE_CORE_LOG_LEVEL=4
When CFG_TEE_CORE_LOG_LEVEL=4 and CFG_RPMB_FS=y, the TEE core crashes with a dead stack canary message:
E/TC:0 0 Dead canar
rmpb: fix infinite recursion in dump_fat() when CFG_TEE_CORE_LOG_LEVEL=4
When CFG_TEE_CORE_LOG_LEVEL=4 and CFG_RPMB_FS=y, the TEE core crashes with a dead stack canary message:
E/TC:0 0 Dead canary at end of 'stack_abt[3]' E/TC:0 0 Panic at core/arch/arm/kernel/thread.c:192 <thread_check_canaries> E/TC:0 0 TEE load address @ 0x1bd0f000 E/TC:0 0 Call stack: E/TC:0 0 0x1bd17b3d print_kernel_stack at optee_os/core/arch/arm/kernel/unwind_arm32.c:452 E/TC:0 0 0x1bd23a07 __do_panic at optee_os/core/kernel/panic.c:32 (discriminator 1) E/TC:0 0 0x1bd120cb thread_check_canaries at optee_os/core/arch/arm/kernel/thread.c:188 (discriminator 2) E/TC:0 0 0x1bd12c1f thread_state_suspend at optee_os/core/arch/arm/kernel/thread.c:754 E/TC:0 0 0x1bd14610 thread_rpc at optee_os/core/arch/arm/kernel/thread_optee_smc_a32.S:227
The issue happens to be with the debug function dump_fat() which causes infinite recursion. Fix it by doing nothing until after RPMB initialization has completed.
Fixes: 5f68d7848fe8 ("core: RPMB FS: Caching for FAT FS entries") Signed-off-by: Jerome Forissier <jerome@forissier.org> Reviewed-by: Joakim Bech <joakim.bech@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 7446af61 | 21-Jul-2020 |
Jerome Forissier <jerome@forissier.org> |
core: log message when secure storage corruption is detected
When CFG_REE_FS and CFG_RPMB_FS are both 'y', the data stored by OP-TEE in the REE filesystem (typically, under /data/tee) are protected
core: log message when secure storage corruption is detected
When CFG_REE_FS and CFG_RPMB_FS are both 'y', the data stored by OP-TEE in the REE filesystem (typically, under /data/tee) are protected by hashes stored in the RPMB. Any modifications to the REE files via external means are therefore detected and TEE_ERROR_SECURITY is returned. However, no error or debug message is printed to the secure console which makes troubleshooting more difficult than needed. This commit adds a debug message.
Signed-off-by: Jerome Forissier <jerome@forissier.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 9bee8f2a | 21-Jul-2020 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: add generic rpc shared memory buffer caching
Replaces tee_fs_rpc_cache_alloc() with thread_rpc_shm_alloc() which also takes a shared memory type as argument. This allows allocating an kernel p
core: add generic rpc shared memory buffer caching
Replaces tee_fs_rpc_cache_alloc() with thread_rpc_shm_alloc() which also takes a shared memory type as argument. This allows allocating an kernel private RPC buffer when needed.
Acked-by: Jerome Forissier <jerome@forissier.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 1b97b785 | 05-Jul-2020 |
Roland Nagy <rnagy@xmimx.tk> |
core: fix tee_fs_rpc_readdir() parameter direction
The type of params[1] is changed to OUT to match the expected params in tee-supplicant's tee_fs_rpc_readdir, so calls to tee_fs_rpc_readdir won't f
core: fix tee_fs_rpc_readdir() parameter direction
The type of params[1] is changed to OUT to match the expected params in tee-supplicant's tee_fs_rpc_readdir, so calls to tee_fs_rpc_readdir won't fail with TEE_ERROR_BAD_PARAMETERS.
Signed-off-by: Roland Nagy <rnagy@xmimx.tk> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| e762809b | 11-May-2020 |
Gianguido Sorà <me@gsora.xyz> |
rpmb: fix building when TRACE_LEVEL >= TRACE_FLOW
Building with CFG_RPMB_FS=y and CFG_TEE_CORE_LOG_LEVEL=4 yields a compile-time error due to a typo.
Replacing TEE_RESULT with TEE_Result fixes the
rpmb: fix building when TRACE_LEVEL >= TRACE_FLOW
Building with CFG_RPMB_FS=y and CFG_TEE_CORE_LOG_LEVEL=4 yields a compile-time error due to a typo.
Replacing TEE_RESULT with TEE_Result fixes the issue.
Signed-off-by: Gianguido Sorà <me@gsora.xyz> Reviewed-by: Jerome Forissier <jerome@forissier.org> Reviewed-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
show more ...
|
| 66d685f1 | 28-Apr-2020 |
Peikan Tsai <peikantsai@gmail.com> |
rpmb: remove unnecessary check
Remove unnecessary check to fix compile warning reported by clang as following:
core/tee/tee_rpmb_fs.c:2051:11: warning: address of array 'fh->filename' will always e
rpmb: remove unnecessary check
Remove unnecessary check to fix compile warning reported by clang as following:
core/tee/tee_rpmb_fs.c:2051:11: warning: address of array 'fh->filename' will always evaluate to 'true' [-Wpointer-bool-conversion] if (fh->filename && (!strcmp(fh->filename, fe->filename)) && ~~~~^~~~~~~~ ~~ core/tee/tee_rpmb_fs.c:2134:10: warning: address of array 'fh->filename' will always evaluate to 'true' [-Wpointer-bool-conversion] if (fh->filename && !fh->rpmb_fat_address) ~~~~^~~~~~~~ ~~
Signed-off-by: Mark-PK Tsai <mark-pk.tsai@mediatek.com> Signed-off-by: Peikan Tsai <peikantsai@gmail.com> Reviewed-by: YJ Chiang <yj.chiang@mediatek.com> Reviewed-by: Jerome Forissier <jerome@forissier.org>
show more ...
|
| 5f68d784 | 17-Mar-2020 |
Manuel Huber <mahuber@microsoft.com> |
core: RPMB FS: Caching for FAT FS entries
This patch adds optional FAT FS entry caching functionality to the RPMB FS. This functionality can be enabled by a non zero value for CFG_RPMB_FS_CACHE_ENTR
core: RPMB FS: Caching for FAT FS entries
This patch adds optional FAT FS entry caching functionality to the RPMB FS. This functionality can be enabled by a non zero value for CFG_RPMB_FS_CACHE_ENTRIES. The caching functionality can improve RPMB I/O at the cost of additional heap memory. The cache size is most likely platform-specific and should be chosen according to available secure world memory and expected FAT FS entries in RPMB. The cache holds the first X FAT FS entry in RAM. Whenever the FAT FS is traversed, we read from the cache instead of invoking RPMB I/O. The cache is updated when cached FAT FS entries are written.
Signed-off-by: Manuel Huber <mahuber@microsoft.com> Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Jerome Forissier <jerome@forissier.org> Tested-by: Jerome Forissier <jerome@forissier.org> (HiKey960, GP)
show more ...
|
| 21282bae | 16-Apr-2020 |
Jerome Forissier <jerome@forissier.org> |
core: crypto: ECC: make sure key_size is consistent with attributes
TEE_GenerateKey() takes a key_size argument and various attributes. If the size derived from the attributes is not key_size, we sh
core: crypto: ECC: make sure key_size is consistent with attributes
TEE_GenerateKey() takes a key_size argument and various attributes. If the size derived from the attributes is not key_size, we should return TEE_ERROR_BAD_PARAMETERS as per the GP TEE Internal Core API specification v1.2.1: "If an incorrect or inconsistent attribute is detected. The checks that are performed depend on the implementation.".
Signed-off-by: Jerome Forissier <jerome@forissier.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 9f4dcefb | 16-Apr-2020 |
Jerome Forissier <jerome@forissier.org> |
core: crypto: DH: make sure key_size is consistent with attributes
TEE_GenerateKey() takes a key_size argument and various attributes. For Diffie-Hellman, if the size of the prime number (TEE_ATTR_D
core: crypto: DH: make sure key_size is consistent with attributes
TEE_GenerateKey() takes a key_size argument and various attributes. For Diffie-Hellman, if the size of the prime number (TEE_ATTR_DH_PRIME) is not key_size, we should return TEE_ERROR_BAD_PARAMETERS as per the GP TEE Internal Core API specification v1.2.1: "If an incorrect or inconsistent attribute is detected. The checks that are performed depend on the implementation.".
Signed-off-by: Jerome Forissier <jerome@forissier.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 82c30aaa | 15-Apr-2020 |
Jerome Forissier <jerome@forissier.org> |
core: crypto: use supplied DSA parameters when creating key
When generating a DSA key, syscall_obj_generate_key() currently ignores the supplied parameters: TEE_ATTR_DSA_PRIME, TEE_ATTR_DSA_SUBPRIME
core: crypto: use supplied DSA parameters when creating key
When generating a DSA key, syscall_obj_generate_key() currently ignores the supplied parameters: TEE_ATTR_DSA_PRIME, TEE_ATTR_DSA_SUBPRIME and TEE_ATTR_DSA_BASE. Instead a new set of parameters is generated each time based on the specified key size. This does not comply with the GlobalPlatform TEE Internal Core API specification which lists these atrributes as mandatory input to the generation function (see v1.2.1 table 5-12 TEE_GenerateKey parameters).
Fix this issue by providing the supplied parameters to LibTomCrypt's dsa_generate_key() instead of calling dsa_make_key().
Fixes: https://github.com/OP-TEE/optee_os/issues/3746 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 ...
|
| ee3e1c54 | 07-Apr-2020 |
Cedric Neveux <cedric.neveux@nxp.com> |
core: utee_param_to_param(): set mobj to NULL when NULL memrefs of size 0
Set the tee_ta_param mobj to NULL if user parameter is a NULL memrefs of size 0. When mobj pointer is NULL, it also identify
core: utee_param_to_param(): set mobj to NULL when NULL memrefs of size 0
Set the tee_ta_param mobj to NULL if user parameter is a NULL memrefs of size 0. When mobj pointer is NULL, it also identify the last parameter of the list.
Fixes: 9d2e798360b5 ("core: TEE capability for null sized memrefs support")
Signed-off-by: Cedric Neveux <cedric.neveux@nxp.com> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Tested-by: Jerome Forissier <jerome@forissier.org> (HiKey960) Tested-by: Etienne Carriere <etienne.carriere@linaro.org>
show more ...
|
| 7c767434 | 02-Apr-2020 |
Albert Schwarzkopf <a.schwarzkopf@phytec.de> |
core: merge tee_*_get_digest_size() into a single function
Rename tee_hash_get_digest_size() to tee_alg_get_digest_size().
Change tee_alg_get_digest_size() to use new libutee macro TEE_ALG_GET_DIGE
core: merge tee_*_get_digest_size() into a single function
Rename tee_hash_get_digest_size() to tee_alg_get_digest_size().
Change tee_alg_get_digest_size() to use new libutee macro TEE_ALG_GET_DIGEST_SIZE.
Remove tee_mac_get_digest_size() as its functionality is handled by tee_alg_get_digest_size() now.
Signed-off-by: Albert Schwarzkopf <a.schwarzkopf@phytec.de> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 85daf48c | 25-Mar-2020 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: check writeable in tee_svc_copy_param()
Check that the callee_params are writeable too in tee_svc_copy_param() as they will be updated in tee_svc_update_out_param() in case one of the paramete
core: check writeable in tee_svc_copy_param()
Check that the callee_params are writeable too in tee_svc_copy_param() as they will be updated in tee_svc_update_out_param() in case one of the parameters is an "out" parameter. To keep it simple always require callee_params to be writeable.
Reviewed-by: Joakim Bech <joakim.bech@linaro.org> Reported-by: Bastien Simondi <bsimondi@netflix.com> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| db498484 | 26-Mar-2020 |
Jens Wiklander <jens.wiklander@linaro.org> |
rpmb: fix call to plat_rpmb_key_is_ready()
In tee_rpmb_write_and_verify_key() a call was recently added to check if the RPMB key was ready to be retrieved. But the function wasn't called in the new
rpmb: fix call to plat_rpmb_key_is_ready()
In tee_rpmb_write_and_verify_key() a call was recently added to check if the RPMB key was ready to be retrieved. But the function wasn't called in the new if statement, instead was just the address of the function tested to be non-NULL. So with this patch add the missing () to make it a function call.
Fixes: b1042535dc3e ("rpmb: function to block rpmb write per platform") Reviewed-by: Rouven Czerwinski <r.czerwinski@pengutronix.de> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| b1042535 | 29-Nov-2019 |
Rouven Czerwinski <r.czerwinski@pengutronix.de> |
rpmb: function to block rpmb write per platform
Often the RPMB should only be written if the platform is in the correct state where the Hardware Unique Key (HUK) for the platform works correctly. As
rpmb: function to block rpmb write per platform
Often the RPMB should only be written if the platform is in the correct state where the Hardware Unique Key (HUK) for the platform works correctly. As an example on imx platforms with HUK derivation from the OTPMK, the OTPMK is only accessible from the secure or trusted state. Add a function and weak implementation for platforms to indicate that the device is in the correct state to allow RPMB key writes.
Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de> Acked-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Cedric Neveux <cedric.neveux@nxp.com>
show more ...
|
| 7d97159b | 12-Feb-2020 |
Manuel Huber <mahuber@microsoft.com> |
core: RPMB FS: Make N_ENTRIES a config variable
Allows to configure the number of FAT fs entries to be read from RPMB storage in one chunk. Increasing this number makes functions that traverse the F
core: RPMB FS: Make N_ENTRIES a config variable
Allows to configure the number of FAT fs entries to be read from RPMB storage in one chunk. Increasing this number makes functions that traverse the FAT fs read in more entries within a single RPMB read operation. While this potentially improves RPMB I/O, it comes at the cost of additional memory required to be allocated on the heap. Determining an optimal size is platform- and use-case-dependent.
Signed-off-by: Manuel Huber <mahuber@microsoft.com> Reviewed-by: Jerome Forissier <jerome@forissier.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 213777fd | 11-Feb-2020 |
Manuel Huber <mahuber@microsoft.com> |
Empty body for dump_fat() unless log level set to TRACE_FLOW
This patch improves RPMB performance. When called, dump_fat() traverses the whole list of FAT entries and prints them out using FMSG(). d
Empty body for dump_fat() unless log level set to TRACE_FLOW
This patch improves RPMB performance. When called, dump_fat() traverses the whole list of FAT entries and prints them out using FMSG(). dump_fat() is currently called by write_fat_entry() and rpmb_fs_setup(). With this commit, dump_fat() is only active when debugging/tracing, and empty for productive builds.
Signed-off-by: Manuel Huber <mahuber@microsoft.com> Reviewed-by: Jerome Forissier <jerome@forissier.org>
show more ...
|
| 688c335d | 27-Jan-2020 |
Jerome Forissier <jerome@forissier.org> |
Remove TEE_OPERATION_EXTENSION
Commit 6a2e0a9fe2b9 ("utee: support prehashed RSA sign/ver without ASN.1") has introduced TEE_OPERATION_EXTENSION in tee_api_defines.h with value 0xF. This poses a cou
Remove TEE_OPERATION_EXTENSION
Commit 6a2e0a9fe2b9 ("utee: support prehashed RSA sign/ver without ASN.1") has introduced TEE_OPERATION_EXTENSION in tee_api_defines.h with value 0xF. This poses a couple of minor issues:
1. Values 0x00000009-0x7FFFFFFF are "Reserved for future use" according to the TEE Internal Core API specification v1.2.1 (Table 5-6),
2. The meaning of this #define is not clear: "extension" is not a kind of operation like "cipher", "MAC", "asymmetric signature" etc. The algorithm added by the above commit is TEE_ALG_RSASSA_PKCS1_V1_5 which is an asymmetric signature and should therefore be associated with TEE_OPERATION_ASYMMETRIC_SIGNATURE.
I suppose the operation value was added in a attempt to keep the structure of algorithm identifiers as defined in the GP v1.1 specification, where some particular bits indicate some attributes of the algorithm. This scheme has since been abandoned by GlobalPlatform so there is no reason to keep it.
Therefore, this commit removes the TEE_OPERATION_EXTENSION macro and makes a special case in the TEE_GET_CLASS() macro so that algorithm TEE_ALG_RSASSA_PKCS1_V1_5 is associated with TEE_OPERATION_ASYMMETRIC_SIGNATURE.
Signed-off-by: Jerome Forissier <jerome@forissier.org> Acked-by: Gabor Szekely <szvgabor@gmail.com> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 5b385b3f | 06-Jan-2020 |
Jerome Forissier <jerome@forissier.org> |
core: crypto: add support for SM2 KEP
Adds SM2 Key Exchange Protocol [1] using LibTomCrypt. The TA interface complies with the GlobalPlatform TEE Internal Core API version 1.2.
SM2 KEP is enabled w
core: crypto: add support for SM2 KEP
Adds SM2 Key Exchange Protocol [1] using LibTomCrypt. The TA interface complies with the GlobalPlatform TEE Internal Core API version 1.2.
SM2 KEP is enabled with CFG_CRYPTO_SM2_KEP=y (default y) wich currently requires that CFG_CRYPTOLIB_NAME=tomcrypt. An Mbed TLS implementation could be added later if needed.
[1] http://www.gmbz.org.cn/main/postDetail.html?id=20180724110812
Signed-off-by: Jerome Forissier <jerome@forissier.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 0f151943 | 17-Dec-2019 |
Jerome Forissier <jerome@forissier.org> |
core: crypto add support for SM2 DSA
Adds SM2 Digital Signature Algorithm [1] using LibTomCrypt. The TA interface complies with the GlobalPlatform TEE Internal Core API version 1.2.
SM2 DSA is enab
core: crypto add support for SM2 DSA
Adds SM2 Digital Signature Algorithm [1] using LibTomCrypt. The TA interface complies with the GlobalPlatform TEE Internal Core API version 1.2.
SM2 DSA is enabled with CFG_CRYPTO_SM2_DSA=y (default y) which currently requires that CFG_CRYPTOLIB_NAME=tomcrypt. An Mbed TLS implementation could be added later if needed.
[1] http://www.gmbz.org.cn/main/postDetail.html?id=20180724110812
Signed-off-by: Jerome Forissier <jerome@forissier.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 91fc6bd8 | 17-Dec-2019 |
Jerome Forissier <jerome@forissier.org> |
core: crypto: add support for SM2 PKE
Adds SM2 Public Key Encryption [1] using LibTomCrypt. The TA interface complies with the GlobalPlatform TEE Internal Core API version 1.2.
SM2 is enabled with
core: crypto: add support for SM2 PKE
Adds SM2 Public Key Encryption [1] using LibTomCrypt. The TA interface complies with the GlobalPlatform TEE Internal Core API version 1.2.
SM2 is enabled with CFG_CRYPTO_SM2_PKE=y (default y) which currently requires that CFG_CRYPTOLIB_NAME=tomcrypt. An Mbed TLS implementation could be added later if needed.
[1] http://www.gmbz.org.cn/main/postDetail.html?id=20180724110812
Signed-off-by: Jerome Forissier <jerome@forissier.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|