summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libressl/ressl.c20
-rw-r--r--src/lib/libressl/ressl_internal.h1
2 files changed, 21 insertions, 0 deletions
diff --git a/src/lib/libressl/ressl.c b/src/lib/libressl/ressl.c
index e014d3e572..44a8a19421 100644
--- a/src/lib/libressl/ressl.c
+++ b/src/lib/libressl/ressl.c
@@ -90,6 +90,26 @@ ressl_configure(struct ressl *ctx, struct ressl_config *config)
90 return (0); 90 return (0);
91} 91}
92 92
93int
94ressl_configure_keypair(struct ressl *ctx)
95{
96 if (SSL_CTX_use_certificate_file(ctx->ssl_ctx, ctx->config->cert_file,
97 SSL_FILETYPE_PEM) != 1) {
98 ressl_set_error(ctx, "failed to load certificate");
99 return (1);
100 }
101 if (SSL_CTX_use_PrivateKey_file(ctx->ssl_ctx, ctx->config->key_file,
102 SSL_FILETYPE_PEM) != 1) {
103 ressl_set_error(ctx, "failed to load private key");
104 return (1);
105 }
106 if (SSL_CTX_check_private_key(ctx->ssl_ctx) != 1) {
107 ressl_set_error(ctx, "private/public key mismatch");
108 return (1);
109 }
110 return (0);
111}
112
93void 113void
94ressl_free(struct ressl *ctx) 114ressl_free(struct ressl *ctx)
95{ 115{
diff --git a/src/lib/libressl/ressl_internal.h b/src/lib/libressl/ressl_internal.h
index c33d4cff2e..0b6a58bf2d 100644
--- a/src/lib/libressl/ressl_internal.h
+++ b/src/lib/libressl/ressl_internal.h
@@ -53,6 +53,7 @@ struct ressl {
53struct ressl *ressl_new(void); 53struct ressl *ressl_new(void);
54 54
55int ressl_check_hostname(X509 *cert, const char *host); 55int ressl_check_hostname(X509 *cert, const char *host);
56int ressl_configure_keypair(struct ressl *ctx);
56int ressl_host_port(const char *hostport, char **host, char **port); 57int ressl_host_port(const char *hostport, char **host, char **port);
57int ressl_set_error(struct ressl *ctx, char *fmt, ...); 58int ressl_set_error(struct ressl *ctx, char *fmt, ...);
58 59