I am using MbedTLS client code based on this:
https://github.com/machinezone/IXWebSocket/blob/master/ixwebsocket/IXSocket…
I am connecting to a server via it's URL. However, I would like to connect directly using an IP address returned from running the traceroute command on the URL.
So I replaced the URL with the IP address. However, MBedTLS fails on the handshake:
https://github.com/machinezone/IXWebSocket/blob/master/ixwebsocket/IXSocket…
I get the error:
"error in handshake : X509 - Certificate verification failed, e.g. CRL, CA or signature check failed"
If I revert back to URL, it works. The IP address does exist.
How can I connect using the IP address, instead of the URL?
Hello,
Mbed TLS 3.6.0 was the first release to enable TLS 1.3 support by
default. Unfortunately, this breaks many applications that open a TLS
connection with default settings, which are now negotiating TLS 1.3
instead of TLS 1.2, but hit a difference in how Mbed TLS 3.6.0
implements the two versions of the protocol.
The most common symptom is: you are using the default configuration (or
something close), and your application fails in the handshake with an
internal error whenever it negotiates TLS 1.3. To resolve this, call
psa_crypto_init() before starting a TLS handshake.
For a list of other known issues, please see
https://github.com/Mbed-TLS/mbedtls/issues/9223
If you are encountering a problem due to the enablement of TLS 1.3 that
is not listed on that page, please let us know by opening an issue on
GitHub.
If no workaround or patch is available for your problem yet, you can
disable TLS 1.3 by calling mbedtls_ssl_conf_max_tls_version(ssl_config,
MBEDTLS_SSL_VERSION_TLS1_2) before mbedtls_ssl_setup().
We are planning to fix all the issues listed on that page before the
3.6.1 patch release. We do not yet have a date for the 3.6.1 release.
Best regards,
--
Gilles Peskine
Mbed TLS developer
Hi All,
A gentle reminder that the Asia-Europe timezone-friendly MBed TLS Tech
forum is next Monday at 10:00am PM UK time. Invite details can be found on
the online calendar here <https://www.trustedfirmware.org/meetings/>.
If you have any topics, please let Dave Rodgman know. :)
Best regards,
Don Harbin
TrustedFirmware Community Manager
don.harbin(a)linaro.org
ReplyReply to allForward
Compose:
Community activity: OpenCV, Sensors, AI
[image: Minimise][image: Pop-out][image: Close]
Compose:
Reminder: MBed TLS Tech Forum - Asia/Europe
[image: Minimise][image: Pop-out][image: Close]
Recipients
Hi TF-M and mbedtls community,
I am new to TF-M, I have a few questions about CryptoCell and random number generation. Thank you in advance.
1.
I figure there seems to have two CryptoCell 312 implementations within TF-M. One under lib/ext/cryptocell-312-runtime and the other under platform/ext/accelerator/cc312/cc312-rom. What are the difference between these two?
2.
For lib/ext/cryptocell-312-runtime, it does not define MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG whereas /ext/accelerator/cc312/cc312-rom does. Does that mean cryptocell-312-runtime is initiating RNG cryptodriver by using mbedtls_entropy_add_source whereas cc312-rom is using mbedtls_psa_external_get_random<https://github.com/zephyrproject-rtos/trusted-firmware-m/blob/8df9cc8baf462…>. If so, may I ask why these two cryptocells take two different approaches? I read from one of the documentation that mbedtls_psa_external_get_random is used when entropy is sufficient. So if entropy is sufficient, is it always preferred to have MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG defined and implements mbedtls_psa_external_get_random? What are the differences between the two approaches.
3.
I also found cryptocell-312-runtime defines the entry point function cc3xx_init_random<https://github.com/zephyrproject-rtos/trusted-firmware-m/blob/8df9cc8baf462…>. But since PSA random number entry point funciton is not complete, the cc3xx_init_random is not being called anywhere, right?
[https://opengraph.githubassets.com/17cdebc400b0ed807c620b586b21f3f77ff9c5d3…]<https://github.com/zephyrproject-rtos/trusted-firmware-m/blob/8df9cc8baf462…>
trusted-firmware-m/platform/ext/accelerator/cc312/cc312-rom/psa_driver_api/src/cc3xx_psa_random.c at 8df9cc8baf46252fd188bba1d87333a8daa9a5e8 · zephyrproject-rtos/trusted-firmware-m<https://github.com/zephyrproject-rtos/trusted-firmware-m/blob/8df9cc8baf462…>
Zephyr repository tracking https://git.trustedfirmware.org/trusted-firmware-m.git/ - zephyrproject-rtos/trusted-firmware-m
github.com
4.
I know random number generation PSA entry point function is in development, may I ask when that would be expected to complete?
Thank you very much!
Best regards,
Hao
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