Hello,
This is a request for feedback about the next major release of Mbed TLS
(TF-PSA-Crypto 1.0 + Mbed TLS 4.0). (Mbed TLS 3.6 LTS will remain
supported with its current feature set until at least Q2 2027.) Please
reply to this thread or on the GitHub issue linked below. If you wish to
leave feedback privately, you can reply privately and your feedback will
be anonymized before sharing outside Arm.
https://github.com/Mbed-TLS/TF-PSA-Crypto/issues/107
Should TF-PSA-Crypto 1.0 (and thus Mbed TLS 4.0) have an interface for
*pseudo*-random generation? It will, of course, still have a
pseudorandom generator (= deterministic random bit generator = DRBG)
internally, to power psa_generate_random(), psa_generate_key(), etc. The
question is whether there will still be a public interface to create
other DRBG instances, and if so, with what interface.
If you want to be able to create instances of HMAC_DRBG and CTR_DRBG
from application code in TF-PSA-Crypto 1.0, please let us know what your
use case is. In particular, what parameters do you need (HMAC_DRBG and
CTR_DRBG have many)? Do you need reseeding, and if so under whose
control (the DRBG, or the caller)? In the absence of feedback, it is
likely that HMAC_DRBG and CTR_DRBG will not be publicly available.
Best regards,
--
Gilles Peskine
Mbed TLS developer
Hi all,
I have a custom configuration where MBEDTLS_ECDSA_C is defined but MBEDTLS_PSA_CRYPTO_C and MBEDTLS_PSA_CRYPTO_CONFIG are not.
This leads to a compiler warning in e.g. psa_util.c because a zero-sized array is declared
(because PSA_VENDOR_ECC_MAX_CURVE_BITS is defined as 0).
As of C99, §6.7.5.2 Array declarators: "If the expression is a constant expression, it shall have a value greater than zero."
psa_util.c:
#if defined(MBEDTLS_PSA_UTIL_HAVE_ECDSA) // Line 368
int mbedtls_ecdsa_raw_to_der(...) // Line 433
unsigned char r[PSA_BITS_TO_BYTES(PSA_VENDOR_ECC_MAX_CURVE_BITS)]; // Line 436 --> becomes in my config: unsigned char r[0];
MBEDTLS_PSA_UTIL_HAVE_ECDSA is automatically defined in my configuration due to the following code in config_adjust_legacy_crypto.h:
#if defined(MBEDTLS_ECDSA_C) || (defined(MBEDTLS_PSA_CRYPTO_C) && \
(defined(PSA_WANT_ALG_ECDSA) || defined(PSA_WANT_ALG_DETERMINISTIC_ECDSA)))
#define MBEDTLS_PSA_UTIL_HAVE_ECDSA
#endif
PSA_VENDOR_ECC_MAX_CURVE_BITS only receives a non-zero value if a PSA_WANT_<CURVE>, e.g. PSA_WANT_ECC_BRAINPOOL_P_R1_256, is defined.
PSA_WANT_<CURVE> only gets defined in crypto_config.h if MBEDTLS_PSA_CRYPTO_CONFIG is defined (which it is not in my configuration).
I have worked around it by explicitly defining e.g. PSA_WANT_ECC_BRAINPOOL_P_R1_256 in my configuration.
But I believe there is some mismatch in the defines, at least in this example case, because mbedtls_ecdsa_raw_to_der() is only used in pk_wrap.c if MBEDTLS_USE_PSA_CRYPTO is defined.
Impact:
* In general, zero-sized arrays have undefined behavior in C (but are allowed by some compiler extensions) and thus behave differently for different compilers
--> you might want to review PSA_VENDOR_ECC_MAX_CURVE_BITS and PSA_VENDOR_FFDH_MAX_KEY_BITS (and possibly more definitions) that fall through to 0 and are used as array sizes.
* In my particular case, I believe code is compiled that is not needed (defines in psa_util.c and pk_wrap.c do not seem to match)
Hello,
This is a request for feedback about the next major release of Mbed TLS
(Mbed TLS 4.0). (Mbed TLS 3.6 LTS will remain supported with its current
feature set until at least Q2 2027.) Please reply to this thread or on
the GitHub issue linked below. If you wish to leave feedback privately,
you can reply privately and your feedback will be anonymized before
sharing outside Arm.
https://github.com/Mbed-TLS/mbedtls/issues/9307
Mbed TLS requires a C99 platform, with some pragmatic restrictions. One
restriction is that we do not require printf and friends to support %zu
for size_t printing. Starting with Mbed TLS 4.0, we are considering
requiring printf() and friends (or the mbedtls_printf() and friends
alternatives if overridden) to support %zu. This only affects the TLS
library, not X.509 and crypto.
Is it still necessary in 2025 to support platforms where printf() does
not support the z modifier?
Best regards,
--
Gilles Peskine
Mbed TLS developer
Hello,
This is a request for feedback about the next major release of Mbed TLS
(TF-PSA-Crypto 1.0 + Mbed TLS 4.0). (Mbed TLS 3.6 LTS will remain
supported with its current feature set until at least Q2 2027.) Please
reply to this thread or on the GitHub issue linked below. If you wish to
leave feedback privately, you can reply privately and your feedback will
be anonymized before sharing outside Arm.
https://github.com/Mbed-TLS/TF-PSA-Crypto/issues/106
We are evaluating build systems for TF-PSA-Crypto, and this will
influence the Mbed TLS build as well (the Mbed TLS build scripts will
call the TF-PSA-Crypto build scripts, whatever they are). Our current
thinking is that we would like to have *CMake as the sole build system*.
(We're still investigating whether CMake can do all we need.) That would
mean that we would no longer provide GNU makefiles or Visual Studio
solutions.
As this remains a C project, for just building the library, compiling
all the .c files with an include path covering all the .h files will
keep working in common cases (but, as today, it isn't something we
support officially). The main case I can think of where this wouldn't
work is when cryptographic accelerator support requires special includes
or compiler flags.
Are there environments where the use of CMake is a problem? What is the
oldest version of CMake that you'd like us to be compatible with?
Best regards,
--
Gilles Peskine
Mbed TLS developer
Hello,
This is a request for feedback about the next major release of Mbed TLS
(Mbed TLS 4.0). (Mbed TLS 3.6 LTS will remain supported with its current
feature set until at least Q2 2027.) Please reply to this thread or on
the GitHub issue linked below. If you wish to leave feedback privately,
you can reply privately and your feedback will be anonymized before
sharing outside Arm.
https://github.com/Mbed-TLS/mbedtls/issues/8170
We are considering removing support for RSA and RSA-PSK key exchanges in
Mbed TLS 4. These are cipher suites that use RSA encryption, as opposed
to cipher suites using a key agreement (ECDHE) plus RSA signature. These
key exchanges are hard to implement securely (we believe we got it
right, but it's very delicate code), and they add significantly to the
complexity of the TLS code. They have been formally deprecated for a
long time and were removed in TLS 1.3. However, I'm aware that some
ecosystems are clinging to RSA key exchange.
Are RSA-encryption key exchanges still relevant for Mbed TLS? If you
want Mbed TLS 4 to keep supporting RSA-encryption cipher suites in TLS
1.2, please let us know and tell us about your use cases.
Best regards,
--
Gilles Peskine
Mbed TLS developer
Hello,
This is a request for feedback about the next major release of Mbed TLS
(TF-PSA-Crypto 1.0 + Mbed TLS 4.0). (Mbed TLS 3.6 LTS will remain
supported with its current feature set until at least Q2 2027.) Please
reply to this thread or on the GitHub issue linked below. If you wish to
leave feedback privately, you can reply privately and your feedback will
be anonymized before sharing outside Arm.
https://github.com/Mbed-TLS/mbedtls/issues/8231
We currently have two implementations of accelerated AES on x86_64 using
AESNI (Intel AES acceleration): using assembly or using compiler
intrinsics. The assembly code works with GCC and Clang without any
compilation options, but not with MSVC. The intrinsics work with MSVC,
but not with ancient GCC/Clang and they require compiling at least
aesni.c with suitable CPU variant options (e.g. -maes -mpclmul for Clang).
We're considering removing the assembly implementation. Is there still
interest in compiling AESNI support with older compilers or with simple
build systems that don't pass machine options?
Best regards,
--
Gilles Peskine
Mbed TLS developer
+ Mbed TLS mailing list as well for visibility and any comments.
Regards,
Shebu
From: Zhang, Hao via TF-M <tf-m(a)lists.trustedfirmware.org>
Sent: Wednesday, June 5, 2024 12:37 AM
To: tf-m(a)lists.trustedfirmware.org
Subject: [TF-M] PSA Cryptoprocessor Driver Interface
Hi TF-M community,
TF-M allows Semiconductor vendors to plug in their HW accelerator using PSA cryptoprocessor driver interface. I have a couple of questions in terms of the driver interface.
1. To port customized HW accelerator to TF-M's Crypto service for TF-M v2.1.0 LTS using driver interface, for the multipart operation, https://github.com/zephyrproject-rtos/mbedtls/blob/zephyr/docs/proposed/psa… states that "A driver that implements a multi-part operation must define all of the entry points in this family as well as a type that represents the operation context." Take aead encrypt as an example, if the underlying hardware does not support aead_abort, could it implements aead_abort by simply return PSA_ERROR_NOT_SUPPORTED?
1. The driver interface depends heavily on psa_crypto_driver_wrappers.h to dispatch operations to customized HW accelerator, where the psa_crypto_driver_wrappers.h file is automatically generated by scripts/data_files/driver_templates/psa_crypto_driver_wrappers.h.jinja. To port customized HW accelerator to TF-M's Crypto service for TF-M v2.1.0 LTS, would the approach be creating a customized psa_crypto_driver_wrappers.h.jinja file, the driver description file in JSON, and entry point functions. If so and we are considering upstreaming TF-M in the future, all these files would go inside platform/ext/accelerator/<vendor name>. Efforts need to be made so files such as psa_crypto_driver_wrappers.h.jinja should point to mbedtls, right? Additionally, as .jinja is retiring (mentioned in another email exchange), how would semi vendors update psa_crypto_driver_wrappers.h in the future?
[https://opengraph.githubassets.com/c87e79773a7fb0841ea038f7cf3dfdf4170debb8…]<https://github.com/zephyrproject-rtos/mbedtls/blob/zephyr/docs/proposed/psa…>
mbedtls/docs/proposed/psa-driver-interface.md at zephyr * zephyrproject-rtos/mbedtls<https://github.com/zephyrproject-rtos/mbedtls/blob/zephyr/docs/proposed/psa…>
mbedtls module for Zephyr, this is not a mirror of the official mbedtls repository. - zephyrproject-rtos/mbedtls
github.com
Thank you very much!
Best regards
Hi,
Not sure whether I should report this as a bug or maybe an enhancement issue or maybe it is as-designed:
I recently migrated from 2.28.8 to 3.6.0 and noticed:
An X.509 certificate DN coded as T61 string (done automatically so by openssl for a DN that contains an underscore) is returned as a hex string in 3.6.0 while it is returned as a regular, human-readable string in 2.28.8.
As this is not working for us I patched mbedtls_c509_dn_gets() locally as shown below.
Please feedback whether you want me to report an issue or if the 3.6.0 behavior is as-designed for a good reason.
Best regards,
/Almut
--- mbedtls-3.6.0_orig/library/x509.c 2024-03-28 09:59:12.000000000 +0100
+++ mbedtls-3.6.0/library/x509.c 2024-05-21 10:43:43.327442284 +0200
@@ -840,9 +840,7 @@
MBEDTLS_X509_SAFE_SNPRINTF;
}
- print_hexstring = (name->val.tag != MBEDTLS_ASN1_UTF8_STRING) &&
- (name->val.tag != MBEDTLS_ASN1_PRINTABLE_STRING) &&
- (name->val.tag != MBEDTLS_ASN1_IA5_STRING);
+ print_hexstring = !MBEDTLS_ASN1_IS_STRING_TAG(name->val.tag);
if ((ret = mbedtls_oid_get_attr_short_name(&name->oid, &short_name)) == 0) {
ret = mbedtls_snprintf(p, n, "%s=", short_name);
I have a very basic use case, to use a buffer and perform ECDSA encryption in a TA application.
I also want to read back the private key which is generated.
I see functions like mbedtls_ecp_gen_key but I have failed to find enough details on what steps to follow to use this function.
It will be really helpful if I can be pointed to a example. Or let me know If there is some other way to achieve the end goal.