| 9c4d0955 | 17-Jul-2023 |
loubaihui <loubaihui1@huawei.com> |
crypto: add drvcrypt_register_x25519() and drvcrypt_register_x448()
Add X25519 and X448 drvcrypt.
Signed-off-by: loubaihui <loubaihui1@huawei.com> Acked-by: Jerome Forissier <jerome.forissier@linar
crypto: add drvcrypt_register_x25519() and drvcrypt_register_x448()
Add X25519 and X448 drvcrypt.
Signed-off-by: loubaihui <loubaihui1@huawei.com> Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 34ce35b1 | 14-Jul-2023 |
loubaihui <loubaihui1@huawei.com> |
crypto: add X448 support
Refer to the X25519 algorithm, add the X448 algorithm framework code.
Signed-off-by: loubaihui <loubaihui1@huawei.com> Acked-by: Jerome Forissier <jerome.forissier@linaro.o
crypto: add X448 support
Refer to the X25519 algorithm, add the X448 algorithm framework code.
Signed-off-by: loubaihui <loubaihui1@huawei.com> Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 5c2c0fb3 | 14-Jun-2023 |
Jerome Forissier <jerome.forissier@linaro.org> |
ftrace: change implementation to use binary circular buffer
The current implementation of function tracing (CFG_FTRACE_SUPPORT) produces human-readable text into the output buffer that is passed to
ftrace: change implementation to use binary circular buffer
The current implementation of function tracing (CFG_FTRACE_SUPPORT) produces human-readable text into the output buffer that is passed to tee-supplicant and ultimately saved to the Linux filesystem. Two main issues with that:
1. The string formatting code is somewhat complex. It introduces significant overhead in the execution time of the instrumented functions. 2. The various policies about how to handle a buffer full condition (CFG_FTRACE_BUF_WHEN_FULL) are not very convenient. In particular, "shift" is typically the most desirable option because it always keeps the most recent entries, but it is very inefficient to the point of not being usable in practice.
This commit addresses the above concerns by making the ftrace buffer circular one, each entry being 64-bit value. The formatting code is offloaded to a new Python script: scripts/ftrace_format.py. The output is unchanged except for an added field showing the current depth in the call stack.
Typical usage (captured on QEMUv8):
build$ mkdir -p ../tmp build$ chmod a+w ../tmp build$ make CFG_FTRACE_SUPPORT=y CFG_FTRACE_BUF_SIZE=15000 \ CFG_TA_MCOUNT=y CFG_ULIBS_MCOUNT=y CFG_SYSCALL_FTRACE=y \ QEMU_VIRTFS_AUTOMOUNT=y run $ xtest regression_1004 ... $ cp /tmp/ftrace-cb3e5ba0-adf1-11e0-998b-0002a5d5c51b.out /mnt/host/tmp build$ cd .. optee$ optee_os/scripts/ftrace_format.py \ tmp/ftrace-cb3e5ba0-adf1-11e0-998b-0002a5d5c51b.out | optee_os/scripts/symbolize.py \ -d optee_os/out/arm/core \ -d out-br/build/optee_test_ext-1.0/ta/*/out | less TEE load address @ 0x5ab04000 Function graph for TA: cb3e5ba0-adf1-11e0-998b-0002a5d5c51b @ 80085000 | 1 | __ta_entry() { | 2 | __utee_entry() { 43.840 us | 3 | ta_header_get_session() 7.216 us | 3 | tahead_get_trace_level() 14.480 us | 3 | trace_set_level() | 3 | malloc_add_pool() { | 4 | raw_malloc_add_pool() { 46.032 us | 5 | bpool() | 5 | raw_realloc() { 166.256 us | 6 | bget() 23.056 us | 6 | raw_malloc_return_hook() 267.952 us | 5 | } 398.720 us | 4 | } 426.992 us | 3 | } | 3 | TEE_GetPropertyAsU32() { 23.600 us | 4 | is_propset_pseudo_handle() | 4 | __utee_check_instring_annotation() { 26.416 us | 5 | strlen() | 5 | check_access() { | 6 | TEE_CheckMemoryAccessRights() { | 7 | _utee_check_access_rights() { | 8 | syscall_check_access_rights() { | 9 | ts_get_current_session() { 4.304 us | 10 | ts_get_current_session_may_fail() 10.976 us | 9 | } | 9 | to_user_ta_ctx() { 2.496 us | 10 | is_user_ta_ctx() 8.096 us | 9 | } | 9 | vm_check_access_rights() { | 10 | vm_buf_is_inside_um_private() { | 11 | core_is_buffer_inside() { ...
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Sumit Garg <sumit.garg@linaro.org> Acked-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| 53877f84 | 20-Jun-2023 |
Alvin Chang <alvinga@andestech.com> |
libutee: Implement RISC-V helper functions for TA libraries
To enable ftrace support in TA libraries, the timer related functions should be implemented. Add riscv_user_sysreg.h which implements thes
libutee: Implement RISC-V helper functions for TA libraries
To enable ftrace support in TA libraries, the timer related functions should be implemented. Add riscv_user_sysreg.h which implements these functions for TA libraries. The code is referenced from core header and the M-mode related code is removed.
Signed-off-by: Alvin Chang <alvinga@andestech.com> Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Sumit Garg <sumit.garg@linaro.org> Reviewed-by: Marouene Boubakri <marouene.boubakri@nxp.com>
show more ...
|
| 69e63e33 | 15-May-2023 |
Alvin Chang <alvinga@andestech.com> |
Add missing conditional compilation for RISC-V
RV64 also uses kern_sp. The elf.h is also used by RV32 and RV64.
Signed-off-by: Alvin Chang <alvinga@andestech.com> Acked-by: Jerome Forissier <jerome
Add missing conditional compilation for RISC-V
RV64 also uses kern_sp. The elf.h is also used by RV32 and RV64.
Signed-off-by: Alvin Chang <alvinga@andestech.com> Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 41d9f6c2 | 07-Mar-2023 |
Jerome Forissier <jerome.forissier@linaro.org> |
libutee: add TEE_ALG_ECDSA_SHA* to TEE_ALG_GET_DIGEST_SIZE()
The TEE_ALG_GET_DIGEST_SIZE() macro lacks the ECDSA algorithms. Add them.
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
libutee: add TEE_ALG_ECDSA_SHA* to TEE_ALG_GET_DIGEST_SIZE()
The TEE_ALG_GET_DIGEST_SIZE() macro lacks the ECDSA algorithms. Add them.
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 0db29820 | 23-Jan-2023 |
Clement Faure <clement.faure@nxp.com> |
core: pta: imx: add manufacturing protection
Add the i.MX PTA to expose CAAM manufacturing protection features: * Get manufacturing protection public key. * Get manufacturing protection message.
core: pta: imx: add manufacturing protection
Add the i.MX PTA to expose CAAM manufacturing protection features: * Get manufacturing protection public key. * Get manufacturing protection message. * Message signature with manufacturing protection private key.
Signed-off-by: Cedric Neveux <cedric.neveux@nxp.com> Signed-off-by: Clement Faure <clement.faure@nxp.com> Acked-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
show more ...
|
| f5c3d85a | 01-Dec-2020 |
Julien Masson <jmasson@baylibre.com> |
core: crypto: add support MD5 hashes in RSA sign/verify/cipher
Introduce support of using MD5 hashes in RSA sign/verify/cipher operations, which is required by AOSP Keymaster.
This is verified in
core: crypto: add support MD5 hashes in RSA sign/verify/cipher
Introduce support of using MD5 hashes in RSA sign/verify/cipher operations, which is required by AOSP Keymaster.
This is verified in VerificationOperationsTest.RsaSuccess VTS Test [1], which checks usage of such digests: NONE, MD5, SHA1, SHA_2_224, SHA_2_256, SHA_2_384, SHA_2_512.
This patch has been inspired by commit[2]:
Link: [1] https://android.googlesource.com/platform/hardware/interfaces/+/master/keymaster/3.0/vts/functional/keymaster_hidl_hal_test.cpp Link: [2] https://github.com/OP-TEE/optee_os/commit/199d0b7310d1705661a106358f1f0b46e4c5c587 ("core: crypto: add support MD5 hashes in RSA sign/verify") Signed-off-by: Julien Masson <jmasson@baylibre.com> Signed-off-by: Safae Ouajih <souajih@baylibre.com> Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 31c02813 | 07-Feb-2023 |
Clement Faure <clement.faure@nxp.com> |
libutee: add TEE_MAIN_ALGO_SHAKE values
The CAAM driver relies on TEE_ALG_GET_MAIN_ALG() macro to retrieve the main algorithm ID from the TEE_ALG_* value.
With the addition of TEE_ALG_SHAKE128 and
libutee: add TEE_MAIN_ALGO_SHAKE values
The CAAM driver relies on TEE_ALG_GET_MAIN_ALG() macro to retrieve the main algorithm ID from the TEE_ALG_* value.
With the addition of TEE_ALG_SHAKE128 and TEE_ALG_SHAKE256, TEE_ALG_GET_MAIN_ALG() would return 0x01 (TEE_MAIN_ALGO_MD5) and 0x02 (TEE_MAIN_ALGO_SHA1). These returned values are wrong.
Add TEE_MAIN_ALGO_SHAKE128 and TEE_MAIN_ALGO_SHAKE256 values for respectively TEE_ALG_SHAKE128 and TEE_ALG_SHAKE256.
Signed-off-by: Clement Faure <clement.faure@nxp.com> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| c6d054eb | 12-Dec-2022 |
Manorit Chawdhry <m-chawdhry@ti.com> |
core: pta: Add K3 specific PTA for writing into extended OTP
Writing into the extended OTP has been a vendor specific thing and no generic drivers exists for it in the OP-TEE framework.
Add a PTA t
core: pta: Add K3 specific PTA for writing into extended OTP
Writing into the extended OTP has been a vendor specific thing and no generic drivers exists for it in the OP-TEE framework.
Add a PTA to write into the custom extended OTP bits in K3 architecture.
This header should be exported out of optee-os to be used by the host binary for interacting with the PTA.
Includes OTP keywriting PTA header file in libutee
Signed-off-by: Manorit Chawdhry <m-chawdhry@ti.com> Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
show more ...
|
| 3b439c8f | 26-Jan-2023 |
Jens Wiklander <jens.wiklander@linaro.org> |
GP131: Fix the TEE_ALG_SM2_PKE define
The define TEE_ALG_SM2_PKE was introduced with the value 0x80000045 in the v1.2 specification and later changed to 0x80000046 in v1.3. At this point we try to b
GP131: Fix the TEE_ALG_SM2_PKE define
The define TEE_ALG_SM2_PKE was introduced with the value 0x80000045 in the v1.2 specification and later changed to 0x80000046 in v1.3. At this point we try to be compatible with v1.3.1 so update the value to match that version of the GlobalPlatform specification.
Reviewed-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 ...
|
| b9263ec2 | 25-Jan-2023 |
Jens Wiklander <jens.wiklander@linaro.org> |
GP131: tee_api_defines.h: remove obsolete comments
Removes the obsolete comments "/* vx.y.z spec */" from attributes, type, and algorithm defines. The defines are all now up to date with GP v1.3.1.
GP131: tee_api_defines.h: remove obsolete comments
Removes the obsolete comments "/* vx.y.z spec */" from attributes, type, and algorithm defines. The defines are all now up to date with GP v1.3.1.
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 ...
|
| 138c5102 | 14-Dec-2022 |
Jens Wiklander <jens.wiklander@linaro.org> |
GP131: Add TA property gpd.ta.doesNotCloseHandleOnCorruptObject
Adds the TA property gpd.ta.doesNotCloseHandleOnCorruptObject.
All syscalls operating on an object handle and can return TEE_ERROR_CO
GP131: Add TA property gpd.ta.doesNotCloseHandleOnCorruptObject
Adds the TA property gpd.ta.doesNotCloseHandleOnCorruptObject.
All syscalls operating on an object handle and can return TEE_ERROR_CORRUPT_OBJECT must also do special treatment when TEE_ERROR_CORRUPT_OBJECT is returned. Prior to gpd.ta.doesNotCloseHandleOnCorruptObject this meant removing the object and closing the object handle. With the gpd.ta.doesNotCloseHandleOnCorruptObject property the object handle shouldn't be close if this the current TA has the property set to true.
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 6214424f | 15-Dec-2022 |
Jens Wiklander <jens.wiklander@linaro.org> |
GP131: add TEE_BigIntExpMod()
Adds the function TEE_BigIntExpMod() introduced in TEE Internal Core API v1.2.
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Jens Wiklande
GP131: add TEE_BigIntExpMod()
Adds the function TEE_BigIntExpMod() introduced in TEE Internal Core API v1.2.
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 3be980f7 | 15-Dec-2022 |
Jens Wiklander <jens.wiklander@linaro.org> |
GP131: add TEE_BigIntAbs()
Adds the function TEE_BigIntAbs() introduced in TEE Internal Core API v1.2.
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Jens Wiklander <jen
GP131: add TEE_BigIntAbs()
Adds the function TEE_BigIntAbs() introduced in TEE Internal Core API v1.2.
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 42023295 | 15-Dec-2022 |
Jens Wiklander <jens.wiklander@linaro.org> |
GP131: add TEE_BigIntSetBit()
Adds the function TEE_BigIntSetBit() introduced in TEE Internal Core API v1.2.
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Jens Wiklande
GP131: add TEE_BigIntSetBit()
Adds the function TEE_BigIntSetBit() introduced in TEE Internal Core API v1.2.
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| af4bcf34 | 15-Dec-2022 |
Jens Wiklander <jens.wiklander@linaro.org> |
GP131: add TEE_BigIntAssign()
Adds the function TEE_BigIntAssign() introduced in TEE Internal Core API v1.2.
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Jens Wiklande
GP131: add TEE_BigIntAssign()
Adds the function TEE_BigIntAssign() introduced in TEE Internal Core API v1.2.
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 287a6182 | 15-Dec-2022 |
Jens Wiklander <jens.wiklander@linaro.org> |
GP131: Update TEE_SetOperationKey*()
Update TEE_SetOperationKey() and TEE_SetOperationKey2() according to TEE Internal Core API version 1.3.1.
Compatibility functions for v1.1 are added due an inco
GP131: Update TEE_SetOperationKey*()
Update TEE_SetOperationKey() and TEE_SetOperationKey2() according to TEE Internal Core API version 1.3.1.
Compatibility functions for v1.1 are added due an incompatible change highlighted by the GP compliance test suite. Prior to 1.3 the functions where should panic if operation state isn't "initial", in 1.3 they are instead required to always reset the operation state to "initial".
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| e64b7b2e | 09-Dec-2022 |
Jens Wiklander <jens.wiklander@linaro.org> |
GP131: add support for TEE_MALLOC_NO_SHARE
Adds support for the TEE_MALLOC_NO_SHARE hint to TEE_Malloc(). With this there is a check in TEE_OpenTASession() and TEE_InvokeTACommand() to see that buff
GP131: add support for TEE_MALLOC_NO_SHARE
Adds support for the TEE_MALLOC_NO_SHARE hint to TEE_Malloc(). With this there is a check in TEE_OpenTASession() and TEE_InvokeTACommand() to see that buffers allocated with this flag are passed on to other TAs.
A second memory pool is added to be used for memory allocations using this flag. This means a new configuration variable, TA_NO_SHARE_DATA_SIZE, for user_ta_header.h. It's set to 0 by default, so by default nothing can be allocated using the TEE_MALLOC_NO_SHARE hint.
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 24ea7613 | 06-Dec-2022 |
Jens Wiklander <jens.wiklander@linaro.org> |
GP131: add TEE_DigestExtract()
Adds TEE_DigestExtract() to support Extendable Output Functions, that is, for now TEE_ALG_SHAKE128 and TEE_ALG_SHAKE256.
Reviewed-by: Etienne Carriere <etienne.carrie
GP131: add TEE_DigestExtract()
Adds TEE_DigestExtract() to support Extendable Output Functions, that is, for now TEE_ALG_SHAKE128 and TEE_ALG_SHAKE256.
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 260b4028 | 02-Dec-2022 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: crypto: add API for SHA-3
Adds an API for the SHA-3 [1] algorithms SHA3-224, SHA3_256, SHA3_384, SHA3_512, SHAKE128, and SHAKE256. SHAKE128 and SHAKE256 are Extendable-Output Functions (XOF),
core: crypto: add API for SHA-3
Adds an API for the SHA-3 [1] algorithms SHA3-224, SHA3_256, SHA3_384, SHA3_512, SHAKE128, and SHAKE256. SHAKE128 and SHAKE256 are Extendable-Output Functions (XOF), but handled as hashes in the API.
Adds API for SHA-3 based HMAC functions.
For XOF algorithms crypto_hash_final() can be called multiple times and generate an arbitrary amount of data. Note that this data will have a common prefix if done over the same input (see A.2 in [1]).
[1] https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.202.pdf
Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| cff9b486 | 09-Dec-2022 |
Jens Wiklander <jens.wiklander@linaro.org> |
GP131: add missing TEE_ALG_* and TEE_TYPE_* defines
Adds the missing TEE_ALG_* and TEE_TYPE_* defines from the GlobalPlatform TEE Internal Core API v1.3.1 specification.
Reviewed-by: Jerome Forissi
GP131: add missing TEE_ALG_* and TEE_TYPE_* defines
Adds the missing TEE_ALG_* and TEE_TYPE_* defines from the GlobalPlatform TEE Internal Core API v1.3.1 specification.
Reviewed-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 ...
|
| c036e912 | 05-Dec-2022 |
Jens Wiklander <jens.wiklander@linaro.org> |
GP131: Update TEE_FreeOperation()
Update TEE_FreeOperation() according to TEE Internal Core API version 1.3.1. TEE_FreeOperation() does nothing if operation is TEE_HANDLE_NULL.
Reviewed-by: Jerome
GP131: Update TEE_FreeOperation()
Update TEE_FreeOperation() according to TEE Internal Core API version 1.3.1. TEE_FreeOperation() does nothing if operation is TEE_HANDLE_NULL.
Reviewed-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 ...
|
| d3efff0b | 05-Dec-2022 |
Jens Wiklander <jens.wiklander@linaro.org> |
GP131: add TA property gpd.ta.endian
Adds the new property "gpd.ta.endian" to report the endianness used by the TA.
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Etienne
GP131: add TA property gpd.ta.endian
Adds the new property "gpd.ta.endian" to report the endianness used by the TA.
Reviewed-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 ...
|
| fe03ed8b | 02-Dec-2022 |
Jens Wiklander <jens.wiklander@linaro.org> |
GP131: Update TEE_BigInt*() functions
Updates the following functions: - TEE_BigIntInitFMMContext() - TEE_BigIntFMMContextSizeInU32() - TEE_BigIntFMMSizeInU32() - TEE_BigIntInitFMMContext() - TEE_Bi
GP131: Update TEE_BigInt*() functions
Updates the following functions: - TEE_BigIntInitFMMContext() - TEE_BigIntFMMContextSizeInU32() - TEE_BigIntFMMSizeInU32() - TEE_BigIntInitFMMContext() - TEE_BigIntInitFMM() - TEE_BigIntShiftRight() according to TEE Internal Core API version 1.3.1. The modulusSizeInBits, len, and bufferLen parameters are changed to use size_t instead of uint32_t.
TEE_BigIntInitFMMContext1() is added.
TEE_BigIntInit() checks that supplied length isn't larger than "gpd.tee.arith.maxBigIntSize", based on CFG_TA_BIGNUM_MAX_BITS.
Reviewed-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 ...
|