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

Comments about size and initial settings for counter incorrect #9

Open
cpopp opened this issue Aug 15, 2015 · 0 comments
Open

Comments about size and initial settings for counter incorrect #9

cpopp opened this issue Aug 15, 2015 · 0 comments

Comments

@cpopp
Copy link

cpopp commented Aug 15, 2015

In trying to understand the protocol I noticed the following comments around https://github.com/spark/spark-protocol/blob/master/js/lib/Handshake.js#L62

 * Core creates a protobufs Hello with counter set to the uint32 represented by the most significant 4 bytes of the IV, encrypts the protobufs Hello with AES, and sends the ciphertext to Server.
 * Server reads protobufs Hello from socket, taking note of counter.  Each subsequent message received from Core must have the counter incremented by 1. After the max uint32, the next message should set the counter to zero.
 * Server creates protobufs Hello with counter set to a random uint32, encrypts the protobufs Hello with AES, and sends the ciphertext to Core.
 * Core reads protobufs Hello from socket, taking note of counter.  Each subsequent message received from Server must have the counter incremented by 1. After the max uint32, the next message should set the counter to zero.

However, as far as I can tell, the counter is a uint16 and the firmware grabs the the top 2 significant bytes of the SALT, not the top 4 from the IV. It would be great if these comments could be updated since it could throw someone else otherwise. (If I'm wrong please let me know of course.)

What led me to believe this:
https://github.com/spark/firmware/blob/release/0.4.3/communication/src/spark_protocol.cpp#L1636
https://github.com/spark/spark-protocol/blob/master/js/settings.js#L39
https://github.com/spark/spark-protocol/blob/master/js/clients/SparkCore.js#L373

straccio pushed a commit to straccio/spark-protocol that referenced this issue Jun 13, 2017
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

1 participant