Skip to content

Commit af7d58b

Browse files
Merge pull request #789 from ejohnstown/ed25519-compat
Curve25519 Compat with LibSSH
2 parents cea99e5 + 599c4b8 commit af7d58b

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

src/internal.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -684,6 +684,7 @@ static const char cannedKexAlgoNames[] =
684684
#endif
685685
#ifndef WOLFSSH_NO_CURVE25519_SHA256
686686
"curve25519-sha256,"
687+
687688
#endif
688689
#if !defined(WOLFSSH_NO_ECDH_SHA2_NISTP521)
689690
"ecdh-sha2-nistp521,"
@@ -2492,6 +2493,7 @@ static const NameIdPair NameIdMap[] = {
24922493
#ifndef WOLFSSH_NO_CURVE25519_SHA256
24932494
/* See RFC 8731 */
24942495
{ ID_CURVE25519_SHA256, TYPE_KEX, "curve25519-sha256" },
2496+
{ ID_CURVE25519_SHA256_LIBSSH, TYPE_KEX, "[email protected]" },
24952497
#endif
24962498
{ ID_EXTINFO_S, TYPE_OTHER, "ext-info-s" },
24972499
{ ID_EXTINFO_C, TYPE_OTHER, "ext-info-c" },
@@ -3750,6 +3752,7 @@ enum wc_HashType HashForId(byte id)
37503752
#endif
37513753
#ifndef WOLFSSH_NO_CURVE25519_SHA256
37523754
case ID_CURVE25519_SHA256:
3755+
case ID_CURVE25519_SHA256_LIBSSH:
37533756
return WC_HASH_TYPE_SHA256;
37543757
#endif
37553758
#ifndef WOLFSSH_NO_RSA_SHA2_256
@@ -3827,6 +3830,7 @@ int wcPrimeForId(byte id)
38273830
#endif
38283831
#ifndef WOLFSSH_NO_CURVE25519_SHA256
38293832
case ID_CURVE25519_SHA256:
3833+
case ID_CURVE25519_SHA256_LIBSSH:
38303834
return ECC_X25519;
38313835
#endif
38323836
#ifndef WOLFSSH_NO_ECDH_SHA2_NISTP521
@@ -11953,6 +11957,7 @@ int SendKexDhReply(WOLFSSH* ssh)
1195311957
#endif
1195411958
#ifndef WOLFSSH_NO_CURVE25519_SHA256
1195511959
case ID_CURVE25519_SHA256:
11960+
case ID_CURVE25519_SHA256_LIBSSH:
1195611961
useCurve25519 = 1;
1195711962
msgId = MSGID_KEXDH_REPLY;
1195811963
break;
@@ -12535,6 +12540,7 @@ int SendKexDhInit(WOLFSSH* ssh)
1253512540
#endif
1253612541
#ifndef WOLFSSH_NO_CURVE25519_SHA256
1253712542
case ID_CURVE25519_SHA256:
12543+
case ID_CURVE25519_SHA256_LIBSSH:
1253812544
ssh->handshake->useCurve25519 = 1;
1253912545
msgId = MSGID_KEXECDH_INIT;
1254012546
break;

src/ssh.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3027,10 +3027,9 @@ size_t wolfSSH_GetText(WOLFSSH *ssh, WS_Text id, char *str, size_t strSz)
30273027
case ID_ECDH_SHA2_NISTP256:
30283028
case ID_ECDH_SHA2_NISTP384:
30293029
case ID_ECDH_SHA2_NISTP521:
3030-
case ID_ECDH_SHA2_ED25519:
3031-
case ID_ECDH_SHA2_ED25519_LIBSSH:
30323030
#ifndef WOLFSSH_NO_CURVE25519_SHA256
30333031
case ID_CURVE25519_SHA256:
3032+
case ID_CURVE25519_SHA256_LIBSSH:
30343033
#endif
30353034
ret = WSNPRINTF(str, strSz, "%s", "ECDH");
30363035
break;

wolfssh/internal.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,13 +335,12 @@ enum {
335335
ID_ECDH_SHA2_NISTP256,
336336
ID_ECDH_SHA2_NISTP384,
337337
ID_ECDH_SHA2_NISTP521,
338-
ID_ECDH_SHA2_ED25519,
339-
ID_ECDH_SHA2_ED25519_LIBSSH,
340338
#ifndef WOLFSSH_NO_ECDH_NISTP256_KYBER_LEVEL1_SHA256
341339
ID_ECDH_NISTP256_KYBER_LEVEL1_SHA256,
342340
#endif
343341
#ifndef WOLFSSH_NO_CURVE25519_SHA256
344342
ID_CURVE25519_SHA256,
343+
ID_CURVE25519_SHA256_LIBSSH,
345344
#endif
346345
ID_EXTINFO_S, /* Pseudo-KEX to indicate server extensions. */
347346
ID_EXTINFO_C, /* Pseudo-KEX to indicate client extensions. */

0 commit comments

Comments
 (0)