]> git.sesse.net Git - vlc/commitdiff
Generic client SSL/TLS support
authorRémi Denis-Courmont <rem@videolan.org>
Sun, 26 Dec 2004 10:21:47 +0000 (10:21 +0000)
committerRémi Denis-Courmont <rem@videolan.org>
Sun, 26 Dec 2004 10:21:47 +0000 (10:21 +0000)
modules/misc/gnutls.c
src/misc/tls.c

index b55f59345b57ce20951e99f9918e3121abcc40a5..34e454b091f5b5e1b5f331945c93651945f0d1df 100644 (file)
@@ -305,6 +305,7 @@ gnutls_ClientCreate( tls_t *p_tls, const char *psz_ca_path )
     p_session->sock.pf_send = gnutls_Send;
     p_session->sock.pf_recv = gnutls_Recv;
     p_session->pf_handshake = gnutls_SessionHandshake;
+    p_session->pf_handshake2 = gnutls_SessionContinueHandshake;
     p_session->pf_close = gnutls_SessionClose;
 
     return p_session;
index 689c8b8991de155302ad59e060e40899f5698bb8..fe64e16e949b0f2f02dda0e77e2e5cc2f1bdbf72 100644 (file)
@@ -29,7 +29,6 @@
 
 /*
  * TODO:
- * - client side stuff,
  * - server-side client cert validation,
  * - client-side server cert validation (?).
  */
@@ -97,7 +96,7 @@ tls_ServerDelete( tls_server_t *p_server )
  * tls_ClientCreate:
  *****************************************************************************
  * Allocates a client's TLS credentials and shakes hands through the network.
- * Returns NULL on error.
+ * Returns NULL on error. This is a blocking network operation.
  *****************************************************************************/
 tls_session_t *
 tls_ClientCreate( vlc_object_t *p_this, const char *psz_ca, int fd )
@@ -114,13 +113,17 @@ tls_ClientCreate( vlc_object_t *p_this, const char *psz_ca, int fd )
         p_session = __tls_ClientCreate( p_tls, psz_ca );
         if( p_session != NULL )
         {
-            if( tls_SessionHandshake( p_session, fd ) )
+            int i_val;
+
+            for( i_val = tls_SessionHandshake( p_session, fd ); i_val > 0;
+                 i_val = tls_SessionContinueHandshake( p_session ) );
+            
+            if( i_val == 0 )
             {
                 msg_Dbg( p_this, "TLS/SSL provider initialized" );
                 return p_session;
             }
-            else
-                msg_Err( p_this, "TLS/SSL session handshake error" );
+            msg_Err( p_this, "TLS/SSL session handshake error" );
         }
         else
             msg_Err( p_this, "TLS/SSL provider error" );