Skip to contentSkip to conversation

Do not pass struct tls_session* as void*

PATCH Applied Steffan Karger 2 participants 3 messages Jun 7, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Do not pass struct tls_session* as void*

Hi,

The attached patch changes the key_state_ssl_init() function to take the TLS session as a 'struct tls_session *', instead of a 'void *' that has to be cast back later. This patch prepares for a patch from Tamas Tevesz that actually uses the TLS session inside key_state_ssl_init().

-Steffan

From fcae4846ed642386be8ae985f0b8ff29d3b738ba Mon Sep 17 00:00:00 2001
From: Steffan Karger <[email protected]...>
Date: Sun, 19 May 2013 10:01:29 +0200
Subject: [PATCH 1/2] Do not pass struct tls_session* as void* in
key_state_ssl_init().

---
 src/openvpn/ssl_backend.h  |    6 +++++-
 src/openvpn/ssl_openssl.c  |    2 +-
 src/openvpn/ssl_polarssl.c |    2 +-
 3 files changed, 7 insertions(+), 3 deletions(-)
src/openvpn/ssl_backend.h +5 -1
index f61580c..72235ae 100644
@@ -42,6 +42,10 @@
 #include "ssl_verify_polarssl.h"
 #endif
 
+/**
+ *  prototype for struct tls_session from ssl_common.h
+ */
+struct tls_session;
 
 /**
  * Get a tls_cipher_name_pair containing OpenSSL and IANA names for supplied TLS cipher name
@@ -291,7 +295,7 @@ void tls_ctx_personalise_random(struct tls_root_ctx *ctx);
  * @param session	The session associated with the given key_state
  */
 void key_state_ssl_init(struct key_state_ssl *ks_ssl,
-    const struct tls_root_ctx *ssl_ctx, bool is_server, void *session);
+    const struct tls_root_ctx *ssl_ctx, bool is_server, struct tls_session *session);
 
 /**
  * Free the SSL channel part of the given key state.
src/openvpn/ssl_openssl.c +1 -1
index 79cc056..2e40ebd 100644
@@ -1015,7 +1015,7 @@ bio_read (BIO *bio, struct buffer *buf, int maxlen, const char *desc)
 }
 
 void
-key_state_ssl_init(struct key_state_ssl *ks_ssl, const struct tls_root_ctx *ssl_ctx, bool is_server, void *session)
+key_state_ssl_init(struct key_state_ssl *ks_ssl, const struct tls_root_ctx *ssl_ctx, bool is_server, struct tls_session *session)
 {
   ASSERT(NULL != ssl_ctx);
   ASSERT(ks_ssl);
src/openvpn/ssl_polarssl.c +1 -1
index 2b5b37b..a82b233 100644
@@ -502,7 +502,7 @@ void tls_ctx_personalise_random(struct tls_root_ctx *ctx)
 }
 
 void key_state_ssl_init(struct key_state_ssl *ks_ssl,
-    const struct tls_root_ctx *ssl_ctx, bool is_server, void *session)
+    const struct tls_root_ctx *ssl_ctx, bool is_server, struct tls_session *session)
 {
   ASSERT(NULL != ssl_ctx);
   ASSERT(ks_ssl);
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 8 lines · Steffan Karger

Hi,

The attached patch changes the key_state_ssl_init() function to take the TLS session as a 'struct tls_session *', instead of a 'void *' that has to be cast back later. This patch prepares for a patch from Tamas Tevesz that actually uses the TLS session inside key_state_ssl_init().

-Steffan

From fcae4846ed642386be8ae985f0b8ff29d3b738ba Mon Sep 17 00:00:00 2001

Quoted 11 lines

From: Steffan Karger <[email protected]...>
Date: Sun, 19 May 2013 10:01:29 +0200
Subject: [PATCH 1/2] Do not pass struct tls_session* as void* in
key_state_ssl_init().

---
 src/openvpn/ssl_backend.h  |    6 +++++-
 src/openvpn/ssl_openssl.c  |    2 +-
 src/openvpn/ssl_polarssl.c |    2 +-
 3 files changed, 7 insertions(+), 3 deletions(-)

ACK!

Signature · 3 lines
kind regards,

David Sommerseth
#2 lore raw
In reply to Steffan Karger
Quoted 8 lines · Steffan Karger

Hi,

The attached patch changes the key_state_ssl_init() function to take the TLS session as a 'struct tls_session *', instead of a 'void *' that has to be cast back later. This patch prepares for a patch from Tamas Tevesz that actually uses the TLS session inside key_state_ssl_init().

-Steffan

Applied to master and pushed out.

commit b97e2c3c90afdbb1a24bc1357ec6b94d626defcd

Author: Steffan Karger <[email protected]...>
Date:   Sun May 19 10:01:29 2013 +0200
    Do not pass struct tls_session* as void* in key_state_ssl_init().

    Signed-off-by: Steffan Karger <[email protected]...>
    Acked-by: David Sommerseth <[email protected]...>
    Message-Id: [email protected]...
    URL: http://article.gmane.org/gmane.network.openvpn.devel/7664
    Signed-off-by: David Sommerseth <[email protected]...>
Signature · 3 lines
kind regards,

David Sommerseth