Hi,
Referring to https://mbed-tls.readthedocs.io/en/latest/kb/how-to/generate-a-self-signed-…
I am trying to create mutual certificates for server / client self
signed certificates. As I derive from the web page the following steps
need to be followed:
Generic
gen_key type=rsa rsa_keysize=2048 filename=ca.key format=pem
cert_write selfsign=1 issuer_key=ca.key
issuer_name=CN=myserver,O=myorganization,C=NL
not_before=20130101000000 not_after=20251231235959 is_ca=1
max_pathlen=0 output_file=my_crt.crt
Server Side:
What steps to do to create the following files where server.crt is
server side certificate, sever.key is the server private key and
trusted.pem is the CA that it trusts.
server.crt, server.key, trusted.pem[trusted.pem==>is it my_crt.crt]
Do we need to create new server keys and certificates then do we need
to bundle them - I am not sure how and what steps to do?
Client Side
What steps to do to create the following file where client.crt is
client side certificate, client.key is the client private key and
trusted.pem is the CA that it trusts.
client.crt, client.key, trusted.pem[trusted.pem==>is it my_crt.crt]
Do we need to create new client keys and certificates then do we need
to bundle them - I am not sure how and what steps to do?
Objective:
Objective is that client and server should be able to connect securely
successfully using their certs
Request to provide help related to the generation of self-signed
client / server certs that can be used for SSL handshake using MBedTLS
library.
Regards,
Prakash
Hi all,
Given TLS 1.3 has added two new cipher suites in RFC 8998 (
https://datatracker.ietf.org/doc/html/rfc8998), it would be useful to add
these algorithms and ciphersuites in Mbedtls.
CipherSuite TLS_SM4_GCM_SM3 = { 0x00, 0xC6 };
CipherSuite TLS_SM4_CCM_SM3 = { 0x00, 0xC7 };
There are some posts in this topic,
https://github.com/Mbed-TLS/mbedtls/pull/4091,
https://github.com/Mbed-TLS/mbedtls/pull/1620. But SM2/3/4 have not been
added in recent versions(e.g., 3.6).
I have implemented SM3, SM4 as standalone code(
https://github.com/zliucd/cryptoshark), and want to port the code to
Mbedtls while supporting SM2. However, to fully support the two new cipher
suites, we need to add lots of other code. The first step is to add SM2,
SM3 and SM as standalone ciphers.
Thanks for any comments.
Zhi
Hi Mbed TLS users,
We have released Mbed TLS versions 3.6.0 LTS and 2.28.8.
These releases of Mbed TLS address several security issues, provide bug fixes, and bring other minor changes. Full details are available in the release notes (https://github.com/Mbed-TLS/mbedtls/releases/tag/v3.6.0, https://github.com/Mbed-TLS/mbedtls/releases/tag/v2.28.8).
We recommend all users to consider whether they are impacted, and to upgrade appropriately.
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
--
Mbed-tls-announce mailing list -- mbed-tls-announce(a)lists.trustedfirmware.org
To unsubscribe send an email to mbed-tls-announce-leave(a)lists.trustedfirmware.org
Hello Mbed-TLS team,
I am reaching out for guidance on an issue I've encountered while integrating MbedTLS for HTTPS requests using the coreHTTP stack alongside FreeRTOSplusTCP on an STM32F4 device. Although I have successfully implemented an HTTP client, moving to HTTPS has presented some challenges.
My approach has included several adjustments to the mbedtls_config file, such as:
- Integrating a Random Number Generator (RNG) from STM32 within the mbed_Entropy_poll function.
- Utilizing the calloc and free functions provided by FreeRTOS.
- Modifying the search algorithm to correctly handle null-terminated PEM certificates.
Despite these efforts, I am unable to establish a connection to the server, with the process consistently failing during the TLS handshake phase. Specifically, the client hello message is transmitted from my device, but no response is received from the server, resulting in an MBEDTLS_INTERNAL_ERROR.
Enclosed with this email are my mbedtls_config file and a detailed account of the issue as posted on the FreeRTOS forum<https://forums.freertos.org/t/integration-of-ssl-in-corehttp/19561/11>. While I do not expect a full code review<https://github.com/AshvajitP/Eth_FreeRTOS_F4>, any insights into potential causes for this type of handshake failure would be greatly appreciated.
Thank you for your time and assistance.
Regards,
Ashvajit Prasad
I saw the following comment when configuring Record Size Limit Extension (RFC 8449) in `mbedtls_config.h` [1]:
> This extension is currently in development and must NOT be used except for testing purposes.
Is this still accurate? What functionality is missing for full RFC 8449 support? Is this feature planned for a specific date?
[1] https://github.com/Mbed-TLS/mbedtls/blob/611f899c0c9d397baedfaec34ea0861ad2…
Hi,
We are integrating https://github.com/prplfoundation/hostap code into
our project that makes uses of crypto and SSL functionality. Their
code is so written that they have interfaces defined where crypto and
SSL 3rd party algorithms can be called and implemented.
We are stuck implementing those APIs interfaces using MBedTLS and in
need of help for its implementation. Referring to the below set of
interfaces as defined in
https://github.com/prplfoundation/hostap/blob/master/src/crypto/tls_none.c
we need to implement required code for MBedTLS.
I am in need help implementing below API:
struct tls_connection * tls_connection_init(void *tls_ctx) where
tls_connection is below defined type [user defined type - hope is
correct implementation]:
struct tls_connection {
mbedtls_ssl_context *ssl;
keyman_creds *cr;
};
We have made the below implementation
struct tls_connection * tls_connection_init(void *ssl_ctx)
{
mbedtls_ssl_context *mssl_ctx = ssl_ctx;
struct tls_connection *conn;
conn = os_zalloc(sizeof(*conn));
if (conn == NULL) {
return NULL;
}
conn->ssl = mssl_ctx ;
conn->cr = NULL;
mbedtls_ssl_set_bio(ssl_ctx, NULL, net_send, net_recv, NULL);
return conn;
}
If my above implementation is correct please let me know how to
implement our own net_send and net_recv function. There are many
buffer declaration in mbedtls_ssl_context I am not sue what algorithm
to use to read complete / remaining bytes using internal data
structure :
int net_recv(void *ctx, unsigned char *buf, size_t len)
{
/* how to implement */
}
int net_send(void *ctx, const unsigned char *buf, size_t len)
{
/* how to implement */
}
Thanks in advance.
Regards,
Prakash
Hi,
Please also let me know the features of PSA in MbedTLS. I found this
related document -
https://mbed-tls.readthedocs.io/en/latest/getting_started/psa/.
Is PSA related to Platform Security Architecture or is related to TLS security?
How will the inclusion and non-inclusion of PSA will differ in terms
of security?
Thanks in advance.
Regards,
Prakash
Hello,
Bignum is a very useful feature in Mbedtls, which is a part to
libmbedcrypto.a. I want to build this module only as a standalone static
library. However, I find it's difficult to modify CMakelists.txt to do
this.
I appreciate your suggestions.
Blade
Hi,
I am trying to compile MbedTLS 3.5.2 release without PSA but get below
error message:
mbedtls/check_config.h:62:2: #error "MBEDTLS_ECP_DP_BP256R1_ENABLED
defined, but not its PSA counterpart"
mbedtls/check_config.h:66:2: #error "MBEDTLS_ECP_DP_BP384R1_ENABLED
defined, but not its PSA counterpart"
mbedtls/check_config.h:70:2: #error "MBEDTLS_ECP_DP_BP512R1_ENABLED
defined, but not its PSA counterpart"
mbedtls/check_config.h:74:2: #error "MBEDTLS_ECP_DP_CURVE25519_ENABLED
defined, but not its PSA counterpart"
mbedtls/check_config.h:78:2: #error "MBEDTLS_ECP_DP_CURVE448_ENABLED
defined, but not its PSA counterpart"
mbedtls/check_config.h:82:2: #error "MBEDTLS_ECP_DP_SECP192R1_ENABLED
defined, but not its PSA counterpart"
mbedtls/check_config.h:86:2: #error "MBEDTLS_ECP_DP_SECP224R1_ENABLED
defined, but not its PSA counterpart"
mbedtls/check_config.h:90:2: #error "MBEDTLS_ECP_DP_SECP256R1_ENABLED
defined, but not its PSA counterpart"
mbedtls/check_config.h:94:2: #error "MBEDTLS_ECP_DP_SECP384R1_ENABLED
defined, but not its PSA counterpart"
mbedtls/check_config.h:98:2: #error "MBEDTLS_ECP_DP_SECP521R1_ENABLED
defined, but not its PSA counterpart"
mbedtls/check_config.h:102:2: #error "MBEDTLS_ECP_DP_SECP192K1_ENABLED
defined, but not its PSA counterpart"
mbedtls/check_config.h:111:2: #error "MBEDTLS_ECP_DP_SECP256K1_ENABLED
defined, but not its PSA counterpart"
mbedtls/check_config.h:391:2: #error
"MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED defined, but not all
prerequisites"
mbedtls/check_config.h:397:2: #error
"MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED defined, but not all
prerequisites"
mbedtls/check_config.h:406:2: #error
"MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED defined, but not all
prerequisites"
mbedtls/check_config.h:418:2: #error
"MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED defined, but not all
prerequisites"
mbedtls/check_config.h:425:2: #error
"MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED defined, but not all
prerequisites"
mbedtls/check_config.h:481:2: #error "MBEDTLS_LMS_C requires
MBEDTLS_PSA_CRYPTO_C and PSA_WANT_ALG_SHA_256"
mbedtls/check_config.h:725:2: #error "MBEDTLS_PLATFORM_NV_SEED_ALT
defined, but not all prerequisites"
mbedtls/check_config.h:879:2: #error
"MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_EPHEMERAL_ENABLED defined, but
not all prerequisites"
mbedtls/check_config.h:885:2: #error
"MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_EPHEMERAL_ENABLED defined,
but not all prerequisites"
Regards,
Prakash
Hi,
I am trying to build MbedtLS 3.5.2 and get the below error:
mbedtls/library/psa_crypto_storage.c:23:23: psa/error.h: No such file
or directory
mbedtls/library/psa_crypto_storage.c:24:42:
psa/internal_trusted_storage.h: No such file or directory
I searched all thru the directories and found error.h in mbetls
directory but could not find internal_trusted_storage.h header file?
#if defined(MBEDTLS_PSA_ITS_FILE_C)
#include "psa_crypto_its.h"
#else /* Native ITS implementation */
#include "psa/error.h"
#include "psa/internal_trusted_storage.h"
#endif
Regards,
Prakash
Hi Team,
Referring to MBed release page -
https://github.com/Mbed-TLS/mbedtls/releases?page=1 I see that there has
been constant release periodically from Jul 27, 2018 mbedtls-2.1.14
till Nov 8, 2023 v3.5.1.
In the same context I understand that with each release there have been
fixes and new features / enhancement implementation. There was a project
that I was working in year 2020 were we tried to integrate MBed TLS in EAP
https://github.com/prplfoundation/hostap. It was a practice exercise that
our team did that time. I have not much idea as to which MBed TLS version
was opted and integrated then.
Now that so many new releases are made after 2020 - are older versions can
be taken as stable?
Is it that we should take the latest version and try again from scratch?
Thanks in advance.
Regards,
Prakash
Hello,
I have a simple http(s) server running on embedded platform using mbedtls.
Using ssl session cache significantly improves the throughput. However
while it works flawlessly in chromium based browser I noticed that in
Firefox it does not work at all.
Following there is a short snippet of my accept routine. Am I doing
something wrong?
...
mbedtls_ssl_conf_session_cache(&ssl_ctx->conf, &server_cache,
mbedtls_ssl_cache_get,
mbedtls_ssl_cache_set);
mbedtls_ssl_init(*ssl);
rc = mbedtls_ssl_setup(*ssl, &ssl_ctx->conf);
if (rc < 0) {
mbedtls_ssl_free(*ssl);
mg_free(*ssl);
*ssl = NULL;
return -ENOMEM;
}
mbedtls_ssl_set_bio(*ssl, sock, mbedtls_net_send, mbedtls_net_recv, NULL);
rc = mbed_ssl_handshake(*ssl);
...
best regards
Jan
Hi,
We are trying to integrate MBedTLs 3.5.2 release code into our
project. In the same regards we need your help for all information as
requested below - please do provide your valuable information:
1. Please confirm if all source and include files for MbedTLs 3.5.2
are available in below directories, so that we make use of these file
only (libraries can be built independently and have no dependency with
other files in other folder) -
mbedtls-3.5.2\include\mbedtls
mbedtls-3.5.2\include\psa
mbedtls-3.5.2\library
2. We are using our own RTOS threads instead of Posix or other
variants. Is there any specific configuration we need to do / setup?
3. We want to use as much small memory as possible - please let me
know the required configuration for the same?
4. Please let us know the various configuration / setup details that
we should do for the MBedTLS 3.5.2 codebase?
5. Any other references and information related to configuration /
setup / compilation will be an added advantage.
Thanks in advance and please let me know in case of any issues or concerns.
Regards,
Prakash
Hi,
Iam trying to import an ECC privatekey(parsed through mbedtls_parse_key()) to PSA (psa_import_key()) (for ECDSA NIST-P256-SECP-R1), by following the suggestions here ==>
https://github.com/Mbed-TLS/mbedtls/blob/development/docs/psa-transition.md (under the heading - Importing a PK key by export-import for an ECC private key).
But, i get an undefined reference to `mbedtls_ecp_export' error. Is there a special flag that controls this?
I can see that the definition of this function does exist in ecp.c.
Kind Regards,
Mathi.
Hi Shripad,
Cross-posting to mbed-tls ML.
I noticed though you already sent the same query to this list.
Regards,
Olivier.
________________________________
From: shripad.nunjundarao--- via TF-A <tf-a(a)lists.trustedfirmware.org>
Sent: 06 March 2024 05:39
To: tf-a(a)lists.trustedfirmware.org <tf-a(a)lists.trustedfirmware.org>
Subject: [TF-A] mbedtls and PQC algorithms support
Hi,
Is there a plan for mbedtls to add support for PQC algorithms (Dilithium/Khyber)?
regards,
/Shripad
--
TF-A mailing list -- tf-a(a)lists.trustedfirmware.org
To unsubscribe send an email to tf-a-leave(a)lists.trustedfirmware.org
Greetings,
## The Setup
Greetings,
## The Setup
I have a RENESAS board that has an integrated crypto processor and uses MbedTLS 2.25.0.
I have a SE (secure element) connected to it.
I am allowing hardware acceleration and PSA crypto API inside mbedtls_config.h
I registered my SE driver before calling psa_crypto_init().
The board connects to a web server and performs TLS handshake with the forced cipher `MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256`.
## The issue
The handshake fails during the step 8 when generating EC private key for ECDHE exchange.
I have tracked the issue through debug and it unfolded as follows inside `ssl_write_client_key_exchange()`:
- We enter the PSA crypto code from the pre-processor directives.
- We set the key attributes after initializing them to 0. (here usage_flags, algorithm, type and bits field are set but lifetime is still 0 from init at this point, this will count later on)
- The next function `psa_generate_key()` fails.
## In depth
When inside the `psa_generate_key()` function, we start the key creation inside `psa_start_key_creation()`.
But here, when validating the attributes of the key in `psa_validate_key_attributes()`, we are not able to rely on the SE to store the key due to it being volatile (lifetime is still 0), the driver is never called.
From there the program keeps going until trying to generate the key with the crypto processor from the board which does not support this type of key and returns unsupported error.
## Main question
Since the lifetime is forced to be representing a volatile key and since the driver for the SE is not called except for persistent ones, i cannot do this cryptographic step using the SE. Is the generation of the volatile key at this step meant to be handled by the MbedTLS library (software or hardware alt) and not by the PSA Crypto API (SE) due to the key being volatile ? If not, how is the Se supposed to be called in the handshake and what am i missing ?
## Discussion
I can pass the handshake when disabling hardware acceleration and using the software for cryptographic steps, but in this case i am not using the SE for them. Should the SE only be used to store the client certificate for mTLS case ?
## Note
I must use the MbedTLS version 2.25.0 since the SE driver I am using relies on this version.
Hi,
We are writing a client code which can accept or decline connection to the
server - so for each connection I understand there is a mbedtls_ssl_context
data established. Once the same is closed or not required we need to do
deinitialize or free memory allocated to its member variables like - we
need to free all memory allocated since we need it back else our
application will run out of memory like:
os_free(mbed_ctx->handshake);
os_free(mbed_ctx->transform_negotiate);
os_free(mbed_ctx->session_negotiate);
os_free(mbed_ctx->in_buf);
os_free(mbed_ctx->out_buf);
But there are many member variables which also need to free memory if
allocated and assigned to it.
Is there a function / method that can free all memory
for mbedtls_ssl_context instance variable?
Thanks in advance.
Regards,
Prakash
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
Hi,
Please note that I needed to compile and work with MBed TLS version 2.19.1
https://github.com/Mbed-TLS/mbedtls/releases/tag/mbedtls-2.19.1
However I am unable to compile the code / examples in it - i get below
error:
*$ cmake .CMake Deprecation Warning at CMakeLists.txt:1
(cmake_minimum_required): Compatibility with CMake < 2.8.12 will be
removed from a future version of CMake. Update the VERSION argument <min>
value or use a ...<max> suffix to tell CMake that the project does not
need compatibility with older versions.-- Selecting Windows SDK version
10.0.19041.0 to target Windows 10.0.22631.CMake Error at CMakeLists.txt:192
(add_subdirectory): add_subdirectory given source "crypto/3rdparty" which
is not an existing directory.CMake Error at CMakeLists.txt:199
(add_subdirectory): add_subdirectory given source "crypto/library" which
is not an existing directory.CMake Error at CMakeLists.txt:200
(add_subdirectory): add_subdirectory given source "crypto/include" which
is not an existing directory.CMake Warning (dev) at
programs/ssl/CMakeLists.txt:37 (target_sources): Policy CMP0076 is not
set: target_sources() command converts relative paths to absolute. Run
"cmake --help-policy CMP0076" for policy details. Use the cmake_policy
command to set the policy and suppress this warning. An interface source
of target "ssl_client2" has a relative path.This warning is for project
developers. Use -Wno-dev to suppress it.CMake Warning (dev) at
programs/ssl/CMakeLists.txt:44 (target_sources): Policy CMP0076 is not
set: target_sources() command converts relative paths to absolute. Run
"cmake --help-policy CMP0076" for policy details. Use the cmake_policy
command to set the policy and suppress this warning. An interface source
of target "ssl_server2" has a relative path.This warning is for project
developers. Use -Wno-dev to suppress it.CMake Warning (dev) at
programs/test/CMakeLists.txt:31 (target_sources): Policy CMP0076 is not
set: target_sources() command converts relative paths to absolute. Run
"cmake --help-policy CMP0076" for policy details. Use the cmake_policy
command to set the policy and suppress this warning. An interface source
of target "query_compile_time_config" has a relative path.This warning is
for project developers. Use -Wno-dev to suppress it.*
I tried removing the errors from the CmakeFile.txt but now get below error:
*$ cmake --build .Microsoft (R) Build Engine version 16.11.2+f32259642 for
.NET FrameworkCopyright (C) Microsoft Corporation. All rights
reserved.MSBUILD : error MSB1009: Project file does not exist.Switch:
ALL_BUILD.vcxproj*
Also
make all
Makefile:84: ../crypto/3rdparty/Makefile.inc: No such file or directory
make[1]: *** No rule to make target '../crypto/3rdparty/Makefile.inc'.
Stop.
Makefile:19: recipe for target 'lib' failed
make: *** [lib] Error 2
Please let me know how to resolve them and compile MBedTLS version 2.19.1
code?
Thanks in advance.
Regards,
Prakash