[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-exchange] 27/37: change TEH_keys_denomination_sign message parame
From: |
gnunet |
Subject: |
[taler-exchange] 27/37: change TEH_keys_denomination_sign message parameter |
Date: |
Fri, 04 Feb 2022 16:53:57 +0100 |
This is an automated email from the git hooks/post-receive script.
gian-demarmels pushed a commit to branch master
in repository exchange.
commit 74ce114b832daf49cf51185c38949240de2e89cd
Author: Lucien Heuzeveldt <lucienclaude.heuzeveldt@students.bfh.ch>
AuthorDate: Tue Jan 11 21:16:47 2022 +0100
change TEH_keys_denomination_sign message parameter
---
src/exchange/taler-exchange-httpd_keys.c | 22 +++++------
src/exchange/taler-exchange-httpd_keys.h | 39 +++++++++++++++++-
.../taler-exchange-httpd_refreshes_reveal.c | 10 +++++
src/exchange/taler-exchange-httpd_withdraw.c | 46 ++++++++++++----------
4 files changed, 81 insertions(+), 36 deletions(-)
diff --git a/src/exchange/taler-exchange-httpd_keys.c
b/src/exchange/taler-exchange-httpd_keys.c
index 66c0f69e..42f351b7 100644
--- a/src/exchange/taler-exchange-httpd_keys.c
+++ b/src/exchange/taler-exchange-httpd_keys.c
@@ -2410,8 +2410,7 @@ TEH_keys_denomination_by_hash2 (
struct TALER_BlindedDenominationSignature
TEH_keys_denomination_sign (const struct TALER_DenominationHash *h_denom_pub,
- const void *msg,
- size_t msg_size,
+ const struct TEH_SignDetails *msg,
enum TALER_ErrorCode *ec)
{
struct TEH_KeyStateHandle *ksh;
@@ -2434,26 +2433,23 @@ TEH_keys_denomination_sign (const struct
TALER_DenominationHash *h_denom_pub,
*ec = TALER_EC_EXCHANGE_GENERIC_DENOMINATION_KEY_UNKNOWN;
return none;
}
+ if (msg->cipher != hd->denom_pub.cipher)
+ {
+ *ec = TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE;
+ return none;
+ }
switch (hd->denom_pub.cipher)
{
case TALER_DENOMINATION_RSA:
return TALER_CRYPTO_helper_rsa_sign (ksh->helpers->rsadh,
&hd->h_details.h_rsa,
- msg,
- msg_size,
+ msg->details.rsa_message.msg,
+ msg->details.rsa_message.msg_size,
ec);
case TALER_DENOMINATION_CS:
- if (sizeof (struct TALER_BlindedCsPlanchet) != msg_size)
- {
- *ec = TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE;
- return none;
- }
- struct TALER_BlindedCsPlanchet *blinded_cs_planchet = ((struct
-
TALER_BlindedCsPlanchet
- *) msg);
return TALER_CRYPTO_helper_cs_sign (ksh->helpers->csdh,
&hd->h_details.h_cs,
- blinded_cs_planchet,
+ &msg->details.cs_message,
ec);
default:
*ec = TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE;
diff --git a/src/exchange/taler-exchange-httpd_keys.h
b/src/exchange/taler-exchange-httpd_keys.h
index 0134a28d..7e75c80a 100644
--- a/src/exchange/taler-exchange-httpd_keys.h
+++ b/src/exchange/taler-exchange-httpd_keys.h
@@ -82,6 +82,42 @@ struct TEH_DenominationKey
};
+struct TEH_SignDetails_RSA
+{
+ /**
+ * message to sign
+ */
+ const void *msg;
+
+ /**
+ * number of bytes in msg
+ */
+ size_t msg_size;
+};
+
+
+struct TEH_SignDetails
+{
+ /**
+ * Cipher type of the message
+ */
+ enum TALER_DenominationCipher cipher;
+
+ union
+ {
+ /**
+ * If we use #TALER_DENOMINATION_RSA in @a cipher.
+ */
+ struct TEH_SignDetails_RSA rsa_message;
+
+ /**
+ * If we use #TALER_DENOMINATION_CS in @a cipher.
+ */
+ struct TALER_BlindedCsPlanchet cs_message;
+ } details;
+};
+
+
/**
* Snapshot of the (coin and signing) keys (including private keys) of
* the exchange. There can be multiple instances of this struct, as it is
@@ -179,8 +215,7 @@ TEH_keys_denomination_by_hash2 (struct TEH_KeyStateHandle
*ksh,
*/
struct TALER_BlindedDenominationSignature
TEH_keys_denomination_sign (const struct TALER_DenominationHash *h_denom_pub,
- const void *msg,
- size_t msg_size,
+ const struct TEH_SignDetails *msg,
enum TALER_ErrorCode *ec);
diff --git a/src/exchange/taler-exchange-httpd_refreshes_reveal.c
b/src/exchange/taler-exchange-httpd_refreshes_reveal.c
index 9d806bea..5a46aa22 100644
--- a/src/exchange/taler-exchange-httpd_refreshes_reveal.c
+++ b/src/exchange/taler-exchange-httpd_refreshes_reveal.c
@@ -507,6 +507,7 @@ resolve_refreshes_reveal_denominations (struct
MHD_Connection *connection,
for (unsigned int i = 0; i<rctx->num_fresh_coins; i++)
{
enum TALER_ErrorCode ec = TALER_EC_NONE;
+ //FIXME:
rrcs[i].coin_sig
= TEH_keys_denomination_sign (
@@ -514,6 +515,15 @@ resolve_refreshes_reveal_denominations (struct
MHD_Connection *connection,
rcds[i].coin_ev,
rcds[i].coin_ev_size,
&ec);
+ struct TEH_SignDetails sign_details;
+
+ // FIXME: implement cipher handling
+ sign_details.cipher = TALER_DENOMINATION_RSA;
+ sign_details.details.rsa_message.msg = rctx->rcds[i].coin_ev;
+ sign_details.details.rsa_message.msg_size = rctx->rcds[i].coin_ev_size;
+ rctx->ev_sigs[i] = TEH_keys_denomination_sign (&dk_h[i],
+ &sign_details,
+ &ec);
if (TALER_EC_NONE != ec)
{
GNUNET_break (0);
diff --git a/src/exchange/taler-exchange-httpd_withdraw.c
b/src/exchange/taler-exchange-httpd_withdraw.c
index ed54fe27..9925fa8e 100644
--- a/src/exchange/taler-exchange-httpd_withdraw.c
+++ b/src/exchange/taler-exchange-httpd_withdraw.c
@@ -600,31 +600,35 @@ TEH_handler_withdraw (struct TEH_RequestContext *rc,
/* Sign before transaction! */
ec = TALER_EC_NONE;
- switch (wc.blinded_planchet.cipher)
{
- case TALER_DENOMINATION_RSA:
- wc.collectable.sig = TEH_keys_denomination_sign (
- &wc.collectable.denom_pub_hash,
- wc.blinded_planchet.details.rsa_blinded_planchet.blinded_msg,
- wc.blinded_planchet.details.rsa_blinded_planchet.blinded_msg_size,
- &ec);
- break;
- case TALER_DENOMINATION_CS:
+ struct TEH_SignDetails sign_details;
+ sign_details.cipher = wc.blinded_planchet.cipher;
+ switch (wc.blinded_planchet.cipher)
+ {
+ case TALER_DENOMINATION_RSA:
+ sign_details.details.rsa_message.msg =
+ wc.blinded_planchet.details.rsa_blinded_planchet.blinded_msg;
+ sign_details.details.rsa_message.msg_size =
+ wc.blinded_planchet.details.rsa_blinded_planchet.blinded_msg_size;
+ break;
+ case TALER_DENOMINATION_CS:
+ sign_details.details.cs_message =
+ wc.blinded_planchet.details.cs_blinded_planchet;
+ break;
+ default:
+ GNUNET_break (0);
+ GNUNET_JSON_parse_free (spec);
+ if (NULL != coin_ev_spec)
+ GNUNET_JSON_parse_free (coin_ev_spec);
+ return TALER_MHD_reply_with_error (rc->connection,
+ MHD_HTTP_FORBIDDEN,
+
TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE,
+ NULL);
+ }
wc.collectable.sig = TEH_keys_denomination_sign (
&wc.collectable.denom_pub_hash,
- &wc.blinded_planchet.details.cs_blinded_planchet,
- sizeof (wc.blinded_planchet.details.cs_blinded_planchet),
+ &sign_details,
&ec);
- break;
- default:
- GNUNET_break (0);
- GNUNET_JSON_parse_free (spec);
- if (NULL != coin_ev_spec)
- GNUNET_JSON_parse_free (coin_ev_spec);
- return TALER_MHD_reply_with_error (rc->connection,
- MHD_HTTP_FORBIDDEN,
-
TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE,
- NULL);
}
if (TALER_EC_NONE != ec)
{
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-exchange] 14/37: initial cs_secmod implementation, (continued)
- [taler-exchange] 14/37: initial cs_secmod implementation, gnunet, 2022/02/04
- [taler-exchange] 15/37: setup_key for cs secmod helper, gnunet, 2022/02/04
- [taler-exchange] 34/37: include denom_pub into coin_ev_hash, gnunet, 2022/02/04
- [taler-exchange] 36/37: denomination CIPHER field per denom, gnunet, 2022/02/04
- [taler-exchange] 21/37: secmod CS sign implementation, gnunet, 2022/02/04
- [taler-exchange] 22/37: cleanup, gnunet, 2022/02/04
- [taler-exchange] 23/37: implement withdraw (nonce reuse check missing), gnunet, 2022/02/04
- [taler-exchange] 10/37: remove varargs in cs crypto implementation, gnunet, 2022/02/04
- [taler-exchange] 31/37: introduce new type for security module pubkeys, gnunet, 2022/02/04
- [taler-exchange] 25/37: implement spend, gnunet, 2022/02/04
- [taler-exchange] 27/37: change TEH_keys_denomination_sign message parameter,
gnunet <=
- [taler-exchange] 35/37: refactor TALER_coin_ev_hash, gnunet, 2022/02/04
- [taler-exchange] 28/37: -scope needed, gnunet, 2022/02/04
- [taler-exchange] 33/37: fixed nonce check, renamed WithdrawNonce, gnunet, 2022/02/04
- [taler-exchange] 26/37: refactoring, gnunet, 2022/02/04
- [taler-exchange] 19/37: set planchet detail cipher, add cipher checks, gnunet, 2022/02/04
- [taler-exchange] 30/37: -make picky gcc happy, gnunet, 2022/02/04
- [taler-exchange] 37/37: resolves merge conflicts, gnunet, 2022/02/04
- [taler-exchange] 20/37: implement CS key handling and csr endpoint, gnunet, 2022/02/04
- [taler-exchange] 29/37: implement feedback, gnunet, 2022/02/04
- [taler-exchange] 24/37: removed varargs, gnunet, 2022/02/04