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

Add perfect forward secrecy to nterfacer #56

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

pandame
Copy link
Contributor

@pandame pandame commented Mar 10, 2017

This bumps the nterfacer protocol version to 5.

The authentication stage of the protocol is modified. In addition to the
challenge (from server) or response (from client), the IV and the nonce,
both sides send a Curve25519 public key in hex. The new field is added
to the end of the challenge/response + IV + nonce line.

The resulting shared secret from X25519 is then hashed like so:
SHA-256(shared_from_smult || receiver public key || sender public key).
The order for hashing was taken from
https://download.libsodium.org/doc/advanced/scalar_multiplication.html.
The resulting hash is then used as the client raw key, meaning that the
nterfacer rekeying mechanism/subkeying mechanism is untouched from
version 4.

This adds a Curve25519 implementation (curve25519-donna) to /lib/.
Deploying this changeset therefore requires recompiling and restarting
newserv. The header file contains static inline helper functions to
avoid misuse of the underlying ECDH primitive.

This addresses issue #46 in part. The memcpy calls have not been changed in the interest of keeping this commit focused on one issue.

@pandame pandame changed the title Add perfect forward security to nterfacer Add perfect forward secrecy to nterfacer Mar 10, 2017
@pandame pandame force-pushed the master+nterfacer-pfs branch from fff032d to 028caba Compare March 10, 2017 19:15
This bumps the nterfacer protocol version to 5.

The authentication stage of the protocol is modified. In addition to the
challenge (from server) or response (from client), the IV and the nonce,
both sides send a Curve25519 public key in hex. The new field is added
to the end of the challenge/response + IV + nonce line.

The resulting shared secret from X25519 is then hashed like so:
SHA-256(shared from smult || receiver public key || sender public key).
The order for hashing was taken from
https://download.libsodium.org/doc/advanced/scalar_multiplication.html.
The resulting hash is then used as the client raw key, meaning that the
nterfacer rekeying mechanism/subkeying mechanism is untouched from
version 4.

This adds a Curve25519 implementation (curve25519-donna) to /lib/.
Deploying this changeset therefore requires recompiling and  restarting
newserv. curve25519.c contains helper functions to avoid misuse of the
underlying ECDH primitive.
@pandame pandame force-pushed the master+nterfacer-pfs branch from 028caba to 55f596f Compare March 16, 2017 08:15
A configuration option nterfacer:legacy_kex (defaults to 0/false) for
backwards compatibility so that migration to the new key exchange can
happen in waves.

This a separate commit so it can be removed again when the
migration to the new key exchange is complete.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant