Commit f48b0f3f authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

tls: pass credentials pointer to handshake function

parent 7be25353
...@@ -92,8 +92,8 @@ struct vlc_tls_creds ...@@ -92,8 +92,8 @@ struct vlc_tls_creds
int (*open) (vlc_tls_creds_t *, vlc_tls_t *, int fd, const char *host, int (*open) (vlc_tls_creds_t *, vlc_tls_t *, int fd, const char *host,
const char *const *alpn); const char *const *alpn);
int (*handshake) (vlc_tls_t *, const char *host, const char *service, int (*handshake)(vlc_tls_creds_t *, vlc_tls_t *, const char *host,
char ** /*restrict*/ alp); const char *service, char ** /*restrict*/ alp);
}; };
/** /**
...@@ -120,7 +120,7 @@ vlc_tls_creds_t *vlc_tls_ServerCreate (vlc_object_t *, ...@@ -120,7 +120,7 @@ vlc_tls_creds_t *vlc_tls_ServerCreate (vlc_object_t *,
static inline int vlc_tls_SessionHandshake (vlc_tls_creds_t *crd, static inline int vlc_tls_SessionHandshake (vlc_tls_creds_t *crd,
vlc_tls_t *tls) vlc_tls_t *tls)
{ {
return crd->handshake (tls, NULL, NULL, NULL); return crd->handshake(crd, tls, NULL, NULL, NULL);
} }
/** /**
......
...@@ -353,8 +353,9 @@ static int gnutls_ClientSessionOpen (vlc_tls_creds_t *crd, vlc_tls_t *tls, ...@@ -353,8 +353,9 @@ static int gnutls_ClientSessionOpen (vlc_tls_creds_t *crd, vlc_tls_t *tls,
return VLC_SUCCESS; return VLC_SUCCESS;
} }
static int gnutls_ClientHandshake (vlc_tls_t *tls, const char *host, static int gnutls_ClientHandshake(vlc_tls_creds_t *creds, vlc_tls_t *tls,
const char *service, char **restrict alp) const char *host, const char *service,
char **restrict alp)
{ {
int val = gnutls_ContinueHandshake (tls, alp); int val = gnutls_ContinueHandshake (tls, alp);
if (val) if (val)
...@@ -542,8 +543,9 @@ static int gnutls_ServerSessionOpen (vlc_tls_creds_t *crd, vlc_tls_t *tls, ...@@ -542,8 +543,9 @@ static int gnutls_ServerSessionOpen (vlc_tls_creds_t *crd, vlc_tls_t *tls,
return gnutls_SessionOpen (tls, GNUTLS_SERVER, sys->x509_cred, fd, alpn); return gnutls_SessionOpen (tls, GNUTLS_SERVER, sys->x509_cred, fd, alpn);
} }
static int gnutls_ServerHandshake (vlc_tls_t *tls, const char *host, static int gnutls_ServerHandshake(vlc_tls_creds_t *crd, vlc_tls_t *tls,
const char *service, char **restrict alp) const char *host, const char *service,
char **restrict alp)
{ {
(void) host; (void) service; (void) host; (void) service;
return gnutls_ContinueHandshake (tls, alp); return gnutls_ContinueHandshake (tls, alp);
......
...@@ -378,8 +378,9 @@ out: ...@@ -378,8 +378,9 @@ out:
* 1 if more would-be blocking recv is needed, * 1 if more would-be blocking recv is needed,
* 2 if more would-be blocking send is required. * 2 if more would-be blocking send is required.
*/ */
static int st_Handshake (vlc_tls_t *session, const char *host, static int st_Handshake (vlc_tls_creds_t *crd, vlc_tls_t *session,
const char *service, char **restrict alp) { const char *host, const char *service,
char **restrict alp) {
VLC_UNUSED(service); VLC_UNUSED(service);
vlc_tls_sys_t *sys = session->sys; vlc_tls_sys_t *sys = session->sys;
......
...@@ -178,7 +178,7 @@ vlc_tls_t *vlc_tls_ClientSessionCreate (vlc_tls_creds_t *crd, int fd, ...@@ -178,7 +178,7 @@ vlc_tls_t *vlc_tls_ClientSessionCreate (vlc_tls_creds_t *crd, int fd,
ufd[0].fd = fd; ufd[0].fd = fd;
vlc_cleanup_push (cleanup_tls, session); vlc_cleanup_push (cleanup_tls, session);
while ((val = crd->handshake (session, host, service, alp)) != 0) while ((val = crd->handshake(crd, session, host, service, alp)) != 0)
{ {
if (val < 0) if (val < 0)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment