[vlc-commits] tls: pass credentials pointer to handshake function

Rémi Denis-Courmont git at videolan.org
Fri Dec 18 21:07:44 CET 2015


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Dec 16 23:35:26 2015 +0200| [f48b0f3fee9be0271cd71360c9b8b926bf470c4f] | committer: Rémi Denis-Courmont

tls: pass credentials pointer to handshake function

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f48b0f3fee9be0271cd71360c9b8b926bf470c4f
---

 include/vlc_tls.h              |    6 +++---
 modules/misc/gnutls.c          |   10 ++++++----
 modules/misc/securetransport.c |    5 +++--
 src/network/tls.c              |    2 +-
 4 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/include/vlc_tls.h b/include/vlc_tls.h
index d243f35..69ce19a 100644
--- a/include/vlc_tls.h
+++ b/include/vlc_tls.h
@@ -92,8 +92,8 @@ struct vlc_tls_creds
 
     int (*open) (vlc_tls_creds_t *, vlc_tls_t *, int fd, const char *host,
                  const char *const *alpn);
-    int  (*handshake) (vlc_tls_t *, const char *host, const char *service,
-                       char ** /*restrict*/ alp);
+    int  (*handshake)(vlc_tls_creds_t *, vlc_tls_t *, const char *host,
+                      const char *service, char ** /*restrict*/ alp);
 };
 
 /**
@@ -120,7 +120,7 @@ vlc_tls_creds_t *vlc_tls_ServerCreate (vlc_object_t *,
 static inline int vlc_tls_SessionHandshake (vlc_tls_creds_t *crd,
                                             vlc_tls_t *tls)
 {
-    return crd->handshake (tls, NULL, NULL, NULL);
+    return crd->handshake(crd, tls, NULL, NULL, NULL);
 }
 
 /**
diff --git a/modules/misc/gnutls.c b/modules/misc/gnutls.c
index e1804ac..a16c44f 100644
--- a/modules/misc/gnutls.c
+++ b/modules/misc/gnutls.c
@@ -353,8 +353,9 @@ static int gnutls_ClientSessionOpen (vlc_tls_creds_t *crd, vlc_tls_t *tls,
     return VLC_SUCCESS;
 }
 
-static int gnutls_ClientHandshake (vlc_tls_t *tls, const char *host,
-                                   const char *service, char **restrict alp)
+static int gnutls_ClientHandshake(vlc_tls_creds_t *creds, vlc_tls_t *tls,
+                                  const char *host, const char *service,
+                                  char **restrict alp)
 {
     int val = gnutls_ContinueHandshake (tls, alp);
     if (val)
@@ -542,8 +543,9 @@ static int gnutls_ServerSessionOpen (vlc_tls_creds_t *crd, vlc_tls_t *tls,
     return gnutls_SessionOpen (tls, GNUTLS_SERVER, sys->x509_cred, fd, alpn);
 }
 
-static int gnutls_ServerHandshake (vlc_tls_t *tls, const char *host,
-                                   const char *service, char **restrict alp)
+static int gnutls_ServerHandshake(vlc_tls_creds_t *crd, vlc_tls_t *tls,
+                                  const char *host, const char *service,
+                                  char **restrict alp)
 {
     (void) host; (void) service;
     return gnutls_ContinueHandshake (tls, alp);
diff --git a/modules/misc/securetransport.c b/modules/misc/securetransport.c
index b84a7f4..40c3dbc 100644
--- a/modules/misc/securetransport.c
+++ b/modules/misc/securetransport.c
@@ -378,8 +378,9 @@ out:
  * 1 if more would-be blocking recv is needed,
  * 2 if more would-be blocking send is required.
  */
-static int st_Handshake (vlc_tls_t *session, const char *host,
-                                        const char *service, char **restrict alp) {
+static int st_Handshake (vlc_tls_creds_t *crd, vlc_tls_t *session,
+                         const char *host, const char *service,
+                         char **restrict alp) {
     VLC_UNUSED(service);
 
     vlc_tls_sys_t *sys = session->sys;
diff --git a/src/network/tls.c b/src/network/tls.c
index 571bb03..26f2f73 100644
--- a/src/network/tls.c
+++ b/src/network/tls.c
@@ -178,7 +178,7 @@ vlc_tls_t *vlc_tls_ClientSessionCreate (vlc_tls_creds_t *crd, int fd,
     ufd[0].fd = fd;
 
     vlc_cleanup_push (cleanup_tls, session);
-    while ((val = crd->handshake (session, host, service, alp)) != 0)
+    while ((val = crd->handshake(crd, session, host, service, alp)) != 0)
     {
         if (val < 0)
         {



More information about the vlc-commits mailing list