-
Notifications
You must be signed in to change notification settings - Fork 403
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add sntrup761x25519-sha512 post-quantum key exchange
This follows draft-ietf-sshm-ntruprime-ssh-01, using the sntrup761 implementation from supercop. It is available under both sntrup761x25519-sha512 and [email protected] names. Interoperability has been tested against OpenSSH 9.8 (client/server) and PuTTY 0.82 client. sntrup761.sh is taken from OpenSSH, to extract the code from the supercop distribution. KEX hash buffer size calculation has been updated to current algorithm limits, since sntrup761 was larger than the previous limit. Code size increases by approx 9kB (209 to 218kB) for a 32-bit armv7 build.
- Loading branch information
Showing
7 changed files
with
2,330 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,7 @@ | |
#include "gcm.h" | ||
#include "chachapoly.h" | ||
#include "ssh.h" | ||
#include "sntrup761.h" | ||
|
||
/* This file (algo.c) organises the ciphers which can be used, and is used to | ||
* decide which ciphers/hashes/compression/signing to use during key exchange*/ | ||
|
@@ -266,12 +267,35 @@ static const struct dropbear_kex kex_ecdh_nistp521 = {DROPBEAR_KEX_ECDH, NULL, 0 | |
#endif /* DROPBEAR_ECDH */ | ||
|
||
#if DROPBEAR_CURVE25519 | ||
/* Referred to directly */ | ||
static const struct dropbear_kex kex_curve25519 = {DROPBEAR_KEX_CURVE25519, NULL, 0, NULL, &sha256_desc }; | ||
#endif | ||
|
||
|
||
#if DROPBEAR_SNTRUP761 | ||
static const struct dropbear_kem_desc sntrup761_desc = { | ||
.public_len = crypto_kem_sntrup761_PUBLICKEYBYTES, | ||
.secret_len = crypto_kem_sntrup761_SECRETKEYBYTES, | ||
.ciphertext_len = crypto_kem_sntrup761_CIPHERTEXTBYTES, | ||
.output_len = crypto_kem_sntrup761_BYTES, | ||
.kem_gen = crypto_kem_sntrup761_keypair, | ||
.kem_enc = crypto_kem_sntrup761_enc, | ||
.kem_dec = crypto_kem_sntrup761_dec, | ||
}; | ||
static const struct dropbear_kex kex_sntrup761 = {DROPBEAR_KEX_PQHYBRID, NULL, 0, &sntrup761_desc, &sha512_desc }; | ||
#endif | ||
|
||
/* For sntrup761 */ | ||
volatile int16_t crypto_int16_optblocker = 0; | ||
volatile int32_t crypto_int32_optblocker = 0; | ||
volatile int64_t crypto_int64_optblocker = 0; | ||
|
||
|
||
/* data == NULL for non-kex algorithm identifiers */ | ||
algo_type sshkex[] = { | ||
#if DROPBEAR_SNTRUP761 | ||
{"sntrup761x25519-sha512", 0, &kex_sntrup761, 1, NULL}, | ||
{"[email protected]", 0, &kex_sntrup761, 1, NULL}, | ||
#endif | ||
#if DROPBEAR_CURVE25519 | ||
{"curve25519-sha256", 0, &kex_curve25519, 1, NULL}, | ||
{"[email protected]", 0, &kex_curve25519, 1, NULL}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.