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
4b2909ca
Commit
4b2909ca
authored
Dec 16, 2015
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tls: move close callback from credentials to session
parent
d3c0569c
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
20 deletions
+18
-20
include/vlc_tls.h
include/vlc_tls.h
+1
-1
modules/misc/gnutls.c
modules/misc/gnutls.c
+15
-14
modules/misc/securetransport.c
modules/misc/securetransport.c
+1
-2
src/network/tls.c
src/network/tls.c
+1
-3
No files found.
include/vlc_tls.h
View file @
4b2909ca
...
...
@@ -45,6 +45,7 @@ struct vlc_tls
ssize_t
(
*
recv
)(
struct
vlc_tls
*
,
void
*
,
size_t
);
ssize_t
(
*
send
)(
struct
vlc_tls
*
,
const
void
*
,
size_t
);
void
(
*
close
)(
vlc_tls_t
*
);
};
/**
...
...
@@ -95,7 +96,6 @@ struct vlc_tls_creds
const
char
*
const
*
alpn
);
int
(
*
handshake
)
(
vlc_tls_t
*
,
const
char
*
host
,
const
char
*
service
,
char
**
/*restrict*/
alp
);
void
(
*
close
)
(
vlc_tls_t
*
);
};
/**
...
...
modules/misc/gnutls.c
View file @
4b2909ca
...
...
@@ -183,6 +183,20 @@ static ssize_t gnutls_Recv (vlc_tls_t *tls, void *buf, size_t length)
return
(
val
<
0
)
?
gnutls_Error
(
tls
,
val
)
:
val
;
}
/**
* Terminates a TLS session.
*
* This terminates a TLS session and releases session data.
* The underlying socket must be closed separately.
*/
static
void
gnutls_Close
(
vlc_tls_t
*
tls
)
{
gnutls_session_t
session
=
tls
->
sys
;
gnutls_bye
(
session
,
GNUTLS_SHUT_RDWR
);
gnutls_deinit
(
session
);
}
static
int
gnutls_SessionOpen
(
vlc_tls_t
*
tls
,
int
type
,
gnutls_certificate_credentials_t
x509
,
int
fd
,
const
char
*
const
*
alpn
)
...
...
@@ -251,6 +265,7 @@ static int gnutls_SessionOpen (vlc_tls_t *tls, int type,
tls
->
sys
=
session
;
tls
->
send
=
gnutls_Send
;
tls
->
recv
=
gnutls_Recv
;
tls
->
close
=
gnutls_Close
;
return
VLC_SUCCESS
;
error:
...
...
@@ -317,18 +332,6 @@ done:
return
0
;
}
/**
* Terminates TLS session and releases session data.
* You still have to close the socket yourself.
*/
static
void
gnutls_SessionClose
(
vlc_tls_t
*
tls
)
{
gnutls_session_t
session
=
tls
->
sys
;
gnutls_bye
(
session
,
GNUTLS_SHUT_RDWR
);
gnutls_deinit
(
session
);
}
static
int
gnutls_ClientSessionOpen
(
vlc_tls_creds_t
*
crd
,
vlc_tls_t
*
tls
,
int
fd
,
const
char
*
hostname
,
const
char
*
const
*
alpn
)
...
...
@@ -504,7 +507,6 @@ static int OpenClient (vlc_tls_creds_t *crd)
crd
->
sys
=
x509
;
crd
->
open
=
gnutls_ClientSessionOpen
;
crd
->
handshake
=
gnutls_ClientHandshake
;
crd
->
close
=
gnutls_SessionClose
;
return
VLC_SUCCESS
;
}
...
...
@@ -638,7 +640,6 @@ static int OpenServer (vlc_tls_creds_t *crd, const char *cert, const char *key)
crd
->
sys
=
sys
;
crd
->
open
=
gnutls_ServerSessionOpen
;
crd
->
handshake
=
gnutls_ServerHandshake
;
crd
->
close
=
gnutls_SessionClose
;
return
VLC_SUCCESS
;
...
...
modules/misc/securetransport.c
View file @
4b2909ca
...
...
@@ -542,6 +542,7 @@ static int st_SessionOpenCommon (vlc_tls_creds_t *crd, vlc_tls_t *session,
session
->
sys
=
sys
;
session
->
send
=
st_Send
;
session
->
recv
=
st_Recv
;
session
->
close
=
st_SessionClose
;
crd
->
handshake
=
st_Handshake
;
SSLContextRef
p_context
=
NULL
;
...
...
@@ -635,7 +636,6 @@ static int OpenClient (vlc_tls_creds_t *crd) {
crd
->
sys
=
sys
;
crd
->
open
=
st_ClientSessionOpen
;
crd
->
close
=
st_SessionClose
;
return
VLC_SUCCESS
;
}
...
...
@@ -792,7 +792,6 @@ static int OpenServer (vlc_tls_creds_t *crd, const char *cert, const char *key)
crd
->
sys
=
sys
;
crd
->
open
=
st_ServerSessionOpen
;
crd
->
close
=
st_SessionClose
;
out:
if
(
policy
)
...
...
src/network/tls.c
View file @
4b2909ca
...
...
@@ -153,9 +153,7 @@ int vlc_tls_SessionHandshake (vlc_tls_t *session, const char *host,
void
vlc_tls_SessionDelete
(
vlc_tls_t
*
session
)
{
vlc_tls_creds_t
*
crd
=
(
vlc_tls_creds_t
*
)(
session
->
p_parent
);
crd
->
close
(
session
);
session
->
close
(
session
);
vlc_object_release
(
session
);
}
...
...
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