ab432b
 src/network/ssl/ssl.c |   33 ++++++++++++++++++++++++++++++++-
ab432b
 1 files changed, 32 insertions(+), 1 deletions(-)
ab432b
ab432b
diff --git a/src/network/ssl/ssl.c b/src/network/ssl/ssl.c
ab432b
index 73446b5..eadff7f 100644
ab432b
--- a/src/network/ssl/ssl.c
ab432b
+++ b/src/network/ssl/ssl.c
ab432b
@@ -48,10 +48,20 @@ SSL_CTX *context = NULL;
ab432b
 static void
ab432b
 init_openssl(struct module *module)
ab432b
 {
ab432b
+	unsigned char *ca_file;
ab432b
 	SSLeay_add_ssl_algorithms();
ab432b
 	context = SSL_CTX_new(SSLv23_client_method());
ab432b
 	SSL_CTX_set_options(context, SSL_OP_ALL);
ab432b
+#ifdef CONFIG_NSS_COMPAT_OSSL
ab432b
+	ca_file = get_opt_str("connection.ssl.trusted_ca_file");
ab432b
+	if (*ca_file)
ab432b
+		SSL_CTX_load_verify_locations(context, ca_file, NULL);
ab432b
+	else
ab432b
+		SSL_CTX_set_default_verify_paths(context);
ab432b
+#else
ab432b
+	(void) ca_file;
ab432b
 	SSL_CTX_set_default_verify_paths(context);
ab432b
+#endif
ab432b
 }
ab432b
 
ab432b
 static void
ab432b
@@ -61,10 +71,30 @@ done_openssl(struct module *module)
ab432b
 }
ab432b
 
ab432b
 static union option_info openssl_options[] = {
ab432b
+#ifdef CONFIG_NSS_COMPAT_OSSL
ab432b
+	INIT_OPT_BOOL("connection.ssl", N_("Verify certificates"),
ab432b
+		"cert_verify", 0, 0,
ab432b
+		N_("Verify the peer's SSL certificate.")),
ab432b
+
ab432b
+	INIT_OPT_STRING("connection.ssl", N_("Trusted CA file"),
ab432b
+		"trusted_ca_file", 0, "/etc/pki/tls/certs/ca-bundle.crt",
ab432b
+		N_("The location of a file containing certificates of "
ab432b
+		"trusted certification authorities in PEM format. "
ab432b
+		"ELinks then trusts certificates issued by these CAs.\n"
ab432b
+		"\n"
ab432b
+		"If you set this option to an empty string, default NSS root"
ab432b
+		"certificates are loaded.\n"
ab432b
+		"\n"
ab432b
+		"If you change this option or the file, you must "
ab432b
+		"restart ELinks for the changes to take effect. "
ab432b
+		"This option affects GnuTLS and nss_compat_ossl but not "
ab432b
+		"OpenSSL.")),
ab432b
+#else
ab432b
 	INIT_OPT_BOOL("connection.ssl", N_("Verify certificates"),
ab432b
 		"cert_verify", 0, 0,
ab432b
 		N_("Verify the peer's SSL certificate. Note that this "
ab432b
 		"needs extensive configuration of OpenSSL by the user.")),
ab432b
+#endif
ab432b
 
ab432b
 	INIT_OPT_TREE("connection.ssl", N_("Client Certificates"),
ab432b
         	"client_cert", OPT_SORT,
ab432b
@@ -187,7 +217,8 @@ static union option_info gnutls_options[] = {
ab432b
 		"\n"
ab432b
 		"If you change this option or the file, you must "
ab432b
 		"restart ELinks for the changes to take effect. "
ab432b
-		"This option affects GnuTLS but not OpenSSL.")),
ab432b
+		"This option affects GnuTLS and nss_compat_ossl but not "
ab432b
+		"OpenSSL.")),
ab432b
 
ab432b
 	NULL_OPTION_INFO,
ab432b
 };