Skip to content

Commit

Permalink
ifdef tls version constants
Browse files Browse the repository at this point in the history
TLS1_3_VERSION is not defined on older OpenSSL variants.
  • Loading branch information
Christopher Zimmermann committed Jun 21, 2020
1 parent 6b75fac commit 5cbeba7
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/ssl_stubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -861,25 +861,35 @@ CAMLprim value ocaml_ssl_version(value socket)
caml_leave_blocking_section();

switch(version) {
#ifdef SSL_version
case SSL3_VERSION:
ret = 1;
break;
#endif

#ifdef TLS1_VERSION
case TLS1_VERSION:
ret = 2;
break;
#endif

#ifdef TLS1_1_VERSION
case TLS1_1_VERSION:
ret = 3;
break;
#endif

#ifdef TLS1_2_VERSION
case TLS1_2_VERSION:
ret = 4;
break;
#endif

#ifdef TLS1_3_VERSION
case TLS1_3_VERSION:
ret = 5;
break;
#endif

default:
caml_failwith("Ssl.version");
Expand Down

0 comments on commit 5cbeba7

Please sign in to comment.