sed module names
This commit is contained in:
parent
6ed9916974
commit
e4b9fb473a
2 changed files with 79 additions and 81 deletions
|
|
@ -23,7 +23,7 @@ module Time = struct
|
|||
|+ field neint64 (fun t -> t.timestamp_us)
|
||||
|> sealr
|
||||
|
||||
let nbo_bin =
|
||||
let nboBin =
|
||||
let open Bin in
|
||||
record (fun abs_value_us__ -> { abs_value_us__ })
|
||||
|+ field beint64 (fun t -> t.abs_value_us__)
|
||||
|
|
@ -42,7 +42,7 @@ module Time = struct
|
|||
|+ field neint64 (fun t -> t.timestamp_us)
|
||||
|> sealr
|
||||
|
||||
let nbo_bin =
|
||||
let nboBin =
|
||||
let open Bin in
|
||||
record (fun rel_value_us__ -> { rel_value_us__ })
|
||||
|+ field beint64 (fun t -> t.rel_value_us__)
|
||||
|
|
@ -53,7 +53,7 @@ end
|
|||
(* -- Cryptographic primitives -- *)
|
||||
|
||||
(* MK_BASIC_XX functor for structs like:
|
||||
struct Foo { uint8_t bar[XX]; } *)
|
||||
struct Foo { uint8t bar[XX]; } *)
|
||||
module MKMK_BASIC (Size : sig
|
||||
val v : int
|
||||
end) =
|
||||
|
|
@ -79,7 +79,7 @@ module MK_BASIC_32 () = MKMK_BASIC (SIZE_32)
|
|||
module MK_BASIC_64 () = MKMK_BASIC (SIZE_64)
|
||||
|
||||
(* MK_XX functor for structs like:
|
||||
struct FooWrap { struct Foo { uint8_t bar[XX]; } } *)
|
||||
struct FooWrap { struct Foo { uint8t bar[XX]; } } *)
|
||||
module MKMK (Size : sig
|
||||
val v : int
|
||||
end) =
|
||||
|
|
@ -101,37 +101,37 @@ module MK_64 () = MKMK (SIZE_64)
|
|||
|
||||
module ShortHashCode = MK_BASIC_32 ()
|
||||
module HashCode = MK_BASIC_64 ()
|
||||
module Denomination_hash = MK_64 ()
|
||||
module Private_contract_hash = MK_64 ()
|
||||
module Extensions_policy_hash = MK_64 ()
|
||||
module Merchant_wire_hash = MK_64 ()
|
||||
module DenominationHash = MK_64 ()
|
||||
module PrivateContractHash = MK_64 ()
|
||||
module ExtensionsPolicyHash = MK_64 ()
|
||||
module MerchantWireHash = MK_64 ()
|
||||
|
||||
(* Hash over a full payto://-URI, including receiver-name
|
||||
(and possibly BIC and other optional fields). *)
|
||||
module Full_payto_hash = MK_32 ()
|
||||
module FullPaytoHash = MK_32 ()
|
||||
|
||||
(* Hash over a normalized payto://-URI, including all optional
|
||||
fields and also with account-part canonicalized (so no BIC). *)
|
||||
module Normalized_payto_hash = MK_32 ()
|
||||
module NormalizedPaytoHash = MK_32 ()
|
||||
|
||||
(* Hash over:
|
||||
a) the hash of the denomination's public key,
|
||||
b) an enum value identifying the cipher, and
|
||||
c) cipher-dependant blinded information.
|
||||
See implementation of `TALER_coin_ev_hash`
|
||||
See implementation of `TALER_CoinEvHash`
|
||||
in libtalerexchange for details. *)
|
||||
module Blinded_coin_hash = MK_64 ()
|
||||
module Coin_pub_hash = MK_64 ()
|
||||
module Output_commitment_hash = MK_64 ()
|
||||
module Reserve_public_key_p = MK_32 ()
|
||||
module Reserve_private_key_p = MK_32 ()
|
||||
module Reserve_signature_p = MK_64 ()
|
||||
module Merchant_public_key_p = MK_32 ()
|
||||
module Merchant_private_key_p = MK_32 ()
|
||||
(*module Merchant_signature_p = MK_64 () *)
|
||||
module BlindedCoinHash = MK_64 ()
|
||||
module CoinPubHash = MK_64 ()
|
||||
module OutputCommitmentHash = MK_64 ()
|
||||
module ReservePublicKeyP = MK_32 ()
|
||||
module ReservePrivateKeyP = MK_32 ()
|
||||
module ReserveSignatureP = MK_64 ()
|
||||
module MerchantPublicKeyP = MK_32 ()
|
||||
module MerchantPrivateKeyP = MK_32 ()
|
||||
(*module MerchantSignatureP = MK_64 () *)
|
||||
|
||||
module Transfert_public_key_p = MK_32 ()
|
||||
module Transfert_private_key_p = MK_32 ()
|
||||
module TransfertPublicKeyP = MK_32 ()
|
||||
module TransfertPrivateKeyP = MK_32 ()
|
||||
|
||||
(*
|
||||
enum TALER_AmlDecisionState {
|
||||
|
|
@ -139,18 +139,18 @@ enum TALER_AmlDecisionState {
|
|||
};
|
||||
*)
|
||||
|
||||
module Aml_officer_public_key_p = MK_32 ()
|
||||
module Aml_officer_private_key_p = MK_32 ()
|
||||
module Exchange_public_key_p = MK_32 ()
|
||||
module Exchange_private_key_p = MK_32 ()
|
||||
module Exchange_signature_p = MK_64 ()
|
||||
module Master_public_key_p = MK_32 ()
|
||||
module Master_private_key_p = MK_32 ()
|
||||
module Master_signature_p = MK_64 ()
|
||||
module Wire_transfert_identifier_raw_p = MK_BASIC_32 ()
|
||||
module AmlOfficerPublicKeyP = MK_32 ()
|
||||
module AmlOfficerPrivateKeyP = MK_32 ()
|
||||
module ExchangePublicKeyP = MK_32 ()
|
||||
module ExchangePrivateKeyP = MK_32 ()
|
||||
module ExchangeSignatureP = MK_64 ()
|
||||
module MasterPublicKeyP = MK_32 ()
|
||||
module MasterPrivateKeyP = MK_32 ()
|
||||
module MasterSignatureP = MK_64 ()
|
||||
module WireTransfertIdentifierRawP = MK_BASIC_32 ()
|
||||
|
||||
module UUID = struct
|
||||
(* uint32_t value[4]; *)
|
||||
(* uint32t value[4]; *)
|
||||
type t = { value: string }
|
||||
|
||||
let size = 4 * int32_size
|
||||
|
|
@ -162,8 +162,8 @@ module UUID = struct
|
|||
|> sealr
|
||||
end
|
||||
|
||||
module Wad_id = struct
|
||||
(* uint32_t value[6]; *)
|
||||
module WadId = struct
|
||||
(* uint32t value[6]; *)
|
||||
type t = { raw: string }
|
||||
|
||||
let size = 6 * int32_size
|
||||
|
|
@ -176,40 +176,40 @@ end
|
|||
(* TODO not sure what to do of union, probably not needed *)
|
||||
(*
|
||||
union TALER_CoinSpendPublicKeyP {
|
||||
uint8_t eddsa_pub[32];
|
||||
uint8_t ecdhe_pub[32];
|
||||
uint8t eddsaPub[32];
|
||||
uint8t ecdhePub[32];
|
||||
};
|
||||
union TALER_CoinSpendPrivateKeyP {
|
||||
uint8_t eddsa_priv[32];
|
||||
uint8_t ecdhe_priv[32];
|
||||
uint8t eddsaPriv[32];
|
||||
uint8t ecdhePriv[32];
|
||||
};
|
||||
*)
|
||||
module Coin_spend_public_key_p = MK_32 ()
|
||||
module Coin_spend_private_key_p = MK_32 ()
|
||||
module Coin_spend_signature_p = MK_64 ()
|
||||
module CoinSpendPublicKeyP = MK_32 ()
|
||||
module CoinSpendPrivateKeyP = MK_32 ()
|
||||
module CoinSpendSignatureP = MK_64 ()
|
||||
|
||||
(* TODO padding: sizeof used here (assume no padding for now) *)
|
||||
(*
|
||||
struct TALER_TransferSecretP {
|
||||
uint8_t key[sizeof (struct GNUNET_HashCode)];
|
||||
uint8t key[sizeof (struct GNUNET_HashCode)];
|
||||
};
|
||||
uint8_t key[sizeof (struct GNUNET_HashCode)];
|
||||
uint8t key[sizeof (struct GNUNET_HashCode)];
|
||||
};
|
||||
struct TALER_EncryptedLinkSecretP {
|
||||
uint8_t enc[sizeof (struct TALER_LinkSecretP)];
|
||||
uint8t enc[sizeof (struct TALER_LinkSecretP)];
|
||||
};
|
||||
*)
|
||||
module Transfert_secret_p = MK_64 ()
|
||||
module Link_secret_p = MK_64 ()
|
||||
module Encrypted_link_secret_p = MK_64 ()
|
||||
module TransfertSecretP = MK_64 ()
|
||||
module LinkSecretP = MK_64 ()
|
||||
module EncryptedLinkSecretP = MK_64 ()
|
||||
|
||||
(*
|
||||
union TALER_TokenPublicKeyP {
|
||||
uint8_t eddsa_pub[32];
|
||||
uint8_t ecdhe_pub[32];
|
||||
uint8t eddsaPub[32];
|
||||
uint8t ecdhePub[32];
|
||||
};
|
||||
*)
|
||||
module Token_public_key_p = MK_32 ()
|
||||
module TokenPublicKeyP = MK_32 ()
|
||||
|
||||
(* -- Signatures -- *)
|
||||
|
||||
|
|
@ -243,7 +243,7 @@ end
|
|||
Note that each `TALER_BlindedCoinHashP` itself
|
||||
captures the hash of the corresponding denomination's
|
||||
public key. *)
|
||||
module Hash_planchets_p = MK_64 ()
|
||||
module HashPlanchetsP = MK_64 ()
|
||||
|
||||
(* Binary representation of the age groups.
|
||||
The bits set in the mask mark the edges at the beginning of a next age
|
||||
|
|
@ -257,7 +257,7 @@ module Hash_planchets_p = MK_64 ()
|
|||
|
||||
A value of 0 means that the exchange does not support the extension for
|
||||
age-restriction. *)
|
||||
module Age_mask = struct
|
||||
module AgeMask = struct
|
||||
type t = { mask: int32 }
|
||||
|
||||
let size = int32_size
|
||||
|
|
@ -269,7 +269,7 @@ end
|
|||
|
||||
(* TODO TALER doc
|
||||
should be in doc
|
||||
found in src/include/taler/taler_amount_lib.h
|
||||
found in src/include/taler/talerAmountLib.h
|
||||
|
||||
why is the non-NBO version only used in TALER_WithdrawRequestPS?
|
||||
GNUNET_PACKED?
|
||||
|
|
@ -284,19 +284,17 @@ end
|
|||
* For regional currencies, the first character should be a "*" followed
|
||||
* by a region-specific name (i.e. "*BRETAGNEFR").
|
||||
*/
|
||||
#define TALER_CURRENCY_LEN 12
|
||||
|
||||
struct TALER_AmountNBO
|
||||
{
|
||||
/**
|
||||
* Value in the main currency, in NBO.
|
||||
*/
|
||||
uint64_t value GNUNET_PACKED;
|
||||
uint64t value GNUNET_PACKED;
|
||||
|
||||
/**
|
||||
* Fraction (integer multiples of #TALER_AMOUNT_FRAC_BASE), in NBO.
|
||||
*/
|
||||
uint32_t fraction GNUNET_PACKED;
|
||||
uint32t fraction GNUNET_PACKED;
|
||||
|
||||
/**
|
||||
* Type of the currency being represented.
|
||||
|
|
@ -309,12 +307,12 @@ struct TALER_Amount
|
|||
/**
|
||||
* Value (numerator of fraction)
|
||||
*/
|
||||
uint64_t value;
|
||||
uint64t value;
|
||||
|
||||
/**
|
||||
* Fraction (integer multiples of #TALER_AMOUNT_FRAC_BASE).
|
||||
*/
|
||||
uint32_t fraction;
|
||||
uint32t fraction;
|
||||
|
||||
/**
|
||||
* Currency string, left adjusted and padded with zeros. All zeros
|
||||
|
|
@ -362,11 +360,11 @@ module AmountNBO = struct
|
|||
|> sealr
|
||||
end
|
||||
|
||||
module Blinding_master_seed = MK_BASIC_32 ()
|
||||
module BlindingMasterSeed = MK_BASIC_32 ()
|
||||
|
||||
(* Format used for to generate the signature on a request to withdraw
|
||||
coins from a reserve. *)
|
||||
module Withdraw_request_ps = struct
|
||||
module WithdrawRequestPs = struct
|
||||
(* Purpose is #TALER_SIGNATURE_WALLET_RESERVE_WITHDRAW *)
|
||||
type t = {
|
||||
(* Amount to withdraw, excluding fees, i.e.
|
||||
|
|
@ -381,7 +379,7 @@ module Withdraw_request_ps = struct
|
|||
Note that each `TALER_BlindedCoinHashP` itself
|
||||
captures the hash of the corresponding denomination's
|
||||
public key.
|
||||
If max_age was set in the withdraw request, there will be
|
||||
If maxAge was set in the withdraw request, there will be
|
||||
n*κ many such values. The iteration MUST be first over
|
||||
all coins belonging to κ index=0, then all coins
|
||||
to κ index=1 etc:
|
||||
|
|
@ -390,51 +388,51 @@ module Withdraw_request_ps = struct
|
|||
Note also that this value is required for /recoup and
|
||||
-- in case of a withdraw request with required age proof --
|
||||
in the subsequent call to /reveal-withdraw *)
|
||||
h_planchets: Hash_planchets_p.t;
|
||||
h_planchets: HashPlanchetsP.t;
|
||||
(* The master seed that was used in the call to /blinding-prepare blinding,
|
||||
or all zeros, if no denomination of cipher type Clause-Schnorr is used. *)
|
||||
(* TODO TALER doc
|
||||
`TALER_BlindingMasterSecretP` in doc, but probably TALER_BlindingMasterSeed *)
|
||||
blinding_seed: Blinding_master_seed.t;
|
||||
(* If age restriction proof is required, the maximum age _group_
|
||||
blinding_seed: BlindingMasterSeed.t;
|
||||
(* If age restriction proof is required, the maximum age Group_
|
||||
to commit to, 0 otherwise. Note that in this case, all
|
||||
denominations for all coins MUST support age restriction.
|
||||
Also note that this is not an age (in years), but the age group
|
||||
(an index) according to list of age groups in the configuration
|
||||
of the exchange. See TALER_get_max_group() how to calculate
|
||||
of the exchange. See TALER_GetMaxGroup() how to calculate
|
||||
the age group to a given age (in years). *)
|
||||
max_age_group: int32;
|
||||
(* The age groups as configured for the exchange, represented as a mask.
|
||||
If max_age_group is > 0, the mask MUST be non-zero, too. *)
|
||||
mask: Age_mask.t;
|
||||
mask: AgeMask.t;
|
||||
}
|
||||
|
||||
let size =
|
||||
Purpose.size
|
||||
+ (2 * Amount.size)
|
||||
+ Hash_planchets_p.size
|
||||
+ Blinding_master_seed.size
|
||||
+ HashPlanchetsP.size
|
||||
+ BlindingMasterSeed.size
|
||||
+ int32_size
|
||||
+ Age_mask.size
|
||||
+ AgeMask.size
|
||||
|
||||
let purpose = Purpose.make ~size Taler_signatures.wallet_reserve_withdraw
|
||||
|
||||
let bin =
|
||||
let open Bin in
|
||||
record
|
||||
(fun _purpose amount fee h_planchets blinding_seed max_age_group mask ->
|
||||
(fun _urpose amount fee h_planchets blinding_seed max_age_group mask ->
|
||||
{ amount; fee; h_planchets; blinding_seed; max_age_group; mask })
|
||||
|+ field Purpose.bin (Fun.const purpose)
|
||||
|+ field Amount.bin (fun t -> t.amount)
|
||||
|+ field Amount.bin (fun t -> t.fee)
|
||||
|+ field Hash_planchets_p.bin (fun t -> t.h_planchets)
|
||||
|+ field Blinding_master_seed.bin (fun t -> t.blinding_seed)
|
||||
|+ field HashPlanchetsP.bin (fun t -> t.h_planchets)
|
||||
|+ field BlindingMasterSeed.bin (fun t -> t.blinding_seed)
|
||||
|+ field beint32 (fun t -> t.max_age_group)
|
||||
|+ field Age_mask.bin (fun t -> t.mask)
|
||||
|+ field AgeMask.bin (fun t -> t.mask)
|
||||
|> sealr
|
||||
end
|
||||
|
||||
module Withdraw_confirmation_ps = struct
|
||||
module WithdrawConfirmationPs = struct
|
||||
(* Purpose is #TALER_SIGNATURE_EXCHANGE_CONFIRM_WITHDRAW.
|
||||
Signed by a `struct TALER_ExchangePrivateKeyP` using EdDSA. *)
|
||||
type t = {
|
||||
|
|
@ -443,9 +441,9 @@ module Withdraw_confirmation_ps = struct
|
|||
of required proof of age restriction) and for /recoup *)
|
||||
(* TODO TALER doc
|
||||
missing TALER_HashBlindedPlanchetsP*)
|
||||
h_planchets: Hash_planchets_p.t;
|
||||
h_planchets: HashPlanchetsP.t;
|
||||
(* If proof of age restriction is not required for to this
|
||||
withdrawal, (i.e. max_age was not set during the request)
|
||||
withdrawal, (i.e. maxAge was not set during the request)
|
||||
MUST be 0xFFFFFFFF.
|
||||
Otherwise (i.e. proof of age restriction required):
|
||||
index that the client will not have to reveal, in NBO,
|
||||
|
|
@ -453,15 +451,15 @@ module Withdraw_confirmation_ps = struct
|
|||
noreveal_index: int32;
|
||||
}
|
||||
|
||||
let size = Purpose.size + Hash_planchets_p.size + int32_size
|
||||
let size = Purpose.size + HashPlanchetsP.size + int32_size
|
||||
let purpose = Purpose.make ~size Taler_signatures.exchange_confirm_withdraw
|
||||
|
||||
let bin =
|
||||
let open Bin in
|
||||
record (fun _purpose h_planchets noreveal_index ->
|
||||
record (fun _urpose h_planchets noreveal_index ->
|
||||
{ h_planchets; noreveal_index })
|
||||
|+ field Purpose.bin (Fun.const purpose)
|
||||
|+ field Hash_planchets_p.bin (fun t -> t.h_planchets)
|
||||
|+ field HashPlanchetsP.bin (fun t -> t.h_planchets)
|
||||
|+ field beint32 (fun t -> t.noreveal_index)
|
||||
|> sealr
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue