Indentation fixes
This commit is contained in:
parent
a10932b577
commit
7206ccd560
@ -1,7 +1,7 @@
|
|||||||
(rule
|
(rule
|
||||||
(targets v1.ml)
|
(targets v1.ml)
|
||||||
(deps
|
(deps
|
||||||
|
|
||||||
;; Part of OCaml stdlib
|
;; Part of OCaml stdlib
|
||||||
v1/pervasives.mli
|
v1/pervasives.mli
|
||||||
v1/list.mli
|
v1/list.mli
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
reasonably efficient: insertion and membership take time
|
reasonably efficient: insertion and membership take time
|
||||||
logarithmic in the size of the set, for instance.
|
logarithmic in the size of the set, for instance.
|
||||||
|
|
||||||
The {!Make} functor constructs implementations for any type, given a
|
The {!Make} functor constructs implementations for any type, given a
|
||||||
[compare] function.
|
[compare] function.
|
||||||
For instance:
|
For instance:
|
||||||
{[
|
{[
|
||||||
|
4
vendors/irmin-lmdb/irmin_lmdb.ml
vendored
4
vendors/irmin-lmdb/irmin_lmdb.ml
vendored
@ -622,7 +622,7 @@ module Make
|
|||||||
type config = {
|
type config = {
|
||||||
root : string option ;
|
root : string option ;
|
||||||
mapsize : int64 ;
|
mapsize : int64 ;
|
||||||
readonly : bool ;
|
readonly : bool ;
|
||||||
(* TODO *)
|
(* TODO *)
|
||||||
(* ?write_buffer_size:int -> *)
|
(* ?write_buffer_size:int -> *)
|
||||||
(* ?max_open_files:int -> *)
|
(* ?max_open_files:int -> *)
|
||||||
@ -641,7 +641,7 @@ module Make
|
|||||||
let { root ; mapsize ; readonly } = config conf in
|
let { root ; mapsize ; readonly } = config conf in
|
||||||
let root = match root with None -> "irmin.ldb" | Some root -> root in
|
let root = match root with None -> "irmin.ldb" | Some root -> root in
|
||||||
if not (Sys.file_exists root) then Unix.mkdir root 0o755 ;
|
if not (Sys.file_exists root) then Unix.mkdir root 0o755 ;
|
||||||
let flags = Lmdb.NoTLS :: if readonly then [ Lmdb.RdOnly ] else [] in
|
let flags = Lmdb.NoTLS :: if readonly then [ Lmdb.RdOnly ] else [] in
|
||||||
let file_flags = if readonly then 0o444 else 0o644 in
|
let file_flags = if readonly then 0o444 else 0o644 in
|
||||||
match Lmdb.opendir ~mapsize ~flags root file_flags with
|
match Lmdb.opendir ~mapsize ~flags root file_flags with
|
||||||
| Error err -> Lwt.fail_with (Lmdb.string_of_error err)
|
| Error err -> Lwt.fail_with (Lmdb.string_of_error err)
|
||||||
|
@ -12,7 +12,7 @@ module Version = struct
|
|||||||
| Tezos -> Format.pp_print_string ppf "Tezos"
|
| Tezos -> Format.pp_print_string ppf "Tezos"
|
||||||
| TezBake -> Format.pp_print_string ppf "TezBake"
|
| TezBake -> Format.pp_print_string ppf "TezBake"
|
||||||
|
|
||||||
let class_of_int = function
|
let class_of_int = function
|
||||||
| 0 -> Tezos
|
| 0 -> Tezos
|
||||||
| 1 -> TezBake
|
| 1 -> TezBake
|
||||||
| _ -> invalid_arg "class_of_int"
|
| _ -> invalid_arg "class_of_int"
|
||||||
|
6
vendors/ocaml-ledger-wallet/src/transport.ml
vendored
6
vendors/ocaml-ledger-wallet/src/transport.ml
vendored
@ -117,7 +117,7 @@ module Header = struct
|
|||||||
let read cs =
|
let read cs =
|
||||||
let cslen = Cstruct.len cs in
|
let cslen = Cstruct.len cs in
|
||||||
begin if cslen < 5 then
|
begin if cslen < 5 then
|
||||||
fail_header_too_short cslen
|
fail_header_too_short cslen
|
||||||
else R.ok ()
|
else R.ok ()
|
||||||
end >>= fun () ->
|
end >>= fun () ->
|
||||||
let channel_id = Cstruct.BE.get_uint16 cs 0 in
|
let channel_id = Cstruct.BE.get_uint16 cs 0 in
|
||||||
@ -129,8 +129,8 @@ module Header = struct
|
|||||||
else R.ok ()
|
else R.ok ()
|
||||||
end >>= fun () ->
|
end >>= fun () ->
|
||||||
begin match cmd_of_int cmd with
|
begin match cmd_of_int cmd with
|
||||||
| Some cmd -> R.ok cmd
|
| Some cmd -> R.ok cmd
|
||||||
| None -> fail_invalid_cmd cmd
|
| None -> fail_invalid_cmd cmd
|
||||||
end >>= fun cmd ->
|
end >>= fun cmd ->
|
||||||
R.ok ({ cmd ; seq }, Cstruct.shift cs 5)
|
R.ok ({ cmd ; seq }, Cstruct.shift cs 5)
|
||||||
|
|
||||||
|
66
vendors/ocaml-lmdb/src/lmdb.ml
vendored
66
vendors/ocaml-lmdb/src/lmdb.ml
vendored
@ -253,20 +253,20 @@ let opendir ?maxreaders ?maxdbs ?mapsize ?(flags=[]) path mode =
|
|||||||
match create () with
|
match create () with
|
||||||
| Error v -> Error (error_of_int v)
|
| Error v -> Error (error_of_int v)
|
||||||
| Ok t ->
|
| Ok t ->
|
||||||
begin match maxreaders with
|
begin match maxreaders with
|
||||||
| None -> Ok ()
|
| None -> Ok ()
|
||||||
| Some readers -> set_maxreaders t readers
|
| Some readers -> set_maxreaders t readers
|
||||||
end >>= fun () ->
|
end >>= fun () ->
|
||||||
begin match maxdbs with
|
begin match maxdbs with
|
||||||
| None -> Ok ()
|
| None -> Ok ()
|
||||||
| Some dbs -> set_maxdbs t dbs
|
| Some dbs -> set_maxdbs t dbs
|
||||||
end >>= fun () ->
|
end >>= fun () ->
|
||||||
begin match mapsize with
|
begin match mapsize with
|
||||||
| None -> Ok ()
|
| None -> Ok ()
|
||||||
| Some size -> set_mapsize t size
|
| Some size -> set_mapsize t size
|
||||||
end >>= fun () ->
|
end >>= fun () ->
|
||||||
let ret = opendir t path (int_of_flags_env flags) mode in
|
let ret = opendir t path (int_of_flags_env flags) mode in
|
||||||
return ret t ~on_error:(fun () -> closedir t)
|
return ret t ~on_error:(fun () -> closedir t)
|
||||||
|
|
||||||
external copy :
|
external copy :
|
||||||
t -> string -> int -> int = "stub_mdb_env_copy2" [@@noalloc]
|
t -> string -> int -> int = "stub_mdb_env_copy2" [@@noalloc]
|
||||||
@ -425,28 +425,28 @@ let with_ro_db ?sync ?metasync ?parent ?flags ?name t ~f =
|
|||||||
opendb ?flags ?name txn >>= fun db ->
|
opendb ?flags ?name txn >>= fun db ->
|
||||||
match f txn db with
|
match f txn db with
|
||||||
| exception exn ->
|
| exception exn ->
|
||||||
abort_txn txn ;
|
abort_txn txn ;
|
||||||
raise exn
|
raise exn
|
||||||
| Ok res ->
|
| Ok res ->
|
||||||
commit_txn txn >>= fun () ->
|
commit_txn txn >>= fun () ->
|
||||||
Ok res
|
Ok res
|
||||||
| Error err ->
|
| Error err ->
|
||||||
abort_txn txn ;
|
abort_txn txn ;
|
||||||
Error err
|
Error err
|
||||||
|
|
||||||
let with_rw_db ?sync ?metasync ?parent ?flags ?name t ~f =
|
let with_rw_db ?sync ?metasync ?parent ?flags ?name t ~f =
|
||||||
create_rw_txn ?sync ?metasync ?parent t >>= fun txn ->
|
create_rw_txn ?sync ?metasync ?parent t >>= fun txn ->
|
||||||
opendb ?flags ?name txn >>= fun db ->
|
opendb ?flags ?name txn >>= fun db ->
|
||||||
match f txn db with
|
match f txn db with
|
||||||
| exception exn ->
|
| exception exn ->
|
||||||
abort_txn txn ;
|
abort_txn txn ;
|
||||||
raise exn
|
raise exn
|
||||||
| Ok res ->
|
| Ok res ->
|
||||||
commit_txn txn >>= fun () ->
|
commit_txn txn >>= fun () ->
|
||||||
Ok res
|
Ok res
|
||||||
| Error err ->
|
| Error err ->
|
||||||
abort_txn txn ;
|
abort_txn txn ;
|
||||||
Error err
|
Error err
|
||||||
|
|
||||||
type buffer = (char, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t
|
type buffer = (char, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t
|
||||||
|
|
||||||
@ -504,10 +504,10 @@ external opencursor :
|
|||||||
let opencursor :
|
let opencursor :
|
||||||
type a. a txn -> db -> (a cursor, error) result = fun txn dbi ->
|
type a. a txn -> db -> (a cursor, error) result = fun txn dbi ->
|
||||||
match txn with
|
match txn with
|
||||||
| Txn_ro rawtxn ->
|
| Txn_ro rawtxn ->
|
||||||
R.reword_error error_of_int (opencursor rawtxn dbi) |>
|
R.reword_error error_of_int (opencursor rawtxn dbi) |>
|
||||||
R.map cursor_ro
|
R.map cursor_ro
|
||||||
| Txn_rw rawtxn ->
|
| Txn_rw rawtxn ->
|
||||||
R.reword_error error_of_int (opencursor rawtxn dbi) |>
|
R.reword_error error_of_int (opencursor rawtxn dbi) |>
|
||||||
R.map cursor_rw
|
R.map cursor_rw
|
||||||
|
|
||||||
@ -586,11 +586,11 @@ let cursor_fold_left ~f ~init cursor =
|
|||||||
| Error KeyNotFound -> Ok a
|
| Error KeyNotFound -> Ok a
|
||||||
| Error err -> Error err
|
| Error err -> Error err
|
||||||
| Ok kv ->
|
| Ok kv ->
|
||||||
f a kv >>= fun a ->
|
f a kv >>= fun a ->
|
||||||
match cursor_next cursor with
|
match cursor_next cursor with
|
||||||
| Error KeyNotFound -> Ok a
|
| Error KeyNotFound -> Ok a
|
||||||
| Error err -> Error err
|
| Error err -> Error err
|
||||||
| Ok () -> inner a
|
| Ok () -> inner a
|
||||||
in
|
in
|
||||||
inner init
|
inner init
|
||||||
|
|
||||||
|
2
vendors/ocaml-pbkdf/src/pbkdf.ml
vendored
2
vendors/ocaml-pbkdf/src/pbkdf.ml
vendored
@ -13,7 +13,7 @@ let cdiv x y =
|
|||||||
exposed _internal_ utility library not for public consumption, hence
|
exposed _internal_ utility library not for public consumption, hence
|
||||||
the API break that prompted this copy-pasted function. *)
|
the API break that prompted this copy-pasted function. *)
|
||||||
if y < 1 then raise Division_by_zero else
|
if y < 1 then raise Division_by_zero else
|
||||||
if x > 0 then 1 + ((x - 1) / y) else 0 [@@inline]
|
if x > 0 then 1 + ((x - 1) / y) else 0 [@@inline]
|
||||||
|
|
||||||
module type S = sig
|
module type S = sig
|
||||||
val pbkdf2 : password:Bigstring.t -> salt:Bigstring.t -> count:int -> dk_len:int32 -> Bigstring.t
|
val pbkdf2 : password:Bigstring.t -> salt:Bigstring.t -> count:int -> dk_len:int32 -> Bigstring.t
|
||||||
|
42
vendors/ocaml-uecc/src/uecc.ml
vendored
42
vendors/ocaml-uecc/src/uecc.ml
vendored
@ -99,22 +99,22 @@ let equal : type a b. (a, b) key -> (a, b) key -> bool = fun k1 k2 ->
|
|||||||
match k1, k2 with
|
match k1, k2 with
|
||||||
| Sk (sk, _), Sk (sk2, _) -> Bigstring.equal sk sk2
|
| Sk (sk, _), Sk (sk2, _) -> Bigstring.equal sk sk2
|
||||||
| Pk (pk, c), Pk (pk2, _) ->
|
| Pk (pk, c), Pk (pk2, _) ->
|
||||||
let len = compressed_size c in
|
let len = compressed_size c in
|
||||||
let cpk = Bigstring.create len in
|
let cpk = Bigstring.create len in
|
||||||
let cpk2 = Bigstring.create len in
|
let cpk2 = Bigstring.create len in
|
||||||
compress pk cpk (to_curve c) ;
|
compress pk cpk (to_curve c) ;
|
||||||
compress pk2 cpk2 (to_curve c) ;
|
compress pk2 cpk2 (to_curve c) ;
|
||||||
Bigstring.equal cpk cpk2
|
Bigstring.equal cpk cpk2
|
||||||
|
|
||||||
let neuterize : type a b. (a, b) key -> (a, public) key = function
|
let neuterize : type a b. (a, b) key -> (a, public) key = function
|
||||||
| Pk (pk, curve) -> Pk (pk, curve)
|
| Pk (pk, curve) -> Pk (pk, curve)
|
||||||
| Sk (sk, curve) ->
|
| Sk (sk, curve) ->
|
||||||
let pk = Bigstring.create (pk_size curve) in
|
let pk = Bigstring.create (pk_size curve) in
|
||||||
let pk_computed_ok = pk_of_sk sk pk (to_curve curve) in
|
let pk_computed_ok = pk_of_sk sk pk (to_curve curve) in
|
||||||
let pk_is_valid = valid_pk pk (to_curve curve) in
|
let pk_is_valid = valid_pk pk (to_curve curve) in
|
||||||
if not pk_computed_ok && pk_is_valid then
|
if not pk_computed_ok && pk_is_valid then
|
||||||
invalid_arg "Uecc.neuterize" ;
|
invalid_arg "Uecc.neuterize" ;
|
||||||
Pk (pk, curve)
|
Pk (pk, curve)
|
||||||
|
|
||||||
let pk_of_bytes :
|
let pk_of_bytes :
|
||||||
type a. a t -> Bigstring.t ->
|
type a. a t -> Bigstring.t ->
|
||||||
@ -216,18 +216,18 @@ external verify :
|
|||||||
|
|
||||||
let write_sign (Sk (_sk, _c)) _buf ~msg:_ =
|
let write_sign (Sk (_sk, _c)) _buf ~msg:_ =
|
||||||
failwith "Not implemented"
|
failwith "Not implemented"
|
||||||
(* if Bigstring.length buf < pk_size c then 0
|
(* if Bigstring.length buf < pk_size c then 0
|
||||||
* else
|
* else
|
||||||
* match sign sk msg buf (to_curve c) with
|
* match sign sk msg buf (to_curve c) with
|
||||||
* | true -> pk_size c
|
* | true -> pk_size c
|
||||||
* | false -> 0 *)
|
* | false -> 0 *)
|
||||||
|
|
||||||
let sign (Sk (_sk, _c)) _msg =
|
let sign (Sk (_sk, _c)) _msg =
|
||||||
failwith "Not implemented"
|
failwith "Not implemented"
|
||||||
(* let signature = Bigstring.create (pk_size c) in
|
(* let signature = Bigstring.create (pk_size c) in
|
||||||
* match sign sk msg signature (to_curve c) with
|
* match sign sk msg signature (to_curve c) with
|
||||||
* | true -> Some signature
|
* | true -> Some signature
|
||||||
* | false -> None *)
|
* | false -> None *)
|
||||||
|
|
||||||
let verify (Pk (pk, c)) ~msg ~signature =
|
let verify (Pk (pk, c)) ~msg ~signature =
|
||||||
if Bigstring.length signature <> pk_size c then false
|
if Bigstring.length signature <> pk_size c then false
|
||||||
|
86
vendors/ocaml-uecc/test/test.ml
vendored
86
vendors/ocaml-uecc/test/test.ml
vendored
@ -25,18 +25,18 @@ let test_export_curve curve =
|
|||||||
match keypair curve with
|
match keypair curve with
|
||||||
| None -> assert false
|
| None -> assert false
|
||||||
| Some (sk, pk) ->
|
| Some (sk, pk) ->
|
||||||
let sk_bytes = to_bytes ~compress:false sk in
|
let sk_bytes = to_bytes ~compress:false sk in
|
||||||
let pk_bytes = to_bytes ~compress:false pk in
|
let pk_bytes = to_bytes ~compress:false pk in
|
||||||
checki __LOC__ (sk_size curve) (Bigstring.length sk_bytes) ;
|
checki __LOC__ (sk_size curve) (Bigstring.length sk_bytes) ;
|
||||||
checki __LOC__ (pk_size curve + 1) (Bigstring.length pk_bytes) ;
|
checki __LOC__ (pk_size curve + 1) (Bigstring.length pk_bytes) ;
|
||||||
match sk_of_bytes curve sk_bytes,
|
match sk_of_bytes curve sk_bytes,
|
||||||
pk_of_bytes curve pk_bytes with
|
pk_of_bytes curve pk_bytes with
|
||||||
| Some (sk', pk'), Some pk'' ->
|
| Some (sk', pk'), Some pk'' ->
|
||||||
assert (equal sk sk') ;
|
assert (equal sk sk') ;
|
||||||
assert (equal pk pk') ;
|
assert (equal pk pk') ;
|
||||||
assert (equal pk pk'') ;
|
assert (equal pk pk'') ;
|
||||||
assert (equal pk' pk') ;
|
assert (equal pk' pk') ;
|
||||||
| _ -> assert false
|
| _ -> assert false
|
||||||
|
|
||||||
let test_export_curve curve =
|
let test_export_curve curve =
|
||||||
for _i = 0 to nb_iterations - 1 do
|
for _i = 0 to nb_iterations - 1 do
|
||||||
@ -55,18 +55,18 @@ let test_export_curve_compressed curve =
|
|||||||
match keypair curve with
|
match keypair curve with
|
||||||
| None -> assert false
|
| None -> assert false
|
||||||
| Some (sk, pk) ->
|
| Some (sk, pk) ->
|
||||||
let sk_bytes = to_bytes sk in
|
let sk_bytes = to_bytes sk in
|
||||||
let pk_bytes = to_bytes pk in
|
let pk_bytes = to_bytes pk in
|
||||||
checki __LOC__ (sk_size curve) (Bigstring.length sk_bytes) ;
|
checki __LOC__ (sk_size curve) (Bigstring.length sk_bytes) ;
|
||||||
checki __LOC__ (compressed_size curve) (Bigstring.length pk_bytes) ;
|
checki __LOC__ (compressed_size curve) (Bigstring.length pk_bytes) ;
|
||||||
match sk_of_bytes curve sk_bytes,
|
match sk_of_bytes curve sk_bytes,
|
||||||
pk_of_bytes curve pk_bytes with
|
pk_of_bytes curve pk_bytes with
|
||||||
| Some (sk', pk'), Some pk'' ->
|
| Some (sk', pk'), Some pk'' ->
|
||||||
assert (equal sk sk') ;
|
assert (equal sk sk') ;
|
||||||
assert (equal pk pk') ;
|
assert (equal pk pk') ;
|
||||||
assert (equal pk pk'') ;
|
assert (equal pk pk'') ;
|
||||||
assert (equal pk' pk') ;
|
assert (equal pk' pk') ;
|
||||||
| _ -> assert false
|
| _ -> assert false
|
||||||
|
|
||||||
let test_export_curve_compressed curve =
|
let test_export_curve_compressed curve =
|
||||||
for _i = 0 to nb_iterations - 1 do
|
for _i = 0 to nb_iterations - 1 do
|
||||||
@ -85,10 +85,10 @@ let test_keypair_curve curve =
|
|||||||
match keypair curve with
|
match keypair curve with
|
||||||
| None -> assert false
|
| None -> assert false
|
||||||
| Some (sk, pk) ->
|
| Some (sk, pk) ->
|
||||||
assert (equal sk sk) ;
|
assert (equal sk sk) ;
|
||||||
assert (equal pk pk) ;
|
assert (equal pk pk) ;
|
||||||
let pk' = neuterize sk in
|
let pk' = neuterize sk in
|
||||||
assert (equal pk pk')
|
assert (equal pk pk')
|
||||||
|
|
||||||
let test_keypair_curve curve =
|
let test_keypair_curve curve =
|
||||||
for _i = 0 to nb_iterations - 1 do
|
for _i = 0 to nb_iterations - 1 do
|
||||||
@ -106,11 +106,11 @@ let test_keypair () =
|
|||||||
let test_dh_curve curve =
|
let test_dh_curve curve =
|
||||||
match keypair curve, keypair curve with
|
match keypair curve, keypair curve with
|
||||||
| Some (sk, pk), Some (sk', pk') ->
|
| Some (sk, pk), Some (sk', pk') ->
|
||||||
begin match dh sk pk', dh sk' pk with
|
begin match dh sk pk', dh sk' pk with
|
||||||
| Some secret, Some secret' ->
|
| Some secret, Some secret' ->
|
||||||
assert (Bigstring.equal secret secret')
|
assert (Bigstring.equal secret secret')
|
||||||
| _ -> assert false
|
| _ -> assert false
|
||||||
end
|
end
|
||||||
| _ -> assert false
|
| _ -> assert false
|
||||||
|
|
||||||
let test_dh_curve curve =
|
let test_dh_curve curve =
|
||||||
@ -133,16 +133,16 @@ let test_sign_curve curve =
|
|||||||
match keypair curve with
|
match keypair curve with
|
||||||
| None -> assert false
|
| None -> assert false
|
||||||
| Some (sk, pk) ->
|
| Some (sk, pk) ->
|
||||||
let signature = Bigstring.create (pk_size curve) in
|
let signature = Bigstring.create (pk_size curve) in
|
||||||
begin match write_sign sk signature ~msg with
|
begin match write_sign sk signature ~msg with
|
||||||
| nb_written when nb_written = (pk_size curve) ->
|
| nb_written when nb_written = (pk_size curve) ->
|
||||||
assert (verify pk ~msg ~signature)
|
assert (verify pk ~msg ~signature)
|
||||||
| _ -> assert false
|
| _ -> assert false
|
||||||
end ;
|
end ;
|
||||||
match sign sk msg with
|
match sign sk msg with
|
||||||
| None -> assert false
|
| None -> assert false
|
||||||
| Some signature ->
|
| Some signature ->
|
||||||
assert (verify pk ~msg ~signature)
|
assert (verify pk ~msg ~signature)
|
||||||
|
|
||||||
let test_sign_curve curve =
|
let test_sign_curve curve =
|
||||||
for _i = 0 to nb_iterations - 1 do
|
for _i = 0 to nb_iterations - 1 do
|
||||||
|
Loading…
Reference in New Issue
Block a user