Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
73ae5d90
Commit
73ae5d90
authored
Mar 05, 2005
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- TLS API cleanup
- some minor fixes as well
parent
1a90a3cd
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
196 additions
and
166 deletions
+196
-166
include/vlc_tls.h
include/vlc_tls.h
+13
-13
modules/access/http.c
modules/access/http.c
+1
-1
modules/misc/gnutls.c
modules/misc/gnutls.c
+163
-138
src/misc/httpd.c
src/misc/httpd.c
+5
-2
src/misc/tls.c
src/misc/tls.c
+14
-12
No files found.
include/vlc_tls.h
View file @
73ae5d90
/*****************************************************************************
* tls.c
*****************************************************************************
* Copyright (C) 2004 VideoLAN
* Copyright (C) 2004
-2005
VideoLAN
* $Id: httpd.c 8263 2004-07-24 09:06:58Z courmisch $
*
* Authors: Remi Denis-Courmont <courmisch@via.ecp.fr>
...
...
@@ -34,13 +34,15 @@ struct tls_t
module_t
*
p_module
;
void
*
p_sys
;
tls_server_t
*
(
*
pf_server_create
)
(
tls_t
*
,
const
char
*
,
const
char
*
);
tls_session_t
*
(
*
pf_client_create
)
(
tls_t
*
,
const
char
*
);
tls_server_t
*
(
*
pf_server_create
)
(
tls_t
*
,
const
char
*
,
const
char
*
);
tls_session_t
*
(
*
pf_client_create
)
(
tls_t
*
);
};
struct
tls_server_t
{
tls_t
*
p_tls
;
VLC_COMMON_MEMBERS
void
*
p_sys
;
void
(
*
pf_delete
)
(
tls_server_t
*
);
...
...
@@ -53,13 +55,12 @@ struct tls_server_t
struct
tls_session_t
{
tls_t
*
p_tls
;
tls_server_t
*
p_server
;
VLC_COMMON_MEMBERS
void
*
p_sys
;
struct
virtual_socket_t
sock
;
int
(
*
pf_handshake
)
(
tls_session_t
*
,
int
);
int
(
*
pf_handshake
)
(
tls_session_t
*
,
int
,
const
char
*
);
int
(
*
pf_handshake2
)
(
tls_session_t
*
);
void
(
*
pf_close
)
(
tls_session_t
*
);
};
...
...
@@ -71,7 +72,6 @@ struct tls_session_t
* Allocates a whole server's TLS credentials.
* Returns NULL on error.
*****************************************************************************/
# define __tls_ServerCreate( a, b, c ) (((tls_t *)a)->pf_server_create (a, b, c))
VLC_EXPORT
(
tls_server_t
*
,
tls_ServerCreate
,
(
vlc_object_t
*
,
const
char
*
,
const
char
*
)
);
/*****************************************************************************
...
...
@@ -92,20 +92,20 @@ VLC_EXPORT( tls_server_t *, tls_ServerCreate, ( vlc_object_t *, const char *, co
# define tls_ServerAddCRL( a, b ) (((tls_server_t *)a)->pf_add_CRL (a, b))
# define __tls_ServerDelete( a ) (((tls_server_t *)a)->pf_delete ( a ))
VLC_EXPORT
(
void
,
tls_ServerDelete
,
(
tls_server_t
*
)
);
# define tls_ServerSessionPrepare( a ) (((tls_server_t *)a)->pf_session_prepare (a))
# define tls_ServerSessionHandshake( a, b ) (((tls_session_t *)a)->pf_handshake (a, b, NULL))
# define tls_ServerSessionClose( a ) (((tls_session_t *)a)->pf_close (a))
# define __tls_ClientCreate( a, b ) (((tls_t *)a)->pf_client_create (a, b ))
VLC_EXPORT
(
tls_session_t
*
,
tls_ClientCreate
,
(
vlc_object_t
*
,
const
char
*
,
int
)
);
VLC_EXPORT
(
tls_session_t
*
,
tls_ClientCreate
,
(
vlc_object_t
*
,
int
,
const
char
*
)
);
VLC_EXPORT
(
void
,
tls_ClientDelete
,
(
tls_session_t
*
)
);
# define tls_SessionHandshake( a, b ) (((tls_session_t *)a)->pf_handshake (a, b))
# define tls_ClientSessionHandshake( a, b, c ) (((tls_session_t *)a)->pf_handshake (a, b, c))
# define tls_SessionContinueHandshake( a ) (((tls_session_t *)a)->pf_handshake2 (a))
# define tls_SessionClose( a ) (((tls_session_t *)a)->pf_close (a))
/* NOTE: It is assumed that a->sock.p_sys = a */
# define tls_Send( a, b, c ) (((tls_session_t *)a)->sock.pf_send (a, b, c ))
...
...
modules/access/http.c
View file @
73ae5d90
...
...
@@ -860,7 +860,7 @@ static int Connect( access_t *p_access, int64_t i_tell )
return
VLC_EGENERIC
;
}
p_sys
->
p_tls
=
tls_ClientCreate
(
VLC_OBJECT
(
p_access
),
NULL
,
p_sys
->
fd
);
p_sys
->
p_tls
=
tls_ClientCreate
(
VLC_OBJECT
(
p_access
),
p_sys
->
fd
,
NULL
);
if
(
p_sys
->
p_tls
==
NULL
)
{
msg_Err
(
p_access
,
"cannot establish HTTP/SSL session"
);
...
...
modules/misc/gnutls.c
View file @
73ae5d90
This diff is collapsed.
Click to expand it.
src/misc/httpd.c
View file @
73ae5d90
...
...
@@ -1539,7 +1539,7 @@ static void httpd_ClientClean( httpd_client_t *cl )
if
(
cl
->
fd
>=
0
)
{
if
(
cl
->
p_tls
!=
NULL
)
tls_SessionClose
(
cl
->
p_tls
);
tls_Se
rverSe
ssionClose
(
cl
->
p_tls
);
net_Close
(
cl
->
fd
);
cl
->
fd
=
-
1
;
}
...
...
@@ -2480,7 +2480,7 @@ static void httpd_HostThread( httpd_host_t *host )
if
(
p_tls
!=
NULL
)
{
switch
(
tls_SessionHandshake
(
p_tls
,
fd
)
)
switch
(
tls_Se
rverSe
ssionHandshake
(
p_tls
,
fd
)
)
{
case
-
1
:
msg_Err
(
host
,
"Rejecting TLS connection"
);
...
...
@@ -2553,6 +2553,9 @@ static void httpd_HostThread( httpd_host_t *host )
}
vlc_mutex_unlock
(
&
host
->
lock
);
}
if
(
p_tls
!=
NULL
)
tls_ServerSessionClose
(
p_tls
);
}
#ifndef HAVE_GETADDRINFO
...
...
src/misc/tls.c
View file @
73ae5d90
/*****************************************************************************
* tls.c
*****************************************************************************
* Copyright (C) 2004 VideoLAN
* Copyright (C) 2004
-2005
VideoLAN
* $Id: httpd.c 8263 2004-07-24 09:06:58Z courmisch $
*
* Authors: Remi Denis-Courmont <courmisch@via.ecp.fr>
...
...
@@ -55,18 +55,18 @@ tls_ServerCreate( vlc_object_t *p_this, const char *psz_cert,
if
(
psz_key
==
NULL
)
psz_key
=
psz_cert
;
p_server
=
__tls_ServerC
reate
(
p_tls
,
psz_cert
,
psz_key
);
p_server
=
p_tls
->
pf_server_c
reate
(
p_tls
,
psz_cert
,
psz_key
);
if
(
p_server
!=
NULL
)
{
msg_Dbg
(
p_t
hi
s
,
"TLS/SSL provider initialized"
);
msg_Dbg
(
p_t
l
s
,
"TLS/SSL provider initialized"
);
return
p_server
;
}
else
msg_Err
(
p_t
hi
s
,
"TLS/SSL provider error"
);
msg_Err
(
p_t
l
s
,
"TLS/SSL provider error"
);
module_Unneed
(
p_tls
,
p_tls
->
p_module
);
}
else
msg_Err
(
p_t
hi
s
,
"TLS/SSL provider not found"
);
msg_Err
(
p_t
l
s
,
"TLS/SSL provider not found"
);
vlc_object_detach
(
p_tls
);
vlc_object_destroy
(
p_tls
);
...
...
@@ -82,9 +82,9 @@ tls_ServerCreate( vlc_object_t *p_this, const char *psz_cert,
void
tls_ServerDelete
(
tls_server_t
*
p_server
)
{
tls_t
*
p_tls
=
p_server
->
p_tls
;
tls_t
*
p_tls
=
(
tls_t
*
)
p_server
->
p_parent
;
__tls_ServerD
elete
(
p_server
);
p_server
->
pf_d
elete
(
p_server
);
module_Unneed
(
p_tls
,
p_tls
->
p_module
);
vlc_object_detach
(
p_tls
);
...
...
@@ -99,7 +99,7 @@ tls_ServerDelete( tls_server_t *p_server )
* 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
)
tls_ClientCreate
(
vlc_object_t
*
p_this
,
int
fd
,
const
char
*
psz_hostname
)
{
tls_t
*
p_tls
;
tls_session_t
*
p_session
;
...
...
@@ -110,12 +110,14 @@ tls_ClientCreate( vlc_object_t *p_this, const char *psz_ca, int fd )
p_tls
->
p_module
=
module_Need
(
p_tls
,
"tls"
,
0
,
0
);
if
(
p_tls
->
p_module
!=
NULL
)
{
p_session
=
__tls_ClientCreate
(
p_tls
,
psz_ca
);
p_session
=
p_tls
->
pf_client_create
(
p_tls
);
if
(
p_session
!=
NULL
)
{
int
i_val
;
for
(
i_val
=
tls_SessionHandshake
(
p_session
,
fd
);
i_val
>
0
;
for
(
i_val
=
tls_ClientSessionHandshake
(
p_session
,
fd
,
psz_hostname
);
i_val
>
0
;
i_val
=
tls_SessionContinueHandshake
(
p_session
)
);
if
(
i_val
==
0
)
...
...
@@ -146,9 +148,9 @@ tls_ClientCreate( vlc_object_t *p_this, const char *psz_ca, int fd )
void
tls_ClientDelete
(
tls_session_t
*
p_session
)
{
tls_t
*
p_tls
=
p_session
->
p_tls
;
tls_t
*
p_tls
=
(
tls_t
*
)
p_session
->
p_parent
;
tls_SessionC
lose
(
p_session
);
p_session
->
pf_c
lose
(
p_session
);
module_Unneed
(
p_tls
,
p_tls
->
p_module
);
vlc_object_detach
(
p_tls
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment