Hi,
I'm working on a client application that will connect to an FTPS server (vsftpd) to download files.
Now, I have ca-cert, cert and key files all setup to work with curl like:
curl -3 -k -v --ftp-ssl --tlsv1.2 --ftp-ssl-reqd --ftp-pasv --verbose \
--ssl \
--cert ./en-cert.pem \
--cert-type PEM \
--key ./en-cert.key \
--key-type PEM \
--cacert ./ca-cert \
ftp://user:pass@10.10.100.1/test.txt -O
Now, I use the same cert, key & ca-cert with mbedtls but am unable to handshake, mbedtls_ssl_handshake()
keeps giving me an error, what is done in order:
- init cert, ca-cert, key, entropy, drbg, ssl, config
- parse ca-cert, cert & key
- seed RNG - mbedtls_ctr_drbg_seed with mbedtls_hardware_poll
- set config defaults MBEDTLS_SSL_IS_CLIENT, MBEDTLS_SSL_TRANSPORT_STREAM, MBEDTLS_SSL_PRESET_DEFAULT
- mbedtls_ssl_conf_ca_chain
- mbedtls_ssl_conf_rng with mbedtls_ctr_drbg_random
- mbedtls_ssl_conf_dbg
- mbedtls_ssl_conf_own_cert
- mbedtls_ssl_setup
- mbedtls_ssl_set_bio
- mbedtls_ssl_handshake
which up to the handshake all seems to go through without any issues.
When I look at it with wireshark, I see something like:
Response: 234 Proceed with negotiation.
Request:looks like the certificate jumbled up
Response 500 OOPS:
Response :SSL routines:ssl3_read_bytes:sslv3 alert certificate unknown
Any hints on how I best go about troubleshooting this? I have confirmed that ca-cert, cert & key are identical to the ones
that are used for the above curl command.
Thanks,
Hi,
Semantic versioning applies only to API compatibility but not for ABI. When we break the ABI we increase the SO version for that part of the library and this is how linux distributions normally track our ABI compatibility. Additionally, we try very hard not to break ABI at all in LTS versions.
You can find a detailed description what Mbed TLS promises regarding API/ABI compatibility:
https://github.com/ARMmbed/mbedtls/blob/development/BRANCHES.md
Kind regards,
Janos
From: mbed-tls <mbed-tls-bounces(a)lists.trustedfirmware.org> on behalf of Hugues De Valon via mbed-tls <mbed-tls(a)lists.trustedfirmware.org>
Date: Wednesday, 14 July 2021 at 17:09
To: mbed-tls(a)lists.trustedfirmware.org <mbed-tls(a)lists.trustedfirmware.org>
Subject: [mbed-tls] Question about dynamic linking, versioning and API/ABI stability
Hello,
We are using Mbed Crypto in our Parsec project through the psa-crypto Rust crate (https://github.com/parallaxsecond/rust-psa-crypto). We currently have Mbed Crypto through Mbed TLS 2.25.0 which we build statically from scratch by default.
We also offer the option to dynamically link with an Mbed Crypto library available on the system. Ideally, this would offer an easy and simple way to patch bug fixes without having to recompile everything.
However, as we observed API (and probably ABI) breaking changes over the past versions of Mbed TLS we were wondering if this (dynamic linking) was a model we should promote at all.
Is there a semantic versioning process currently applied in Mbed TLS? If we use Mbed TLS 3.0.0 in our crate, can we be sure than 3.x.y versions won’t contain any API/ABI breaking changes or is there nothing of the sort?
I believe that Mbed Crypto is catching up to be fully compliant with PSA Crypto 1.0.1. Once that will be the case, will its API/ABI be stable and follow the PSA Crypto semantic versioning?
It might be that the good solution is that we shouldn’t dynamically link with Mbed Crypto but always compile it from scratch as we do by default. I am just sending this email so that we follow the good approach!
Kind regards,
Hugues
Hello,
We are using Mbed Crypto in our Parsec project through the psa-crypto Rust crate (https://github.com/parallaxsecond/rust-psa-crypto). We currently have Mbed Crypto through Mbed TLS 2.25.0 which we build statically from scratch by default.
We also offer the option to dynamically link with an Mbed Crypto library available on the system. Ideally, this would offer an easy and simple way to patch bug fixes without having to recompile everything.
However, as we observed API (and probably ABI) breaking changes over the past versions of Mbed TLS we were wondering if this (dynamic linking) was a model we should promote at all.
Is there a semantic versioning process currently applied in Mbed TLS? If we use Mbed TLS 3.0.0 in our crate, can we be sure than 3.x.y versions won't contain any API/ABI breaking changes or is there nothing of the sort?
I believe that Mbed Crypto is catching up to be fully compliant with PSA Crypto 1.0.1. Once that will be the case, will its API/ABI be stable and follow the PSA Crypto semantic versioning?
It might be that the good solution is that we shouldn't dynamically link with Mbed Crypto but always compile it from scratch as we do by default. I am just sending this email so that we follow the good approach!
Kind regards,
Hugues
Hello, we are using the mbed-tls for secure communication for FTP. FTP
server is handling the client hello serially one at a time, one
communication is blocking other clients to communicate. What could be the
reason and how to solve this issue.
--
Thanks and Regards,
Sunil Jain
Gilles,
Thanks for getting me to try to read DER files. There must definitely be
something wrong in that area. I am speficying support for PEM in the
build but reading DER gets me past that error.
Searching further :-)
Again, thanks
Danny
On 05/07/2021 20:27, Gilles Peskine via mbed-tls wrote:
> Hello,
>
> The first thing when you see an unexpected error code is to look up the
> corresponding error message. Mbed TLS comes with a utility for that:
>
> programs/util/strerror 0x2180
> Last error was: -0x2180 - X509 - The CRT/CRL/CSR format is invalid,
> e.g. different type expected
>
> You can also search the error code in the source code:
>
> grep 0x2180 include/mbedtls/*.h
> include/mbedtls/x509.h:#define
> MBEDTLS_ERR_X509_INVALID_FORMAT -0x2180 /**< The
> CRT/CRL/CSR format is invalid, e.g. different type expected. */
>
> At first glance it looks like there's only one case for which CRT
> parsing return MBEDTLS_ERR_X509_INVALID_FORMAT as opposed to
> (MBEDTLS_ERR_X509_INVALID_FORMAT + low_level_error_code), and that's if
> the certificate doesn't parse like a DER format at the top level. A
> plausible reason for that is that the certificate is in PEM format and
> your build has PEM support turned off. If that's the case, convert the
> certifcate to DER when you copy it to the device. You can use the Mbed
> TLS utility programs/util/pem2der for that.
>
> Best regards,
>
--
Danny Backx - dannybackx(a)telenet.be - http://danny.backx.info
Hi, mbedtls experts
I note that there is AES NI support (aesni.c) on x86 platform.
I'm wondering why there is no SHA NI support for SHA1 and SHA256? How can I get SHA NI support? Should I choose another crypto library?
Thanks,
Jingdong
Hello,
The first thing when you see an unexpected error code is to look up the
corresponding error message. Mbed TLS comes with a utility for that:
programs/util/strerror 0x2180
Last error was: -0x2180 - X509 - The CRT/CRL/CSR format is invalid,
e.g. different type expected
You can also search the error code in the source code:
grep 0x2180 include/mbedtls/*.h
include/mbedtls/x509.h:#define
MBEDTLS_ERR_X509_INVALID_FORMAT -0x2180 /**< The
CRT/CRL/CSR format is invalid, e.g. different type expected. */
At first glance it looks like there's only one case for which CRT
parsing return MBEDTLS_ERR_X509_INVALID_FORMAT as opposed to
(MBEDTLS_ERR_X509_INVALID_FORMAT + low_level_error_code), and that's if
the certificate doesn't parse like a DER format at the top level. A
plausible reason for that is that the certificate is in PEM format and
your build has PEM support turned off. If that's the case, convert the
certifcate to DER when you copy it to the device. You can use the Mbed
TLS utility programs/util/pem2der for that.
Best regards,
--
Gilles Peskine
Mbed TLS developer
On 05/07/2021 18:10, Danny Backx via mbed-tls wrote:
>
> Hi,
>
> I must be missing something obvious but my code (on an ESP32) fails to
> accept an incoming connection.
>
> I tried the same certificate on an ESP32 sample, and it appears to
> work there.
>
> Does anyone have a clue where to look next ?
>
> Danny
>
> I (16:06:51.481) esp_https_server: performing session handshake
> E (16:06:51.483) x509_crt: x509_crt_parse_der_core -> 0x2180
> E (16:06:51.484) esp_tls_mbedtls: set_pki_context: public_cert
> 0x3ffdb924, len 5750 -> ret 0x2180
> E (16:06:51.493) esp-tls-mbedtls: mbedtls_x509_crt_parse returned -0x2180
> E (16:06:51.501) esp-tls-mbedtls: Failed to set server pki context
> E (16:06:51.508) esp-tls-mbedtls: Failed to set server configurations
> E (16:06:51.515) esp-tls-mbedtls: create_ssl_handle failed
> E (16:06:51.521) esp_https_server: esp_tls_create_server_session failed
> W (16:06:51.528) httpd: httpd_accept_conn: session creation failed
> W (16:06:51.538) httpd: httpd_server: error accepting new connection
>
> --
> Danny Backx - dannybackx(a)telenet.be - http://danny.backx.info
>
Hi,
I must be missing something obvious but my code (on an ESP32) fails to
accept an incoming connection.
I tried the same certificate on an ESP32 sample, and it appears to work
there.
Does anyone have a clue where to look next ?
Danny
I (16:06:51.481) esp_https_server: performing session handshake
E (16:06:51.483) x509_crt: x509_crt_parse_der_core -> 0x2180
E (16:06:51.484) esp_tls_mbedtls: set_pki_context: public_cert
0x3ffdb924, len 5750 -> ret 0x2180
E (16:06:51.493) esp-tls-mbedtls: mbedtls_x509_crt_parse returned -0x2180
E (16:06:51.501) esp-tls-mbedtls: Failed to set server pki context
E (16:06:51.508) esp-tls-mbedtls: Failed to set server configurations
E (16:06:51.515) esp-tls-mbedtls: create_ssl_handle failed
E (16:06:51.521) esp_https_server: esp_tls_create_server_session failed
W (16:06:51.528) httpd: httpd_accept_conn: session creation failed
W (16:06:51.538) httpd: httpd_server: error accepting new connection
--
Danny Backx - dannybackx(a)telenet.be - http://danny.backx.info
Hello everyone,
I am currently evaluating SSL with a local server and an STM32 device. I'm
unable to figure out why the decryption fails with CCM as the cipher suite.
FYI: I am using MbedTLS *v2.14.1.*
*Setup*:
I'm using *x86 local server* with *STM32* device as a client.
Here is what happens-
1. Software CCM implementation on the client:
When I use the *software* implementation of the CCM. Handshake and
decryption is *successful*. Therefore, I can stream
the data from STM32 and read it on the local server.
2. Hardware CCM implementation with MBEDTLS_CCM_ALT:
I have used ccm_alt.c provided from STM32Cube v1.9.0. Here, the
handshake is successful. But *decrypting* the
message *fails*.
The errors are:
ssl_decrypt_buf() returned -29056 (-0x7180)
mbedtls_ssl_read_record() returned -29056 (-0x7180)
Checks performed:
- Same certificates are used for SW and HW implementations.
- CCM self test returns '0' for both HW and SW CCM implementations.
- I have reserved enough heap, no memory issues.
Please find all the necessary data in the attachment provided. I have added
the logs from the server and the client. I have added the certificates and
the code files as well.
It would be of great help if somebody could point at what might be going
wrong.
Thank you!
Best regards,
Navin
Hi Shudong,
Mbed TLS currently does not provide EdDSA. The contribution by @aurel32 is a first step in this direction. The work leading up to a fully functional EdDSA implementation is tracked here:
https://github.com/ARMmbed/mbedtls/projects/2#column-11150355
Kind regards,
Janos
From: mbed-tls <mbed-tls-bounces(a)lists.trustedfirmware.org> on behalf of Shudong Zhang via mbed-tls <mbed-tls(a)lists.trustedfirmware.org>
Date: Wednesday, 30 June 2021 at 07:28
To: mbed-tls(a)lists.trustedfirmware.org <mbed-tls(a)lists.trustedfirmware.org>
Subject: [mbed-tls] Is the a version that can use the EdDSA signature algorithm currently?
Hello,
I want to use EdDSA signature algorithm, but I did’t find API for it in 2.26.0.Then I searched in the issue of Github and I found @aurel32 contributed some code about ed25519.But I am still not sure whether there are any versions under development that provide interface functions for EdDSA signature algorithm. Can someone help me answer my question?
Thanks and kind regards,
Shudong
Hello,
I want to use EdDSA signature algorithm, but I did’t find API for it in 2.26.0.Then I searched in the issue of Github and I found @aurel32 contributed some code about ed25519.But I am still not sure whether there are any versions under development that provide interface functions for EdDSA signature algorithm. Can someone help me answer my question?
Thanks and kind regards,
Shudong
Hi,
I have an ACME client library for esp32, and I try to extend it to
support multiple host names. First step is to include alternate names in
the CSR.
After I tried the ARMmbed issues forum, I was pointed to this list.
My code is in
http://svn.code.sf.net/p/esp32-acme-client/code/trunk/libraries/acmeclient/…
<http://svn.code.sf.net/p/esp32-acme-client/code/trunk/libraries/acmeclient/…>
(see function Acme::CreateAltUrlList) , the function below is an attempt
to do what I described, but doesn't work.
Can anyone help ?
Danny
int Acme::CreateAltUrlList(mbedtls_x509write_csr req) {
int l = 20;
int ret;
for (int i=0; alt_urls[i]; i++) {
l += strlen(alt_urls[i]) + 20;
}
unsigned char *buf = (unsigned char *)malloc(l), *p = buf + l;
int len = 0;
for (int i=0; alt_urls[i]; i++) {
MBEDTLS_ASN1_CHK_ADD(len, mbedtls_asn1_write_raw_buffer(&p, buf, (const
unsigned char *)alt_urls[i], strlen(alt_urls[i])));
MBEDTLS_ASN1_CHK_ADD(len, mbedtls_asn1_write_len(&p, buf,
strlen(alt_urls[i])));
MBEDTLS_ASN1_CHK_ADD(len, mbedtls_asn1_write_tag(&p, buf,
MBEDTLS_ASN1_CONTEXT_SPECIFIC | 2));
}
MBEDTLS_ASN1_CHK_ADD(len, mbedtls_asn1_write_len(&p, buf, len));
MBEDTLS_ASN1_CHK_ADD(len, mbedtls_asn1_write_tag(&p, buf,
MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE));
if ((ret = mbedtls_x509write_csr_set_extension(&req,
MBEDTLS_OID_SUBJECT_ALT_NAME,
MBEDTLS_OID_SIZE(MBEDTLS_OID_SUBJECT_ALT_NAME),
(const unsigned char *)p, len)) != 0) {
char errbuf[80];
mbedtls_strerror(ret, errbuf, sizeof(errbuf));
ESP_LOGE(acme_tag, "%s: mbedtls_x509write_csr_set_extension failed %s
(0x%04x)", *__FUNCTION__*, errbuf, -ret);
}
free(buf);
ESP_LOGD(acme_tag, "%s: ret %d", *__FUNCTION*__, ret);
return ret;
}
--
Danny Backx - dannybackx(a)telenet.be - http://danny.backx.info
Hi David,
Archive can be found here
https://lists.trustedfirmware.org/pipermail/mbed-tls/https://lists.trustedfirmware.org/pipermail/psa-crypto/
Regards,
Shebu
-----Original Message-----
From: mbed-tls <mbed-tls-bounces(a)lists.trustedfirmware.org> On Behalf Of David Higton via mbed-tls
Sent: Friday, June 25, 2021 2:51 PM
To: mbed-tls(a)lists.trustedfirmware.org
Subject: [mbed-tls] List archive?
Hi everybody,
I've just joined the list. The first thing I did was to try to find an archive of list postings, but I haven't found one. Is there one, and, if so, where do I find it?
The information may have been staring me in the face; if that's the case, I apologise.
David
--
mbed-tls mailing list
mbed-tls(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/mbed-tls
Hi everybody,
I've just joined the list. The first thing I did was to try to find an
archive of list postings, but I haven't found one. Is there one, and,
if so, where do I find it?
The information may have been staring me in the face; if that's the
case, I apologise.
David
Hi Anasasija,
Mbed TLS is entirely agnostic of the communication channel or protocol. You can configure it to use any underlying layer, like TCP, UDP or even just a local buffer.
That said, we have a module that makes it more convenient to use Mbed TLS with TCP (or UDP) on common platforms:
https://github.com/ARMmbed/mbedtls/blob/development/include/mbedtls/net_soc…
You can see an example for using the module in several sample applications, for example:
https://github.com/ARMmbed/mbedtls/blob/development/programs/ssl/ssl_client… and
https://github.com/ARMmbed/mbedtls/blob/development/programs/ssl/ssl_server…
Kind regards,
Janos
From: mbed-tls <mbed-tls-bounces(a)lists.trustedfirmware.org> on behalf of 1637062--- via mbed-tls <mbed-tls(a)lists.trustedfirmware.org>
Date: Friday, 25 June 2021 at 09:27
To: mbed-tls(a)lists.trustedfirmware.org <mbed-tls(a)lists.trustedfirmware.org>
Subject: [mbed-tls] Is TCP integrated in mbed-TLS?
Hello,
I am a Student and for my bachelor thesis I am working on a tool that
is able to detect whether a server is vulnerable regarding
Bleichenbacher's attack or not, testing multiple side channels.
For this I am looking for a TLS implementation that has the TCP
protocol integrated and generates the TCP messages.
I was wondering if mbed-tls has the TCP integrated in the
implementation or not.
If so, I could make use of this information, too.
Thanks and kind regards,
Anastasija
--
mbed-tls mailing list
mbed-tls(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/mbed-tls
Hi Lijin,
It still can be the endianness of the keys. If the key is reversed, there won’t be any discernible pattern or relationship between the derived secrets.
Regards,
Janos
From: mbed-tls <mbed-tls-bounces(a)lists.trustedfirmware.org> on behalf of T V LIJIN (EXT) via mbed-tls <mbed-tls(a)lists.trustedfirmware.org>
Date: Friday, 25 June 2021 at 09:15
To: mbed-tls(a)lists.trustedfirmware.org <mbed-tls(a)lists.trustedfirmware.org>
Subject: Re: [mbed-tls] mbed-tls Digest, Vol 16, Issue 12
Hello,
We couldn't see word swap in the output from both the end. Issue doesn't look related to the endianness.
Could you please confirm that the code used for ECDHE key exchange is proper?
SHARED_SECRET (Computed on Client):
11 36 F7 DB 2B 14 BB 86
1C A0 FC DF 6D 4D 17 70
BE 4F D8 58 C2 11 67 10
42 D7 47 EB 14 4B 10 5E
SHARED_SECRET(Computed on Sever):
c6 96 d9 f0 ec 37 be 9e
1a 60 a4 5f 88 f2 13 d3
bb 98 15 3f 3b d9 81 37
c6 10 12 85 e5 8b 49 16
Thanks,
LIJIN T V
________________________________
From: mbed-tls <mbed-tls-bounces(a)lists.trustedfirmware.org> on behalf of mbed-tls-request(a)lists.trustedfirmware.org <mbed-tls-request(a)lists.trustedfirmware.org>
Sent: Friday, June 25, 2021 4:52 AM
To: mbed-tls(a)lists.trustedfirmware.org <mbed-tls(a)lists.trustedfirmware.org>
Subject: mbed-tls Digest, Vol 16, Issue 12
This message is from an external sender. Be cautious, especially with links and attachments.
Send mbed-tls mailing list submissions to
mbed-tls(a)lists.trustedfirmware.org
To subscribe or unsubscribe via the World Wide Web, visit
https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.tru…
or, via email, send a message with subject or body 'help' to
mbed-tls-request(a)lists.trustedfirmware.org
You can reach the person managing the list at
mbed-tls-owner(a)lists.trustedfirmware.org
When replying, please edit your Subject line so it is more specific
than "Re: Contents of mbed-tls digest..."
Today's Topics:
1. ECDHE Shared Secret is computed differently (T V LIJIN (EXT))
2. Re: ECDHE Shared Secret is computed differently (Brian D.)
3. How does the bignum.c works? (Shariful Alam)
----------------------------------------------------------------------
Message: 1
Date: Thu, 24 Jun 2021 13:35:03 +0000
From: "T V LIJIN (EXT)" <lijin.tv(a)kone.com>
To: "mbed-tls(a)lists.trustedfirmware.org"
<mbed-tls(a)lists.trustedfirmware.org>
Subject: [mbed-tls] ECDHE Shared Secret is computed differently
Message-ID:
<AS8PR07MB8006A77D2451AD93FAFDA3D8FE079(a)AS8PR07MB8006.eurprd07.prod.outlook.com>
Content-Type: text/plain; charset="iso-8859-1"
Hello ,
We are trying to perform an ECDHE key exchange between two devices running on different platforms.[one on Linux and another on RTOS]
Both the devices use the same code to compute the ECDHE shared secret. The peer public parameters are exchanged in the base64 format and passed to the functions correctly , but the final shared secret computed seems to be different on both ends.
We have tested the same source code on Visual studio and found working.
I have attached the source files
Could you please comment on why the computed shared secret are different on both the ends?
Thanks,
LIJIN T V
Hello,
I am a Student and for my bachelor thesis I am working on a tool that
is able to detect whether a server is vulnerable regarding
Bleichenbacher's attack or not, testing multiple side channels.
For this I am looking for a TLS implementation that has the TCP
protocol integrated and generates the TCP messages.
I was wondering if mbed-tls has the TCP integrated in the
implementation or not.
If so, I could make use of this information, too.
Thanks and kind regards,
Anastasija
Hello,
We couldn't see word swap in the output from both the end. Issue doesn't look related to the endianness.
Could you please confirm that the code used for ECDHE key exchange is proper?
SHARED_SECRET (Computed on Client):
11 36 F7 DB 2B 14 BB 86
1C A0 FC DF 6D 4D 17 70
BE 4F D8 58 C2 11 67 10
42 D7 47 EB 14 4B 10 5E
SHARED_SECRET(Computed on Sever):
c6 96 d9 f0 ec 37 be 9e
1a 60 a4 5f 88 f2 13 d3
bb 98 15 3f 3b d9 81 37
c6 10 12 85 e5 8b 49 16
Thanks,
LIJIN T V
________________________________
From: mbed-tls <mbed-tls-bounces(a)lists.trustedfirmware.org> on behalf of mbed-tls-request(a)lists.trustedfirmware.org <mbed-tls-request(a)lists.trustedfirmware.org>
Sent: Friday, June 25, 2021 4:52 AM
To: mbed-tls(a)lists.trustedfirmware.org <mbed-tls(a)lists.trustedfirmware.org>
Subject: mbed-tls Digest, Vol 16, Issue 12
This message is from an external sender. Be cautious, especially with links and attachments.
Send mbed-tls mailing list submissions to
mbed-tls(a)lists.trustedfirmware.org
To subscribe or unsubscribe via the World Wide Web, visit
https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.tru…
or, via email, send a message with subject or body 'help' to
mbed-tls-request(a)lists.trustedfirmware.org
You can reach the person managing the list at
mbed-tls-owner(a)lists.trustedfirmware.org
When replying, please edit your Subject line so it is more specific
than "Re: Contents of mbed-tls digest..."
Today's Topics:
1. ECDHE Shared Secret is computed differently (T V LIJIN (EXT))
2. Re: ECDHE Shared Secret is computed differently (Brian D.)
3. How does the bignum.c works? (Shariful Alam)
----------------------------------------------------------------------
Message: 1
Date: Thu, 24 Jun 2021 13:35:03 +0000
From: "T V LIJIN (EXT)" <lijin.tv(a)kone.com>
To: "mbed-tls(a)lists.trustedfirmware.org"
<mbed-tls(a)lists.trustedfirmware.org>
Subject: [mbed-tls] ECDHE Shared Secret is computed differently
Message-ID:
<AS8PR07MB8006A77D2451AD93FAFDA3D8FE079(a)AS8PR07MB8006.eurprd07.prod.outlook.com>
Content-Type: text/plain; charset="iso-8859-1"
Hello ,
We are trying to perform an ECDHE key exchange between two devices running on different platforms.[one on Linux and another on RTOS]
Both the devices use the same code to compute the ECDHE shared secret. The peer public parameters are exchanged in the base64 format and passed to the functions correctly , but the final shared secret computed seems to be different on both ends.
We have tested the same source code on Visual studio and found working.
I have attached the source files
Could you please comment on why the computed shared secret are different on both the ends?
Thanks,
LIJIN T V
Hello,
Can someone please briefly explain how does the bignum.c library works in
terms of RSA? I understand that this is too broad a question to ask. but If
someone can briefly explain the basic working mechanism it will be a great
help.
Thanks,
Shariful
Hi Linjin,
I am not part of the mbed-tls staff but I developed a lot with mbed library and I had your same problem. Try to check the byte order, I had issues when computing the shared secret because I had the little endian from the other side but mbed uses big endian.
Try to do a quick test and this could resolve your problem, let me know!
Bye,
Brian
24 giu 2021, 15:35 da mbed-tls(a)lists.trustedfirmware.org:
> Hello ,
> We are trying to perform an ECDHE key exchange between two devices running on different platforms.[one on Linux and another on RTOS]
> Both the devices use the same code to compute the ECDHE shared secret. The peer public parameters are exchanged in the base64 format and passed to the functions correctly , but the final shared secret computed seems to be different on both ends.
> We have tested the same source code on Visual studio and found working.
> I have attached the source files
>
> Could you please comment on why the computed shared secret are different on both the ends?
>
> Thanks,
> LIJIN T V
>
Hello ,
We are trying to perform an ECDHE key exchange between two devices running on different platforms.[one on Linux and another on RTOS]
Both the devices use the same code to compute the ECDHE shared secret. The peer public parameters are exchanged in the base64 format and passed to the functions correctly , but the final shared secret computed seems to be different on both ends.
We have tested the same source code on Visual studio and found working.
I have attached the source files
Could you please comment on why the computed shared secret are different on both the ends?
Thanks,
LIJIN T V
Hi Andrey,
Thank you for your interest in Mbed TLS! In general we welcome
contributions to the project. Unfortunately, our limiting factor is
bandwidth for review. In 2021 the Mbed TLS team has grown, so we have
more time for reviews, but we are still struggling to catch up with the
large backlog.
There is already an old attempt to add unencrypted PKCS#8 writing
support (https://github.com/ARMmbed/mbedtls/issues/1695
<https://github.com/ARMmbed/mbedtls/issues/1695>). There is a long
pending request for encrypted PKCS#8 writing support
(https://github.com/ARMmbed/mbedtls/issues/1372
<https://github.com/ARMmbed/mbedtls/issues/1372>) but I'm not aware of
any prior implementation.
We would be glad to have your contribution, but I must be honest and say
it might take us several months to get around to it.
Best regards,
--
Gilles Peskine
Mbed TLS developer
On 09/06/2021 22:46, Андрей Макаров via mbed-tls wrote:
> Recently I used mbedtls library in my working project. In accordance
> with the needs of the project, I added some functions to mbedtls for
> saving and loading keys in plain and encrypted pem and der forms.
> The changes are still raw and should be brought up to pull request
> requirements - there are no tests, since the functions tested as part
> of a working project which uses mbedtls. I can, over time, finalize
> the changes to a pull request, but it will take some time and effort
> that you don't want to waste unnecessarily — this will have to be done
> at my home time.
> If there is an interest for this work, then I will try to do it, but
> if few people need it or do not coincide with the general direction of
> development of the project, then I would not bother.
> To be done: 1) added mbedtls_pk_write_key_pkcs8_der() write
> non-encrypted pkcs8 der key 2) added mbedtls_pk_write_key_pkcs8_pem()
> write non-encrypted pkcs8 pem key 3) added
> mbedtls_pk_write_key_encrypted_pem() write legacy encryped pem file
> with DEK-Info header 4) added
> mbedtls_pk_write_key_pkcs8_encrypted_der() write to encrypted pkcs8
> der key; pkcs5 pbes1, pkcs12 and pbes2 schemes are supported 5) added
> mbedtls_pk_write_key_pkcs8_encrypted_pem() same as above but pem key
> 6) changed mbedtls_pem_read_buffer() which reads legacy encrypted pem
> formats (with DEK-Info header) now it uses mbedtls_cipher_… functions
> which allow to use any supported cipher rather than four enforced (was
> limited to des-cbc, des-ede3-cbc, ars-128-cbc and aes-256-cbc) 7)
> changed pk_parse_key_pkcs8_encrypted_der() 7.1) added pkcs5 pbes1
> support MD5-DES-CB CpbeWithMD5AndDES-CBC) and SHA1-DES-CBC
> (pbeWithSHA1AndDES-CBC) 7.2) changed pkcs12 pbe (use same cipher for
> all SHA1-DES2-EDE-CBC (pbeWithSHAAnd2-KeyTripleDES-CBC),
> SHA1-DES3-EDE-CBC (pbeWithSHAAnd3-KeyTripleDES-CBC) and SHA1-RC4-128
> (pbeWithSHA1And128BitRC4); (the special
> mbedtls_pkcs12_pbe_sha1_rc4_128() is not used now and may be removed)
> 7.3) changed pkcs5 pbes2 support: added AES-128-CBC and AES-256-CBC
> ciphers Some «preview» is available at fork
> https://github.com/loafer-mka/mbedtls
> <https://github.com/loafer-mka/mbedtls>, branch ‘dev_clean’ Of course,
> many changes relate to obsolete formats, and may be undesirable … also
> I do not touch PSK at all.
> Please, give me some feedback — try to finish this with tests, pull
> request, etc or not. ----------- Regards, Andrey
>