summaryrefslogtreecommitdiff
path: root/sockets.c
diff options
context:
space:
mode:
authorLuke Bratch <luke@bratch.co.uk>2019-05-12 21:41:49 +0100
committerLuke Bratch <luke@bratch.co.uk>2019-05-12 21:41:49 +0100
commit9064f7b9c347f913089bfea94d65ad3afc11ccf4 (patch)
treeeb323c6c20fd000461053d44f7fc2be5fd76df50 /sockets.c
parent03b15b2a99dee16998d08e17652bb49555c8560d (diff)
Make certificate and key file paths configurable.
Diffstat (limited to 'sockets.c')
-rw-r--r--sockets.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sockets.c b/sockets.c
index fd733b8..0f78b21 100644
--- a/sockets.c
+++ b/sockets.c
@@ -151,16 +151,16 @@ SSL_CTX *create_context() {
return ctx;
}
-void configure_context(SSL_CTX *ctx) {
+void configure_context(SSL_CTX *ctx, char *certfile, char *keyfile) {
SSL_CTX_set_ecdh_auto(ctx, 1);
/* Set the key and cert */
- if (SSL_CTX_use_certificate_file(ctx, "cert.pem", SSL_FILETYPE_PEM) <= 0) {
+ if (SSL_CTX_use_certificate_file(ctx, certfile, SSL_FILETYPE_PEM) <= 0) {
ERR_print_errors_fp(stderr);
exit(EXIT_FAILURE);
}
- if (SSL_CTX_use_PrivateKey_file(ctx, "key.pem", SSL_FILETYPE_PEM) <= 0 ) {
+ if (SSL_CTX_use_PrivateKey_file(ctx, keyfile, SSL_FILETYPE_PEM) <= 0 ) {
ERR_print_errors_fp(stderr);
exit(EXIT_FAILURE);
}