From 64e64141962fbea4e8acea87f57f98e93360a7c4 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 19 Dec 2021 12:24:14 +0100 Subject: introduce new data type for the post-orders hash used for idempotency checks, as well as the hash and salt for authentication checks --- src/include/taler_merchantdb_plugin.h | 52 ++++++++++++++++++++++++++++++++--- 1 file changed, 48 insertions(+), 4 deletions(-) (limited to 'src/include') diff --git a/src/include/taler_merchantdb_plugin.h b/src/include/taler_merchantdb_plugin.h index b4dc17b2..d301eeef 100644 --- a/src/include/taler_merchantdb_plugin.h +++ b/src/include/taler_merchantdb_plugin.h @@ -33,6 +33,50 @@ struct TALER_MERCHANTDB_Plugin; +GNUNET_NETWORK_STRUCT_BEGIN + + +/** + * @brief Hash over an order request, used for the idempotency check. + */ +struct TALER_MerchantPostDataHashP +{ + /** + * The authentication hash is a SHA-512 hash code. + */ + struct GNUNET_HashCode hash; +}; + + +/** + * @brief Hash used for client authenticiation. Computed with a + * `struct TALER_MerchantAuthenticationSaltP`. + */ +struct TALER_MerchantAuthenticationHashP +{ + /** + * The authentication hash is a SHA-512 hash code. + * All zeros if authentication is off. + */ + struct GNUNET_HashCode hash; +}; + + +/** + * @brief Salt used for client authenticiation. + */ +struct TALER_MerchantAuthenticationSaltP +{ + /** + * The authentication salt is a 256-bit value. + */ + uint32_t salt[256 / 8 / sizeof(uint32_t)]; /* = 8 */ +}; + + +GNUNET_NETWORK_STRUCT_END + + /** * Details about a wire account of the merchant. */ @@ -68,13 +112,13 @@ struct TALER_MERCHANTDB_InstanceAuthSettings /** * Hash used for authentication. All zero if authentication is off. */ - struct GNUNET_HashCode auth_hash; + struct TALER_MerchantAuthenticationHashP auth_hash; /** * Salt used to hash the "Authentication" header, the result must then * match the @e auth_hash. */ - struct GNUNET_ShortHashCode auth_salt; + struct TALER_MerchantAuthenticationSaltP auth_salt; }; /** @@ -1184,7 +1228,7 @@ struct TALER_MERCHANTDB_Plugin const char *instance_id, const char *order_id, struct TALER_ClaimTokenP *claim_token, - struct GNUNET_HashCode *h_post_data, + struct TALER_MerchantPostDataHashP *h_post_data, json_t **contract_terms); @@ -1240,7 +1284,7 @@ struct TALER_MERCHANTDB_Plugin (*insert_order)(void *cls, const char *instance_id, const char *order_id, - const struct GNUNET_HashCode *h_post_data, + const struct TALER_MerchantPostDataHashP *h_post_data, struct GNUNET_TIME_Timestamp pay_deadline, const struct TALER_ClaimTokenP *claim_token, const json_t *contract_terms); -- cgit v1.2.3