This commit is contained in:
swrup 2025-11-20 23:09:12 +01:00
parent d924b5994c
commit 43aeec672b
3 changed files with 4 additions and 65 deletions

View file

@ -4,11 +4,6 @@
(modules taler_signatures)
(libraries))
(executable
(name gen_taler_signatures)
(modules gen_taler_signatures)
(libraries fmt angstrom))
(executable
(name gen_eddsa_key)
(modules gen_eddsa_key)
@ -18,10 +13,3 @@
(name parse_config)
(modules parse_config)
(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

View file

@ -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;
()

View file

@ -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_drain_profit : int32 = 1018_l
let master_partner_details : int32 = 1019_l