| 5c669b6d | 28-Aug-2024 |
Arnaud Pouliquen <arnaud.pouliquen@foss.st.com> |
ta: remoteproc: add command to release remote processor firmware
This patch introduces a new command `TA_RPROC_CMD_RELEASE_FW` to release the firmware images and associated resources of a remote pro
ta: remoteproc: add command to release remote processor firmware
This patch introduces a new command `TA_RPROC_CMD_RELEASE_FW` to release the firmware images and associated resources of a remote processor.
This command can be called by the non-secure context to release the loaded firmware if the remoteproc is not running.
The command can be used, for instance, in case an error occurs in the non-secure context between the load request and the start of the remote processor. Calling the command allows releasing the loaded firmware and going back to the REMOTEPROC_OFF state.
This command should also be called after the stop of the remote processor to release associated resources.
Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com> Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| 931c8c5e | 14-Aug-2024 |
Weizhao Jiang <weizhaoj@amazon.com> |
ta: pkcs11: write db_main and db_objs in one operation
Problem: There is a potential issue in persistent_token.c::init_persistent_db(). There are two steps to initialize a token DB if it doesn’t exi
ta: pkcs11: write db_main and db_objs in one operation
Problem: There is a potential issue in persistent_token.c::init_persistent_db(). There are two steps to initialize a token DB if it doesn’t exist: 1. Call TEE_CreatePersistentObject() with db_main as the initial data. 2. Truncate the object data and then insert db_obj data. If a power loss occurs between above two steps, only the db_main data is present in the database. When the device restarts, it detects the existing database and successfully reads db_main, but fails to read db_obj, leading to a TA panic each time. https://github.com/OP-TEE/optee_os/issues/6977
Solution: Write both db_main and the initial 4 bytes of db_objs (with a count of 0) in a single operation during TEE_CreatePersistentObject().
Tested-by: Weizhao Jiang <weizhaoj@amazon.com> Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com> Signed-off-by: Weizhao Jiang <weizhaoj@amazon.com>
show more ...
|
| 3dc4089a | 24-Apr-2024 |
Etienne Carriere <etienne.carriere@foss.st.com> |
ta: pkcs11: correct RSA keys extended attributes sanitation
Fix RSA key attributes function load_tee_rsa_key_attrs() that badly checks that the 5 extended RSA attributes are found in the key object.
ta: pkcs11: correct RSA keys extended attributes sanitation
Fix RSA key attributes function load_tee_rsa_key_attrs() that badly checks that the 5 extended RSA attributes are found in the key object.
Link: https://github.com/OP-TEE/optee_test/issues/721#issuecomment-2068055537 Link: https://github.com/OP-TEE/optee_test/issues/721#issuecomment-2072064963 Fixes: 0442c956edfb ("ta: pkcs11: Add support for RSA signing & verification") Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com> Reviewed-by: Vesa Jääskeläinen <vesa.jaaskelainen@vaisala.com>
show more ...
|
| 5d2d37cd | 09-Feb-2024 |
Etienne Carriere <etienne.carriere@foss.st.com> |
ta: pkcs11: Clarify context reference in step_symm_operation()
Function step_symm_operation() defines a local variable to reference the session processing context but uses both session reference and
ta: pkcs11: Clarify context reference in step_symm_operation()
Function step_symm_operation() defines a local variable to reference the session processing context but uses both session reference and this local variable which can be confusing when reading the code. Change the implementation to only use the local variable for consistency. No functional changes.
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| ad50321f | 08-Mar-2024 |
Arnaud Pouliquen <arnaud.pouliquen@foss.st.com> |
ta: remoteproc: allow remoteproc_load_fw re-entrance
Instead of returning an error if the TA_RPROC_CMD_LOAD_FW is called several times, just return TEE_SUCCESS if the firmware is already loaded.
Th
ta: remoteproc: allow remoteproc_load_fw re-entrance
Instead of returning an error if the TA_RPROC_CMD_LOAD_FW is called several times, just return TEE_SUCCESS if the firmware is already loaded.
This commit is the result of a discussion on Linux Kernel mailing list: https://lore.kernel.org/lkml/ZeCujRgH%2FodzU9og@p14s/
Fixes: fcf382e2440c ("ta: remoteproc: add remote processor Trusted Application")
Suggested-by: Mathieu Poirier <mathieu.poirier@linaro.org> Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com> Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| 571857c0 | 15-Feb-2024 |
Etienne Carriere <etienne.carriere@foss.st.com> |
ta: pkcs11: factorize second operation handle
Factorize fields tee_hash_op_handle and tee_op_handle2 of struct active_processing that both are used as second operation handle for specific algorithm.
ta: pkcs11: factorize second operation handle
Factorize fields tee_hash_op_handle and tee_op_handle2 of struct active_processing that both are used as second operation handle for specific algorithm.
Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Marouene Boubakri <marouene.boubakri@nxp.com> Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| 63778faa | 12-Feb-2024 |
Etienne Carriere <etienne.carriere@foss.st.com> |
ta: pkcs11: implement AES GCM operations
Implement AES GCM authenticated encryption and decryption.
AES GCM decryption requires that the output data is revealed only once decryption is finalized an
ta: pkcs11: implement AES GCM operations
Implement AES GCM authenticated encryption and decryption.
AES GCM decryption requires that the output data is revealed only once decryption is finalized and the MAC signature successfully verified. For this operation, the AES GCM context references a dynamically allocated data buffer to store output data as they are generated by each call to TEE_AEUpdate().
AES GCM one-shot operation in the pkc11 TA is a bit specific in that it requires an extra TEE operation handle to save the initialized operation state in case of one shot processing request (C_Encrypt() or C_Decrypt() cryptoki API functions) that queries the output buffer size. GP TEE Internal Core API does not define a single API function for such one shot operation that could be called to query the output buffer size. We must first fully process the input data (TEE_AEUpdate()) before we can query the output buffer size with TEE_AEEncryptFinal() or TEE_AEDecryptFinal(). Consequently we will need to process again the input data when client provides a well sized output buffer as we are not sure that input data will be the same. Therefore the implementation allocates a 2nd operation handle, copy the operation state into after it is initialized and use this context to restore this initial state in case the one shot AE operation is returning PKCS11_CKR_BUFFER_TOO_SMALL.
Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Marouene Boubakri <marouene.boubakri@nxp.com> Co-developed-by: Marouene Boubakri <marouene.boubakri@nxp.com> Signed-off-by: Marouene Boubakri <marouene.boubakri@nxp.com> Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| 5fee6cc9 | 16-Nov-2023 |
Marouene Boubakri <marouene.boubakri@nxp.com> |
ta: pkcs11: pkcs11_ta.h: define PKCS11_CKM_AES_GCM
Define PKCS11_CKM_AES_GCM setting its value to 0x01087 according to libckteec/include/pkcs11_ta.h from OP-TEE Client API.
Reviewed-by: Jerome Fori
ta: pkcs11: pkcs11_ta.h: define PKCS11_CKM_AES_GCM
Define PKCS11_CKM_AES_GCM setting its value to 0x01087 according to libckteec/include/pkcs11_ta.h from OP-TEE Client API.
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Marouene Boubakri <marouene.boubakri@nxp.com> Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| 897aaf11 | 15-Feb-2024 |
Etienne Carriere <etienne.carriere@foss.st.com> |
ta: pkcs11: fix build warning on unused arguments
Add missing __maybe_unused attribute for function arguments not used when the pkcs11 TA is built with NDEBUG directive, as shown by the following bu
ta: pkcs11: fix build warning on unused arguments
Add missing __maybe_unused attribute for function arguments not used when the pkcs11 TA is built with NDEBUG directive, as shown by the following build trace message:
ta/pkcs11/src/pkcs11_attributes.c: In function ‘get_default_value’: ta/pkcs11/src/pkcs11_attributes.c:261:61: warning: unused parameter ‘id’ [-Wunused-parameter] 261 | static enum pkcs11_rc get_default_value(enum pkcs11_attr_id id, void **value, | ~~~~~~~~~~~~~~~~~~~~^~ ta/pkcs11/src/pkcs11_attributes.c: In function ‘check_created_attrs_against_processing’: ta/pkcs11/src/pkcs11_attributes.c:1647:73: warning: unused parameter ‘head’ [-Wunused-parameter] 1647 | struct obj_attrs *head) | ~~~~~~~~~~~~~~~~~~^~~~
Fixes: 63f89caa9022 ("ta: pkcs11: attribute helper functions") Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| a2431e9f | 05-Jan-2024 |
Clement Faure <clement.faure@nxp.com> |
ta: pkcs11: check returned value of mbedtls_pk_rsa()
Check returned pointer of mbedtls_pk_rsa() as it can return NULL.
Signed-off-by: Clement Faure <clement.faure@nxp.com> Reviewed-by: Jerome Foris
ta: pkcs11: check returned value of mbedtls_pk_rsa()
Check returned pointer of mbedtls_pk_rsa() as it can return NULL.
Signed-off-by: Clement Faure <clement.faure@nxp.com> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| 4bc2a199 | 10-Jan-2024 |
Clement Faure <clement.faure@nxp.com> |
ta: remove unnecessary includes
Remove unnecessary includes.
Signed-off-by: Clement Faure <clement.faure@nxp.com> Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Jens Wiklander <
ta: remove unnecessary includes
Remove unnecessary includes.
Signed-off-by: Clement Faure <clement.faure@nxp.com> Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| 6959626e | 15-Dec-2023 |
Etienne Carriere <etienne.carriere@foss.st.com> |
ta: pkcs11: preserve object when set attribute fails
Preserve original object attributes when C_SetAttributeValue service fails instead of possibly changing object attributes before the whole new at
ta: pkcs11: preserve object when set attribute fails
Preserve original object attributes when C_SetAttributeValue service fails instead of possibly changing object attributes before the whole new attribute set is validated.
Fixes: bcac2127a7f1 ("ta: pkcs11: pkcs11_attributes.c: support PKCS11_CKA_CHECK_VALUE") Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Marouene Boubakri <marouene.boubakri@nxp.com> Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| 2ea9746d | 15-Dec-2023 |
Etienne Carriere <etienne.carriere@foss.st.com> |
ta: pkcs11: treat bad KCV size as a bad value case
Return PKCS11_CKR_ATTRIBUTE_VALUE_INVALID instead of a template inconsistency when the key check value attribute is wrong due to its size.
Fixes:
ta: pkcs11: treat bad KCV size as a bad value case
Return PKCS11_CKR_ATTRIBUTE_VALUE_INVALID instead of a template inconsistency when the key check value attribute is wrong due to its size.
Fixes: bcac2127a7f1 ("ta: pkcs11: pkcs11_attributes.c: support PKCS11_CKA_CHECK_VALUE") Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Marouene Boubakri <marouene.boubakri@nxp.com> Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| 69de4b2d | 08-Jan-2024 |
Etienne Carriere <etienne.carriere@foss.st.com> |
ta: pkcs11: default enable key check value support
Default enable support for key check value attribute in pkcs11 TA.
Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Etienne
ta: pkcs11: default enable key check value support
Default enable support for key check value attribute in pkcs11 TA.
Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| 3bc92b91 | 08-Jan-2024 |
Etienne Carriere <etienne.carriere@foss.st.com> |
ta: pkcs11: use TEE_InitRefAttribute() to compute key check value
Use TEE_InitRefAttribute() helper function to set key data attribute in compute_check_value_with_ecb().
Fixes: bcac2127a7f1 ("ta: p
ta: pkcs11: use TEE_InitRefAttribute() to compute key check value
Use TEE_InitRefAttribute() helper function to set key data attribute in compute_check_value_with_ecb().
Fixes: bcac2127a7f1 ("ta: pkcs11: pkcs11_attributes.c: support PKCS11_CKA_CHECK_VALUE") Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| cfbe7874 | 08-Jan-2024 |
Etienne Carriere <etienne.carriere@foss.st.com> |
ta: pkcs11: key check value may not be applicable
Key check value attribute is required only for objects of types certificate and symmetric keys. Fix set_check_value_attr() to return a successful st
ta: pkcs11: key check value may not be applicable
Key check value attribute is required only for objects of types certificate and symmetric keys. Fix set_check_value_attr() to return a successful status instead of bad argument error code when there is no key check value attribute to compute.
Fixes: bcac2127a7f1 ("ta: pkcs11: pkcs11_attributes.c: support PKCS11_CKA_CHECK_VALUE") Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| adfad2cd | 08-Jan-2024 |
Etienne Carriere <etienne.carriere@foss.st.com> |
ta: pkcs11: fix block size to compute AES key check value
Fix AES block size in compute_check_value_with_ecb(). It is 16 bytes, not the AES key size. By the way allocate cipher block in the stack in
ta: pkcs11: fix block size to compute AES key check value
Fix AES block size in compute_check_value_with_ecb(). It is 16 bytes, not the AES key size. By the way allocate cipher block in the stack instead of in the heap since the block is quite small.
Fixes: bcac2127a7f1 ("ta: pkcs11: pkcs11_attributes.c: support PKCS11_CKA_CHECK_VALUE") Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| 1a442a9f | 07-Sep-2023 |
Arnaud Pouliquen <arnaud.pouliquen@foss.st.com> |
ta: remoteproc: add support for resource table
The resource table is a specific table declared in the remote processor firmware and that is parsed by the main processor to discover resources and con
ta: remoteproc: add support for resource table
The resource table is a specific table declared in the remote processor firmware and that is parsed by the main processor to discover resources and configure inter-processors communication. The resource table is requested by the non-secure context. The remoteproc TA retrieves it from the firmware ELF file.
Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com> Acked-by: Etienne Carriere <etienne.carriere@foss.st.com> Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
show more ...
|
| 56a69fb4 | 15-May-2023 |
Arnaud Pouliquen <arnaud.pouliquen@foss.st.com> |
ta: remoteproc: add support for start and stop command
Implement command TA_RPROC_FW_CMD_START_FW and TA_RPROC_FW_CMD_STOP_FW in remoteproc TA. The TA relay the request to the platform specific PTA
ta: remoteproc: add support for start and stop command
Implement command TA_RPROC_FW_CMD_START_FW and TA_RPROC_FW_CMD_STOP_FW in remoteproc TA. The TA relay the request to the platform specific PTA that can act on the hardware.
Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com> Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com> Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
show more ...
|
| fcf382e2 | 24-Mar-2023 |
Arnaud Pouliquen <arnaud.pouliquen@foss.st.com> |
ta: remoteproc: add remote processor Trusted Application
Add a generic TA for a remote processor firmware management. This TA should be defined as early TA to allow remote processor firmware managem
ta: remoteproc: add remote processor Trusted Application
Add a generic TA for a remote processor firmware management. This TA should be defined as early TA to allow remote processor firmware management in Linux kernel built-in driver and in boot stages.
Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com> Acked-by: Etienne Carriere <etienne.carriere@foss.st.com> Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
show more ...
|
| 155cb3e8 | 23-Apr-2020 |
Arnaud Pouliquen <arnaud.pouliquen@foss.st.com> |
ta: remoteproc: add firmware ELF parser
Add a ELF parser that will used by the remoteproc generic TA. It is in charge of parsing the ELF files to extract segments to load in the remote processor mem
ta: remoteproc: add firmware ELF parser
Add a ELF parser that will used by the remoteproc generic TA. It is in charge of parsing the ELF files to extract segments to load in the remote processor memories. It also offers an API to retrieve the resource table in the image. This optional table is defined in a specific section ".resource_table" and is used by the Linux remoteproc driver to discover services exposed by the remote processor.
Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com> Acked-by: Etienne Carriere <etienne.carriere@foss.st.com> Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
show more ...
|
| bcac2127 | 24-Nov-2023 |
Marouene Boubakri <marouene.boubakri@nxp.com> |
ta: pkcs11: pkcs11_attributes.c: support PKCS11_CKA_CHECK_VALUE
Add PKCS11_CKA_CHECK_VALUE as an optional attribute of symmetric key and certificate objects . As per the PKCS#11 specification, key c
ta: pkcs11: pkcs11_attributes.c: support PKCS11_CKA_CHECK_VALUE
Add PKCS11_CKA_CHECK_VALUE as an optional attribute of symmetric key and certificate objects . As per the PKCS#11 specification, key check value attribute is optional therefore add pkcs11 TA configuration switch CFG_PKCS11_TA_CHECK_VALUE_ATTRIBUTE to embed or not the support.
When supported, as per the spec, the attribute can be either the legitimate value recomputed by the PKCS#11 token or a zero-sized value called a no-value for when client does not want the attribute to set in an object.
This change adds the support for the pcks11 TA commands related to Cryptoki API functions C_GenerateKey(), C_CreateObject(), C_CopyObject(), C_SetAttributeValue(), C_UnwrapKey() and C_DeriveKey(). TA command related to C_FindOjects() support the attribute without any change.
Signed-off-by: Marouene Boubakri <marouene.boubakri@nxp.com> Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| 2eba68d2 | 28-Sep-2023 |
Etienne Carriere <etienne.carriere@foss.st.com> |
ta: pkcs11: prevent user ID verification when user PIN is not set
Fix User PIN verification in ACL mode (protected authentication) so that it always returns PKCS11_CKR_USER_PIN_NOT_INITIALIZED when
ta: pkcs11: prevent user ID verification when user PIN is not set
Fix User PIN verification in ACL mode (protected authentication) so that it always returns PKCS11_CKR_USER_PIN_NOT_INITIALIZED when User PIN has not been initialized yet by the Security Officer. Before this change, this was tested only in the standard PIN path, not for the authenticated TEE identity mode (CFG_PKCS11_TA_AUTH_TEE_IDENTITY=y).
Reviewed-by: Vesa Jääskeläinen <vesa.jaaskelainen@vaisala.com> Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| d75c42ff | 31-Oct-2023 |
Loic Poulain <loic.poulain@linaro.org> |
ta: pkcs11: Improve PIN counter handling robustness
Make sure PIN check attempt is saved persistently before continuing with the actual PIN verification, improving counter and flags coherency in cas
ta: pkcs11: Improve PIN counter handling robustness
Make sure PIN check attempt is saved persistently before continuing with the actual PIN verification, improving counter and flags coherency in case of subsequent failure with persistent saving.
Signed-off-by: Loic Poulain <loic.poulain@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com> Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
show more ...
|
| 2ae2cfb2 | 09-Nov-2023 |
Sumit Garg <sumit.garg@linaro.org> |
TA dev kit: Export ftrace_format.py
Commit 5c2c0fb31efb ("ftrace: change implementation to use binary circular buffer") added script ftrace_format.py which is required to analyze ftrace logs. So exp
TA dev kit: Export ftrace_format.py
Commit 5c2c0fb31efb ("ftrace: change implementation to use binary circular buffer") added script ftrace_format.py which is required to analyze ftrace logs. So export it as part of TA dev kit as well.
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Etienne Carriere <etienne.carriere@foss.st.com> Acked-by: Jens Wiklander <jens.wiklander@linaro.org> Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
show more ...
|