From 98eda78857cfc463e8980c30fa3f989c8be08e5f Mon Sep 17 00:00:00 2001 From: mgrojo Date: Fri, 28 Mar 2025 19:33:42 +0100 Subject: [PATCH] Ada: fix issues in tls_server.adb detected by gnatprove Checked with: ``` gnatprove -Pdefault.gpr --level=4 -j12 ``` --- wrapper/Ada/tls_server.adb | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/wrapper/Ada/tls_server.adb b/wrapper/Ada/tls_server.adb index 3f1b3dc8a..52ec6ac2e 100644 --- a/wrapper/Ada/tls_server.adb +++ b/wrapper/Ada/tls_server.adb @@ -139,10 +139,6 @@ package body Tls_Server with SPARK_Mode is return 0; end if; - put_line (Interfaces.C.Strings.Value - (Item => Identity, - Length => Identity_String'Length) ); - Interfaces.C.Strings.Update (Item => Key, Offset => 0, @@ -261,13 +257,15 @@ package body Tls_Server with SPARK_Mode is if not PSK then -- Require mutual authentication. WolfSSL.Set_Verify - (Context => Ctx, + (Context => Ctx, Mode => WolfSSL.Verify_Peer or WolfSSL.Verify_Fail_If_No_Peer_Cert); -- Check verify is set correctly (GitHub #7461) if WolfSSL.Get_Verify(Context => Ctx) /= (WolfSSL.Verify_Peer or WolfSSL.Verify_Fail_If_No_Peer_Cert) then - Put ("Error: Verify does not match requested"); - New_Line; + Put_Line ("Error: Verify does not match requested"); + SPARK_Sockets.Close_Socket (L); + WolfSSL.Free (Context => Ctx); + Set (Exit_Status_Failure); return; end if;