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

update to TLS 1.0.0 (and mirage-crypto 1.0.0) API #646

Merged
merged 1 commit into from
Sep 4, 2024
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
8 changes: 4 additions & 4 deletions git-mirage.opam
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ depends: [
"awa-mirage" {>= "0.2.0"}
"dns" {>= "6.1.3"}
"dns-client" {>= "6.1.3"}
"tls"
"tls-mirage"
"tls" {>= "1.0.0"}
"tls-mirage" {>= "1.0.0"}
"uri"
"happy-eyeballs-mirage" {>= "0.1.2"}
"happy-eyeballs" {>= "0.1.2"}
"ca-certs-nss"
"mirage-crypto"
"mirage-crypto" {>= "1.0.0"}
"ptime"
"x509" {>= "0.16.2"}
"x509" {>= "1.0.0"}
"cstruct"
"tcpip" {>= "7.0.0"}
"domain-name" {>= "0.3.0"}
Expand Down
6 changes: 3 additions & 3 deletions git-paf.opam
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ depends: [
"dune" {>= "2.8.0"}
"git" {= version}
"mimic" {>= "0.0.4"}
"paf" {>= "0.2.0"}
"paf" {>= "0.7.0"}
"ca-certs-nss"
"fmt"
"ipaddr"
Expand All @@ -21,13 +21,13 @@ depends: [
"tcpip" {>= "7.0.0"}
"mirage-time"
"rresult" {>= "0.7.0"}
"tls" {>= "0.14.0"}
"tls" {>= "1.0.0"}
"uri"
"bigstringaf"
"domain-name"
"httpaf"
"mirage-flow" {>= "4.0.0"}
"tls-mirage"
"tls-mirage" {>= "1.0.0"}
]
conflicts: [ "result" {< "1.5"} ]
build: [
Expand Down
4 changes: 2 additions & 2 deletions git-unix.opam
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ depends: [
"cstruct" {>= "6.0.0"}
"mirage-flow" {>= "4.0.0"}
"ke" {>= "0.4" & with-test}
"mirage-crypto-rng" {>= "0.11.0" & with-test}
"mirage-crypto-rng" {>= "1.0.0" & with-test}
"mimic" {>= "0.0.8"}
"tls" {>= "0.14.0"}
"tls" {>= "1.0.0"}
]
conflicts: [ "result" {< "1.5"} ]
build: [
Expand Down
2 changes: 1 addition & 1 deletion git.opam
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ depends: [
"encore" {>= "0.8"}
"alcotest" {with-test & >= "1.1.0"}
"alcotest-lwt" {with-test & >= "1.1.0"}
"mirage-crypto-rng" {with-test & >= "0.8.0"}
"mirage-crypto-rng" {with-test & >= "1.0.0"}
"cmdliner" {with-test & >= "1.1.0"}
"base-unix" {with-test}
"hxd" {>= "0.3.2"}
Expand Down
28 changes: 16 additions & 12 deletions src/git-mirage/git_mirage_http.ml
Original file line number Diff line number Diff line change
Expand Up @@ -270,23 +270,27 @@ struct
match NSS.authenticator () with
| Ok authenticator -> authenticator
| Error (`Msg err) ->
print_endline ("[git-mirage-http] NSS authenticator error: " ^ err);
exit 64)
print_endline ("[git-mirage-http] NSS authenticator error: " ^ err);
exit 64)
| Some str -> (
match X509.Authenticator.of_string str with
| Ok auth -> auth time
| Error (`Msg msg) ->
print_endline ("[git-mirage-http] authenticator error: " ^ msg);
exit 64)
print_endline ("[git-mirage-http] authenticator error: " ^ msg);
exit 64)
in
let tls = Tls.Config.client ~authenticator () in
let ctx = Mimic.add git_mirage_http_tls_config tls ctx in
let ctx =
Option.fold ~none:ctx
~some:(fun headers -> Mimic.add git_mirage_http_headers headers ctx)
headers
in
Lwt.return ctx
match Tls.Config.client ~authenticator () with
| Error (`Msg msg) ->
print_endline ("[git-mirage-http] tls error: " ^ msg);
exit 64
| Ok tls ->
let ctx = Mimic.add git_mirage_http_tls_config tls ctx in
let ctx =
Option.fold ~none:ctx
~some:(fun headers -> Mimic.add git_mirage_http_headers headers ctx)
headers
in
Lwt.return ctx

let ctx = Mimic.empty
end
12 changes: 6 additions & 6 deletions src/git-mirage/git_mirage_ssh.ml
Original file line number Diff line number Diff line change
Expand Up @@ -151,19 +151,19 @@ struct
let ctx =
match authenticator with
| Some (Error err) ->
print_endline ("[git-mirage-ssh] authenticator error: " ^ err);
exit 64
print_endline ("[git-mirage-ssh] authenticator error: " ^ err);
exit 64
| Some (Ok authenticator) ->
Mimic.add git_mirage_ssh_authenticator authenticator ctx
| None -> ctx
in
match key, password with
| Some (Error (`Msg err)), _ ->
print_endline ("[git-mirage-ssh] ssh key error: " ^ err);
exit 64
print_endline ("[git-mirage-ssh] ssh key error: " ^ err);
exit 64
| Some _, Some _ ->
print_endline "[git-mirage-ssh] both key and password provided";
exit 64
print_endline "[git-mirage-ssh] both key and password provided";
exit 64
| Some (Ok key), None ->
let ctx = Mimic.add git_mirage_ssh_key key ctx in
Lwt.return ctx
Expand Down
8 changes: 5 additions & 3 deletions src/git-unix/git_unix_mimic.ml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ module Happy_eyeballs = struct

let happy_eyeballs = Mimic.make ~name:"happy-eyeballs-lwt"

let resolve t ?aaaa_timeout ?connect_delay ?connect_timeout ?resolve_timeout ?resolve_retries addr ports =
Happy_eyeballs_lwt.connect ?aaaa_timeout ?connect_delay ?connect_timeout ?resolve_timeout ?resolve_retries
t addr ports >|= Rresult.R.open_error_msg
let resolve t ?aaaa_timeout ?connect_delay ?connect_timeout ?resolve_timeout
?resolve_retries addr ports =
Happy_eyeballs_lwt.connect ?aaaa_timeout ?connect_delay ?connect_timeout
?resolve_timeout ?resolve_retries t addr ports
>|= Rresult.R.open_error_msg
end

module TCP = struct
Expand Down