| 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 ...
|
| 7fb525f1 | 23-Jan-2020 |
Jerome Forissier <jerome@forissier.org> |
Remove libmpa in favor of libmbedtls
We currently have two "big numbers" library, Mbed TLS and MPA. Both can be used by libutee to implement the TEE Internal Core API Arithmetical functions, and by
Remove libmpa in favor of libmbedtls
We currently have two "big numbers" library, Mbed TLS and MPA. Both can be used by libutee to implement the TEE Internal Core API Arithmetical functions, and by the TEE core or pseudo-TAs. This situation is reflected by two configuration variables allowing to choose between libmbedtls and libmpa:
- CFG_TA_MBEDTLS_MPI (default y) configures libutee, - CFG_CORE_MBEDTLS_MPI (default y) configures the TEE core/PTAs.
In addition there is CFG_TA_MBEDTLS (default y, mandatory when CFG_TA_MBEDTLS_MPI is y) to build libmbedtls and install it into the SDK for direct use by TAs (libmbedtls also has function to deal with certificates for instance).
MBed TLS has been supported and used by default for just over a year; and we have recently found an issue with the MPA implementation of the integer multiplication with modulus (mpa_mulmod()) [1] [2]. Therefore, now is a good time to remove libmpa and use libmbedtls instead.
Link: [1] https://github.com/OP-TEE/optee_os/pull/3541#issuecomment-577592381 Link: [2] https://github.com/OP-TEE/optee_test/pull/389 Signed-off-by: Jerome Forissier <jerome@forissier.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 17f326eb | 29-Jan-2020 |
Jerome Forissier <jerome@forissier.org> |
libfdt: move to version v1.5.1
Imports upstream libfdt version v1.5.1 [1]. Things worthy of note:
- SPDX license identifiers were added upstream in commit 94f87cd5b7c5 ("libfdt: Add dual GPL/BSD
libfdt: move to version v1.5.1
Imports upstream libfdt version v1.5.1 [1]. Things worthy of note:
- SPDX license identifiers were added upstream in commit 94f87cd5b7c5 ("libfdt: Add dual GPL/BSD SPDX tags to files missing license text"). They conflict with those we have added locally in commit 1bb929836182 ("Add SPDX license identifiers"). We added "BSD-2-Clause" while upstream added "GPL-2.0-or-later OR BSD-2-Clause". This commit keeps the upstream tags.
- At this stage we carry no local modification except for two minor things enabling C99 compliance: 1. Zero sized arrays at the end of structs fdt_node_header and fdt_property are changed from "[0]" to "[]", 2. An extra semicolon is removed after the static function overlay_fixup_one_phandle(). These changes were in the initial import already, commit b908c67504cd ("Import libfdt v1.4.1").
Link: [1] https://github.com/dgibson/dtc/tree/v1.5.1/libfdt Signed-off-by: Jerome Forissier <jerome@forissier.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 6b6195cb | 22-Jan-2020 |
Jerome Forissier <jerome@forissier.org> |
core: ltc: sm2: add missing status check
crypto_acipher_sm2_pke_decrypt() fails to check a return status from LibTomCrypt. Add the missing check.
Fixes: f9a78287dd12 ("core: ltc: add support for SM
core: ltc: sm2: add missing status check
crypto_acipher_sm2_pke_decrypt() fails to check a return status from LibTomCrypt. Add the missing check.
Fixes: f9a78287dd12 ("core: ltc: add support for SM2 PKE") 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 ...
|