upstream: https://github.com/mirage/mirage-crypto
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

crypto: delete dead helpers (ccm, fortuna, aes_pure, gen_tables)

Warnings 32 (unused value), 34 (unused type):

- lib/ccm: [crypto_core] was the non-_into variant, superseded by
[crypto_core_into]. The latter is used by every caller; the wrapper
was never exercised.
- rng/fortuna: [Sha_d256.t] and [Sha_d256.digest] — the module is
used but only through [ctx], [empty], [get], [digesti], [feedi]. The
other two were left over from an earlier shape.
- lib/ocaml/aes_pure: [interleave_in] — the comment just below it
explicitly calls it superseded ("The above is a compact version that
handles one half-block; for the full pipeline we use a different
layout").
- ec/gen_tables: delete unused [div_round_up]; change [let go = ...]
script body to the idiomatic [let () = ...].

+1 -43
+1 -3
ec/gen_tables/gen_tables.ml
··· 19 19 done; 20 20 fout "@]@,}" 21 21 22 - let div_round_up a b = (a / b) + if a mod b = 0 then 0 else 1 23 - 24 22 let pp_string_words ~wordsize fmt str = 25 23 assert (String.length str * 8 mod wordsize = 0); 26 24 let limbs = String.length str * 8 / wordsize in ··· 94 92 (Fmt.list ~sep:(Fmt.any " | ") Fmt.string) 95 93 (List.map fst curves) 96 94 97 - let go = 95 + let () = 98 96 let name, curve, wordsize = 99 97 try 100 98 let name, curve =
-9
lib/ccm.ml
··· 131 131 loop 1 src src_off dst dst_off len; 132 132 iv 133 133 134 - let crypto_core ~cipher ~mode ~key ~nonce ~adata data = 135 - let datalen = String.length data in 136 - let dst = Bytes.create datalen in 137 - let t = 138 - crypto_core_into ~cipher ~mode ~key ~nonce ~adata data ~src_off:0 dst 139 - ~dst_off:0 datalen 140 - in 141 - (dst, t) 142 - 143 134 let crypto_t t nonce cipher key = 144 135 let ctr = gen_ctr nonce 0 in 145 136 cipher ~key (Bytes.unsafe_to_string ctr) ~src_off:0 ctr ~dst_off:0;
-27
lib/ocaml/aes_pure.ml
··· 362 362 done; 363 363 skey 364 364 365 - (* Public API: load 1-2 blocks into bitsliced state, encrypt, store. *) 366 - 367 - let interleave_in q0 q1 w = 368 - let x0 = ref w.(0) in 369 - let x1 = ref w.(1) in 370 - let x2 = ref w.(2) in 371 - let x3 = ref w.(3) in 372 - x0 := !x0 ||| (!x0 <<< 16); 373 - x1 := !x1 ||| (!x1 <<< 16); 374 - x2 := !x2 ||| (!x2 <<< 16); 375 - x3 := !x3 ||| (!x3 <<< 16); 376 - x0 := !x0 &&& 0x0000FFFFl; 377 - x1 := !x1 &&& 0x0000FFFFl; 378 - x2 := !x2 &&& 0x0000FFFFl; 379 - x3 := !x3 &&& 0x0000FFFFl; 380 - x1 := !x1 <<< 8; 381 - x3 := !x3 <<< 8; 382 - let q0v = !x0 ||| !x1 in 383 - let q1v = !x2 ||| !x3 in 384 - q0 := q0v; 385 - q1 := q1v 386 - 387 - (* The above is a compact version that handles one half-block; for 388 - the full pipeline we use a different layout: pack 4 32-bit words 389 - from each of two blocks into the 8 q-words. BearSSL's encrypt 390 - path uses a different shape -- we follow it directly. *) 391 - 392 365 (* Encrypt up to 2 blocks at once. [src_blocks] is a list of one 393 366 or two 16-byte blocks (as offsets); [dst_blocks] is the 394 367 corresponding output positions. We use BearSSL's exact data
-4
rng/fortuna.ml
··· 7 7 module Sha_d256 = struct 8 8 open Digestif 9 9 10 - type t = SHA256.t 11 10 type ctx = SHA256.ctx 12 11 13 12 let empty = SHA256.empty 14 13 let get t = SHA256.(get t |> to_raw_string |> digest_string |> to_raw_string) 15 - 16 - let digest x = 17 - SHA256.(digest_string x |> to_raw_string |> digest_string |> to_raw_string) 18 14 19 15 let digesti i = 20 16 SHA256.(digesti_string i |> to_raw_string |> digest_string |> to_raw_string)