[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-exchange] 60/130: consistently distinguish blinded/unblinded deno
From: |
gnunet |
Subject: |
[taler-exchange] 60/130: consistently distinguish blinded/unblinded denomination sigs |
Date: |
Wed, 17 Nov 2021 12:25:08 +0100 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository exchange.
commit 783d07b4765aabee529f889b55f4fb5a27efaa44
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sun Oct 31 18:12:54 2021 +0100
consistently distinguish blinded/unblinded denomination sigs
---
src/exchange/taler-exchange-httpd_link.c | 4 ++--
src/exchangedb/irbt_callbacks.c | 4 ++--
src/exchangedb/lrbt_callbacks.c | 4 ++--
src/exchangedb/plugin_exchangedb_postgres.c | 6 ++---
src/exchangedb/test_exchangedb.c | 34 +++++++++++++++++------------
src/include/taler_crypto_lib.h | 13 +++++++++++
src/include/taler_exchangedb_plugin.h | 6 ++---
src/util/denom.c | 20 +++++++++++++++++
8 files changed, 65 insertions(+), 26 deletions(-)
diff --git a/src/exchange/taler-exchange-httpd_link.c
b/src/exchange/taler-exchange-httpd_link.c
index 19a03595..3393e068 100644
--- a/src/exchange/taler-exchange-httpd_link.c
+++ b/src/exchange/taler-exchange-httpd_link.c
@@ -84,8 +84,8 @@ handle_link_data (void *cls,
obj = GNUNET_JSON_PACK (
TALER_JSON_pack_denom_pub ("denom_pub",
&pos->denom_pub),
- TALER_JSON_pack_denom_sig ("ev_sig",
- &pos->ev_sig),
+ TALER_JSON_pack_blinded_denom_sig ("ev_sig",
+ &pos->ev_sig),
GNUNET_JSON_pack_data_auto ("link_sig",
&pos->orig_coin_link_sig));
if ( (NULL == obj) ||
diff --git a/src/exchangedb/irbt_callbacks.c b/src/exchangedb/irbt_callbacks.c
index 756d755e..20f25686 100644
--- a/src/exchangedb/irbt_callbacks.c
+++ b/src/exchangedb/irbt_callbacks.c
@@ -230,7 +230,7 @@ irbt_cb_table_reserves_out (struct PostgresClosure *pg,
&td->details.reserves_out.h_blind_ev),
GNUNET_PQ_query_param_uint64 (
&td->details.reserves_out.denominations_serial),
- TALER_PQ_query_param_denom_sig (
+ TALER_PQ_query_param_blinded_denom_sig (
&td->details.reserves_out.denom_sig),
GNUNET_PQ_query_param_uint64 (
&td->details.reserves_out.reserve_uuid),
@@ -437,7 +437,7 @@ irbt_cb_table_refresh_revealed_coins (
td->details.refresh_revealed_coins.
coin_ev_size),
GNUNET_PQ_query_param_auto_from_type (&h_coin_ev),
- TALER_PQ_query_param_denom_sig (
+ TALER_PQ_query_param_blinded_denom_sig (
&td->details.refresh_revealed_coins.ev_sig),
GNUNET_PQ_query_param_uint64 (
&td->details.refresh_revealed_coins.denominations_serial),
diff --git a/src/exchangedb/lrbt_callbacks.c b/src/exchangedb/lrbt_callbacks.c
index 481ee378..8aa0a083 100644
--- a/src/exchangedb/lrbt_callbacks.c
+++ b/src/exchangedb/lrbt_callbacks.c
@@ -405,7 +405,7 @@ lrbt_cb_table_reserves_out (void *cls,
GNUNET_PQ_result_spec_uint64 (
"denominations_serial",
&td.details.reserves_out.denominations_serial),
- TALER_PQ_result_spec_denom_sig (
+ TALER_PQ_result_spec_blinded_denom_sig (
"denom_sig",
&td.details.reserves_out.denom_sig),
GNUNET_PQ_result_spec_uint64 (
@@ -787,7 +787,7 @@ lrbt_cb_table_refresh_revealed_coins (void *cls,
"coin_ev",
(void **) &td.details.refresh_revealed_coins.coin_ev,
&td.details.refresh_revealed_coins.coin_ev_size),
- TALER_PQ_result_spec_denom_sig (
+ TALER_PQ_result_spec_blinded_denom_sig (
"ev_sig",
&td.details.refresh_revealed_coins.ev_sig),
GNUNET_PQ_result_spec_uint64 (
diff --git a/src/exchangedb/plugin_exchangedb_postgres.c
b/src/exchangedb/plugin_exchangedb_postgres.c
index 85550e98..219ea064 100644
--- a/src/exchangedb/plugin_exchangedb_postgres.c
+++ b/src/exchangedb/plugin_exchangedb_postgres.c
@@ -6367,7 +6367,7 @@ free_link_data_list (void *cls,
{
next = ldl->next;
TALER_denom_pub_free (&ldl->denom_pub);
- TALER_denom_sig_free (&ldl->ev_sig);
+ TALER_blinded_denom_sig_free (&ldl->ev_sig);
GNUNET_free (ldl);
ldl = next;
}
@@ -6401,8 +6401,8 @@ add_ldl (void *cls,
&transfer_pub),
GNUNET_PQ_result_spec_auto_from_type ("link_sig",
&pos->orig_coin_link_sig),
- TALER_PQ_result_spec_denom_sig ("ev_sig",
- &pos->ev_sig),
+ TALER_PQ_result_spec_blinded_denom_sig ("ev_sig",
+ &pos->ev_sig),
TALER_PQ_result_spec_denom_pub ("denom_pub",
&pos->denom_pub),
GNUNET_PQ_result_spec_end
diff --git a/src/exchangedb/test_exchangedb.c b/src/exchangedb/test_exchangedb.c
index 817dcbbc..9b8d1a6d 100644
--- a/src/exchangedb/test_exchangedb.c
+++ b/src/exchangedb/test_exchangedb.c
@@ -262,8 +262,8 @@ create_denom_key_pair (unsigned int size,
TALER_denom_pub_hash (&dkp->pub,
&dki.issue.properties.denom_hash);
- dki.issue.properties.purpose.size = htonl (sizeof (struct
-
TALER_DenominationKeyValidityPS));
+ dki.issue.properties.purpose.size
+ = htonl (sizeof (struct TALER_DenominationKeyValidityPS));
dki.issue.properties.purpose.purpose = htonl (
TALER_SIGNATURE_MASTER_DENOMINATION_KEY_VALIDITY);
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
@@ -479,8 +479,8 @@ handle_link_data_cb (void *cls,
TALER_denom_pub_cmp (&ldlp->denom_pub,
&new_dkp[cnt]->pub)) &&
(0 ==
- TALER_denom_sig_cmp (&ldlp->ev_sig,
- &revealed_coins[cnt].coin_sig)) )
+ TALER_blinded_denom_sig_cmp (&ldlp->ev_sig,
+ &revealed_coins[cnt].coin_sig)) )
{
found = GNUNET_YES;
break;
@@ -623,7 +623,7 @@ test_melting (void)
RND_BLK (&hc);
ccoin->denom_pub = new_dkp[cnt]->pub;
ccoin->coin_sig.cipher = TALER_DENOMINATION_RSA;
- ccoin->coin_sig.details.rsa_signature
+ ccoin->coin_sig.details.blinded_rsa_signature
= GNUNET_CRYPTO_rsa_sign_fdh (new_dkp[cnt]->priv.details.rsa_private_key,
&hc.hash);
}
@@ -675,7 +675,7 @@ drop:
{
for (unsigned int cnt = 0; cnt < MELT_NEW_COINS; cnt++)
{
- TALER_denom_sig_free (&revealed_coins[cnt].coin_sig);
+ TALER_blinded_denom_sig_free (&revealed_coins[cnt].coin_sig);
GNUNET_free (revealed_coins[cnt].coin_ev);
}
GNUNET_free (revealed_coins);
@@ -1593,7 +1593,7 @@ run (void *cls)
RND_BLK (&cbc.reserve_sig);
cbc.denom_pub_hash = dkp_pub_hash;
cbc.sig.cipher = TALER_DENOMINATION_RSA;
- cbc.sig.details.rsa_signature
+ cbc.sig.details.blinded_rsa_signature
= GNUNET_CRYPTO_rsa_sign_fdh (dkp->priv.details.rsa_private_key,
&cbc.h_coin_envelope.hash);
cbc.reserve_pub = reserve_pub;
@@ -1620,12 +1620,14 @@ run (void *cls)
plugin->get_withdraw_info (plugin->cls,
&cbc.h_coin_envelope,
&cbc2));
- FAILIF (0 != GNUNET_memcmp (&cbc2.reserve_sig, &cbc.reserve_sig));
- FAILIF (0 != GNUNET_memcmp (&cbc2.reserve_pub, &cbc.reserve_pub));
+ FAILIF (0 != GNUNET_memcmp (&cbc2.reserve_sig,
+ &cbc.reserve_sig));
+ FAILIF (0 != GNUNET_memcmp (&cbc2.reserve_pub,
+ &cbc.reserve_pub));
result = 6;
FAILIF (GNUNET_OK !=
GNUNET_CRYPTO_rsa_verify (&cbc.h_coin_envelope.hash,
- cbc2.sig.details.rsa_signature,
+ cbc2.sig.details.blinded_rsa_signature,
dkp->pub.details.rsa_public_key));
@@ -1634,7 +1636,9 @@ run (void *cls)
RND_BLK (&deposit.coin.coin_pub);
TALER_denom_pub_hash (&dkp->pub,
&deposit.coin.denom_pub_hash);
- deposit.coin.denom_sig = cbc.sig;
+ deposit.coin.denom_sig.cipher = TALER_DENOMINATION_RSA;
+ deposit.coin.denom_sig.details.rsa_signature =
+ cbc.sig.details.blinded_rsa_signature;
deadline = GNUNET_TIME_absolute_get ();
(void) GNUNET_TIME_round_abs (&deadline);
FAILIF (TALER_EXCHANGEDB_CKS_ADDED !=
@@ -1792,7 +1796,9 @@ run (void *cls)
RND_BLK (&deposit.coin.coin_pub);
TALER_denom_pub_hash (&dkp->pub,
&deposit.coin.denom_pub_hash);
- deposit.coin.denom_sig = cbc.sig;
+ deposit.coin.denom_sig.cipher = TALER_DENOMINATION_RSA;
+ deposit.coin.denom_sig.details.rsa_signature =
+ cbc.sig.details.blinded_rsa_signature;
RND_BLK (&deposit.csig);
RND_BLK (&deposit.merchant_pub);
RND_BLK (&deposit.h_contract_terms);
@@ -2126,8 +2132,8 @@ drop:
plugin->drop_tables (plugin->cls));
if (NULL != dkp)
destroy_denom_key_pair (dkp);
- TALER_denom_sig_free (&cbc.sig);
- TALER_denom_sig_free (&cbc2.sig);
+ TALER_blinded_denom_sig_free (&cbc.sig);
+ TALER_blinded_denom_sig_free (&cbc2.sig);
dkp = NULL;
TALER_EXCHANGEDB_plugin_unload (plugin);
plugin = NULL;
diff --git a/src/include/taler_crypto_lib.h b/src/include/taler_crypto_lib.h
index 69acfa0b..f63b7dca 100644
--- a/src/include/taler_crypto_lib.h
+++ b/src/include/taler_crypto_lib.h
@@ -772,6 +772,19 @@ TALER_denom_sig_cmp (const struct
TALER_DenominationSignature *sig1,
const struct TALER_DenominationSignature *sig2);
+/**
+ * Compare two blinded denomination signatures.
+ *
+ * @param sig1 first signature
+ * @param sig2 second signature
+ * @return 0 if the keys are equal, otherwise -1 or 1
+ */
+int
+TALER_blinded_denom_sig_cmp (
+ const struct TALER_BlindedDenominationSignature *sig1,
+ const struct TALER_BlindedDenominationSignature *sig2);
+
+
/**
* Obtain denomination public key from a denomination private key.
*
diff --git a/src/include/taler_exchangedb_plugin.h
b/src/include/taler_exchangedb_plugin.h
index 17df7528..c278aa40 100644
--- a/src/include/taler_exchangedb_plugin.h
+++ b/src/include/taler_exchangedb_plugin.h
@@ -239,7 +239,7 @@ struct TALER_EXCHANGEDB_TableData
{
struct TALER_BlindedCoinHash h_blind_ev;
uint64_t denominations_serial;
- struct TALER_DenominationSignature denom_sig;
+ struct TALER_BlindedDenominationSignature denom_sig;
uint64_t reserve_uuid;
struct TALER_ReserveSignatureP reserve_sig;
struct GNUNET_TIME_Absolute execution_date;
@@ -301,7 +301,7 @@ struct TALER_EXCHANGEDB_TableData
void *coin_ev;
size_t coin_ev_size;
// h_coin_ev omitted, to be recomputed!
- struct TALER_DenominationSignature ev_sig;
+ struct TALER_BlindedDenominationSignature ev_sig;
} refresh_revealed_coins;
struct
@@ -1334,7 +1334,7 @@ struct TALER_EXCHANGEDB_LinkList
/**
* Signature over the blinded envelope.
*/
- struct TALER_DenominationSignature ev_sig;
+ struct TALER_BlindedDenominationSignature ev_sig;
/**
* Signature of the original coin being refreshed over the
diff --git a/src/util/denom.c b/src/util/denom.c
index 8d6ddd5e..e623a635 100644
--- a/src/util/denom.c
+++ b/src/util/denom.c
@@ -295,4 +295,24 @@ TALER_denom_sig_cmp (const struct
TALER_DenominationSignature *sig1,
}
+int
+TALER_blinded_denom_sig_cmp (
+ const struct TALER_BlindedDenominationSignature *sig1,
+ const struct TALER_BlindedDenominationSignature *sig2)
+{
+ if (sig1->cipher != sig2->cipher)
+ return (sig1->cipher > sig2->cipher) ? 1 : -1;
+ switch (sig1->cipher)
+ {
+ case TALER_DENOMINATION_RSA:
+ return GNUNET_CRYPTO_rsa_signature_cmp
(sig1->details.blinded_rsa_signature,
+
sig2->details.blinded_rsa_signature);
+ // TODO: add case for Clause-Schnorr
+ default:
+ GNUNET_assert (0);
+ }
+ return -2;
+}
+
+
/* end of denom.c */
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-exchange] 02/130: brutally fixing types in src/include/, creating plenty of FTBFS issues, (continued)
- [taler-exchange] 02/130: brutally fixing types in src/include/, creating plenty of FTBFS issues, gnunet, 2021/11/17
- [taler-exchange] 12/130: -more changes towards fixing FTBFS, gnunet, 2021/11/17
- [taler-exchange] 11/130: -more changes towards fixing FTBFS, gnunet, 2021/11/17
- [taler-exchange] 05/130: fix remaining libtalerutil FTBFS issues, gnunet, 2021/11/17
- [taler-exchange] 01/130: database change -- breaks everything, gnunet, 2021/11/17
- [taler-exchange] 10/130: -more changes towards fixing FTBFS, gnunet, 2021/11/17
- [taler-exchange] 06/130: add missing file, gnunet, 2021/11/17
- [taler-exchange] 04/130: -fixing more FTBFS, gnunet, 2021/11/17
- [taler-exchange] 09/130: work on FTBFS issues..., gnunet, 2021/11/17
- [taler-exchange] 08/130: -resovling more FTBFS issues, gnunet, 2021/11/17
- [taler-exchange] 60/130: consistently distinguish blinded/unblinded denomination sigs,
gnunet <=
- [taler-exchange] 20/130: -fix more FTBFS, gnunet, 2021/11/17
- [taler-exchange] 43/130: address most FIXMEs in pg plugin, gnunet, 2021/11/17
- [taler-exchange] 44/130: address most FIXMEs in pg plugin, gnunet, 2021/11/17
- [taler-exchange] 07/130: fix remaining libtalerutil tests FTBFS issues, gnunet, 2021/11/17
- [taler-exchange] 21/130: -work on FTBFS, gnunet, 2021/11/17
- [taler-exchange] 25/130: -work on fTBFS, gnunet, 2021/11/17
- [taler-exchange] 29/130: fix lib/ FTBFS, gnunet, 2021/11/17
- [taler-exchange] 63/130: fix bug, gnunet, 2021/11/17
- [taler-exchange] 39/130: fix FTBFS of auditordb, gnunet, 2021/11/17
- [taler-exchange] 35/130: -FTBFS fix, gnunet, 2021/11/17