Topic: Enabling Post-Quantum (ML-KEM) support
As new OpenSSH versions have started nagging about not using post-quantum safe key exchange algorithms, I decided to test enabling ML-KEM on wolfSSH.
I added following in user_settings.h:
#define WOLFSSL_HAVE_MLKEM
#define WOLFSSL_WC_MLKEM
#define WOLFSSL_SHAKE128
#define WOLFSSL_SHAKE256And that seemed to work, as (after re-compiling) wolfSSH server started advertising two new "mlkem" algorithms:
debug2: peer server KEXINIT proposal
debug2: KEX algorithms: mlkem768x25519-sha256,mlkem768nistp256-sha256,curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256
debug2: host key algorithms: ecdsa-sha2-nistp256,ssh-ed25519
debug2: ciphers ctos: aes256-gcm@openssh.com,aes192-gcm@openssh.com,aes128-gcm@openssh.com
debug2: ciphers stoc: aes256-gcm@openssh.com,aes192-gcm@openssh.com,aes128-gcm@openssh.com
debug2: MACs ctos: hmac-sha2-256,hmac-sha2-512
debug2: MACs stoc: hmac-sha2-256,hmac-sha2-512
debug2: compression ctos: none
debug2: compression stoc: noneHowever, when trying to connect using OpenSSH client (OpenSSH_10.2p1, LibreSSL 3.3.6), connection seems to hang indefinitely in key exchange:
debug1: kex: algorithm: mlkem768x25519-sha256
debug1: kex: host key algorithm: ssh-ed25519
debug1: kex: server->client cipher: aes128-gcm@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: aes128-gcm@openssh.com MAC: <implicit> compression: none
debug3: send packet: type 30
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY(client hangs here...)
If I try any of the other advertised kex algorithms (curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256) connection works just fine.... (I was testing on latest 'version' pulled from github)