Skip to content

Commit

Permalink
fix: drop tls/ssl support
Browse files Browse the repository at this point in the history
If you need TLS you can terminate it outside of the runtime. This will
help us drop a bunch of dependencies too.

Also get rid of Cstruct.
  • Loading branch information
leostera committed Sep 28, 2024
1 parent 32ac28f commit e20e08e
Show file tree
Hide file tree
Showing 11 changed files with 11 additions and 504 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ _opam
.direnv
result
.envrc
dune.lock
dev-tools.locks
Empty file removed dune
Empty file.
2 changes: 0 additions & 2 deletions dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@
(randomconv (= "0.2.0"))
(rio (>= "0.0.1"))
(telemetry (>= "0.0.1"))
(tls (= "0.17.5"))
(uri (>= "4.4.0"))
(x509 (and :with-test (>= "0.16.5")))
dune)
(tags
(multicore erlang actor "message-passing" processes)))
2 changes: 0 additions & 2 deletions riot.opam
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ depends: [
"randomconv" {= "0.2.0"}
"rio" {>= "0.0.1"}
"telemetry" {>= "0.0.1"}
"tls" {= "0.17.5"}
"uri" {>= "4.4.0"}
"x509" {with-test & >= "0.16.5"}
"dune" {>= "3.11"}
]
build: [
Expand Down
21 changes: 9 additions & 12 deletions riot/lib/crypto.ml
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
let () = Mirage_crypto_rng_unix.initialize (module Mirage_crypto_rng.Fortuna)

module Random = struct
let cstruct n = Mirage_crypto_rng.generate n
let cstruct_to_string n = Mirage_crypto_rng.generate n |> Cstruct.to_string
let int8 () = Randomconv.int8 cstruct_to_string
let int16 () = Randomconv.int16 cstruct_to_string
let int32 () = Randomconv.int32 cstruct_to_string
let int64 () = Randomconv.int64 cstruct_to_string
let string n = Mirage_crypto_rng.generate n
let int8 () = Randomconv.int8 string
let int16 () = Randomconv.int16 string
let int32 () = Randomconv.int32 string
let int64 () = Randomconv.int64 string
let char () = Char.chr (int8 ())
let int ?max () = Randomconv.int ?bound:max cstruct_to_string
let float ?max () = Randomconv.float ?bound:max cstruct_to_string
let bytes n = cstruct n |> Cstruct.to_bytes
let bigarray n = cstruct n |> Cstruct.to_bigarray
let string n = cstruct n |> Cstruct.to_string
let int ?max () = Randomconv.int ?bound:max string
let float ?max () = Randomconv.float ?bound:max string
let bytes n = string n |> Bytes.unsafe_of_string
let bytestring n = string n |> Bytestring.of_string
let alphanum () = Char.chr (48 + Randomconv.int ~bound:74 cstruct_to_string)
let alphanum () = Char.chr (48 + Randomconv.int ~bound:74 string)
let seq n gen = List.init n (fun _ -> gen ()) |> List.to_seq |> String.of_seq
end
1 change: 0 additions & 1 deletion riot/lib/dune
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
global
logger
riot_runtime
tls
bytestring
telemetry
randomconv
Expand Down
1 change: 0 additions & 1 deletion riot/lib/lib.ml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ module Process = Process
module Queue = Queue
module Ref = Ref
module Runtime = Runtime_lib
module SSL = Ssl
module Store = Key_value_store
module Stream = Stream
module Supervisor = Supervisor
Expand Down
286 changes: 0 additions & 286 deletions riot/lib/ssl.ml

This file was deleted.

Loading

0 comments on commit e20e08e

Please sign in to comment.