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

Configure Feed

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

fix(lint): replace Printf/Format with Fmt in block and bpsec

+21 -27
+1 -2
ec/crypto_ec.ml
··· 14 14 | `Invalid_range -> "invalid range" 15 15 | `Low_order -> "low order" 16 16 17 - let pp_error fmt e = 18 - Format.fprintf fmt "Cannot parse point: %s" (error_to_string e) 17 + let pp_error fmt e = Fmt.pf fmt "Cannot parse point: %s" (error_to_string e) 19 18 20 19 let rev_string buf = 21 20 let len = String.length buf in
+1 -1
ec/dune
··· 1 1 (library 2 2 (name crypto_ec) 3 3 (public_name crypto-ec) 4 - (libraries eqaf crypto-rng digestif) 4 + (libraries eqaf crypto-rng digestif fmt) 5 5 (foreign_stubs 6 6 (language c) 7 7 (names
+1 -1
rng/dune
··· 1 1 (library 2 2 (name crypto_rng) 3 3 (public_name crypto-rng) 4 - (libraries crypto digestif logs) 4 + (libraries crypto digestif logs fmt) 5 5 (private_modules entropy fortuna hmac_drbg rng))
+1 -1
rng/entropy.ml
··· 77 77 78 78 let id (idx, _) = idx 79 79 let sources () = S.elements (Atomic.get sources_ref) 80 - let pp_source ppf (idx, name) = Format.fprintf ppf "[%d] %s" idx name 80 + let pp_source ppf (idx, name) = Fmt.pf ppf "[%d] %s" idx name 81 81 82 82 let cpu_rng isn buf off = 83 83 match isn with
+7 -7
rng/fortuna.ml
··· 4 4 open Crypto 5 5 open Crypto.Uncommon 6 6 7 - module SHAd256 = struct 7 + module Sha_d256 = struct 8 8 open Digestif 9 9 10 10 type t = SHA256.t ··· 38 38 mutable ctr : AES.CTR.ctr; 39 39 mutable secret : string; 40 40 mutable key : AES.CTR.key; 41 - pools : SHAd256.ctx array; 41 + pools : Sha_d256.ctx array; 42 42 mutable pool0_size : int; 43 43 mutable reseed_count : int; 44 44 mutable last_reseed : int64; ··· 51 51 ctr = (0L, 0L); 52 52 secret = k; 53 53 key = AES.CTR.of_secret k; 54 - pools = Array.make pools SHAd256.empty; 54 + pools = Array.make pools Sha_d256.empty; 55 55 pool0_size = 0; 56 56 reseed_count = 0; 57 57 last_reseed = 0L; ··· 69 69 70 70 let reseedi ~g iter = 71 71 set_key ~g 72 - @@ SHAd256.digesti (fun f -> 72 + @@ Sha_d256.digesti (fun f -> 73 73 f g.secret; 74 74 iter f); 75 75 g.ctr <- AES.CTR.add_ctr g.ctr 1L ··· 102 102 reseedi ~g @@ fun add -> 103 103 for i = 0 to pools - 1 do 104 104 if g.reseed_count land ((1 lsl i) - 1) = 0 then ( 105 - SHAd256.get g.pools.(i) |> add; 106 - g.pools.(i) <- SHAd256.empty) 105 + Sha_d256.get g.pools.(i) |> add; 106 + g.pools.(i) <- Sha_d256.empty) 107 107 done 108 108 end 109 109 ··· 126 126 Bytes.set_uint8 buf 0 source; 127 127 Bytes.set_uint8 buf 1 (String.length data); 128 128 g.pools.(pool) <- 129 - SHAd256.feedi g.pools.(pool) (iter2 (Bytes.unsafe_to_string buf) data); 129 + Sha_d256.feedi g.pools.(pool) (iter2 (Bytes.unsafe_to_string buf) data); 130 130 if pool = 0 then g.pool0_size <- g.pool0_size + String.length data 131 131 132 132 (* XXX
+1 -1
src/dune
··· 1 1 (library 2 2 (name crypto) 3 3 (public_name crypto) 4 - (libraries eqaf) 4 + (libraries eqaf fmt) 5 5 (private_modules 6 6 aead 7 7 chacha20
+1 -3
src/uncommon.ml
··· 1 1 (** [Uncommon] is a [Common], now with less name clashes. *) 2 2 3 - let kasprintf k fmt = 4 - Format.(kfprintf (fun _ -> k (flush_str_formatter ())) str_formatter fmt) 5 - 3 + let kasprintf k fmt = Fmt.kstr k fmt 6 4 let invalid_arg fmt = kasprintf invalid_arg ("Crypto: " ^^ fmt) 7 5 8 6 let ( // ) x y =
+1 -1
tests/dune
··· 1 1 (library 2 2 (name test_common) 3 - (libraries crypto ounit2 ohex) 3 + (libraries crypto ounit2 ohex fmt) 4 4 (modules test_common) 5 5 (optional)) 6 6
+4 -6
tests/test_common.ml
··· 1 1 open OUnit2 2 2 3 - let prf, strf = Format.(fprintf, asprintf) 3 + let prf, strf = (Fmt.pf, Fmt.str) 4 4 let pp_map pp f ppf x = pp ppf (f x) 5 5 let pp_diff pp ppf (a, b) = prf ppf "@[<v>want: %a@,have: %a@]" pp a pp b 6 6 ··· 41 41 ignore (f a); 42 42 times ~n:(pred n) f a) 43 43 44 - let pp_opt pp ppf = 45 - Format.( 46 - function 47 - | Some x -> fprintf ppf "Some(%a)" pp x 48 - | None -> fprintf ppf "None") 44 + let pp_opt pp ppf = function 45 + | Some x -> Fmt.pf ppf "Some(%a)" pp x 46 + | None -> Fmt.pf ppf "None" 49 47 50 48 let eq_opt eq a b = match (a, b) with Some x, Some y -> eq x y | _ -> false 51 49 let pp_octets pp = pp (Ohex.pp_hexdump ())
+1 -1
tests/wycheproof/dune
··· 1 1 (library 2 2 (name wycheproof) 3 - (libraries jsont jsont.bytesrw) 3 + (libraries fmt jsont jsont.bytesrw) 4 4 (optional))
+2 -3
tests/wycheproof/wycheproof.ml
··· 267 267 } 268 268 269 269 let pp_eddsa_key fmt t = 270 - Fmt.pf fmt 271 - "{ curve = %S; key_size = %d; pk = %a; sk = %a; type_ = %a }" t.curve 272 - t.key_size pp_hex t.pk pp_hex t.sk pp_json t.type_ 270 + Fmt.pf fmt "{ curve = %S; key_size = %d; pk = %a; sk = %a; type_ = %a }" 271 + t.curve t.key_size pp_hex t.pk pp_hex t.sk pp_json t.type_ 273 272 274 273 let show_eddsa_key t = Fmt.str "%a" pp_eddsa_key t 275 274