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?
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,
I have an inhouse developed secure authentication program that uses certificate for authentication. I have used mbedtls library for the x.509 certificate verification purpose. In our custom PKI we have only three level of certificates, Root-CA -> Intermediate-CA -> Device-Cert.
The embedded device has very limited memory, so instead of sending whole certificate chain, the devices communicates intermediate_CA and device cert (in der format base64 encoded) in separate packet. Root-CA will be available on node as trusted-ca. Intermediate is verified against Root; then device cert is verified against intermediate.
The problem is, the poc developed on linux platform is working fine - but on embedded platform I encounter either 0x3b00(parsing failed) or 0x2700(with flag 8). Also the error code are inconsistent.
I verified the integrity of packet with certificate using crc16. So no chance of certificate getting corrupted. Also verified the certificate's base64 format integrity using crc16.
All certificates are sha256WithRSAEncryption; RSA Public-Key: (4096 bit)
Attached config.h on target platform for reference - could you help me if anything wrong with configuration.
While trying to trace, the flag was set from x509_crt.c from below code.
/* No parent? We're done here */
if( parent == NULL )
{
printf("NO_PARENT\r\n");
*flags |= MBEDTLS_X509_BADCERT_NOT_TRUSTED;
return( 0 );
}
Any clue would be helpful.
Thanks,
Gopi Krishnan
Hi All,
A gentle reminder that the US-Europe timezone-friendly MBed TLS Tech forum
is next Monday at 4:30 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 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
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,
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
Hi,
I am working on an issue related to memory leak in MBedTLS. We have
integrated MBedTLS code for below 3rd party HostAPD code integration .
https://github.com/prplfoundation/hostap [Hostapd]
Please refer to the Hostapd peer code implementation as provided in
the link below:
https://github.com/prplfoundation/hostap/blob/master/eap_example/eap_exampl…https://github.com/prplfoundation/hostap/blob/master/eap_example/eap_exampl…
The main function code snippet is provided below:
https://github.com/prplfoundation/hostap/blob/master/eap_example/eap_exampl…
if (eap_example_peer_init() < 0 ||
eap_example_server_init() < 0)
return -1;
do {
printf("---[ server ]--------------------------------\n");
res_s = eap_example_server_step();
printf("---[ peer ]----------------------------------\n");
res_p = eap_example_peer_step();
} while (res_s || res_p);
Since we are implementing code for peers hence we have removed the
server step. Now we need to keep monitoring for new connections /
failed connections and act accordingly we have modified the code to
something like below -
if (eap_example_peer_init() < 0 ||
eap_example_server_init() < 0)
return -1;
do {
res_p = eap_example_peer_step();
if (eap_ctx.eapNoResp || eap_ctx.eapFail) {
eap_client_peer_deinit();
eap_client_peer_init();
}
} while (1);
We have modified the loop such that it will keep iterating for new
connections and in case of failure, re-initialization is required. Is
my understanding correct? The issue I am facing is that the client
peer deinit method is not releasing all memory allocated during
eap_example_peer_step() function ( I understand while processing the
EAP TLS server request). The deinit is purely implemented to
deallocate memory initially allocated for a new connection using TLS?
void eap_client_peer_deinit(void)
{
eap_peer_sm_deinit(eap_ctx.eap);
eap_peer_unregister_methods();
wpabuf_free(eap_ctx.eapReqData);
os_free(eap_ctx.eap_config.identity);
os_free(eap_ctx.eap_config.password);
os_free(eap_ctx.eap_config.cert.ca_cert);
os_free(eap_ctx.eap_config.cert.client_cert);
os_free(eap_ctx.eap_config.cert.private_key);
}
where
void eap_peer_sm_deinit(struct eap_sm *sm)
{
if (sm == NULL)
return;
eap_deinit_prev_method(sm, "deinit");
eap_sm_abort(sm);
if (sm->ssl_ctx2)
tls_deinit(sm->ssl_ctx2);
tls_deinit(sm->ssl_ctx);
eap_peer_erp_free_keys(sm);
os_free(sm);
}
Can you please let me know whether we are deallocating memory correctly?
Thanks in advance.
Regards,
Prakash