loupvaillant / monocypher-handshake Goto Github PK
View Code? Open in Web Editor NEWSecure channels with Monocypher
Secure channels with Monocypher
Protocol design turns out to be more subtle and error prone than I had anticipated. I cannot trust myself with this, I need external review. In the mean time, ProVerif (or CryptoVerif) looks like it could help.
I have noticed that on empty inputs, the result of Poly1305 is equal to the last 16 bytes of the key. Meaning, using Poly1305 even once can reveal up to 128-bits of the authentication key.
When the input is not empty (in this case, 2 blocks), the leak is not so obvious, but there's still a relation between the first part of the key, and the second part of the key. This relation can probably be used to reduce the search space, and reduce the effective entropy of the key so something much below 256-bits.
Thus, it is probably a very bad idea to derive further key material with a key that has been used with Poly1305, so instead of
T2 = Poly1305(K2, Es || Er)
T3 = Poly1305(K3, Es || Er || Chacha20(K2, Ls))
We probably want something like:
T2 = Poly1305(HChacha20(K2, 0), Es || Er)
T3 = Poly1305(HChacha20(K3, 0), Es || Er || Chacha20(K2, Ls))
Also, Ks
should probably be HChacha20(K3, 1)
instead of just K3, to provide a clean key with no used nonce (K3
uses nonce 0
to derive an authentication key, which the user might reuse by accident).
Alternatively, we could derive a whole Chacha20 block with K3, use the first half for T3, and the second half for Ks. This would save one Chacha20 round. If we do that, though, T2 should probably be handled the same way, for uniformity's sake. (Another benefit would be that this is the standard way to derive Poly1305 keys authentication keys with Chacha20.)
To what extent is Monocypher-Handshake compatible with third-party implementations of Noise proper, has this been tested, and against which implementations, for what handshake patterns, etc? Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.