| 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 ...
|
| 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 ...
|