diff options
| author | jsing <> | 2014-07-13 23:36:24 +0000 |
|---|---|---|
| committer | jsing <> | 2014-07-13 23:36:24 +0000 |
| commit | 1165f37d4bd7efd3b30cbb67c69e94960bc3994b (patch) | |
| tree | a51eea524cec30d2fe0552258c574cf0068418d4 | |
| parent | db71c5bf2f35ee4c6899d2c6b5b0a3ed0fa51f98 (diff) | |
| download | openbsd-1165f37d4bd7efd3b30cbb67c69e94960bc3994b.tar.gz openbsd-1165f37d4bd7efd3b30cbb67c69e94960bc3994b.tar.bz2 openbsd-1165f37d4bd7efd3b30cbb67c69e94960bc3994b.zip | |
Add stubs for the proposed server API.
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libressl/Makefile | 3 | ||||
| -rw-r--r-- | src/lib/libressl/ressl.h | 4 | ||||
| -rw-r--r-- | src/lib/libressl/ressl_server.c | 66 |
3 files changed, 72 insertions, 1 deletions
diff --git a/src/lib/libressl/Makefile b/src/lib/libressl/Makefile index 397fefdf69..0a481f0009 100644 --- a/src/lib/libressl/Makefile +++ b/src/lib/libressl/Makefile | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.3 2014/07/13 22:42:01 jsing Exp $ | 1 | # $OpenBSD: Makefile,v 1.4 2014/07/13 23:36:24 jsing Exp $ |
| 2 | 2 | ||
| 3 | CFLAGS+= -Wall -Werror -Wimplicit | 3 | CFLAGS+= -Wall -Werror -Wimplicit |
| 4 | CFLAGS+= -DLIBRESSL_INTERNAL | 4 | CFLAGS+= -DLIBRESSL_INTERNAL |
| @@ -12,6 +12,7 @@ HDRS= ressl.h | |||
| 12 | SRCS= ressl.c \ | 12 | SRCS= ressl.c \ |
| 13 | ressl_client.c \ | 13 | ressl_client.c \ |
| 14 | ressl_config.c \ | 14 | ressl_config.c \ |
| 15 | ressl_server.c \ | ||
| 15 | ressl_util.c \ | 16 | ressl_util.c \ |
| 16 | ressl_verify.c | 17 | ressl_verify.c |
| 17 | 18 | ||
diff --git a/src/lib/libressl/ressl.h b/src/lib/libressl/ressl.h index e7e0a9c51b..dc99368fe6 100644 --- a/src/lib/libressl/ressl.h +++ b/src/lib/libressl/ressl.h | |||
| @@ -37,12 +37,16 @@ void ressl_config_insecure_no_verify(struct ressl_config *config); | |||
| 37 | void ressl_config_verify(struct ressl_config *config); | 37 | void ressl_config_verify(struct ressl_config *config); |
| 38 | 38 | ||
| 39 | struct ressl *ressl_client(void); | 39 | struct ressl *ressl_client(void); |
| 40 | struct ressl *ressl_server(void); | ||
| 40 | int ressl_configure(struct ressl *ctx, struct ressl_config *config); | 41 | int ressl_configure(struct ressl *ctx, struct ressl_config *config); |
| 41 | void ressl_reset(struct ressl *ctx); | 42 | void ressl_reset(struct ressl *ctx); |
| 42 | void ressl_free(struct ressl *ctx); | 43 | void ressl_free(struct ressl *ctx); |
| 43 | 44 | ||
| 45 | int ressl_accept(struct ressl *ctx); | ||
| 46 | int ressl_accept_socket(struct ressl *ctx, int socket); | ||
| 44 | int ressl_connect(struct ressl *ctx, const char *host, const char *port); | 47 | int ressl_connect(struct ressl *ctx, const char *host, const char *port); |
| 45 | int ressl_connect_socket(struct ressl *ctx, int s, const char *hostname); | 48 | int ressl_connect_socket(struct ressl *ctx, int s, const char *hostname); |
| 49 | int ressl_listen(struct ressl *ctx, const char *host, const char *port, int af); | ||
| 46 | int ressl_read(struct ressl *ctx, char *buf, size_t buflen, size_t *outlen); | 50 | int ressl_read(struct ressl *ctx, char *buf, size_t buflen, size_t *outlen); |
| 47 | int ressl_write(struct ressl *ctx, const char *buf, size_t buflen, | 51 | int ressl_write(struct ressl *ctx, const char *buf, size_t buflen, |
| 48 | size_t *outlen); | 52 | size_t *outlen); |
diff --git a/src/lib/libressl/ressl_server.c b/src/lib/libressl/ressl_server.c new file mode 100644 index 0000000000..243b4bfb09 --- /dev/null +++ b/src/lib/libressl/ressl_server.c | |||
| @@ -0,0 +1,66 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> | ||
| 3 | * | ||
| 4 | * Permission to use, copy, modify, and distribute this software for any | ||
| 5 | * purpose with or without fee is hereby granted, provided that the above | ||
| 6 | * copyright notice and this permission notice appear in all copies. | ||
| 7 | * | ||
| 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #include "ressl_internal.h" | ||
| 18 | |||
| 19 | struct ressl * | ||
| 20 | ressl_server(void) | ||
| 21 | { | ||
| 22 | struct ressl *ctx; | ||
| 23 | |||
| 24 | if ((ctx = ressl_new()) == NULL) | ||
| 25 | return (NULL); | ||
| 26 | |||
| 27 | ctx->flags |= RESSL_SERVER; | ||
| 28 | |||
| 29 | return (ctx); | ||
| 30 | } | ||
| 31 | |||
| 32 | int | ||
| 33 | ressl_listen(struct ressl *ctx, const char *host, const char *port, int af) | ||
| 34 | { | ||
| 35 | if ((ctx->flags & RESSL_SERVER) == 0) { | ||
| 36 | ressl_set_error(ctx, "not a server context"); | ||
| 37 | goto err; | ||
| 38 | } | ||
| 39 | |||
| 40 | err: | ||
| 41 | return (1); | ||
| 42 | } | ||
| 43 | |||
| 44 | int | ||
| 45 | ressl_accept(struct ressl *ctx) | ||
| 46 | { | ||
| 47 | if ((ctx->flags & RESSL_SERVER) == 0) { | ||
| 48 | ressl_set_error(ctx, "not a server context"); | ||
| 49 | goto err; | ||
| 50 | } | ||
| 51 | |||
| 52 | err: | ||
| 53 | return (1); | ||
| 54 | } | ||
| 55 | |||
| 56 | int | ||
| 57 | ressl_accept_socket(struct ressl *ctx, int socket) | ||
| 58 | { | ||
| 59 | if ((ctx->flags & RESSL_SERVER) == 0) { | ||
| 60 | ressl_set_error(ctx, "not a server context"); | ||
| 61 | goto err; | ||
| 62 | } | ||
| 63 | |||
| 64 | err: | ||
| 65 | return (1); | ||
| 66 | } | ||
