This commit is contained in:
parent
d09cd2f86b
commit
bc9ccefe84
1 changed files with 78 additions and 12 deletions
|
|
@ -2,6 +2,13 @@
|
|||
|
||||
- numeric values are in network byte order (big endian) *)
|
||||
|
||||
(* TODO
|
||||
use Bin.seq instead of Bin.bytes?
|
||||
less boilerplate (just make type t abstract)?
|
||||
padding issues?
|
||||
how to encode union?
|
||||
test *)
|
||||
|
||||
(* -- Time -- *)
|
||||
|
||||
module Time = struct
|
||||
|
|
@ -181,32 +188,91 @@ module Master_public_key_p = MAKE_EDDSA_PUB ()
|
|||
module Master_private_key_p = MAKE_EDDSA_PRIV ()
|
||||
module Master_signature_p = MAKE_EDDSA_SIG ()
|
||||
|
||||
module Wire_transfert_identifier_raw_p = struct
|
||||
(* uint8_t raw[32]; *)
|
||||
type t = { raw: string }
|
||||
|
||||
let bin =
|
||||
let open Bin in
|
||||
record (fun raw -> { raw }) |+ field (bytes 32) (fun t -> t.raw) |> sealr
|
||||
end
|
||||
|
||||
module UUID = struct
|
||||
(* uint32_t value[4]; *)
|
||||
type t = { value: string }
|
||||
|
||||
let bin =
|
||||
let open Bin in
|
||||
record (fun value -> { value })
|
||||
|+ field (bytes (4 * 4)) (fun t -> t.value)
|
||||
|> sealr
|
||||
end
|
||||
|
||||
module Wad_id = struct
|
||||
(* uint32_t value[6]; *)
|
||||
type t = { raw: string }
|
||||
|
||||
let bin =
|
||||
let open Bin in
|
||||
record (fun raw -> { raw })
|
||||
|+ field (bytes (4 * 6)) (fun t -> t.raw)
|
||||
|> sealr
|
||||
end
|
||||
|
||||
(* TODO not sure what to do of unions *)
|
||||
(*
|
||||
union TALER_CoinSpendPublicKeyP {
|
||||
uint8_t eddsa_pub[32];
|
||||
uint8_t ecdhe_pub[32];
|
||||
};
|
||||
union TALER_CoinSpendPrivateKeyP {
|
||||
uint8_t eddsa_priv[32];
|
||||
uint8_t ecdhe_priv[32];
|
||||
};
|
||||
*)
|
||||
|
||||
module Coin_spend_signature_p = MAKE_EDDSA_SIG ()
|
||||
|
||||
(* TODO padding: sizeof used here (assume no padding for now) *)
|
||||
(*
|
||||
struct TALER_TransferSecretP {
|
||||
uint8_t key[sizeof (struct GNUNET_HashCode)];
|
||||
};
|
||||
uint8_t key[sizeof (struct GNUNET_HashCode)];
|
||||
};
|
||||
struct TALER_EncryptedLinkSecretP {
|
||||
uint8_t enc[sizeof (struct TALER_LinkSecretP)];
|
||||
};
|
||||
*)
|
||||
module Transfert_secret_p = MAKE_H (Hash_code)
|
||||
module Link_secret_p = MAKE_H (Hash_code)
|
||||
module Encrypted_link_secret_p = MAKE_H (Hash_code)
|
||||
|
||||
(*
|
||||
union TALER_TokenPublicKeyP {
|
||||
uint8_t eddsa_pub[32];
|
||||
uint8_t ecdhe_pub[32];
|
||||
};
|
||||
*)
|
||||
|
||||
(* -- Signatures -- *)
|
||||
|
||||
module Purpose = struct
|
||||
(* defined in gnunet_crypto_lib.h *)
|
||||
module Ecc_signature_purpose = struct
|
||||
type t = {
|
||||
(* This field equals the number of bytes being signed,
|
||||
namely 'sizeof (struct Data)'. *)
|
||||
size: int32; (* = uint32_t *)
|
||||
size: int32;
|
||||
(* This field is used to express the context in
|
||||
which the signature is made, ensuring that a
|
||||
signature cannot be lifted from one part of the protocol
|
||||
to another. *)
|
||||
purpose: int32; (* = uint32_t *)
|
||||
purpose: int32;
|
||||
}
|
||||
|
||||
let t_bin =
|
||||
let bin =
|
||||
let open Bin in
|
||||
record (fun size purpose -> { size; purpose })
|
||||
|+ field beint32 (fun t -> t.size)
|
||||
|+ field beint32 (fun t -> t.purpose)
|
||||
|> sealr
|
||||
end
|
||||
|
||||
module Data = struct
|
||||
type t = {
|
||||
purpose: Purpose.t;
|
||||
payloads: string list;
|
||||
}
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue