diff options
author | 2014-07-13 23:06:18 +0000 | |
---|---|---|
committer | 2014-07-13 23:06:18 +0000 | |
commit | 3dc376568a8590df39892f44651dd68152ace9f9 (patch) | |
tree | c59b851d2693f30da982e8b1ff8dd00e2b55c69e | |
parent | Do not fold multiple function arguments into the same .Fn argument: (diff) | |
download | wireguard-openbsd-3dc376568a8590df39892f44651dd68152ace9f9.tar.xz wireguard-openbsd-3dc376568a8590df39892f44651dd68152ace9f9.zip |
Split the context allocation out from the configuration. This will allow
us to properly report errors that occur during configuration processing.
Discussed with tedu@
-rw-r--r-- | lib/libressl/ressl.c | 16 | ||||
-rw-r--r-- | lib/libressl/ressl.h | 3 |
2 files changed, 14 insertions, 5 deletions
diff --git a/lib/libressl/ressl.c b/lib/libressl/ressl.c index dc82f321b11..08ec061bf58 100644 --- a/lib/libressl/ressl.c +++ b/lib/libressl/ressl.c @@ -65,21 +65,29 @@ ressl_set_error(struct ressl *ctx, char *fmt, ...) } struct ressl * -ressl_new(struct ressl_config *config) +ressl_new(void) { struct ressl *ctx; if ((ctx = calloc(1, sizeof(*ctx))) == NULL) return (NULL); + ctx->config = &ressl_config_default; + + ressl_reset(ctx); + + return (ctx); +} + +int +ressl_configure(struct ressl *ctx, struct ressl_config *config) +{ if (config == NULL) config = &ressl_config_default; ctx->config = config; - ressl_reset(ctx); - - return (ctx); + return (0); } void diff --git a/lib/libressl/ressl.h b/lib/libressl/ressl.h index a1d220028f2..766335aa0cd 100644 --- a/lib/libressl/ressl.h +++ b/lib/libressl/ressl.h @@ -36,7 +36,8 @@ void ressl_config_set_verify_depth(struct ressl_config *config, void ressl_config_insecure_no_verify(struct ressl_config *config); void ressl_config_verify(struct ressl_config *config); -struct ressl *ressl_new(struct ressl_config *config); +struct ressl *ressl_new(void); +int ressl_configure(struct ressl *ctx, struct ressl_config *config); void ressl_reset(struct ressl *ctx); void ressl_free(struct ressl *ctx); |