Skip to contentSkip to conversation

mbedtls: print warning if random personalisation fails

PATCH In review Steffan Karger 3 participants 3 messages Aug 29, 2018 – Sep 3, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mbedtls: print warning if random personalisation fails

... instead of when it doesn't fail. Looks like 'someone' mixed up the mbedtls return style (0 means success) with the openvpn internal return style (true means success).

---
 src/openvpn/ssl_mbedtls.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/openvpn/ssl_mbedtls.c +1 -1
index 8e31980..ef83e65 100644
@@ -853,7 +853,7 @@ tls_ctx_personalise_random(struct tls_root_ctx *ctx)
         const md_kt_t *sha256_kt = md_kt_get("SHA256");
         mbedtls_x509_crt *cert = ctx->crt_chain;
 
-        if (0 != md_full(sha256_kt, cert->tbs.p, cert->tbs.len, sha256_hash))
+        if (!md_full(sha256_kt, cert->tbs.p, cert->tbs.len, sha256_hash))
         {
             msg(M_WARN, "WARNING: failed to personalise random");
         }
Signature · 1 line
2.7.4
Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Steffan Karger

... instead of when it doesn't fail. Looks like 'someone' mixed up the mbedtls return style (0 means success) with the openvpn internal return style (true means success).

I guess at some point we should also convert all these functions returning int to bool, because the latter is the meaning we are giving to the return value.

Cheers,

Signature · 1 line
Antonio Quartulli
#2 lore raw
In reply to Steffan Karger

Your patch has been applied to the master and release/2.4 branch (bugfix).

commit dd1da0e485a3d161feb5230b6aa57df11ea72705 (master) commit 0c6323cd07364b6b3be5bd0d12b18554a073a079 (release/2.4)

Author: Steffan Karger
Date:   Wed Aug 29 14:04:46 2018 +0200
     mbedtls: print warning if random personalisation fails

     Signed-off-by: Steffan Karger <[email protected]...>
     Acked-by: Antonio Quartulli <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg17428.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering