mirror of
https://github.com/libssh2/libssh2.git
synced 2026-10-24 03:48:58 +03:00
Implement server hostkey verification for the six ECDSA/RSA OpenSSH certificate hostkey variants: - `ecdsa-sha2-nistp256-cert-v01@openssh.com` - `ecdsa-sha2-nistp384-cert-v01@openssh.com` - `ecdsa-sha2-nistp521-cert-v01@openssh.com` - `ssh-rsa-cert-v01@openssh.com` - `rsa-sha2-256-cert-v01@openssh.com` - `rsa-sha2-512-cert-v01@openssh.com` This fixes #2434, where these algorithms were advertised and accepted as preferences but had `NULL` hostkey `init`/`sig_verify` callbacks. A certificate-only hostkey offer therefore caused `LIBSSH2_ERROR_KEX_FAILURE (-5)`. ## Implementation - ECDSA certificate parsing uses one shared init path for all three curves. It validates the certificate type, nonce, inner curve name, and EC point before constructing the verification context. - RSA certificate parsing uses one shared init path for all three RSA signature variants. - Per-algorithm RSA `sig_verify` callbacks remain distinct. - Per `PROTOCOL.certkeys`, the RSA/SHA-2 certificate blob itself carries the type string `ssh-rsa-cert-v01@openssh.com`; the negotiated SHA-2 algorithm is represented by KEXINIT and the exchange signature. - Certificate CA trust validation remains out of scope, consistent with existing plain-hostkey handling. ## Tests - Host CA fixtures (`keys/ca_host_ecdsa`, `keys/ca_host_rsa`) and CA-signed host certificates for the ECDSA P-256 and RSA host keys in the Docker OpenSSH fixture. - The certificate algorithms are exercised through `test_read_algos.txt` and `FIXTURE_TEST_HOSTKEY`: `ecdsa-sha2-nistp256-cert-v01@openssh.com`, `rsa-sha2-256-cert-v01@openssh.com`, `rsa-sha2-512-cert-v01@openssh.com`, `ssh-rsa-cert-v01@openssh.com`, plus the pre-existing `ssh-ed25519-cert-v01@openssh.com`. - The ECDSA P-384/P-521 certificate variants share the same codepath and are covered by it; only P-256 is tested directly to keep the fixture matrix lean (per maintainer review feedback). - Disabled-backend skip entries in `tests/session_fixture.c` for the new certificate algorithms. - Preserved the existing ed25519 certificate test path. Fixes #2434 Follow-up to6036e57720#2513 Follow-up to65a276e8fe#2064 Closes #2539
25 lines
480 B
Plaintext
25 lines
480 B
Plaintext
3des-cbc
|
|
aes128-cbc
|
|
aes128-ctr
|
|
aes128-gcm@openssh.com
|
|
aes192-cbc
|
|
aes192-ctr
|
|
aes256-cbc
|
|
aes256-ctr
|
|
aes256-gcm@openssh.com
|
|
chacha20-poly1305@openssh.com
|
|
hmac-md5
|
|
hmac-md5-96
|
|
hmac-sha1
|
|
hmac-sha1-96
|
|
hmac-sha1-etm@openssh.com
|
|
hmac-sha2-256
|
|
hmac-sha2-256-etm@openssh.com
|
|
hmac-sha2-512
|
|
hmac-sha2-512-etm@openssh.com
|
|
ecdsa-sha2-nistp256-cert-v01@openssh.com
|
|
rsa-sha2-256-cert-v01@openssh.com
|
|
rsa-sha2-512-cert-v01@openssh.com
|
|
ssh-ed25519-cert-v01@openssh.com
|
|
ssh-rsa-cert-v01@openssh.com
|