diff options
Diffstat (limited to 'src/lib/libressl/ressl_client.c')
| -rw-r--r-- | src/lib/libressl/ressl_client.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/lib/libressl/ressl_client.c b/src/lib/libressl/ressl_client.c index 2e4f253856..1d1ad72b86 100644 --- a/src/lib/libressl/ressl_client.c +++ b/src/lib/libressl/ressl_client.c | |||
| @@ -28,6 +28,19 @@ | |||
| 28 | #include <ressl.h> | 28 | #include <ressl.h> |
| 29 | #include "ressl_internal.h" | 29 | #include "ressl_internal.h" |
| 30 | 30 | ||
| 31 | struct ressl * | ||
| 32 | ressl_client(void) | ||
| 33 | { | ||
| 34 | struct ressl *ctx; | ||
| 35 | |||
| 36 | if ((ctx = ressl_new()) == NULL) | ||
| 37 | return (NULL); | ||
| 38 | |||
| 39 | ctx->flags |= RESSL_CLIENT; | ||
| 40 | |||
| 41 | return (ctx); | ||
| 42 | } | ||
| 43 | |||
| 31 | int | 44 | int |
| 32 | ressl_connect(struct ressl *ctx, const char *host, const char *port) | 45 | ressl_connect(struct ressl *ctx, const char *host, const char *port) |
| 33 | { | 46 | { |
| @@ -36,6 +49,11 @@ ressl_connect(struct ressl *ctx, const char *host, const char *port) | |||
| 36 | char *hs = NULL, *ps = NULL; | 49 | char *hs = NULL, *ps = NULL; |
| 37 | int rv = -1, s = -1, ret; | 50 | int rv = -1, s = -1, ret; |
| 38 | 51 | ||
| 52 | if ((ctx->flags & RESSL_CLIENT) == 0) { | ||
| 53 | ressl_set_error(ctx, "not a client context"); | ||
| 54 | goto err; | ||
| 55 | } | ||
| 56 | |||
| 39 | if (host == NULL) { | 57 | if (host == NULL) { |
| 40 | ressl_set_error(ctx, "host not specified"); | 58 | ressl_set_error(ctx, "host not specified"); |
| 41 | goto err; | 59 | goto err; |
| @@ -108,6 +126,11 @@ ressl_connect_socket(struct ressl *ctx, int socket, const char *hostname) | |||
| 108 | X509 *cert = NULL; | 126 | X509 *cert = NULL; |
| 109 | int ret; | 127 | int ret; |
| 110 | 128 | ||
| 129 | if ((ctx->flags & RESSL_CLIENT) == 0) { | ||
| 130 | ressl_set_error(ctx, "not a client context"); | ||
| 131 | goto err; | ||
| 132 | } | ||
| 133 | |||
| 111 | ctx->socket = socket; | 134 | ctx->socket = socket; |
| 112 | 135 | ||
| 113 | /* XXX - add a configuration option to control versions. */ | 136 | /* XXX - add a configuration option to control versions. */ |
