| #
86ee543b |
| 07-Mar-2024 |
Sami Tolvanen <samitolvanen@google.com> |
core: pass TEE_ATTR_RSA_OAEP_MGF_HASH to RSA-OAEP implementations
OP-TEE currently doesn't support using a different hash for MGF1 with RSA-OAEP. However, this is required for AOSP compatibility (e.
core: pass TEE_ATTR_RSA_OAEP_MGF_HASH to RSA-OAEP implementations
OP-TEE currently doesn't support using a different hash for MGF1 with RSA-OAEP. However, this is required for AOSP compatibility (e.g. in EncryptionOperationsTest.RsaOaepWithMGFDigestSuccess [1]).
Pass the MGF1 attribute to crypto implementations. Note that only libtomcrypt supports this feature at the moment, so other implementations will either fail or fall back to libtomcrypt when passed a different MGF1 hash.
Link: https://android.googlesource.com/platform/hardware/interfaces/+/refs/heads/main/security/keymint/aidl/vts/functional/KeyMintTest.cpp#5552 [1] Signed-off-by: Sami Tolvanen <samitolvanen@google.com> Reviewed-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 ...
|
| #
46e25a17 |
| 14-Jul-2023 |
loubaihui <loubaihui1@huawei.com> |
crypto: rename struct x25519_keypair
Since X25519 and X448 have the same key pair structure, so we rename struct x25519_keypair as struct montgomery_keypair.
Signed-off-by: loubaihui <loubaihui1@hu
crypto: rename struct x25519_keypair
Since X25519 and X448 have the same key pair structure, so we rename struct x25519_keypair as struct montgomery_keypair.
Signed-off-by: loubaihui <loubaihui1@huawei.com> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| #
e2ec831c |
| 03-Jul-2023 |
Jihwan Park <jihwp@amazon.com> |
core: crypto_bignum_free(): add indirection and set pointer to NULL
To prevent human mistake, crypto_bignum_free() sets the location of the bignum pointer to NULL after freeing it.
Signed-off-by: J
core: crypto_bignum_free(): add indirection and set pointer to NULL
To prevent human mistake, crypto_bignum_free() sets the location of the bignum pointer to NULL after freeing it.
Signed-off-by: Jihwan Park <jihwp@amazon.com> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Joakim Bech <joakim.bech@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| #
c4cab13e |
| 20-Feb-2023 |
Clement Faure <clement.faure@nxp.com> |
core: crypto: fix memory leak in Ed25519 support
The software implementation of ED25519 algorithm has a memory leak in the key and key pair allocation. Upon every public key allocation, a key pair i
core: crypto: fix memory leak in Ed25519 support
The software implementation of ED25519 algorithm has a memory leak in the key and key pair allocation. Upon every public key allocation, a key pair is allocated (public and private components). When freeing the public key, only the public component is freed. To reproduce the issue:
$ while xtest 4016; do :; done
Until the following error:
* regression_4016 Test TEE Internal API ED25519 sign/verify E/LD: copy_section_headers:1124 sys_copy_from_ta_bin E/TC:? 0 ldelf_init_with_ldelf:131 ldelf failed with res: 0xffff000c /usr/src/debug/optee-test/master.imx-r0/host/xtest/regression_4000.c:6062: xtest_teec_open_session(&session, &crypt_user_ta_uuid, ((void *)0), &ret_orig) has an unexpected value: 0xffff000c = TEEC_ERROR_OUT_OF_MEMORY, expected 0x0 = TEEC_SUCCESS regression_4016 FAILED
To fix the memory leak, a separate public key allocation function must be defined along a ED25519 public key structure.
Fixes: 0aaad418ac8b ("core: crypto: add Ed25519 support") Signed-off-by: Clement Faure <clement.faure@nxp.com> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| #
6301ca1c |
| 24-Sep-2022 |
Jorge Ramirez-Ortiz <jorge@foundries.io> |
crypto: se050: updates to the crypto object deletion interface
Keys created on the Secure Element NVM via the PKCS#11 TA are removed by scanning the data buffer holding the reference to the key duri
crypto: se050: updates to the crypto object deletion interface
Keys created on the Secure Element NVM via the PKCS#11 TA are removed by scanning the data buffer holding the reference to the key during the release of the object.
The storage allocated to hold those keys (ECC/RSA) is always below the page size length which seems like a reasonable figure to use for future extensions.
- This commit avoids scanning objects larger than that length.
This commit also updates the interface to delegate the actual handling of the object to the crypto driver instead of passing just the raw data contained in the object.
The cryptographic layer is also being allowed to block the deletion of the object. This is to cover the scenario where the I2C device is not accessible while a reference to the key is being removed from the secure storage in the filesystem.
Incidentally also fixes regression 6018: this test releases an object of size 0xA0000 which can't be scanned due to this part of the code hitting an Out of Memory condition.
Signed-off-by: Jorge Ramirez-Ortiz <jorge@foundries.io> Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| #
03e07432 |
| 28-Sep-2022 |
Valerii Chubar <valerii_chubar@epam.com> |
ta: pkcs11: Add Ed25519 support
Add functionality to generate, import keys, sign/verify for ED25519, ED25519ctx and ED25519ph.
The values for the object identifies originates from: https://www.rfc-
ta: pkcs11: Add Ed25519 support
Add functionality to generate, import keys, sign/verify for ED25519, ED25519ctx and ED25519ph.
The values for the object identifies originates from: https://www.rfc-editor.org/rfc/rfc8420.html A.1. ASN.1 Object for Ed25519
The PKCS#11 Specification: https://docs.oasis-open.org/pkcs11/pkcs11-spec/v3.1/cs01/ pkcs11-spec-v3.1-cs01.pdf
Signed-off-by: Valerii Chubar <valerii_chubar@epam.com> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
show more ...
|
| #
a116848b |
| 12-Aug-2022 |
Valerii Chubar <valerii_chubar@epam.com> |
core: libtomcrypt: add Ed25519 support
Enable Ed25519 implementation of libtomcrypt and add the OP-TEE wrappers.
Signed-off-by: Valerii Chubar <valerii_chubar@epam.com> Signed-off-by: Sergiy Kibrik
core: libtomcrypt: add Ed25519 support
Enable Ed25519 implementation of libtomcrypt and add the OP-TEE wrappers.
Signed-off-by: Valerii Chubar <valerii_chubar@epam.com> Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com> Reviewed-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 ...
|
| #
90040fa4 |
| 06-May-2022 |
Sohaib ul Hassan <sohaib.ul.hassan@unikie.com> |
core: crypto: add X25519 support
This adds the X25519 core functionality and enables support for Curve25519 key attribute type for OP-TEE crypto syscalls.
Acked-by: Etienne Carriere <etienne.carrie
core: crypto: add X25519 support
This adds the X25519 core functionality and enables support for Curve25519 key attribute type for OP-TEE crypto syscalls.
Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Sohaib ul Hassan <sohaib.ul.hassan@unikie.com>
show more ...
|
| #
ff0c5d42 |
| 13-Nov-2021 |
Jorge Ramirez-Ortiz <jorge@foundries.io> |
core: crypto: Secure Element cryptographic interface
Extract cryptographic operations specific to Secure Elements from the more generic cryptographic interface.
Also, the Secure Channel Protocol03
core: crypto: Secure Element cryptographic interface
Extract cryptographic operations specific to Secure Elements from the more generic cryptographic interface.
Also, the Secure Channel Protocol03 is a global protocol supported by most SEs and not NXP SE05X specific. Use this commit to reflect this fact.
Signed-off-by: Jorge Ramirez-Ortiz <jorge@foundries.io> Reviewed-by: Etienne Carriere <etienne.carriere@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 ...
|
| #
a3ca687d |
| 24-Sep-2020 |
Jorge Ramirez-Ortiz <jorge@foundries.io> |
drivers: implement se050 driver
Add AES_CTR/RSA/RNG/HUK support for NXP SE050 via the Plug And Trust library.
Tested on imx8mm LPDDR EVK and imx6ull EVK.
Signed-off-by: Jorge Ramirez-Ortiz <jorge@
drivers: implement se050 driver
Add AES_CTR/RSA/RNG/HUK support for NXP SE050 via the Plug And Trust library.
Tested on imx8mm LPDDR EVK and imx6ull EVK.
Signed-off-by: Jorge Ramirez-Ortiz <jorge@foundries.io> Acked-by: Etienne Carriere <etienne.carriere@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 ...
|
| #
a1d5c81f |
| 11-Aug-2020 |
Elias von Däniken <elias.vondaeniken@bluewin.ch> |
crypto: add function to free rsa keypair
There was no function to proper free a rsa kepair from inside a PTA. Now there is crypto_acipher_free_rsa_keypair().
Signed-off-by: Elias von Däniken <elias
crypto: add function to free rsa keypair
There was no function to proper free a rsa kepair from inside a PTA. Now there is crypto_acipher_free_rsa_keypair().
Signed-off-by: Elias von Däniken <elias.vondaeniken@bluewin.ch> Acked-by: Jerome Forissier <jerome@forissier.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| #
4746d394 |
| 15-May-2020 |
Markus S. Wamser <github-dev@mail2013.wamser.eu> |
core: simple typo fixes in comments in core/include tree
* changed "the the" to "the" in crypto.h * changed "the the" to "if the" in handle.h
Signed-off-by: Markus S. Wamser <github-dev@mail2013.wa
core: simple typo fixes in comments in core/include tree
* changed "the the" to "the" in crypto.h * changed "the the" to "if the" in handle.h
Signed-off-by: Markus S. Wamser <github-dev@mail2013.wamser.eu> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
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 ...
|
| #
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 ...
|
| #
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 ...
|
| #
6b3a371c |
| 01-Mar-2019 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: remove algo from crypto_hash_*()
Removes the algo parameters from all crypto_hash_*() functions except crypto_hash_alloc_ctx().
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Ack
core: remove algo from crypto_hash_*()
Removes the algo parameters from all crypto_hash_*() functions except crypto_hash_alloc_ctx().
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|