Skip to content

Commit 31e20d1

Browse files
committed
Merge branch 'maint'
2 parents 02b4f30 + 7ccfaf4 commit 31e20d1

2 files changed

Lines changed: 27 additions & 9 deletions

File tree

lib/ssh/test/ssh_protocol_SUITE.erl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ end_per_group(_GroupName, Config) ->
287287

288288
init_per_testcase(Tc, Config) when Tc == no_common_alg_server_disconnects;
289289
Tc == custom_kexinit ->
290-
start_std_daemon(Config, [{preferred_algorithms,[{public_key,['ssh-rsa']},
290+
start_std_daemon(Config, [{preferred_algorithms,[{public_key,['ssh-ed25519']},
291291
{cipher,?DEFAULT_CIPHERS}
292292
]}]);
293293
init_per_testcase(kex_strict_negotiated, Config) ->
@@ -486,14 +486,14 @@ no_common_alg_server_disconnects(Config) ->
486486
[{silently_accept_hosts, true},
487487
{user_dir, ssh_test_lib:user_dir(Config)},
488488
{user_interaction, false},
489-
{preferred_algorithms,[{public_key,['ssh-dss']},
489+
{preferred_algorithms,[{public_key,['ecdsa-sha2-nistp256']},
490490
{cipher,?DEFAULT_CIPHERS}
491491
]}
492492
]},
493493
receive_hello,
494494
{send, hello},
495495
{match, #ssh_msg_kexinit{_='_'}, receive_msg},
496-
{send, ssh_msg_kexinit}, % with server unsupported 'ssh-dss' !
496+
{send, ssh_msg_kexinit}, % with server unsupported 'ecdsa-sha2-nistp256' !
497497
{match, disconnect(), receive_msg}
498498
]
499499
).
@@ -627,7 +627,7 @@ no_common_alg_client_disconnects(Config) ->
627627

628628
%% and finally connect to it with a regular Erlang SSH client
629629
%% which of course does not support SOME-UNSUPPORTED as pub key algo:
630-
Result = std_connect(HostPort, Config, [{preferred_algorithms,[{public_key,['ssh-dss']},
630+
Result = std_connect(HostPort, Config, [{preferred_algorithms,[{public_key,['ecdsa-sha2-nistp256']},
631631
{cipher,?DEFAULT_CIPHERS}
632632
]}]),
633633
ct:log("Result of connect is ~p",[Result]),

lib/ssh/test/ssh_to_openssh_SUITE.erl

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -326,14 +326,19 @@ eserver_oclient_renegotiate_helper1(Config) ->
326326
{Data, OpenSsh, Pid}.
327327

328328
eserver_oclient_renegotiate_helper2({Data, OpenSsh, Pid}) ->
329+
PQCAvailable = lists:member(mlkem768, crypto:supports(kems)),
329330
Expect = fun({data,R}) ->
330331
Warning =
331332
<<"WARNING: connection is not using a post-quantum key exchange algorithm">>,
332333
case binary:match(R, Warning) of
333334
nomatch -> ok;
334-
_ ->
335+
_ when PQCAvailable ->
335336
?CT_PAL("~p", [R]),
336-
ct:fail(pqc_warning_detected)
337+
ct:fail(pqc_warning_detected);
338+
_ ->
339+
?CT_LOG("PQC warning ignored: mlkem768 not available in crypto backend"),
340+
ct:comment("PQC kex unavailable (LibreSSL lacks ML-KEM support)"),
341+
ok
337342
end,
338343
try
339344
NonAlphaChars = [C || C<-lists:seq(1,255),
@@ -720,9 +725,8 @@ no_forwarding(Config) ->
720725
check_kex_strict(Sock) ->
721726
%% Send some version, in order to receive KEXINIT from server
722727
ok = gen_tcp:send(Sock, "SSH-2.0-OpenSSH_9.5\r\n"),
723-
ct:sleep(100),
724-
{ok, Packet} = gen_tcp:recv(Sock, 0),
725-
case string:find(Packet, ?kex_strict_s) of
728+
Data = recv_kexinit_data(Sock, <<>>),
729+
case string:find(Data, ?kex_strict_s) of
726730
nomatch ->
727731
ct:log("KEX strict NOT supported by local OpenSSH"),
728732
false;
@@ -731,3 +735,17 @@ check_kex_strict(Sock) ->
731735
true
732736
end.
733737

738+
recv_kexinit_data(_Sock, Acc) when byte_size(Acc) > 4096 ->
739+
Acc;
740+
recv_kexinit_data(Sock, Acc) ->
741+
case gen_tcp:recv(Sock, 0, 2000) of
742+
{ok, Packet} ->
743+
Combined = iolist_to_binary([Acc, Packet]),
744+
case string:find(Combined, "kex-strict") of
745+
nomatch -> recv_kexinit_data(Sock, Combined);
746+
_ -> Combined
747+
end;
748+
{error, _} ->
749+
Acc
750+
end.
751+

0 commit comments

Comments
 (0)