Skip to contentSkip to conversation

Exported keying material is always sizeof(unsigned char*)

Openvpn-devel Daniel Kubec 2 participants 2 messages Apr 27, 2016

lore
Share & tools
lore
#0 lore raw

There is patch 'git show 41e4b67a229e774ebc57a882c386e10d80e10e7e' which actually works arround poor support of c99 in MSVC compiler released in 2013 :)

It introduces the bug because exported key size is always sizeof(unsigned char *).

There is patch for this.

From 65c273f4d2eb63a26d270b870e303d5eff99cd0a Mon Sep 17 00:00:00 2001
From: Daniel Kubec <[email protected]...>
Date: Wed, 27 Apr 2016 07:40:31 +0200
Subject: [PATCH 1/1] Exported keying material is always sizeof(unsigned char *)

There is patch 'git show 41e4b67a229e774ebc57a882c386e10d80e10e7e' which actually works arround poor support of c99 in MSVC compiler released in 2013 :)

It introduces the bug because exported key size is always sizeof(unsigned char *). There is patch for this.

---
 src/openvpn/ssl_openssl.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
src/openvpn/ssl_openssl.c +1 -1
index ca9b67b..8909ca3 100644
@@ -144,7 +144,7 @@ key_state_export_keying_material(struct key_state_ssl *ssl,
       struct gc_arena gc = gc_new();
       unsigned char* ekm = (unsigned char*) gc_malloc(size, true, &gc);
 
-      if (SSL_export_keying_material(ssl->ssl, ekm, sizeof(ekm),
+      if (SSL_export_keying_material(ssl->ssl, ekm, size,
           session->opt->ekm_label, session->opt->ekm_label_size, NULL, 0, 0))
        {
          unsigned int len = (size * 2) + 2;
Signature · 1 line
1.7.1
#1 lore raw

ACK!

Your patch has been applied to the master branch.

Sorry for ACKing the patch that broke the code - ACKing the fix now :-) (I've taken the liberty to make the commit message more readable - no code changes)

commit 13a882ae39efb7144d9a9c5ac61100b1e27b1003

Author: Daniel Kubec
Date:   Wed Apr 27 08:00:34 2016 +0200
     Fix buffer size parameter for exported keying material.

     Acked-by: Gert Doering <[email protected]...>
     Message-Id: <[email protected]...>
     URL: http://article.gmane.org/gmane.network.openvpn.devel/11509
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering