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
dc1b41f1
Commit
dc1b41f1
authored
Dec 16, 2015
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tls: make session independent of credentials
parent
4b2909ca
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
15 deletions
+13
-15
include/vlc_tls.h
include/vlc_tls.h
+6
-2
src/network/httpd.c
src/network/httpd.c
+5
-3
src/network/tls.c
src/network/tls.c
+2
-10
No files found.
include/vlc_tls.h
View file @
dc1b41f1
...
...
@@ -73,8 +73,6 @@ VLC_API vlc_tls_t *vlc_tls_ClientSessionCreate (vlc_tls_creds_t *, int fd,
vlc_tls_t
*
vlc_tls_SessionCreate
(
vlc_tls_creds_t
*
,
int
fd
,
const
char
*
host
,
const
char
*
const
*
alpn
);
int
vlc_tls_SessionHandshake
(
vlc_tls_t
*
,
const
char
*
host
,
const
char
*
serv
,
char
**
/*restrict*/
alp
);
VLC_API
void
vlc_tls_SessionDelete
(
vlc_tls_t
*
);
VLC_API
int
vlc_tls_Read
(
vlc_tls_t
*
,
void
*
buf
,
size_t
len
,
bool
waitall
);
...
...
@@ -119,6 +117,12 @@ VLC_API vlc_tls_creds_t *vlc_tls_ClientCreate (vlc_object_t *);
vlc_tls_creds_t
*
vlc_tls_ServerCreate
(
vlc_object_t
*
,
const
char
*
cert
,
const
char
*
key
);
static
inline
int
vlc_tls_SessionHandshake
(
vlc_tls_creds_t
*
crd
,
vlc_tls_t
*
tls
)
{
return
crd
->
handshake
(
tls
,
NULL
,
NULL
,
NULL
);
}
/**
* Releases TLS credentials.
*
...
...
src/network/httpd.c
View file @
dc1b41f1
...
...
@@ -1665,9 +1665,9 @@ static void httpd_ClientSend(httpd_client_t *cl)
}
}
static
void
httpd_ClientTlsHandshake
(
httpd_client_t
*
cl
)
static
void
httpd_ClientTlsHandshake
(
httpd_
host_t
*
host
,
httpd_
client_t
*
cl
)
{
switch
(
vlc_tls_SessionHandshake
(
cl
->
p_tls
,
NULL
,
NULL
,
NULL
))
switch
(
vlc_tls_SessionHandshake
(
host
->
p_tls
,
cl
->
p_tls
))
{
case
-
1
:
cl
->
i_state
=
HTTPD_CLIENT_DEAD
;
break
;
case
0
:
cl
->
i_state
=
HTTPD_CLIENT_RECEIVING
;
break
;
...
...
@@ -2021,7 +2021,9 @@ static void httpdLoop(httpd_host_t *host)
case
HTTPD_CLIENT_RECEIVING
:
httpd_ClientRecv
(
cl
);
break
;
case
HTTPD_CLIENT_SENDING
:
httpd_ClientSend
(
cl
);
break
;
case
HTTPD_CLIENT_TLS_HS_IN
:
case
HTTPD_CLIENT_TLS_HS_OUT
:
httpd_ClientTlsHandshake
(
cl
);
break
;
case
HTTPD_CLIENT_TLS_HS_OUT
:
httpd_ClientTlsHandshake
(
host
,
cl
);
break
;
}
}
...
...
src/network/tls.c
View file @
dc1b41f1
...
...
@@ -131,7 +131,7 @@ void vlc_tls_Delete (vlc_tls_creds_t *crd)
vlc_tls_t
*
vlc_tls_SessionCreate
(
vlc_tls_creds_t
*
crd
,
int
fd
,
const
char
*
host
,
const
char
*
const
*
alpn
)
{
vlc_tls_t
*
session
=
vlc_custom_create
(
crd
,
sizeof
(
*
session
),
vlc_tls_t
*
session
=
vlc_custom_create
(
crd
->
p_parent
,
sizeof
(
*
session
),
"tls session"
);
int
val
=
crd
->
open
(
crd
,
session
,
fd
,
host
,
alpn
);
if
(
val
!=
VLC_SUCCESS
)
...
...
@@ -143,14 +143,6 @@ vlc_tls_t *vlc_tls_SessionCreate (vlc_tls_creds_t *crd, int fd,
return
session
;
}
int
vlc_tls_SessionHandshake
(
vlc_tls_t
*
session
,
const
char
*
host
,
const
char
*
service
,
char
**
restrict
alp
)
{
vlc_tls_creds_t
*
crd
=
(
vlc_tls_creds_t
*
)(
session
->
p_parent
);
return
crd
->
handshake
(
session
,
host
,
service
,
alp
);
}
void
vlc_tls_SessionDelete
(
vlc_tls_t
*
session
)
{
session
->
close
(
session
);
...
...
@@ -186,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
=
vlc_tls_SessionH
andshake
(
session
,
host
,
service
,
alp
))
!=
0
)
while
((
val
=
crd
->
h
andshake
(
session
,
host
,
service
,
alp
))
!=
0
)
{
if
(
val
<
0
)
{
...
...
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