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
cc80d6a2
Commit
cc80d6a2
authored
Nov 09, 2015
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tls: improve documentation
parent
5d92e169
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
38 deletions
+51
-38
include/vlc_tls.h
include/vlc_tls.h
+51
-1
src/network/tls.c
src/network/tls.c
+0
-37
No files found.
include/vlc_tls.h
View file @
cc80d6a2
...
...
@@ -23,8 +23,11 @@
# define VLC_TLS_H
/**
* \ingroup sockets
* \defgroup tls Transport Layer Security
* @{
* \file
* T
his file defines Transport Layer Security API (TLS) in vlc
* T
ransport Layer Security (TLS) functions
*/
# include <vlc_network.h>
...
...
@@ -43,9 +46,28 @@ struct vlc_tls
struct
virtual_socket_t
sock
;
};
/**
* Initiates a client TLS session.
*
* Performs client side of TLS handshake through a connected socket, and
* establishes a secure channel. This is a blocking network operation.
*
* @param fd socket through which to establish the secure channel
* @param hostname expected server name, used both as Server Name Indication
* and as expected Common Name of the peer certificate
* @param service unique identifier for the service to connect to
* (only used locally for certificates database)
* @param alpn NULL-terminated list of Application Layer Protocols
* to negotiate, or NULL to not negotiate protocols
* @param alp storage space for the negotiated Application Layer
* Protocol or NULL if negotiation was not performed[OUT]
*
* @return TLS session, or NULL on error.
**/
VLC_API
vlc_tls_t
*
vlc_tls_ClientSessionCreate
(
vlc_tls_creds_t
*
,
int
fd
,
const
char
*
host
,
const
char
*
service
,
const
char
*
const
*
alpn
,
char
**
alp
);
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
,
...
...
@@ -74,9 +96,37 @@ struct vlc_tls_creds
void
(
*
close
)
(
vlc_tls_t
*
);
};
/**
* Allocates TLS credentials for a client.
* Credentials can be cached and reused across multiple TLS sessions.
*
* @return TLS credentials object, or NULL on error.
**/
VLC_API
vlc_tls_creds_t
*
vlc_tls_ClientCreate
(
vlc_object_t
*
);
/**
* Allocates server TLS credentials.
*
* @param cert_path required (Unicode) path to an x509 certificate,
* if NULL, anonymous key exchange will be used.
* @param key_path (UTF-8) path to the PKCS private key for the certificate,
* if NULL; cert_path will be used.
*
* @return TLS credentials object, or NULL on error.
*/
vlc_tls_creds_t
*
vlc_tls_ServerCreate
(
vlc_object_t
*
,
const
char
*
cert
,
const
char
*
key
);
/**
* Releases TLS credentials.
*
* Releases data allocated with vlc_tls_ClientCreate() or
* vlc_tls_ServerCreate().
*
* @param srv object to be destroyed (or NULL)
*/
VLC_API
void
vlc_tls_Delete
(
vlc_tls_creds_t
*
);
/** @} */
#endif
src/network/tls.c
View file @
cc80d6a2
...
...
@@ -73,16 +73,6 @@ static void tls_unload(void *func, va_list ap)
deactivate
(
crd
);
}
/**
* Allocates a whole server's TLS credentials.
*
* @param cert_path required (Unicode) path to an x509 certificate,
* if NULL, anonymous key exchange will be used.
* @param key_path (UTF-8) path to the PKCS private key for the certificate,
* if NULL; cert_path will be used.
*
* @return NULL on error.
*/
vlc_tls_creds_t
*
vlc_tls_ServerCreate
(
vlc_object_t
*
obj
,
const
char
*
cert_path
,
const
char
*
key_path
)
...
...
@@ -107,12 +97,6 @@ vlc_tls_ServerCreate (vlc_object_t *obj, const char *cert_path,
return
srv
;
}
/**
* Allocates TLS credentials for a client.
* Credentials can be cached and reused across multiple TLS sessions.
*
* @return TLS credentials object, or NULL on error.
**/
vlc_tls_creds_t
*
vlc_tls_ClientCreate
(
vlc_object_t
*
obj
)
{
vlc_tls_creds_t
*
crd
=
vlc_custom_create
(
obj
,
sizeof
(
*
crd
),
...
...
@@ -132,11 +116,6 @@ vlc_tls_creds_t *vlc_tls_ClientCreate (vlc_object_t *obj)
return
crd
;
}
/**
* Releases data allocated with vlc_tls_ClientCreate() or
* vlc_tls_ServerCreate().
* @param srv TLS server object to be destroyed, or NULL
*/
void
vlc_tls_Delete
(
vlc_tls_creds_t
*
crd
)
{
if
(
crd
==
NULL
)
...
...
@@ -180,22 +159,6 @@ void vlc_tls_SessionDelete (vlc_tls_t *session)
vlc_object_release
(
session
);
}
/**
* Performs client side of TLS handshake through a connected socket, and
* establishes a secure channel. This is a blocking network operation.
*
* @param fd socket through which to establish the secure channel
* @param hostname expected server name, used both as Server Name Indication
* and as expected Common Name of the peer certificate
* @param service unique identifier for the service to connect to
* (only used locally for certificates database)
* @param alpn NULL-terminated list of Application Layer Protocols
* to negotiate, or NULL to not negotiate protocols
* @param alp storage space for the negotiated Application Layer
* Protocol or NULL if negotiation was not performed[OUT]
*
* @return NULL on error.
**/
vlc_tls_t
*
vlc_tls_ClientSessionCreate
(
vlc_tls_creds_t
*
crd
,
int
fd
,
const
char
*
host
,
const
char
*
service
,
const
char
*
const
*
alpn
,
char
**
alp
)
...
...
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