diff options
author | Christian Grothoff <grothoff@gnunet.org> | 2023-10-25 22:54:20 +0200 |
---|---|---|
committer | Christian Grothoff <grothoff@gnunet.org> | 2023-10-25 22:54:20 +0200 |
commit | 82d7d87cc3946a01bfed221c7da0fb9ef2c18eb1 (patch) | |
tree | f0d3cb66869650e7dc1a5bc3a197c5f05636cf3e /src/exchangedb | |
parent | bc74ed7c2eb54820a58cf832cb7aa83b1b331458 (diff) | |
download | exchange-82d7d87cc3946a01bfed221c7da0fb9ef2c18eb1.tar.xz |
new blind signing code builds
Diffstat (limited to 'src/exchangedb')
-rw-r--r-- | src/exchangedb/perf_deposits_get_ready.c | 18 | ||||
-rw-r--r-- | src/exchangedb/perf_get_link_data.c | 17 | ||||
-rw-r--r-- | src/exchangedb/perf_select_refunds_by_coin.c | 18 | ||||
-rw-r--r-- | src/exchangedb/pg_do_batch_withdraw_insert.c | 2 | ||||
-rw-r--r-- | src/exchangedb/pg_do_batch_withdraw_insert.h | 2 | ||||
-rw-r--r-- | src/exchangedb/pg_do_recoup.c | 2 | ||||
-rw-r--r-- | src/exchangedb/pg_do_recoup.h | 2 | ||||
-rw-r--r-- | src/exchangedb/pg_do_recoup_refresh.c | 2 | ||||
-rw-r--r-- | src/exchangedb/pg_do_recoup_refresh.h | 2 | ||||
-rw-r--r-- | src/exchangedb/pg_get_link_data.c | 5 | ||||
-rw-r--r-- | src/exchangedb/pg_get_refresh_reveal.c | 3 | ||||
-rw-r--r-- | src/exchangedb/pg_select_recoup_above_serial_id.c | 2 | ||||
-rw-r--r-- | src/exchangedb/pg_select_recoup_refresh_above_serial_id.c | 2 | ||||
-rw-r--r-- | src/exchangedb/test_exchangedb.c | 16 |
14 files changed, 57 insertions, 36 deletions
diff --git a/src/exchangedb/perf_deposits_get_ready.c b/src/exchangedb/perf_deposits_get_ready.c index f15665482..cba751e15 100644 --- a/src/exchangedb/perf_deposits_get_ready.c +++ b/src/exchangedb/perf_deposits_get_ready.c @@ -121,7 +121,7 @@ create_denom_key_pair (unsigned int size, GNUNET_assert (GNUNET_OK == TALER_denom_priv_create (&dkp->priv, &dkp->pub, - TALER_DENOMINATION_RSA, + GNUNET_CRYPTO_BSA_RSA, size)); memset (&dki, 0, @@ -202,8 +202,12 @@ run (void *cls) unsigned int *perm; unsigned long long duration_sq; struct TALER_EXCHANGEDB_RefreshRevealedCoin *ccoin; + struct GNUNET_CRYPTO_BlindingInputValues bi = { + .cipher = GNUNET_CRYPTO_BSA_RSA, + .rc = 0 + }; struct TALER_ExchangeWithdrawValues alg_values = { - .cipher = TALER_DENOMINATION_RSA + .blinding_inputs = &bi }; ref = GNUNET_new_array (ROUNDS + 1, @@ -262,7 +266,7 @@ run (void *cls) for (unsigned int cnt = 0; cnt < MELT_NEW_COINS; cnt++) { struct GNUNET_TIME_Timestamp now; - struct TALER_BlindedRsaPlanchet *rp; + struct GNUNET_CRYPTO_RsaBlindedMessage *rp; struct TALER_BlindedPlanchet *bp; now = GNUNET_TIME_timestamp_get (); @@ -274,8 +278,10 @@ run (void *cls) new_denom_pubs[cnt] = new_dkp[cnt]->pub; ccoin = &revealed_coins[cnt]; bp = &ccoin->blinded_planchet; - bp->cipher = TALER_DENOMINATION_RSA; - rp = &bp->details.rsa_blinded_planchet; + bp->blinded_message = GNUNET_new (struct GNUNET_CRYPTO_BlindedMessage); + bp->blinded_message->cipher = GNUNET_CRYPTO_BSA_RSA; + bp->blinded_message->rc = 1; + rp = &bp->blinded_message->details.rsa_blinded_message; rp->blinded_msg_size = 1 + (size_t) GNUNET_CRYPTO_random_u64 ( GNUNET_CRYPTO_QUALITY_WEAK, (RSA_KEY_SIZE / 8) - 1); @@ -315,7 +321,7 @@ run (void *cls) for (unsigned int j = 0; j < NUM_ROWS; j++) { /*** NEED TO INSERT REFRESH COMMITMENTS + ENSURECOIN ***/ - union TALER_DenominationBlindingKeyP bks; + union GNUNET_CRYPTO_BlindingSecretP bks; struct GNUNET_TIME_Timestamp deadline; struct TALER_CoinSpendPublicKeyP coin_pub; struct TALER_ReservePublicKeyP reserve_pub; diff --git a/src/exchangedb/perf_get_link_data.c b/src/exchangedb/perf_get_link_data.c index eb1f5f6e2..817789afc 100644 --- a/src/exchangedb/perf_get_link_data.c +++ b/src/exchangedb/perf_get_link_data.c @@ -110,7 +110,7 @@ create_denom_key_pair (unsigned int size, GNUNET_assert (GNUNET_OK == TALER_denom_priv_create (&dkp->priv, &dkp->pub, - TALER_DENOMINATION_RSA, + GNUNET_CRYPTO_BSA_RSA, size)); memset (&dki, 0, @@ -208,8 +208,12 @@ run (void *cls) struct TALER_EXCHANGEDB_Refund *ref = NULL; unsigned int *perm; unsigned long long duration_sq; + struct GNUNET_CRYPTO_BlindingInputValues bi = { + .cipher = GNUNET_CRYPTO_BSA_RSA, + .rc = 0 + }; struct TALER_ExchangeWithdrawValues alg_values = { - .cipher = TALER_DENOMINATION_RSA + .blinding_inputs = &bi }; ref = GNUNET_new_array (ROUNDS + 1, @@ -280,7 +284,7 @@ run (void *cls) "Transaction")); for (unsigned int j = 0; j < NUM_ROWS; j++) { - union TALER_DenominationBlindingKeyP bks; + union GNUNET_CRYPTO_BlindingSecretP bks; struct TALER_CoinPubHashP c_hash; unsigned int i = perm[j]; uint64_t known_coin_id; @@ -303,13 +307,16 @@ run (void *cls) struct TALER_EXCHANGEDB_RefreshRevealedCoin *revealed_coin = &revealed_coins[p]; struct TALER_BlindedPlanchet *bp = &revealed_coin->blinded_planchet; - struct TALER_BlindedRsaPlanchet *rp = &bp->details.rsa_blinded_planchet; + bp->blinded_message = GNUNET_new (struct GNUNET_CRYPTO_BlindedMessage); + struct GNUNET_CRYPTO_RsaBlindedMessage *rp = + &bp->blinded_message->details.rsa_blinded_message; /* h_coin_ev must be unique, but we only have MELT_NEW_COINS created above for NUM_ROWS iterations; instead of making "all new" coins, we simply randomize the hash here as nobody is checking for consistency anyway ;-) */ - bp->cipher = TALER_DENOMINATION_RSA; + bp->blinded_message->rc = 1; + bp->blinded_message->cipher = GNUNET_CRYPTO_BSA_RSA; rp->blinded_msg_size = 1 + (size_t) GNUNET_CRYPTO_random_u64 ( GNUNET_CRYPTO_QUALITY_WEAK, (RSA_KEY_SIZE / 8) - 1); diff --git a/src/exchangedb/perf_select_refunds_by_coin.c b/src/exchangedb/perf_select_refunds_by_coin.c index fdb44d2c9..8f2946fb8 100644 --- a/src/exchangedb/perf_select_refunds_by_coin.c +++ b/src/exchangedb/perf_select_refunds_by_coin.c @@ -117,7 +117,7 @@ create_denom_key_pair (unsigned int size, GNUNET_assert (GNUNET_OK == TALER_denom_priv_create (&dkp->priv, &dkp->pub, - TALER_DENOMINATION_RSA, + GNUNET_CRYPTO_BSA_RSA, size)); memset (&dki, 0, @@ -214,10 +214,14 @@ run (void *cls) struct TALER_EXCHANGEDB_CoinDepositInformation *depos = NULL; struct GNUNET_TIME_Timestamp deadline; struct TALER_Amount value; - union TALER_DenominationBlindingKeyP bks; + union GNUNET_CRYPTO_BlindingSecretP bks; struct TALER_EXCHANGEDB_CollectableBlindcoin cbc; + struct GNUNET_CRYPTO_BlindingInputValues bi = { + .cipher = GNUNET_CRYPTO_BSA_RSA, + .rc = 0 + }; struct TALER_ExchangeWithdrawValues alg_values = { - .cipher = TALER_DENOMINATION_RSA + .blinding_inputs = &bi }; struct GNUNET_TIME_Relative times = GNUNET_TIME_UNIT_ZERO; unsigned long long sqrs = 0; @@ -287,7 +291,7 @@ run (void *cls) for (unsigned int cnt = 0; cnt < MELT_NEW_COINS; cnt++) { struct GNUNET_TIME_Timestamp now; - struct TALER_BlindedRsaPlanchet *rp; + struct GNUNET_CRYPTO_RsaBlindedMessage *rp; struct TALER_BlindedPlanchet *bp; now = GNUNET_TIME_timestamp_get (); @@ -299,8 +303,10 @@ run (void *cls) new_denom_pubs[cnt] = new_dkp[cnt]->pub; ccoin = &revealed_coins[cnt]; bp = &ccoin->blinded_planchet; - bp->cipher = TALER_DENOMINATION_RSA; - rp = &bp->details.rsa_blinded_planchet; + bp->blinded_message = GNUNET_new (struct GNUNET_CRYPTO_BlindedMessage); + bp->blinded_message->rc = 1; + bp->blinded_message->cipher = GNUNET_CRYPTO_BSA_RSA; + rp = &bp->blinded_message->details.rsa_blinded_message; rp->blinded_msg_size = 1 + (size_t) GNUNET_CRYPTO_random_u64 ( GNUNET_CRYPTO_QUALITY_WEAK, (RSA_KEY_SIZE / 8) - 1); diff --git a/src/exchangedb/pg_do_batch_withdraw_insert.c b/src/exchangedb/pg_do_batch_withdraw_insert.c index b95a179d2..758f502f2 100644 --- a/src/exchangedb/pg_do_batch_withdraw_insert.c +++ b/src/exchangedb/pg_do_batch_withdraw_insert.c @@ -29,7 +29,7 @@ enum GNUNET_DB_QueryStatus TEH_PG_do_batch_withdraw_insert ( void *cls, - const struct TALER_CsNonce *nonce, + const union GNUNET_CRYPTO_BlindSessionNonce *nonce, const struct TALER_EXCHANGEDB_CollectableBlindcoin *collectable, struct GNUNET_TIME_Timestamp now, uint64_t ruuid, diff --git a/src/exchangedb/pg_do_batch_withdraw_insert.h b/src/exchangedb/pg_do_batch_withdraw_insert.h index 6bc1a9a45..18fcfc9ae 100644 --- a/src/exchangedb/pg_do_batch_withdraw_insert.h +++ b/src/exchangedb/pg_do_batch_withdraw_insert.h @@ -41,7 +41,7 @@ enum GNUNET_DB_QueryStatus TEH_PG_do_batch_withdraw_insert ( void *cls, - const struct TALER_CsNonce *nonce, + const union GNUNET_CRYPTO_BlindSessionNonce *nonce, const struct TALER_EXCHANGEDB_CollectableBlindcoin *collectable, struct GNUNET_TIME_Timestamp now, uint64_t ruuid, diff --git a/src/exchangedb/pg_do_recoup.c b/src/exchangedb/pg_do_recoup.c index 1f74104ed..07566a607 100644 --- a/src/exchangedb/pg_do_recoup.c +++ b/src/exchangedb/pg_do_recoup.c @@ -31,7 +31,7 @@ TEH_PG_do_recoup ( void *cls, const struct TALER_ReservePublicKeyP *reserve_pub, uint64_t reserve_out_serial_id, - const union TALER_DenominationBlindingKeyP *coin_bks, + const union GNUNET_CRYPTO_BlindingSecretP *coin_bks, const struct TALER_CoinSpendPublicKeyP *coin_pub, uint64_t known_coin_id, const struct TALER_CoinSpendSignatureP *coin_sig, diff --git a/src/exchangedb/pg_do_recoup.h b/src/exchangedb/pg_do_recoup.h index 07a350789..2cf3eb976 100644 --- a/src/exchangedb/pg_do_recoup.h +++ b/src/exchangedb/pg_do_recoup.h @@ -45,7 +45,7 @@ TEH_PG_do_recoup ( void *cls, const struct TALER_ReservePublicKeyP *reserve_pub, uint64_t reserve_out_serial_id, - const union TALER_DenominationBlindingKeyP *coin_bks, + const union GNUNET_CRYPTO_BlindingSecretP *coin_bks, const struct TALER_CoinSpendPublicKeyP *coin_pub, uint64_t known_coin_id, const struct TALER_CoinSpendSignatureP *coin_sig, diff --git a/src/exchangedb/pg_do_recoup_refresh.c b/src/exchangedb/pg_do_recoup_refresh.c index be5e4705d..7d099bcd5 100644 --- a/src/exchangedb/pg_do_recoup_refresh.c +++ b/src/exchangedb/pg_do_recoup_refresh.c @@ -30,7 +30,7 @@ TEH_PG_do_recoup_refresh ( void *cls, const struct TALER_CoinSpendPublicKeyP *old_coin_pub, uint64_t rrc_serial, - const union TALER_DenominationBlindingKeyP *coin_bks, + const union GNUNET_CRYPTO_BlindingSecretP *coin_bks, const struct TALER_CoinSpendPublicKeyP *coin_pub, uint64_t known_coin_id, const struct TALER_CoinSpendSignatureP *coin_sig, diff --git a/src/exchangedb/pg_do_recoup_refresh.h b/src/exchangedb/pg_do_recoup_refresh.h index fbd791d44..16b0fd208 100644 --- a/src/exchangedb/pg_do_recoup_refresh.h +++ b/src/exchangedb/pg_do_recoup_refresh.h @@ -46,7 +46,7 @@ TEH_PG_do_recoup_refresh ( void *cls, const struct TALER_CoinSpendPublicKeyP *old_coin_pub, uint64_t rrc_serial, - const union TALER_DenominationBlindingKeyP *coin_bks, + const union GNUNET_CRYPTO_BlindingSecretP *coin_bks, const struct TALER_CoinSpendPublicKeyP *coin_pub, uint64_t known_coin_id, const struct TALER_CoinSpendSignatureP *coin_sig, diff --git a/src/exchangedb/pg_get_link_data.c b/src/exchangedb/pg_get_link_data.c index 7fe6f996c..a110c491b 100644 --- a/src/exchangedb/pg_get_link_data.c +++ b/src/exchangedb/pg_get_link_data.c @@ -147,9 +147,10 @@ add_ldl (void *cls, ldctx->status = GNUNET_SYSERR; return; } - if (TALER_DENOMINATION_CS == bp.cipher) + if (GNUNET_CRYPTO_BSA_CS == bp.blinded_message->cipher) { - pos->nonce = bp.details.cs_blinded_planchet.nonce; + pos->nonce.cs_nonce + = bp.blinded_message->details.cs_blinded_message.nonce; pos->have_nonce = true; } TALER_blinded_planchet_free (&bp); diff --git a/src/exchangedb/pg_get_refresh_reveal.c b/src/exchangedb/pg_get_refresh_reveal.c index 07d632248..c0e3066d2 100644 --- a/src/exchangedb/pg_get_refresh_reveal.c +++ b/src/exchangedb/pg_get_refresh_reveal.c @@ -112,7 +112,8 @@ add_revealed_coins (void *cls, GNUNET_PQ_result_spec_end }; - if (TALER_DENOMINATION_INVALID != rrc->blinded_planchet.cipher) + if (NULL != + rrc->blinded_planchet.blinded_message) { /* duplicate offset, not allowed */ GNUNET_break (0); diff --git a/src/exchangedb/pg_select_recoup_above_serial_id.c b/src/exchangedb/pg_select_recoup_above_serial_id.c index 2ff30c7dc..5791ee500 100644 --- a/src/exchangedb/pg_select_recoup_above_serial_id.c +++ b/src/exchangedb/pg_select_recoup_above_serial_id.c @@ -76,7 +76,7 @@ recoup_serial_helper_cb (void *cls, struct TALER_ReservePublicKeyP reserve_pub; struct TALER_CoinPublicInfo coin; struct TALER_CoinSpendSignatureP coin_sig; - union TALER_DenominationBlindingKeyP coin_blind; + union GNUNET_CRYPTO_BlindingSecretP coin_blind; struct TALER_Amount amount; struct TALER_DenominationPublicKey denom_pub; struct TALER_BlindedCoinHashP h_blind_ev; diff --git a/src/exchangedb/pg_select_recoup_refresh_above_serial_id.c b/src/exchangedb/pg_select_recoup_refresh_above_serial_id.c index 22e09b46a..22f906738 100644 --- a/src/exchangedb/pg_select_recoup_refresh_above_serial_id.c +++ b/src/exchangedb/pg_select_recoup_refresh_above_serial_id.c @@ -76,7 +76,7 @@ recoup_refresh_serial_helper_cb (void *cls, struct TALER_CoinSpendPublicKeyP old_coin_pub; struct TALER_CoinPublicInfo coin; struct TALER_CoinSpendSignatureP coin_sig; - union TALER_DenominationBlindingKeyP coin_blind; + union GNUNET_CRYPTO_BlindingSecretP coin_blind; struct TALER_DenominationPublicKey denom_pub; struct TALER_DenominationHashP old_denom_pub_hash; struct TALER_Amount amount; diff --git a/src/exchangedb/test_exchangedb.c b/src/exchangedb/test_exchangedb.c index 336c14600..3c7c8f486 100644 --- a/src/exchangedb/test_exchangedb.c +++ b/src/exchangedb/test_exchangedb.c @@ -278,7 +278,7 @@ create_denom_key_pair (unsigned int size, GNUNET_assert (GNUNET_OK == TALER_denom_priv_create (&dkp->priv, &dkp->pub, - TALER_DENOMINATION_RSA, + GNUNET_CRYPTO_BSA_RSA, size)); /* Using memset() as fields like master key and signature are not properly initialized for this test. */ @@ -1092,9 +1092,9 @@ recoup_cb (void *cls, const struct TALER_CoinPublicInfo *coin, const struct TALER_DenominationPublicKey *denom_pub, const struct TALER_CoinSpendSignatureP *coin_sig, - const union TALER_DenominationBlindingKeyP *coin_blind) + const union GNUNET_CRYPTO_BlindingSecretP *coin_blind) { - const union TALER_DenominationBlindingKeyP *cb = cls; + const union GNUNET_CRYPTO_BlindingSecretP *cb = cls; (void) rowid; (void) timestamp; @@ -1177,7 +1177,7 @@ run (void *cls) struct GNUNET_CONFIGURATION_Handle *cfg = cls; struct TALER_CoinSpendSignatureP coin_sig; struct GNUNET_TIME_Timestamp deadline; - union TALER_DenominationBlindingKeyP coin_blind; + union GNUNET_CRYPTO_BlindingSecretP coin_blind; struct TALER_ReservePublicKeyP reserve_pub; struct TALER_ReservePublicKeyP reserve_pub2; struct TALER_ReservePublicKeyP reserve_pub3; @@ -1212,11 +1212,11 @@ run (void *cls) uint64_t reserve_out_serial_id; uint64_t melt_serial_id; struct TALER_PlanchetMasterSecretP ps; - union TALER_DenominationBlindingKeyP bks; + union GNUNET_CRYPTO_BlindingSecretP bks; struct TALER_ExchangeWithdrawValues alg_values = { /* RSA is simpler, and for the DB there is no real difference between CS and RSA, just one should be used, so we use RSA */ - .cipher = TALER_DENOMINATION_RSA + .cipher = GNUNET_CRYPTO_BSA_RSA }; memset (&deposit, @@ -1667,7 +1667,7 @@ run (void *cls) new_denom_pubs[cnt] = new_dkp[cnt]->pub; ccoin = &revealed_coins[cnt]; bp = &ccoin->blinded_planchet; - bp->cipher = TALER_DENOMINATION_RSA; + bp->cipher = GNUNET_CRYPTO_BSA_RSA; rp = &bp->details.rsa_blinded_planchet; rp->blinded_msg_size = 1 + (size_t) GNUNET_CRYPTO_random_u64 ( GNUNET_CRYPTO_QUALITY_WEAK, @@ -1759,7 +1759,7 @@ run (void *cls) { struct GNUNET_TIME_Timestamp recoup_timestamp = GNUNET_TIME_timestamp_get (); - union TALER_DenominationBlindingKeyP coin_bks; + union GNUNET_CRYPTO_BlindingSecretP coin_bks; uint64_t new_known_coin_id; struct TALER_CoinPublicInfo new_coin; struct TALER_DenominationHashP dph; |