summaryrefslogtreecommitdiff
path: root/src/streams/tls.h
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2018-10-25 08:49:01 +0100
committerEdward Thomson <ethomson@edwardthomson.com>2018-11-28 15:46:57 +0000
commit43b592ac84dbd3d649022ff9503f00ecc83d5278 (patch)
treeaeb52e3f745cf99eb5d7807073dab1d3d7a07709 /src/streams/tls.h
parent6ba3e6affc73b84f6cd2cadf476c0e0c5e58e404 (diff)
downloadlibgit2-43b592ac84dbd3d649022ff9503f00ecc83d5278.tar.gz
tls: introduce a wrap function
Introduce `git_tls_stream_wrap` which will take an existing `stream` with an already connected socket and begin speaking TLS on top of it. This is useful if you've built a connection to a proxy server and you wish to begin CONNECT over it to tunnel a TLS connection. Also update the pluggable TLS stream layer so that it can accept a registration structure that provides an `init` and `wrap` function, instead of a single initialization function.
Diffstat (limited to 'src/streams/tls.h')
-rw-r--r--src/streams/tls.h19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/streams/tls.h b/src/streams/tls.h
index 6d110e8ad..00c6e0b56 100644
--- a/src/streams/tls.h
+++ b/src/streams/tls.h
@@ -11,13 +11,24 @@
#include "git2/sys/stream.h"
+/** Configure TLS stream functions. */
+int git_tls_stream_global_init(void);
+
/**
* Create a TLS stream with the most appropriate backend available for
- * the current platform.
- *
- * This allows us to ask for a SecureTransport or OpenSSL stream
- * according to being on general Unix vs OS X.
+ * the current platform, whether that's SecureTransport on macOS,
+ * OpenSSL or mbedTLS on other Unixes, or something else entirely.
*/
extern int git_tls_stream_new(git_stream **out, const char *host, const char *port);
+/**
+ * Create a TLS stream on top of an existing insecure stream, using
+ * the most appropriate backend available for the current platform.
+ *
+ * This allows us to create a CONNECT stream on top of a proxy;
+ * using SecureTransport on macOS, OpenSSL or mbedTLS on other
+ * Unixes, or something else entirely.
+ */
+extern int git_tls_stream_wrap(git_stream **out, git_stream *in, const char *host);
+
#endif