Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hostname validation: compatibility with OpenSSL 1.0.2 #53

Merged
merged 2 commits into from
Jul 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/ssl.ml
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,6 @@ external verify : socket -> unit = "ocaml_ssl_verify"

type x509_check_flag =
| Always_check_subject
| Never_check_subject
| No_wildcards
| No_partial_wildcards
| Multi_label_wildcards
Expand Down
1 change: 0 additions & 1 deletion src/ssl.mli
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,6 @@ val verify : socket -> unit
(** Flags to specify how a certificate is matched against a given host name *)
type x509_check_flag =
| Always_check_subject
| Never_check_subject
| No_wildcards
| No_partial_wildcards
| Multi_label_wildcards
Expand Down
13 changes: 5 additions & 8 deletions src/ssl_stubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1254,18 +1254,15 @@ CAMLprim value ocaml_ssl_set_hostflags(value socket, value flag_lst)
flags |= X509_CHECK_FLAG_ALWAYS_CHECK_SUBJECT;
break;
case 1:
flags |= X509_CHECK_FLAG_NEVER_CHECK_SUBJECT;
break;
case 2:
flags |= X509_CHECK_FLAG_NO_WILDCARDS;
break;
case 3:
case 2:
flags |= X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS;
break;
case 4:
case 3:
flags |= X509_CHECK_FLAG_MULTI_LABEL_WILDCARDS;
break;
case 5:
case 4:
flags |= X509_CHECK_FLAG_SINGLE_LABEL_SUBDOMAINS;
break;
default:
Expand All @@ -1275,7 +1272,7 @@ CAMLprim value ocaml_ssl_set_hostflags(value socket, value flag_lst)
}

caml_enter_blocking_section();
SSL_set_hostflags(ssl, flags);
X509_VERIFY_PARAM_set_hostflags(SSL_get0_param(ssl), flags);
caml_leave_blocking_section();

CAMLreturn(Val_unit);
Expand All @@ -1288,7 +1285,7 @@ CAMLprim value ocaml_ssl_set1_host(value socket, value host)
const char *hostname = String_val (host);

caml_enter_blocking_section();
SSL_set1_host (ssl, hostname);
X509_VERIFY_PARAM_set1_host (SSL_get0_param(ssl), hostname, 0);
caml_leave_blocking_section();

CAMLreturn(Val_unit);
Expand Down