| eee637e7 | 10-Feb-2021 |
Alexander Zakharov <uglym8@gmail.com> |
Add 3DES CMAC implementation
CMAC is a Cipher-Based MAC that improves some of the security deficiencies found in CBC-MAC. It is described in NIST SP800-38B as a mode of operation for approved symmet
Add 3DES CMAC implementation
CMAC is a Cipher-Based MAC that improves some of the security deficiencies found in CBC-MAC. It is described in NIST SP800-38B as a mode of operation for approved symmetric block chipers, namely AES and TDEA.
CMAC has similar use cases and security guarantees as HMAC, with the difference that it uses a different primitive (symmetric cipher instead of hash function). CMAC may be appropriate for information systems in which an approved block cipher is more readily available than an approved hash function.
Commonly it is used for symmetric key diversification (ASC X9 TR 31-2018), data integrity assurance (ICV).
CMAC is public domain.
OP-TEE core already supports for AES CMAC, but not TDEA CMAC. This commit adds TDEA CMAC support.
Signed-off-by: Alexander Zakharov <uglym8@gmail.com> Reviewed-by: Jerome Forissier <jerome@forissier.org> Acked-by: Etienne Carriere <etienne.carriere@linaro.org> [jf: wrap commit description at 75 characters] Signed-off-by: Jerome Forissier <jerome@forissier.org>
show more ...
|
| 1e149c24 | 21-Jan-2021 |
Jerome Forissier <jerome@forissier.org> |
core: ltc: move sm2_kdf() to common core/crypto/sm2-kdf.c
The key derivation function sm2_kdf() is a helper function used by SM2 KEP (Key Exchange Protocol) and PKE (Private Key Encryption). It is c
core: ltc: move sm2_kdf() to common core/crypto/sm2-kdf.c
The key derivation function sm2_kdf() is a helper function used by SM2 KEP (Key Exchange Protocol) and PKE (Private Key Encryption). It is currently implemented in core/lib/libtomcrypt/sm2_kdf.c, next to the SM2 source code based on LibTomCrypt.
In order to provide an MBed TLS implementation of SM2, the helper function shall be outside the LibTomCrypt directory. Move it to core/crypto/sm2-kdf.c.
Signed-off-by: Jerome Forissier <jerome@forissier.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-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 ...
|
| 884fd190 | 02-Nov-2020 |
Cedric Neveux <cedric.neveux@nxp.com> |
core: crypto: add encrypt/decrypt to crypto_ecc_[public/keypair]_ops
Add encypt and decrypt methods to respectively the crypto_ecc_public_ops and the crypto_ecc_keypair_ops structure. Method used fo
core: crypto: add encrypt/decrypt to crypto_ecc_[public/keypair]_ops
Add encypt and decrypt methods to respectively the crypto_ecc_public_ops and the crypto_ecc_keypair_ops structure. Method used for the SM2 PKE algorithms.
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 ...
|
| 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 ...
|
| ea9ac29c | 13-Aug-2019 |
Cedric Neveux <cedric.neveux@nxp.com> |
drivers: crypto: generic resources for crypto MAC driver - MAC
Add a generic cryptographic driver MAC interface connecting TEE Crypto generic APIs to HW driver interface
Signed-off-by: Cedric Neveu
drivers: crypto: generic resources for crypto MAC driver - MAC
Add a generic cryptographic driver MAC interface connecting TEE Crypto generic APIs to HW driver interface
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 ...
|
| 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 ...
|
| 80f47278 | 30-Mar-2020 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: drop __weak from internal_aes_gcm_update_payload_blocks()
Removes the __weak attribute from internal_aes_gcm_update_payload_blocks() now that both AArch32 and AArch64 have an optimized replace
core: drop __weak from internal_aes_gcm_update_payload_blocks()
Removes the __weak attribute from internal_aes_gcm_update_payload_blocks() now that both AArch32 and AArch64 have an optimized replacement.
The previous __weak internal_aes_gcm_update_payload_blocks() is now moved into core/crypto/aes-gcm-sw.c with its helper functions.
Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 1df59751 | 30-Mar-2020 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: crypto: remove internal_aes_gcm_expand_enc_key()
Removes internal_aes_gcm_expand_enc_key() which is replaced by crypto_aes_expand_enc_key().
Reviewed-by: Etienne Carriere <etienne.carriere@li
core: crypto: remove internal_aes_gcm_expand_enc_key()
Removes internal_aes_gcm_expand_enc_key() which is replaced by crypto_aes_expand_enc_key().
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 8a15c688 | 30-Mar-2020 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: update AArch64 GHASH acceleration routines
Update AArch64 GHASH acceleration routines for improved performance.
The core parts of assembly and wrapper updates are written by Ard Biesheuvel <a
core: update AArch64 GHASH acceleration routines
Update AArch64 GHASH acceleration routines for improved performance.
The core parts of assembly and wrapper updates are written by Ard Biesheuvel <ard.biesheuvel@linaro.org>, see [1].
Link: [1] https://github.com/torvalds/linux/commit/22240df7ac6d76a271197571a7be45addef2ba15 Acked-by: Jerome Forissier <jerome@forissier.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 8f848cdb | 30-Mar-2020 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: crypto: add internal_aes_gcm_{en,de}crypt_block()
Adds internal_aes_gcm_encrypt_block() and internal_aes_gcm_decrypt_block() to encrypt or decrypt a well aligned AES-GCM payload block.
Review
core: crypto: add internal_aes_gcm_{en,de}crypt_block()
Adds internal_aes_gcm_encrypt_block() and internal_aes_gcm_decrypt_block() to encrypt or decrypt a well aligned AES-GCM payload block.
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 4f6d7160 | 30-Mar-2020 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: crypto: remove internal_aes_gcm_encrypt_block()
Replaces calls to internal_aes_gcm_encrypt_block() with calls to crypto_aes_enc_block(). Removes internal_aes_gcm_encrypt_block().
Reviewed-by:
core: crypto: remove internal_aes_gcm_encrypt_block()
Replaces calls to internal_aes_gcm_encrypt_block() with calls to crypto_aes_enc_block(). Removes internal_aes_gcm_encrypt_block().
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| d7fd8f87 | 30-Mar-2020 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: crypto: unaligned aes-gcm acceleration
The Arm CE code supports working with unaligned data. In order to make full use of that is the generic __weak function internal_aes_gcm_update_payload_bl
core: crypto: unaligned aes-gcm acceleration
The Arm CE code supports working with unaligned data. In order to make full use of that is the generic __weak function internal_aes_gcm_update_payload_block_aligned() replaced with internal_aes_gcm_update_payload_blocks(). The latter now supports working with unaligned buffers.
Acked-by: Jerome Forissier <jerome@forissier.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| b314df1f | 30-Mar-2020 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: crypto: refactor aes-gcm implementation
Adds struct internal_ghash_key to represent the ghash key instead of some lose fields inside struct internal_aes_gcm_state.
Software of CE configuratio
core: crypto: refactor aes-gcm implementation
Adds struct internal_ghash_key to represent the ghash key instead of some lose fields inside struct internal_aes_gcm_state.
Software of CE configuration is done explicitly in core/crypto/aes-gcm-sw.c, dropping the __weak attribute for all functions but internal_aes_gcm_update_payload_block_aligned() which is only overridden with CFG_CRYPTO_WITH_CE=y in AArch64.
Content of aes-gcm-private.h is moved into internal_aes-gcm.h.
internal_aes_gcm_gfmul() is made available for generic GF multiplication.
The CE versions of internal_aes_gcm_expand_enc_key() and internal_aes_gcm_encrypt_block() are now only wrappers around crypto_accel_aes_expand_keys() and crypto_accel_aes_ecb_enc().
Acked-by: Jerome Forissier <jerome@forissier.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 75fea8a9 | 30-Mar-2020 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: add accelerated SHA-256 routines
Adds an Arm CE accelerated SHA-256 function to core/arch/arm/crypto. The code originates from the previous implementation inside LTC library. With this multipl
core: add accelerated SHA-256 routines
Adds an Arm CE accelerated SHA-256 function to core/arch/arm/crypto. The code originates from the previous implementation inside LTC library. With this multiple crypto libraries can share the function.
The old CFG_CRYPTO_SHA256_ARM64_CE and CFG_CRYPTO_SHA256_ARM32_CE are replaced by CFG_CRYPTO_SHA256_ARM_CE.
CFG_CORE_CRYPTO_SHA256_ACCEL is introduced as to indicate that some kind of SHA-256 acceleration is available, not necessarily based on Arm CE.
Acked-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 ...
|
| 858d5279 | 30-Mar-2020 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: add accelerated SHA1 routines
Adds an Arm CE accelerated SHA1 function to core/arch/arm/crypto. The code originates from the previous implementation inside LTC library. With this multiple cryp
core: add accelerated SHA1 routines
Adds an Arm CE accelerated SHA1 function to core/arch/arm/crypto. The code originates from the previous implementation inside LTC library. With this multiple crypto libraries can share the function.
The old CFG_CRYPTO_SHA1_ARM64_CE and CFG_CRYPTO_SHA1_ARM32_CE are replaced by CFG_CRYPTO_SHA1_ARM_CE.
CFG_CORE_CRYPTO_SHA1_ACCEL is introduced as to indicate that some kind of SHA-1 acceleration is available, not necessarily based on Arm CE.
Acked-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 ...
|
| 06d2e416 | 30-Mar-2020 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: add accelerated AES routines
Adds Arm CE accelerated AES routines to core/arch/arm/crypto. The code originates from the previous implementation inside LTC library. With this multiple crypto li
core: add accelerated AES routines
Adds Arm CE accelerated AES routines to core/arch/arm/crypto. The code originates from the previous implementation inside LTC library. With this multiple crypto library can share these routines.
A new header file, <crypto/crypto_accel.h>, is added with primitive functions implementing crypto accelerated ciphers.
The old CFG_CRYPTO_AES_ARM64_CE and CFG_CRYPTO_AES_ARM32_CE are replaced by CFG_CRYPTO_AES_ARM_CE.
CFG_CORE_CRYPTO_AES_ACCEL is introduced as to indicate that some kind of AES acceleration is available, not necessarily based on Arm CE.
Acked-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 ...
|
| e43ab7a8 | 07-Aug-2019 |
Cedric Neveux <cedric.neveux@nxp.com> |
core: driver: generic resources for crypto cipher driver
Add a generic cryptographic Cipher driver interface connecting TEE Crypto generic APIs to HW driver interface
To make Cipher HW driver gener
core: driver: generic resources for crypto cipher driver
Add a generic cryptographic Cipher driver interface connecting TEE Crypto generic APIs to HW driver interface
To make Cipher HW driver generic and to reduce the amount of function parameters, add structure data for the initialization and update function driver call. Checks the Cipher operation's parameter in the generic part before calling the HW driver.
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> Reviewed-by: Etienne Carriere <etienne.carriere@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 ...
|