Giter Site home page Giter Site logo

monocypher-handshake's People

Contributors

loupvaillant avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

monocypher-handshake's Issues

Unsafe use of Poly1305

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.)

Interoperability with Noise

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!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.