| 00507861 | 10-Feb-2021 |
Alexander Zakharov <uglym8@gmail.com> |
core: libtomcrypt: add 3DES CMAC implementation
Add 3DES CMAC (NIST SP800-38B).
Signed-off-by: Alexander Zakharov <uglym8@gmail.com> Reviewed-by: Jerome Forissier <jerome@forissier.org> Acked-by: E
core: libtomcrypt: add 3DES CMAC implementation
Add 3DES CMAC (NIST SP800-38B).
Signed-off-by: Alexander Zakharov <uglym8@gmail.com> Reviewed-by: Jerome Forissier <jerome@forissier.org> Acked-by: Etienne Carriere <etienne.carriere@linaro.org> [jf: add commit description] 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 ...
|
| 55b5758d | 02-Feb-2021 |
Jerome Forissier <jerome@forissier.org> |
core: libtomcrypt: drop useless & before function names
There is no need to use & on a function name to obtain the function address. Drop the useless & characters.
Signed-off-by: Jerome Forissier <
core: libtomcrypt: drop useless & before function names
There is no need to use & on a function name to obtain the function address. Drop the useless & characters.
Signed-off-by: Jerome Forissier <jerome@forissier.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 301ade76 | 05-Nov-2020 |
Etienne Carriere <etienne.carriere@linaro.org> |
core: ltc: fix return value in crypto API SM2 PKA decrypt
Fix calloc() failure case in core crypto API function for SM2 PKE decryption. Prior this change the function failed but return 0/OK. This ch
core: ltc: fix return value in crypto API SM2 PKA decrypt
Fix calloc() failure case in core crypto API function for SM2 PKE decryption. Prior this change the function failed but return 0/OK. This change sets the return value to TEE_ERROR_OUT_OF_MEMORY before reaching the function exit sequence.
Fixes: f9a78287dd12 (core: ltc: add support for SM2 PKE) Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Jerome Forissier <jerome@forissier.org>
show more ...
|
| 9f543cd3 | 17-Nov-2020 |
Jerome Forissier <jerome@forissier.org> |
core: libtomcrypt: dh_make_key(): do not force bit 'xbits' to be 1
When xbits != 0, dh_make_key() generates a private key of size xbits as specified by GP ("TEE_ATTR_DH_X_BITS: If present, constrain
core: libtomcrypt: dh_make_key(): do not force bit 'xbits' to be 1
When xbits != 0, dh_make_key() generates a private key of size xbits as specified by GP ("TEE_ATTR_DH_X_BITS: If present, constrains the private value x to have [xbits] bits"). However, it also makes sure the top bit of the private key is 1. Not only is it not required by the spec, it is also a security vulnerability because it can drastically reduce the acceptable range for the key: 2^(xbits-1) <= X <= P - 2.
Note: this brings the LTC implementation in line with the MBed TLS one, see mbedtls_dhm_make_public().
Signed-off-by: Jerome Forissier <jerome@forissier.org> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 652a36ef | 17-Nov-2020 |
Jerome Forissier <jerome@forissier.org> |
core: libtomcrypt: dh_make_key(): remove useless code
In dh_make_key(), random data is copied into key->x by mp_read_unsigned_bin(), and immediately after key->x is overwritten by mp_mod(). Remove t
core: libtomcrypt: dh_make_key(): remove useless code
In dh_make_key(), random data is copied into key->x by mp_read_unsigned_bin(), and immediately after key->x is overwritten by mp_mod(). Remove the useless call.
Signed-off-by: Jerome Forissier <jerome@forissier.org> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 685d1524 | 02-Nov-2020 |
Cedric Neveux <cedric.neveux@nxp.com> |
core: ltc: fix SM2 PKE memory leak
In function `sm2_ltc_pke_decrypt`, the ecc_point `S` was not deleted if the following bignumber `h` initialization failed.
Fixes: f9a78287dd1 (core: ltc: add supp
core: ltc: fix SM2 PKE memory leak
In function `sm2_ltc_pke_decrypt`, the ecc_point `S` was not deleted if the following bignumber `h` initialization failed.
Fixes: f9a78287dd1 (core: ltc: add support for SM2 PKE) 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 ...
|
| 5328dfb1 | 02-Nov-2020 |
Cedric Neveux <cedric.neveux@nxp.com> |
core: ltc: change SM2 PKE to use crypto_ecc_[public/keypair]_ops
Change the crypto_acipher_sm2_pke_encrypt and crypto_acipher_sm2_pke_decrypt to use the crypto_ecc_public_ops and crypto_ecc_keypair_
core: ltc: change SM2 PKE to use crypto_ecc_[public/keypair]_ops
Change the crypto_acipher_sm2_pke_encrypt and crypto_acipher_sm2_pke_decrypt to use the crypto_ecc_public_ops and crypto_ecc_keypair_ops methods.
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 ...
|
| 1fa655fc | 07-Oct-2020 |
Cedric Neveux <cedric.neveux@nxp.com> |
core: ltc: set SM2 ECC Keys operations
Change the SM2 DSA sign/verify to be called through the allocated ECC keys operations like ECC sign/verify operations.
Signed-off-by: Cedric Neveux <cedric.ne
core: ltc: set SM2 ECC Keys operations
Change the SM2 DSA sign/verify to be called through the allocated ECC keys operations like ECC sign/verify operations.
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 ...
|
| b56ad90e | 06-Oct-2020 |
Cedric Neveux <cedric.neveux@nxp.com> |
libs: ltc and mbedtls introduce crypto_ecc[public/keypair]_ops
Change ECC call functions name to be able to use a ECC HW driver. At ECC public and keypair allocation, if success, set the key ops fie
libs: ltc and mbedtls introduce crypto_ecc[public/keypair]_ops
Change ECC call functions name to be able to use a ECC HW driver. At ECC public and keypair allocation, if success, set the key ops field to call the cryptographic operations linked to the key allocator.
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 ...
|
| 92e38694 | 12-Nov-2020 |
Jerome Forissier <jerome@forissier.org> |
core: ltc: use crypto_acipher_free_rsa_keypair() instead of open-coding
There is a function to free an RSA keypair, use it instead of duplicating the code.
Signed-off-by: Jerome Forissier <jerome@f
core: ltc: use crypto_acipher_free_rsa_keypair() instead of open-coding
There is a function to free an RSA keypair, use it instead of duplicating the code.
Signed-off-by: Jerome Forissier <jerome@forissier.org> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
show more ...
|
| 85f7c554 | 12-Nov-2020 |
Jerome Forissier <jerome@forissier.org> |
core: ltc: crypto_acipher_free_rsa_keypair(): add missing free for s->dq
The crypto_acipher_free_rsa_keypair() function lacks a call to crypto_bignum_free() for the dq member of the key. Add it.
Fi
core: ltc: crypto_acipher_free_rsa_keypair(): add missing free for s->dq
The crypto_acipher_free_rsa_keypair() function lacks a call to crypto_bignum_free() for the dq member of the key. Add it.
Fixes: a1d5c81f8834 ("crypto: add function to free rsa keypair") Signed-off-by: Jerome Forissier <jerome@forissier.org> Reviewed-by: Etienne Carriere <etienne.carriere@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 ...
|
| 8182792a | 23-Apr-2020 |
Khoa Hoang <admin@khoahoang.com> |
core: libtomcrypt: fix return code in convert_ltc_verify_status()
Calling TEE_AsymmetricVerifyDigest() with invalid RSA signature length cause TA to panic. By GP TEE Internal Core specs, TEE_Asymmet
core: libtomcrypt: fix return code in convert_ltc_verify_status()
Calling TEE_AsymmetricVerifyDigest() with invalid RSA signature length cause TA to panic. By GP TEE Internal Core specs, TEE_AsymmetricVerifyDigest() shouldn't cause panic when call with invalid signature length.
Fixes: a3f5668a0cae ("core: ltc: RSA signature verification: fix return code") Signed-off-by: Khoa Hoang <admin@khoahoang.com> Acked-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
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 ...
|
| a828d70f | 02-Apr-2020 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: ltc: use SHA-256 crypto accelerated function
Uses the recently provided accelerated SHA-256 function in LTC.
Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Jens Wikla
core: ltc: use SHA-256 crypto accelerated function
Uses the recently provided accelerated SHA-256 function in LTC.
Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 2b49b295 | 02-Apr-2020 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: ltc: use SHA1 crypto accelerated function
Uses the recently provided accelerated SHA1 function in LTC.
Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Jens Wiklander <
core: ltc: use SHA1 crypto accelerated function
Uses the recently provided accelerated SHA1 function in LTC.
Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| f9429266 | 30-Mar-2020 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: ltc: use AES crypto accelerated routines
Uses the recently provided accelerated AES crypto routines in LTC.
Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Jens Wiklan
core: ltc: use AES crypto accelerated routines
Uses the recently provided accelerated AES crypto routines in LTC.
Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 1bf41f99 | 30-Mar-2020 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: ltc: remove Arm SHA-256 CE routines
Removes the Arm CE routines accelerating SHA-256 in the LTC library.
This will later be added in common code to be shared with other crypto libraries etc.
core: ltc: remove Arm SHA-256 CE routines
Removes the Arm CE routines accelerating SHA-256 in the LTC library.
This will later be added in common code to be shared with other crypto libraries etc.
Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 0d9e74de | 30-Mar-2020 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: ltc: remove Arm SHA1 CE routines
Removes the Arm CE routines accelerating SHA1 in the LTC library.
This will later be added in common code to be shared with other crypto libraries etc.
Acked
core: ltc: remove Arm SHA1 CE routines
Removes the Arm CE routines accelerating SHA1 in the LTC library.
This will later be added in common code to be shared with other crypto libraries etc.
Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| ccf126a5 | 30-Mar-2020 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: ltc: remove Arm AES CE routines
Removes the Arm AES CE routines from the library.
This will later be added in common code to be shared with other crypto libraries etc.
Acked-by: Etienne Carr
core: ltc: remove Arm AES CE routines
Removes the Arm AES CE routines from the library.
This will later be added in common code to be shared with other crypto libraries etc.
Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 4576dbb3 | 30-Mar-2020 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: ltc: simplify _CFG_CORE_LTC_*_DESC logic
If a SHA-{256,384,512} or AES algorithm is needed in LTC a matching _CFG_CORE_LTC_*_DESC variable will be set. So only check the _CFG_CORE_LTC_*_DESC v
core: ltc: simplify _CFG_CORE_LTC_*_DESC logic
If a SHA-{256,384,512} or AES algorithm is needed in LTC a matching _CFG_CORE_LTC_*_DESC variable will be set. So only check the _CFG_CORE_LTC_*_DESC variable to see if a certain algorithm is needed.
Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@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 ...
|