Skip to content

Commit aed257d

Browse files
authored
Merge pull request #225 from hannesm/rename
mirage-crypto: skip Cipher_block / Cipher_stream module indirection
2 parents 5f2d718 + e194153 commit aed257d

9 files changed

+153
-194
lines changed

bench/speed.ml

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
open Mirage_crypto
22

3-
open Cipher_block
4-
53
module Time = struct
64

75
let time ~n f a =
@@ -418,7 +416,7 @@ let runv fs =
418416
(fun ppf -> List.iter @@ fun x ->
419417
Format.fprintf ppf "%s " @@
420418
match x with `XOR -> "XOR" | `AES -> "AES" | `GHASH -> "GHASH")
421-
Cipher_block.accelerated;
419+
accelerated;
422420
Time.warmup () ;
423421
List.iter (fun f -> f ()) fs
424422

rng/fortuna.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
open Mirage_crypto
22
open Mirage_crypto.Uncommon
33

4-
module AES_CTR = Cipher_block.AES.CTR
4+
module AES_CTR = AES.CTR
55

66
module SHAd256 = struct
77
open Digestif

src/cipher_block.ml

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
open Uncommon
22

3-
module S = struct
3+
module Block = struct
44

55
module type Core = sig
66

@@ -127,7 +127,7 @@ module Counters = struct
127127
end
128128

129129
module Modes = struct
130-
module ECB_of (Core : S.Core) : S.ECB = struct
130+
module ECB_of (Core : Block.Core) : Block.ECB = struct
131131

132132
type key = Core.ekey * Core.dkey
133133

@@ -148,7 +148,7 @@ module Modes = struct
148148

149149
end
150150

151-
module CBC_of (Core : S.Core) : S.CBC = struct
151+
module CBC_of (Core : Block.Core) : Block.CBC = struct
152152

153153
type key = Core.ekey * Core.dkey
154154

@@ -193,8 +193,8 @@ module Modes = struct
193193

194194
end
195195

196-
module CTR_of (Core : S.Core) (Ctr : Counters.S) :
197-
S.CTR with type key = Core.ekey and type ctr = Ctr.ctr =
196+
module CTR_of (Core : Block.Core) (Ctr : Counters.S) :
197+
Block.CTR with type key = Core.ekey and type ctr = Ctr.ctr =
198198
struct
199199
(* FIXME: CTR has more room for speedups. Like stitching. *)
200200

@@ -252,7 +252,7 @@ module Modes = struct
252252
Bytes.unsafe_to_string res
253253
end
254254

255-
module GCM_of (C : S.Core) : S.GCM = struct
255+
module GCM_of (C : Block.Core) : Block.GCM = struct
256256

257257
let _ = assert (C.block = 16)
258258
module CTR = CTR_of (C) (Counters.C128be32)
@@ -324,7 +324,7 @@ module Modes = struct
324324
authenticate_decrypt_tag ~key ~nonce ?adata ~tag cipher
325325
end
326326

327-
module CCM16_of (C : S.Core) : S.CCM16 = struct
327+
module CCM16_of (C : Block.Core) : Block.CCM16 = struct
328328

329329
let _ = assert (C.block = 16)
330330

@@ -365,7 +365,7 @@ end
365365

366366
module AES = struct
367367

368-
module Core : S.Core = struct
368+
module Core : Block.Core = struct
369369

370370
let key = [| 16; 24; 32 |]
371371
let block = 16
@@ -413,7 +413,7 @@ end
413413

414414
module DES = struct
415415

416-
module Core : S.Core = struct
416+
module Core : Block.Core = struct
417417

418418
let key = [| 24 |]
419419
let block = 8

src/cipher_stream.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
open Uncommon
22

3-
module type S = sig
3+
module type Stream = sig
44
type key
55
type result = { message : string ; key : key }
66
val of_secret : string -> key

src/mirage_crypto.ml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module Uncommon = Uncommon
22
module Poly1305 = Poly1305.It
33
module type AEAD = Aead.AEAD
4-
module Cipher_block = Cipher_block
4+
include Cipher_block
55
module Chacha20 = Chacha20
6-
module Cipher_stream = Cipher_stream
6+
include Cipher_stream

0 commit comments

Comments
 (0)