Skip to content

Commit

Permalink
adapt to mirage-block-ccm 2.0.0 changes (maclen is removed due to mir…
Browse files Browse the repository at this point in the history
…age-crypto changes)
  • Loading branch information
hannesm committed Feb 16, 2023
1 parent c84e7f0 commit e7e3d85
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
8 changes: 3 additions & 5 deletions lib/mirage/impl/mirage_impl_block.ml
Expand Up @@ -299,10 +299,10 @@ let chamelon ~program_block_size =
impl ~packages ~keys ~connect "Kv.Make"
(block @-> pclock @-> Mirage_impl_kv.rw)

let ccm_block ?maclen ?nonce_len key =
let ccm_block ?nonce_len key =
let keys = [ Key.v key ] in
let packages =
[ package "mirage-block-ccm" ~min:"1.1.0" ~max:"1.2.0"; package "astring" ]
[ package "mirage-block-ccm" ~min:"2.0.0" ~max:"3.0.0"; package "astring" ]
in
let connect _ modname = function
| [ block ] ->
Expand All @@ -311,11 +311,9 @@ let ccm_block ?maclen ?nonce_len key =
let key = match Astring.String.cut ~sep:"0x" key with
| Some ("", key) -> key
| _ -> key in
%s.connect ?maclen:%a ?nonce_len:%a ~key:(Cstruct.of_hex key) %s|ocaml}
%s.connect ?nonce_len:%a ~key:(Cstruct.of_hex key) %s|ocaml}
Key.serialize_call (Key.v key) modname
Fmt.(parens (Dump.option int))
maclen
Fmt.(parens (Dump.option int))
nonce_len block
| _ -> assert false
in
Expand Down
1 change: 0 additions & 1 deletion lib/mirage/impl/mirage_impl_block.mli
Expand Up @@ -39,7 +39,6 @@ val tar_kv_rw :
Mirage_impl_kv.rw Functoria.impl

val ccm_block :
?maclen:int ->
?nonce_len:int ->
string option Functoria.key ->
(block -> block) Functoria.impl
2 changes: 1 addition & 1 deletion lib/mirage/mirage.mli
Expand Up @@ -395,7 +395,7 @@ val tar_kv_rw : ?pclock:pclock impl -> block impl -> kv_rw impl
works on what is allocated, and there are restrictions on [rename]. *)

val ccm_block :
?maclen:int -> ?nonce_len:int -> string option key -> block impl -> block impl
?nonce_len:int -> string option key -> block impl -> block impl
(** [ccm_block key block] returns a new block which is a AES-CCM encrypted disk.
{b Note} also that the available size of an encrypted block is always
Expand Down

0 comments on commit e7e3d85

Please sign in to comment.