summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbcook <bcook@openbsd.org>2016-07-07 13:25:37 +0000
committerbcook <bcook@openbsd.org>2016-07-07 13:25:37 +0000
commitae58e10b9f7263ee4bd0b5fcf622f6ae6c8e466d (patch)
tree3fbc1b8c213a6e692c1dfeac62bb016f0f4a0c7f
parentcall BN_init on temporaries to avoid use-before-set warnings (diff)
downloadwireguard-openbsd-ae58e10b9f7263ee4bd0b5fcf622f6ae6c8e466d.tar.xz
wireguard-openbsd-ae58e10b9f7263ee4bd0b5fcf622f6ae6c8e466d.zip
add ca cert error check and make the path configurable
from Kinichiro Inoguchi
-rw-r--r--regress/lib/libcrypto/ocsp/ocsp_test.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/regress/lib/libcrypto/ocsp/ocsp_test.c b/regress/lib/libcrypto/ocsp/ocsp_test.c
index 88675364cf8..44a5f1b0092 100644
--- a/regress/lib/libcrypto/ocsp/ocsp_test.c
+++ b/regress/lib/libcrypto/ocsp/ocsp_test.c
@@ -47,6 +47,11 @@ int main(int argc, char *argv[]) {
X509_STORE *st = NULL;
STACK_OF(X509) *ch = NULL;
char *host, *port;
+#ifdef _PATH_SSL_CA_FILE
+ char *cafile = _PATH_SSL_CA_FILE;
+#else
+ char *cafile = "/etc/ssl/cert.pem";
+#endif
SSL *ssl;
SSL_CTX *ctx;
@@ -56,7 +61,10 @@ int main(int argc, char *argv[]) {
ctx = SSL_CTX_new(SSLv23_client_method());
- SSL_CTX_load_verify_locations(ctx, "/etc/ssl/cert.pem", NULL);
+ if (!SSL_CTX_load_verify_locations(ctx, cafile, NULL)) {
+ printf("failed to load %s\n", cafile);
+ exit(-1);
+ }
if (argc != 3)
errx(-1, "need a host and port to connect to");