exchange

Base system with REST service to issue digital coins, run by the payment service provider
Log | Files | Refs | Submodules | README | LICENSE

commit 548ebf45aef4a22ce652ff87ac4526c2a93091d0
parent 6bae1938e96164364c177b13d4f6e7d39d9e378a
Author: Martin Schanzenbach <schanzen@gnunet.org>
Date:   Tue, 16 Jun 2026 15:45:37 +0200

migrate to new gnunet random API

Diffstat:
Mflake.lock | 18+++++++++---------
Mflake.nix | 2+-
Msrc/auditordb/test_auditordb.c | 4++--
Msrc/auditordb/test_auditordb_checkpoints.c | 2+-
Msrc/bank-lib/bank_api_transfer.c | 4++--
Msrc/bank-lib/fakebank_bank_post_accounts_withdrawals.c | 3+--
Msrc/bank-lib/fakebank_common_transact.c | 4++--
Msrc/bank-lib/taler-exchange-wire-gateway-client.c | 6++----
Msrc/benchmark/taler-aggregator-benchmark.c | 17++++++-----------
Msrc/benchmark/taler-exchange-benchmark.c | 3+--
Msrc/exchange-tools/taler-exchange-offline.c | 6+-----
Msrc/exchange/taler-exchange-aggregator.c | 3+--
Msrc/exchange/taler-exchange-httpd.c | 3+--
Msrc/exchange/taler-exchange-httpd_post-melt.c | 3+--
Msrc/exchange/taler-exchange-httpd_post-withdraw.c | 4+---
Msrc/exchange/taler-exchange-transfer.c | 1-
Msrc/exchange/taler-exchange-wirewatch.c | 1-
Msrc/exchangedb/bench_db.c | 13+++++--------
Msrc/exchangedb/test_exchangedb.c | 9+++------
Msrc/exchangedb/test_exchangedb_by_j.c | 4++--
Msrc/json/json.c | 6++----
Msrc/kyclogic/plugin_kyclogic_persona.c | 3+--
Msrc/kyclogic/taler-exchange-kyc-tester.c | 3+--
Msrc/lib/exchange_api_post-batch-deposit.c | 3+--
Msrc/pq/test_pq.c | 3+--
Msrc/testing/testing_api_cmd_age_withdraw.c | 3+--
Msrc/testing/testing_api_cmd_batch_withdraw.c | 3+--
Msrc/testing/testing_api_cmd_insert_deposit.c | 7+++----
Msrc/util/bench_age_restriction.c | 12++++--------
Msrc/util/crypto.c | 9+++------
Msrc/util/crypto_contract.c | 9+++------
Msrc/util/test_age_restriction.c | 6++----
Msrc/util/test_crypto.c | 15+++++----------
Msrc/util/test_helper_cs.c | 15+++++----------
Msrc/util/test_helper_eddsa.c | 3+--
Msrc/util/test_helper_rsa.c | 24++++++++----------------
Msrc/util/tokens.c | 3+--
Msrc/util/tv_age_restriction.c | 6++----
38 files changed, 87 insertions(+), 156 deletions(-)

diff --git a/flake.lock b/flake.lock @@ -6,33 +6,33 @@ "systems": "systems" }, "locked": { - "lastModified": 1774899416, - "narHash": "sha256-YcGma1gX/t76xDv9DW71nKkWFhzXYz3NkN/WEceHbZM=", + "lastModified": 1781611204, + "narHash": "sha256-4uCu+3Cdi1ck9J7LT72INcrm3coIkP7Gh9k0COAr91g=", "ref": "refs/heads/master", - "rev": "7c6b613e37e301b0e81fb94af5878d00c98e5b75", - "revCount": 33194, + "rev": "e8e7504b7ab43f7dffa25f273ff228069d8d6dd4", + "revCount": 33248, "submodules": true, "type": "git", "url": "https://git.gnunet.org/gnunet" }, "original": { - "rev": "7c6b613e37e301b0e81fb94af5878d00c98e5b75", + "rev": "e8e7504b7ab43f7dffa25f273ff228069d8d6dd4", "type": "git", "url": "https://git.gnunet.org/gnunet" } }, "nixpkgs": { "locked": { - "lastModified": 1774799055, - "narHash": "sha256-Tsq9BCz0q47ej1uFF39m4tuhcwru/ls6vCCJzutEpaw=", + "lastModified": 1780734595, + "narHash": "sha256-DmTfP92QFYRLOGXlMIE54MAgxSJjDWocl3gRNOu72Os=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "107cba9eb4a8d8c9f8e9e61266d78d340867913a", + "rev": "9b696460ac78b5ccfc17c854d8c976f20456e943", "type": "github" }, "original": { "id": "nixpkgs", - "ref": "release-25.11", + "ref": "release-26.05", "type": "indirect" } }, diff --git a/flake.nix b/flake.nix @@ -2,7 +2,7 @@ inputs = { nixpkgs.url = "nixpkgs/release-25.11"; systems.url = "github:nix-systems/default"; - gnunet.url = "git+https://git.gnunet.org/gnunet?rev=7c6b613e37e301b0e81fb94af5878d00c98e5b75"; + gnunet.url = "git+https://git.gnunet.org/gnunet?rev=e8e7504b7ab43f7dffa25f273ff228069d8d6dd4"; self.submodules = true; }; diff --git a/src/auditordb/test_auditordb.c b/src/auditordb/test_auditordb.c @@ -59,8 +59,8 @@ * Initializes @a ptr with random data. */ #define RND_BLK(ptr) \ - GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, ptr, sizeof (* \ - ptr)) + GNUNET_CRYPTO_random_block (ptr, sizeof (* \ + ptr)) /** * Initializes @a ptr with zeros. diff --git a/src/auditordb/test_auditordb_checkpoints.c b/src/auditordb/test_auditordb_checkpoints.c @@ -52,7 +52,7 @@ * Initializes @a ptr with random data. */ #define RND_BLK(ptr) \ - GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, ptr, \ + GNUNET_CRYPTO_random_block (ptr, \ sizeof (*ptr)) /** diff --git a/src/bank-lib/bank_api_transfer.c b/src/bank-lib/bank_api_transfer.c @@ -96,8 +96,8 @@ TALER_BANK_prepare_transfer ( } *buf_size = sizeof (*wp) + d_len + u_len + x_len; wp = GNUNET_malloc (*buf_size); - GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_NONCE, - &wp->request_uid); + GNUNET_CRYPTO_random_block (&wp->request_uid, + sizeof wp->request_uid); TALER_amount_hton (&wp->amount, amount); wp->wtid = *wtid; diff --git a/src/bank-lib/fakebank_bank_post_accounts_withdrawals.c b/src/bank-lib/fakebank_bank_post_accounts_withdrawals.c @@ -79,8 +79,7 @@ do_post_account_withdrawals ( } while (1) { - GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_NONCE, - &wo->wopid, + GNUNET_CRYPTO_random_block (&wo->wopid, sizeof (wo->wopid)); if (GNUNET_OK == GNUNET_CONTAINER_multishortmap_put (h->wops, diff --git a/src/bank-lib/fakebank_common_transact.c b/src/bank-lib/fakebank_common_transact.c @@ -229,8 +229,8 @@ TALER_FAKEBANK_make_transfer_ ( url_len); t->subject.debit.wtid = *subject; if (NULL == request_uid) - GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_NONCE, - &t->request_uid); + GNUNET_CRYPTO_random_block (&t->request_uid, + sizeof t->request_uid); else t->request_uid = *request_uid; TALER_FAKEBANK_transact_ (h, diff --git a/src/bank-lib/taler-exchange-wire-gateway-client.c b/src/bank-lib/taler-exchange-wire-gateway-client.c @@ -457,8 +457,7 @@ execute_wire_transfer (void) else { /* pick one at random */ - GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_NONCE, - &wtid, + GNUNET_CRYPTO_random_block (&wtid, sizeof (wtid)); } params = strchr (credit_account.full_payto, @@ -548,8 +547,7 @@ execute_admin_transfer (void) else { /* pick one that is kind-of well-formed at random */ - GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_NONCE, - &reserve_pub, + GNUNET_CRYPTO_random_block (&reserve_pub, sizeof (reserve_pub)); } op = TALER_BANK_admin_add_incoming (ctx, diff --git a/src/benchmark/taler-aggregator-benchmark.c b/src/benchmark/taler-aggregator-benchmark.c @@ -114,8 +114,7 @@ eval_probability (float probability) uint64_t random; float random_01; - random = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, - UINT64_MAX); + random = GNUNET_CRYPTO_random_u64 (UINT64_MAX); random_01 = (double) random / (double) UINT64_MAX; return (random_01 <= probability) ? GNUNET_OK : GNUNET_NO; } @@ -127,7 +126,7 @@ eval_probability (float probability) * @param x pointer to data to randomize */ #define RANDOMIZE(x) \ - GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_NONCE, x, sizeof (*x)) + GNUNET_CRYPTO_random_block (x, sizeof (*x)) /** @@ -163,8 +162,7 @@ random_time (void) struct GNUNET_TIME_Absolute ret; delta = end.abs_time.abs_value_us - start.abs_time.abs_value_us; - delta = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_NONCE, - delta); + delta = GNUNET_CRYPTO_random_u64 (delta); ret.abs_value_us = start.abs_time.abs_value_us + delta; return GNUNET_TIME_absolute_to_timestamp (ret); } @@ -381,10 +379,8 @@ work (void *cls) (void) cls; task = NULL; - rnd1 = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_NONCE, - UINT64_MAX); - rnd2 = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_NONCE, - UINT64_MAX); + rnd1 = GNUNET_CRYPTO_random_u64 (UINT64_MAX); + rnd2 = GNUNET_CRYPTO_random_u64 (UINT64_MAX); GNUNET_asprintf (&m.payto_uri.full_payto, "payto://x-taler-bank/localhost:8082/account-%llX-%llX", (unsigned long long) rnd1, @@ -550,8 +546,7 @@ run (void *cls, }; struct TALER_AgeCommitmentProof acp = {0}; - GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, - &seed, + GNUNET_CRYPTO_random_block (&seed, sizeof(seed)); TALER_age_restriction_commit (&mask, 13, diff --git a/src/benchmark/taler-exchange-benchmark.c b/src/benchmark/taler-exchange-benchmark.c @@ -181,8 +181,7 @@ eval_probability (float probability) uint64_t random; float random_01; - random = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, - UINT64_MAX); + random = GNUNET_CRYPTO_random_u64 (UINT64_MAX); random_01 = (double) random / (double) UINT64_MAX; return (random_01 <= probability) ? GNUNET_OK : GNUNET_NO; } diff --git a/src/exchange-tools/taler-exchange-offline.c b/src/exchange-tools/taler-exchange-offline.c @@ -2263,7 +2263,6 @@ upload_keys (const char *exchange_url, } - /** * Function called with information about the add partner operation. * @@ -3629,8 +3628,7 @@ do_drain (char *const *args) if (GNUNET_OK != load_offline_key (GNUNET_NO)) return; - GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_NONCE, - &wtid, + GNUNET_CRYPTO_random_block (&wtid, sizeof (wtid)); date = GNUNET_TIME_timestamp_get (); TALER_exchange_offline_profit_drain_sign (&wtid, @@ -5094,7 +5092,6 @@ do_setup (char *const *args) } - /** * Dispatch @a args in the @a cmds array. * @@ -5140,7 +5137,6 @@ cmd_handler (char *const *args, } - static void work (void *cls) { diff --git a/src/exchange/taler-exchange-aggregator.c b/src/exchange/taler-exchange-aggregator.c @@ -1093,8 +1093,7 @@ do_aggregate (struct AggregationUnit *au) rollback_aggregation (au); return; case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: - GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_NONCE, - &au->wtid, + GNUNET_CRYPTO_random_block (&au->wtid, sizeof (au->wtid)); GNUNET_log (GNUNET_ERROR_TYPE_INFO, "No transient aggregation found, starting %s\n", diff --git a/src/exchange/taler-exchange-httpd.c b/src/exchange/taler-exchange-httpd.c @@ -1234,8 +1234,7 @@ handler_seed (struct TEH_RequestContext *rc, body = malloc (SEED_SIZE); /* must use malloc(), because MHD will use free() */ if (NULL == body) return MHD_NO; - GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_NONCE, - body, + GNUNET_CRYPTO_random_block (body, SEED_SIZE); resp = MHD_create_response_from_buffer (SEED_SIZE, body, diff --git a/src/exchange/taler-exchange-httpd_post-melt.c b/src/exchange/taler-exchange-httpd_post-melt.c @@ -1136,8 +1136,7 @@ phase_prepare_transaction ( mc->request.refresh.num_coins, struct TALER_BlindedDenominationSignature); mc->request.refresh.noreveal_index = - GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_STRONG, - TALER_CNC_KAPPA); + GNUNET_CRYPTO_random_u32 (TALER_CNC_KAPPA); /* Choose and sign the coins */ { diff --git a/src/exchange/taler-exchange-httpd_post-withdraw.c b/src/exchange/taler-exchange-httpd_post-withdraw.c @@ -571,9 +571,7 @@ phase_prepare_transaction ( if (wc->request.withdraw.age_proof_required) { wc->request.withdraw.noreveal_index = - GNUNET_CRYPTO_random_u32 ( - GNUNET_CRYPTO_QUALITY_STRONG, - TALER_CNC_KAPPA); + GNUNET_CRYPTO_random_u32 (TALER_CNC_KAPPA); /** * In case of age restriction, we use the corresponding offset in the planchet * array to the beginning of the coins corresponding to the noreveal_index. diff --git a/src/exchange/taler-exchange-transfer.c b/src/exchange/taler-exchange-transfer.c @@ -765,7 +765,6 @@ select_shard (void *cls) delay = GNUNET_TIME_UNIT_ZERO; else delay.rel_value_us = GNUNET_CRYPTO_random_u64 ( - GNUNET_CRYPTO_QUALITY_WEAK, 4 * GNUNET_TIME_relative_max ( transfer_idle_sleep_interval, GNUNET_TIME_relative_multiply (shard_delay, diff --git a/src/exchange/taler-exchange-wirewatch.c b/src/exchange/taler-exchange-wirewatch.c @@ -945,7 +945,6 @@ lock_shard (void *cls) delay = GNUNET_TIME_UNIT_ZERO; else delay.rel_value_us = GNUNET_CRYPTO_random_u64 ( - GNUNET_CRYPTO_QUALITY_WEAK, 4 * GNUNET_TIME_relative_max ( wirewatch_idle_sleep_interval, GNUNET_TIME_relative_multiply (shard_delay, diff --git a/src/exchangedb/bench_db.c b/src/exchangedb/bench_db.c @@ -38,8 +38,8 @@ static int result; * Initializes @a ptr with random data. */ #define RND_BLK(ptr) \ - GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, ptr, sizeof (* \ - ptr)) + GNUNET_CRYPTO_random_block (ptr, sizeof (* \ + ptr)) static bool @@ -379,8 +379,7 @@ run (void *cls) { uint32_t j; - j = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE, - TOTAL); + j = GNUNET_CRYPTO_random_u32 (TOTAL); if (! bm_select ((0 == f) ? conn2 : conn, j)) { @@ -422,8 +421,7 @@ run (void *cls) { uint32_t j; - j = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE, - TOTAL); + j = GNUNET_CRYPTO_random_u32 (TOTAL); if (! bhm_select ((0 == f) ? conn2 : conn, j)) { @@ -465,8 +463,7 @@ run (void *cls) { uint32_t j; - j = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE, - TOTAL); + j = GNUNET_CRYPTO_random_u32 (TOTAL); if (! bem_select ((0 == f) ? conn2 : conn, j)) { diff --git a/src/exchangedb/test_exchangedb.c b/src/exchangedb/test_exchangedb.c @@ -105,7 +105,7 @@ static int result; * Initializes @a ptr with random data. */ #define RND_BLK(ptr) \ - GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, ptr, \ + GNUNET_CRYPTO_random_block (ptr, \ sizeof (*ptr)) /** @@ -888,8 +888,7 @@ test_wire_fees (void) GNUNET_assert (GNUNET_OK == TALER_string_to_amount (CURRENCY ":2.424242", &fees.closing)); - GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, - &master_sig, + GNUNET_CRYPTO_random_block (&master_sig, sizeof (master_sig)); if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != plugin->insert_wire_fee (plugin->cls, @@ -1852,11 +1851,9 @@ run (struct TALER_EXCHANGEDB_PostgresContext *pg) rp->rc = 1; rsa = &rp->details.rsa_blinded_message; rsa->blinded_msg_size = 1 + (size_t) GNUNET_CRYPTO_random_u64 ( - GNUNET_CRYPTO_QUALITY_WEAK, (RSA_KEY_SIZE / 8) - 1); rsa->blinded_msg = GNUNET_malloc (rsa->blinded_msg_size); - GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, - rsa->blinded_msg, + GNUNET_CRYPTO_random_block (rsa->blinded_msg, rsa->blinded_msg_size); TALER_denom_pub_hash (&new_dkp[cnt]->pub, &ccoin->h_denom_pub); diff --git a/src/exchangedb/test_exchangedb_by_j.c b/src/exchangedb/test_exchangedb_by_j.c @@ -44,8 +44,8 @@ static int result; * Initializes @a ptr with random data. */ #define RND_BLK(ptr) \ - GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, ptr, sizeof (* \ - ptr)) + GNUNET_CRYPTO_random_block (ptr, sizeof (* \ + ptr)) /** * Initializes @a ptr with zeros. diff --git a/src/json/json.c b/src/json/json.c @@ -394,8 +394,7 @@ TALER_JSON_contract_mark_forgettable (json_t *json, } } - GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_NONCE, - &salt, + GNUNET_CRYPTO_random_block (&salt, sizeof (salt)); if (0 != json_object_set_new (fg, @@ -554,8 +553,7 @@ seed_forgettable (json_t *f) { struct GNUNET_ShortHashCode sh; - GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_NONCE, - &sh, + GNUNET_CRYPTO_random_block (&sh, sizeof (sh)); if (0 != json_object_set_new (f, diff --git a/src/kyclogic/plugin_kyclogic_persona.c b/src/kyclogic/plugin_kyclogic_persona.c @@ -437,8 +437,7 @@ persona_load_configuration (void *cls, { uint32_t salt[8]; - GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_NONCE, - salt, + GNUNET_CRYPTO_random_block (salt, sizeof (salt)); pd->salt = GNUNET_STRINGS_data_to_string_alloc (salt, sizeof (salt)); diff --git a/src/kyclogic/taler-exchange-kyc-tester.c b/src/kyclogic/taler-exchange-kyc-tester.c @@ -1876,8 +1876,7 @@ main (int argc, }; enum GNUNET_GenericReturnValue ret; - GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_NONCE, - &cmd_line_h_payto, + GNUNET_CRYPTO_random_block (&cmd_line_h_payto, sizeof (cmd_line_h_payto)); ret = GNUNET_PROGRAM_run (TALER_EXCHANGE_project_data (), argc, argv, diff --git a/src/lib/exchange_api_post-batch-deposit.c b/src/lib/exchange_api_post-batch-deposit.c @@ -283,8 +283,7 @@ auditor_cb (void *cls, } if (0 != - GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, - dh->auditor_chance)) + GNUNET_CRYPTO_random_u32 (dh->auditor_chance)) { GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Not providing deposit confirmation to auditor\n"); diff --git a/src/pq/test_pq.c b/src/pq/test_pq.c @@ -123,8 +123,7 @@ run_queries (struct GNUNET_PQ_Context *conn) json_object_set_new (json, "foo", json_integer (42))); - GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, - in_cs_r_pubs, + GNUNET_CRYPTO_random_block (in_cs_r_pubs, sizeof(struct GNUNET_CRYPTO_CSPublicRPairP) * 5); { struct GNUNET_PQ_QueryParam params_insert[] = { diff --git a/src/testing/testing_api_cmd_age_withdraw.c b/src/testing/testing_api_cmd_age_withdraw.c @@ -294,8 +294,7 @@ age_withdraw_run ( aws->denoms_pub = GNUNET_new_array (aws->num_coins, struct TALER_EXCHANGE_DenomPublicKey); - GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, - &aws->seed, + GNUNET_CRYPTO_random_block (&aws->seed, sizeof(aws->seed)); for (unsigned int i = 0; i<aws->num_coins; i++) diff --git a/src/testing/testing_api_cmd_batch_withdraw.c b/src/testing/testing_api_cmd_batch_withdraw.c @@ -282,8 +282,7 @@ batch_withdraw_run (void *cls, = TALER_reserve_make_payto (ws->exchange_url, &ws->reserve_pub); - GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, - &ws->seed, + GNUNET_CRYPTO_random_block (&ws->seed, sizeof(ws->seed)); /** diff --git a/src/testing/testing_api_cmd_insert_deposit.c b/src/testing/testing_api_cmd_insert_deposit.c @@ -215,8 +215,8 @@ insert_deposit_run (void *cls, strlen (ids->merchant_name))); GNUNET_CRYPTO_eddsa_key_get_public (&merchant_priv.eddsa_priv, &bd.merchant_pub.eddsa_pub); - GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK, - &bd.h_contract_terms.hash); + GNUNET_CRYPTO_random_block (&bd.h_contract_terms.hash, + sizeof bd.h_contract_terms.hash); if (GNUNET_OK != TALER_string_to_amount (ids->amount_with_fee, &deposit.amount_with_fee)) @@ -229,8 +229,7 @@ insert_deposit_run (void *cls, TALER_denom_pub_hash (&dpk, &deposit.coin.denom_pub_hash); - GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, - &deposit.coin.coin_pub, + GNUNET_CRYPTO_random_block (&deposit.coin.coin_pub, sizeof (deposit.coin.coin_pub)); { struct TALER_CoinPubHashP c_hash; diff --git a/src/util/bench_age_restriction.c b/src/util/bench_age_restriction.c @@ -125,8 +125,7 @@ main (int argc, for (; i < ITER; i++) { starttime; - GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, - &seed, + GNUNET_CRYPTO_random_block (&seed, sizeof(seed)); ret = TALER_age_restriction_commit (&age_mask, @@ -141,8 +140,7 @@ main (int argc, // attest for (; i < ITER; i++) { - GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, - &seed, + GNUNET_CRYPTO_random_block (&seed, sizeof(seed)); ret = TALER_age_restriction_commit (&age_mask, @@ -163,8 +161,7 @@ main (int argc, // verify for (; i < ITER; i++) { - GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, - &seed, + GNUNET_CRYPTO_random_block (&seed, sizeof(seed)); ret = TALER_age_restriction_commit (&age_mask, @@ -190,8 +187,7 @@ main (int argc, for (; i < ITER; i++) { struct TALER_AgeCommitmentProof acp2 = {0}; - GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, - &seed, + GNUNET_CRYPTO_random_block (&seed, sizeof(seed)); starttime; TALER_age_commitment_derive (&acp, diff --git a/src/util/crypto.c b/src/util/crypto.c @@ -201,8 +201,7 @@ void TALER_planchet_master_setup_random ( struct TALER_PlanchetMasterSecretP *ps) { - GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_STRONG, - ps, + GNUNET_CRYPTO_random_block (ps, sizeof (*ps)); } @@ -211,8 +210,7 @@ void TALER_withdraw_master_seed_setup_random ( struct TALER_WithdrawMasterSeedP *seed) { - GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_STRONG, - seed, + GNUNET_CRYPTO_random_block (seed, sizeof (*seed)); } @@ -221,8 +219,7 @@ void TALER_refresh_master_setup_random ( struct TALER_PublicRefreshMasterSeedP *rms) { - GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_STRONG, - rms, + GNUNET_CRYPTO_random_block (rms, sizeof (*rms)); } diff --git a/src/util/crypto_contract.c b/src/util/crypto_contract.c @@ -274,8 +274,7 @@ TALER_CRYPTO_contract_encrypt_for_merge ( xbuf, cbuf_size); GNUNET_free (xbuf); - GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_NONCE, - &nonce, + GNUNET_CRYPTO_random_block (&nonce, sizeof (nonce)); blob_encrypt (&nonce, &key, @@ -423,8 +422,7 @@ TALER_CRYPTO_contract_encrypt_for_deposit ( xbuf, cbuf_size); GNUNET_free (xbuf); - GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_NONCE, - &nonce, + GNUNET_CRYPTO_random_block (&nonce, sizeof (nonce)); blob_encrypt (&nonce, &key, @@ -577,8 +575,7 @@ TALER_CRYPTO_kyc_attributes_encrypt ( clen); GNUNET_assert (Z_OK == ret); free (cstr); - GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_NONCE, - &nonce, + GNUNET_CRYPTO_random_block (&nonce, sizeof (nonce)); blob_encrypt (&nonce, key, diff --git a/src/util/test_age_restriction.c b/src/util/test_age_restriction.c @@ -317,8 +317,7 @@ test_attestation (void) uint8_t age_group = TALER_get_age_group (&age_mask, age); struct GNUNET_HashCode seed; - GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, - &seed, + GNUNET_CRYPTO_random_block (&seed, sizeof(seed)); TALER_age_restriction_commit (&age_mask, age, @@ -334,8 +333,7 @@ test_attestation (void) for (uint8_t i = 0; i<2; i++) { struct GNUNET_HashCode salt; - GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, - &salt, + GNUNET_CRYPTO_random_block (&salt, sizeof (salt)); GNUNET_assert (GNUNET_OK == TALER_age_commitment_proof_derive (&acp[i], diff --git a/src/util/test_crypto.c b/src/util/test_crypto.c @@ -137,8 +137,7 @@ test_planchets_rsa (uint8_t age) struct TALER_AgeCommitmentProof acp; struct GNUNET_HashCode seed; - GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, - &seed, + GNUNET_CRYPTO_random_block (seed, sizeof(seed)); TALER_age_restriction_commit (&age_mask, age, @@ -150,8 +149,7 @@ test_planchets_rsa (uint8_t age) TALER_age_commitment_proof_free (&acp); } - GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_STRONG, - &ps, + GNUNET_CRYPTO_random_block (&ps, sizeof (ps)); GNUNET_log_skip (1, GNUNET_YES); GNUNET_assert (GNUNET_SYSERR == @@ -235,8 +233,7 @@ test_planchets_cs (uint8_t age) struct TALER_AgeCommitmentProof acp; struct GNUNET_HashCode seed; - GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, - &seed, + GNUNET_CRYPTO_random_block (&seed, sizeof(seed)); TALER_age_restriction_commit (&age_mask, age, @@ -248,8 +245,7 @@ test_planchets_cs (uint8_t age) TALER_age_commitment_proof_free (&acp); } - GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_STRONG, - &ps, + GNUNET_CRYPTO_random_block (&ps, sizeof (ps)); GNUNET_assert (GNUNET_OK == TALER_denom_priv_create (&dk_priv, @@ -507,8 +503,7 @@ test_attributes (void) size_t eattr_size; json_t *c; - GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_NONCE, - &key, + GNUNET_CRYPTO_random_block (&key, sizeof (key)); c = json_pack ("{s:s}", "test", "value"); GNUNET_assert (NULL != c); diff --git a/src/util/test_helper_cs.c b/src/util/test_helper_cs.c @@ -213,8 +213,7 @@ test_revocation (struct TALER_CRYPTO_CsDenominationHelper *dh) { uint32_t off; - off = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, - num_keys); + off = GNUNET_CRYPTO_random_u32 (num_keys); /* find index of key to revoke */ for (unsigned int j = 0; j < MAX_KEYS; j++) { @@ -393,11 +392,9 @@ test_r_derive (struct TALER_CRYPTO_CsDenominationHelper *dh) .nonce = &nonce.cs_nonce, }; - GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, - &rnd, + GNUNET_CRYPTO_random_block (&rnd, sizeof (rnd)); - GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, - &nonce, + GNUNET_CRYPTO_random_block (&nonce, sizeof (nonce)); ec = TALER_CRYPTO_helper_cs_r_batch_derive (dh, 1, @@ -579,8 +576,7 @@ test_signing (struct TALER_CRYPTO_CsDenominationHelper *dh) struct TALER_CsPubHashP rnd; struct TALER_CRYPTO_CsSignRequest csr; - GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, - &rnd, + GNUNET_CRYPTO_random_block (&rnd, sizeof (rnd)); GNUNET_assert (GNUNET_YES == TALER_planchet_prepare (&keys[0].denom_pub, @@ -799,8 +795,7 @@ test_batch_signing (struct TALER_CRYPTO_CsDenominationHelper *dh, struct TALER_CsPubHashP rnd; struct TALER_CRYPTO_CsSignRequest csr; - GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, - &rnd, + GNUNET_CRYPTO_random_block (&rnd, sizeof (rnd)); GNUNET_assert (GNUNET_YES == TALER_planchet_prepare (&keys[0].denom_pub, diff --git a/src/util/test_helper_eddsa.c b/src/util/test_helper_eddsa.c @@ -183,8 +183,7 @@ test_revocation (struct TALER_CRYPTO_ExchangeSignHelper *esh) { uint32_t off; - off = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, - num_keys); + off = GNUNET_CRYPTO_random_u32 (num_keys); /* find index of key to revoke */ for (unsigned int j = 0; j < MAX_KEYS; j++) { diff --git a/src/util/test_helper_rsa.c b/src/util/test_helper_rsa.c @@ -213,8 +213,7 @@ test_revocation (struct TALER_CRYPTO_RsaDenominationHelper *dh) { uint32_t off; - off = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, - num_keys); + off = GNUNET_CRYPTO_random_u32 (num_keys); /* find index of key to revoke */ for (unsigned int j = 0; j < MAX_KEYS; j++) { @@ -275,8 +274,7 @@ test_signing (struct TALER_CRYPTO_RsaDenominationHelper *dh) struct TALER_CoinSpendPrivateKeyP coin_priv; union GNUNET_CRYPTO_BlindingSecretP bks; - GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_STRONG, - &ps, + GNUNET_CRYPTO_random_block (&ps, sizeof (ps)); TALER_planchet_setup_coin_priv (&ps, alg_values, @@ -284,8 +282,7 @@ test_signing (struct TALER_CRYPTO_RsaDenominationHelper *dh) TALER_planchet_blinding_secret_create (&ps, alg_values, &bks); - GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, - &ach, + GNUNET_CRYPTO_random_block (&ach, sizeof(ach)); for (unsigned int i = 0; i<MAX_KEYS; i++) @@ -425,8 +422,7 @@ test_signing (struct TALER_CRYPTO_RsaDenominationHelper *dh) .msg_size = strlen ("Hello") }; - GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, - &rnd, + GNUNET_CRYPTO_random_block (&rnd, sizeof (rnd)); ec = TALER_CRYPTO_helper_rsa_batch_sign (dh, 1, @@ -470,11 +466,9 @@ test_batch_signing (struct TALER_CRYPTO_RsaDenominationHelper *dh, struct TALER_CoinSpendPrivateKeyP coin_priv[batch_size]; union GNUNET_CRYPTO_BlindingSecretP bks[batch_size]; - GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_STRONG, - &ps, + GNUNET_CRYPTO_random_block (&ps, sizeof (ps)); - GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, - &ach, + GNUNET_CRYPTO_random_block (&ach, sizeof(ach)); alg_values = TALER_denom_ewv_rsa_singleton (); for (unsigned int i = 0; i<batch_size; i++) @@ -643,8 +637,7 @@ test_batch_signing (struct TALER_CRYPTO_RsaDenominationHelper *dh, .msg_size = strlen ("Hello") }; - GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, - &rnd, + GNUNET_CRYPTO_random_block (&rnd, sizeof (rnd)); ec = TALER_CRYPTO_helper_rsa_batch_sign (dh, 1, @@ -695,8 +688,7 @@ perf_signing (struct TALER_CRYPTO_RsaDenominationHelper *dh, TALER_planchet_blinding_secret_create (&ps, alg_values, &bks); - GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, - &ach, + GNUNET_CRYPTO_random_block (&ach, sizeof(ach)); duration = GNUNET_TIME_UNIT_ZERO; TALER_CRYPTO_helper_rsa_poll (dh); diff --git a/src/util/tokens.c b/src/util/tokens.c @@ -47,8 +47,7 @@ TALER_blinded_issue_sig_free ( void TALER_token_use_setup_random (struct TALER_TokenUseMasterSecretP *master) { - GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_STRONG, - master, + GNUNET_CRYPTO_random_block (master, sizeof (*master)); } diff --git a/src/util/tv_age_restriction.c b/src/util/tv_age_restriction.c @@ -152,8 +152,7 @@ generate ( uint8_t age_group = get_age_group (mask, age); struct GNUNET_HashCode seed; - GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, - &seed, + GNUNET_CRYPTO_random_block (&seed, sizeof(seed)); json_object_set (j_top, @@ -171,8 +170,7 @@ generate ( for (uint8_t i = 0; i<2; i++) { struct GNUNET_HashCode salt; - GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, - &salt, + GNUNET_CRYPTO_random_block (&salt, sizeof (salt)); GNUNET_assert (GNUNET_OK == TALER_age_commitment_derive (&acp[i],