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@lists.trustedfirmware.org> on behalf of T V LIJIN (EXT) via mbed-tls <mbed-tls@lists.trustedfirmware.org>
Date: Friday, 25 June 2021 at 09:15
To: mbed-tls@lists.trustedfirmware.org <mbed-tls@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@lists.trustedfirmware.org> on behalf of mbed-tls-request@lists.trustedfirmware.org <mbed-tls-request@lists.trustedfirmware.org>
Sent: Friday, June 25, 2021 4:52 AM
To: mbed-tls@lists.trustedfirmware.org <mbed-tls@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@lists.trustedfirmware.org

To subscribe or unsubscribe via the World Wide Web, visit
        https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.trustedfirmware.org%2Fmailman%2Flistinfo%2Fmbed-tls&amp;data=04%7C01%7Clijin.tv%40kone.com%7C743b00fd8ac14c3ce08808d93766ecee%7C2bb82c642eb143f78862fdc1d2333b50%7C0%7C0%7C637601737496631686%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=DnJ5xIsKWcVubhrqP9Do8Fr0RzRuGRQKOWpgCBceMkg%3D&amp;reserved=0
or, via email, send a message with subject or body 'help' to
        mbed-tls-request@lists.trustedfirmware.org

You can reach the person managing the list at
        mbed-tls-owner@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@kone.com>
To: "mbed-tls@lists.trustedfirmware.org"
        <mbed-tls@lists.trustedfirmware.org>
Subject: [mbed-tls] ECDHE Shared Secret is computed differently
Message-ID:
        <AS8PR07MB8006A77D2451AD93FAFDA3D8FE079@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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://eur02.safelinks.protection.outlook.com/?url=http%3A%2F%2Flists.trustedfirmware.org%2Fpipermail%2Fmbed-tls%2Fattachments%2F20210624%2F250d8c73%2Fattachment-0001.htm&amp;data=04%7C01%7Clijin.tv%40kone.com%7C743b00fd8ac14c3ce08808d93766ecee%7C2bb82c642eb143f78862fdc1d2333b50%7C0%7C0%7C637601737496631686%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=o4QH%2FiHOKDlIt6igjo3gQjVisAfoFkaEtfuyWTVQgiw%3D&amp;reserved=0>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ECP_DP_CURVE25519.c
URL: <https://eur02.safelinks.protection.outlook.com/?url=http%3A%2F%2Flists.trustedfirmware.org%2Fpipermail%2Fmbed-tls%2Fattachments%2F20210624%2F250d8c73%2Fattachment-0001.c&amp;data=04%7C01%7Clijin.tv%40kone.com%7C743b00fd8ac14c3ce08808d93766ecee%7C2bb82c642eb143f78862fdc1d2333b50%7C0%7C0%7C637601737496631686%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=yVH1IBq7cuz9ttCryE1kao9npvYW8cSZ1d2Se5F0Z7Y%3D&amp;reserved=0>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ECP_DP_CURVE25519.h
URL: <https://eur02.safelinks.protection.outlook.com/?url=http%3A%2F%2Flists.trustedfirmware.org%2Fpipermail%2Fmbed-tls%2Fattachments%2F20210624%2F250d8c73%2Fattachment-0001.h&amp;data=04%7C01%7Clijin.tv%40kone.com%7C743b00fd8ac14c3ce08808d93766ecee%7C2bb82c642eb143f78862fdc1d2333b50%7C0%7C0%7C637601737496631686%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=zTAyWIwBzaeC%2BiAUpcHr3qx9HLoCqVbBXuG%2B4B1iBVk%3D&amp;reserved=0>

------------------------------

Message: 2
Date: Thu, 24 Jun 2021 16:44:18 +0200 (CEST)
From: "Brian D." <brian_d@tutanota.com>
To: "T V LIJIN (EXT)" <lijin.tv@kone.com>
Cc: "mbed-tls@lists.trustedfirmware.org"
        <mbed-tls@lists.trustedfirmware.org>
Subject: Re: [mbed-tls] ECDHE Shared Secret is computed differently
Message-ID: <McyTdCH--3-2@tutanota.com>
Content-Type: text/plain; charset=UTF-8

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@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
>



------------------------------

Message: 3
Date: Thu, 24 Jun 2021 17:21:30 -0600
From: Shariful Alam <dipto181@gmail.com>
To: mbed-tls@lists.trustedfirmware.org
Subject: [mbed-tls] How does the bignum.c works?
Message-ID:
        <CAA0KgGoTKuUx3YqTAY+gPEN1uuxR2FJv_1dq15U3ycPfQWe=QQ@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://eur02.safelinks.protection.outlook.com/?url=http%3A%2F%2Flists.trustedfirmware.org%2Fpipermail%2Fmbed-tls%2Fattachments%2F20210624%2Fa616ac95%2Fattachment.htm&amp;data=04%7C01%7Clijin.tv%40kone.com%7C743b00fd8ac14c3ce08808d93766ecee%7C2bb82c642eb143f78862fdc1d2333b50%7C0%7C0%7C637601737496631686%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=HBvM7xdTpvzrvc4yEcFknFvNAst5My3ZX%2FuG8yk1zpY%3D&amp;reserved=0>

------------------------------

Subject: Digest Footer

mbed-tls mailing list
mbed-tls@lists.trustedfirmware.org
https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.trustedfirmware.org%2Fmailman%2Flistinfo%2Fmbed-tls&amp;data=04%7C01%7Clijin.tv%40kone.com%7C743b00fd8ac14c3ce08808d93766ecee%7C2bb82c642eb143f78862fdc1d2333b50%7C0%7C0%7C637601737496631686%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=DnJ5xIsKWcVubhrqP9Do8Fr0RzRuGRQKOWpgCBceMkg%3D&amp;reserved=0


------------------------------

End of mbed-tls Digest, Vol 16, Issue 12
****************************************