Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reducing MSYS_1_BLOCK_SIZE breaks SC Pairing DH key exchange #1662

Open
sacca97 opened this issue Dec 15, 2023 · 5 comments
Open

Reducing MSYS_1_BLOCK_SIZE breaks SC Pairing DH key exchange #1662

sacca97 opened this issue Dec 15, 2023 · 5 comments

Comments

@sacca97
Copy link

sacca97 commented Dec 15, 2023

Edit:

When reducing the MSYS_1_BLOCK_SIZE (e.g., 110 as in the bleprph app) the current way of filling the mbuf does not work as intended when trying to write >60 bytes of data (DH PubKey in SC), and the result is a randomly filled mbuf which causes the handshake to abort.

The solution here would be to use the _copyinto function to fill the buffer.

@sacca97
Copy link
Author

sacca97 commented Dec 18, 2023

My hypothesis: this is due to how the m_bufs are managed.
So if you try to fill them just by working with pointers you will break something (?) if the content is too big.
Would like some feedback on this, there's a completely broken Secure Connection.

@sjanc
Copy link
Contributor

sjanc commented Dec 18, 2023

Hi,

Do you tune MSYS_1_BLOCK_SIZE ? Default 292 should be fine for LE SC.
I think SMP code assumes continuous buffer for SMP commands so probably we miss some restrictions regarding this (at least as short term solution)

@sacca97
Copy link
Author

sacca97 commented Dec 18, 2023

Yeah I was using the provided sample app bleprp, which sets it to 110. I can see the problem now.
I can work on a fix that fits all the scenarios in the next days and make a PR.

@sacca97 sacca97 changed the title SC Pairing not working: Inconsistent behavior in DH key exchange. Reducing MSYS_1_BLOCK_SIZE breaks SC Pairing DH key exchange Dec 20, 2023
@rymanluk
Copy link
Contributor

rymanluk commented May 7, 2024

Hi @sacca97, when do you plan to land the PR ? :)

@sacca97
Copy link
Author

sacca97 commented May 22, 2024

Hey I've been a bit overwhelmend and also forgot abt it. I have made some changes in my fork but could not test it properly yet (it works in the case of the MSYS_1_BLOCK_SIZE=110 as in the blehr app at least).
It is on my profile if you want to check it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants