mv gen_taler_signatures scripts to mte_scripts
This commit is contained in:
parent
9b760b436f
commit
a774ea11ac
4 changed files with 4 additions and 86 deletions
17
include/dune
17
include/dune
|
|
@ -4,24 +4,7 @@
|
||||||
(modules taler_signatures)
|
(modules taler_signatures)
|
||||||
(libraries))
|
(libraries))
|
||||||
|
|
||||||
(executable
|
|
||||||
(name gen_taler_signatures)
|
|
||||||
(modules gen_taler_signatures)
|
|
||||||
(libraries fmt angstrom))
|
|
||||||
|
|
||||||
(executable
|
|
||||||
(name gen_eddsa_key)
|
|
||||||
(modules gen_eddsa_key)
|
|
||||||
(libraries fmt mirage-crypto-rng.unix mirage-crypto-ec b32))
|
|
||||||
|
|
||||||
(library ; todo: should I have a /lib?
|
(library ; todo: should I have a /lib?
|
||||||
(name parse_config)
|
(name parse_config)
|
||||||
(modules parse_config)
|
(modules parse_config)
|
||||||
(libraries mirage-crypto-ec ptime fmt angstrom uri amount b32))
|
(libraries mirage-crypto-ec ptime fmt angstrom uri amount b32))
|
||||||
|
|
||||||
; we prefer to generate taler_signatures.ml once,
|
|
||||||
; and commit it, for versionning:
|
|
||||||
;
|
|
||||||
; wget -q -O taler_signatures.h "https://git.taler.net/exchange.git/plain/src/include/taler/taler_signatures.h"
|
|
||||||
; dune exec ./include/gen_taler_signatures.exe > ./include/taler_signatures.ml
|
|
||||||
; rm taler_signatures.h
|
|
||||||
|
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
let () =
|
|
||||||
Mirage_crypto_rng_unix.use_default ();
|
|
||||||
let open Mirage_crypto_ec.Ed25519 in
|
|
||||||
let _priv, pub = generate () in
|
|
||||||
let octets = pub_to_octets pub in
|
|
||||||
let pub_b32 = B32.encode octets in
|
|
||||||
let octets' = B32.decode pub_b32 |> Result.get_ok in
|
|
||||||
assert (octets = octets');
|
|
||||||
(*
|
|
||||||
Fmt.pr "public key :@.%S@." octets;
|
|
||||||
Fmt.pr "len: %d@." (String.length octets);
|
|
||||||
Fmt.pr "len: %d@." (String.length pub_b32);
|
|
||||||
*)
|
|
||||||
Fmt.pr "%s@." pub_b32;
|
|
||||||
|
|
||||||
()
|
|
||||||
|
|
@ -1,53 +0,0 @@
|
||||||
(* script to generate taler_signatures.ml module
|
|
||||||
get signatures definition form `exchange/src/include/taler/taler_signatures.h` *)
|
|
||||||
|
|
||||||
open Angstrom
|
|
||||||
|
|
||||||
type define = {
|
|
||||||
name: string;
|
|
||||||
value: int;
|
|
||||||
}
|
|
||||||
|
|
||||||
let define_line =
|
|
||||||
let is_ident_char = function
|
|
||||||
| 'A' .. 'Z' | '0' .. '9' | '_' -> true
|
|
||||||
| _ -> false
|
|
||||||
in
|
|
||||||
let p =
|
|
||||||
string "#define"
|
|
||||||
*> skip_while (( = ) ' ')
|
|
||||||
*> string "TALER_SIGNATURE_"
|
|
||||||
*> take_while1 is_ident_char
|
|
||||||
>>= fun name ->
|
|
||||||
skip_while (( = ) ' ')
|
|
||||||
*> take_while1 (function '0' .. '9' -> true | _ -> false)
|
|
||||||
>>| fun digits ->
|
|
||||||
let name = String.lowercase_ascii name in
|
|
||||||
let value = int_of_string digits in
|
|
||||||
{ name; value }
|
|
||||||
in
|
|
||||||
p <* end_of_line
|
|
||||||
|
|
||||||
let all_defines =
|
|
||||||
let any_line = take_till (Char.equal '\n') <* end_of_line in
|
|
||||||
many (choice [ define_line >>| Option.some; any_line *> return None ])
|
|
||||||
>>| List.filter_map Fun.id
|
|
||||||
|
|
||||||
let parse input =
|
|
||||||
match parse_string ~consume:All all_defines input with
|
|
||||||
| Ok defs -> defs
|
|
||||||
| Error msg -> failwith msg
|
|
||||||
|
|
||||||
let read_file file = In_channel.with_open_bin file In_channel.input_all
|
|
||||||
|
|
||||||
let () =
|
|
||||||
let content = read_file "taler_signatures.h" in
|
|
||||||
let l = parse content in
|
|
||||||
assert (List.length l = 74);
|
|
||||||
|
|
||||||
let pp ppf { name; value } =
|
|
||||||
Fmt.pf ppf "let %s : int32 = %d_l@." name value
|
|
||||||
in
|
|
||||||
Fmt.pr "%a" (Fmt.list ~sep:Fmt.nop pp) l;
|
|
||||||
|
|
||||||
()
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
(* This file was generated by using data and/or code from the GNU Taler project,
|
||||||
|
under the AGPL-v3 licence.
|
||||||
|
Do not edit it. *)
|
||||||
|
|
||||||
let master_aml_key : int32 = 1017_l
|
let master_aml_key : int32 = 1017_l
|
||||||
let master_drain_profit : int32 = 1018_l
|
let master_drain_profit : int32 = 1018_l
|
||||||
let master_partner_details : int32 = 1019_l
|
let master_partner_details : int32 = 1019_l
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue