diff options
author | Christian Grothoff <christian@grothoff.org> | 2021-11-02 10:17:57 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2021-11-02 10:17:57 +0100 |
commit | 2a8855b5000b8247c927cb33fcc7c53229fffa44 (patch) | |
tree | 4ab12818410190ae2f23765639f00e2f8f41bccc /src/backenddb | |
parent | c9c8caea1a716d7246853e69b0148ffa3bee696d (diff) | |
download | merchant-2a8855b5000b8247c927cb33fcc7c53229fffa44.tar.gz merchant-2a8855b5000b8247c927cb33fcc7c53229fffa44.tar.bz2 merchant-2a8855b5000b8247c927cb33fcc7c53229fffa44.zip |
-fix FTBFS
Diffstat (limited to 'src/backenddb')
-rw-r--r-- | src/backenddb/test_merchantdb.c | 98 |
1 files changed, 53 insertions, 45 deletions
diff --git a/src/backenddb/test_merchantdb.c b/src/backenddb/test_merchantdb.c index 473a3f62..fc7423bd 100644 --- a/src/backenddb/test_merchantdb.c +++ b/src/backenddb/test_merchantdb.c @@ -150,7 +150,7 @@ static void make_account (struct TALER_MERCHANTDB_AccountDetails *account) { GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_STRONG, - &account->h_wire); + &account->h_wire.hash); GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_STRONG, &account->salt, sizeof (account->salt)); @@ -1751,7 +1751,8 @@ test_mark_contract_paid (const struct InstanceData *instance, const struct OrderData *order, enum GNUNET_DB_QueryStatus expected_result) { - struct GNUNET_HashCode h_contract_terms; + struct TALER_PrivateContractHash h_contract_terms; + GNUNET_assert (GNUNET_OK == TALER_JSON_contract_hash (order->contract, &h_contract_terms)); @@ -1778,9 +1779,10 @@ test_lookup_order_status (const struct InstanceData *instance, const struct OrderData *order, bool expected_paid) { - struct GNUNET_HashCode h_contract_terms_expected; - struct GNUNET_HashCode h_contract_terms; + struct TALER_PrivateContractHash h_contract_terms_expected; + struct TALER_PrivateContractHash h_contract_terms; bool order_paid = false; + if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != plugin->lookup_order_status (plugin->cls, instance->instance.id, @@ -2096,8 +2098,9 @@ run_test_orders (struct TestOrders_Closure *cls) &cls->orders[0], false)); { - struct GNUNET_HashCode h_contract_terms; + struct TALER_PrivateContractHash h_contract_terms; bool order_paid = false; + if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS != plugin->lookup_order_status (plugin->cls, cls->instance.instance.id, @@ -2128,8 +2131,9 @@ run_test_orders (struct TestOrders_Closure *cls) } /* Test lookup order status fails for nonexistent order */ { - struct GNUNET_HashCode h_contract_terms; + struct TALER_PrivateContractHash h_contract_terms; bool order_paid; + if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS != plugin->lookup_order_status (plugin->cls, cls->instance.instance.id, @@ -2364,7 +2368,7 @@ struct DepositData /** * Hash of the associated order's contract terms. */ - struct GNUNET_HashCode h_contract_terms; + struct TALER_PrivateContractHash h_contract_terms; /** * Public key of the coin that has been deposited. @@ -2399,7 +2403,7 @@ struct DepositData /** * Hash of the wire details. */ - struct GNUNET_HashCode h_wire; + struct TALER_MerchantWireHash h_wire; /** * Signature the exchange made on this deposit. @@ -2631,7 +2635,7 @@ lookup_deposits_cb (void *cls, */ static int test_lookup_deposits (const struct InstanceData *instance, - const struct GNUNET_HashCode *h_contract_terms, + const struct TALER_PrivateContractHash *h_contract_terms, unsigned int deposits_length, const struct DepositData *deposits) { @@ -2695,7 +2699,7 @@ lookup_deposits_contract_coin_cb ( const struct TALER_Amount *deposit_fee, const struct TALER_Amount *refund_fee, const struct TALER_Amount *wire_fee, - const struct GNUNET_HashCode *h_wire, + const struct TALER_MerchantWireHash *h_wire, struct GNUNET_TIME_Absolute deposit_timestamp, struct GNUNET_TIME_Absolute refund_deadline, const struct TALER_ExchangeSignatureP *exchange_sig, @@ -2756,7 +2760,7 @@ lookup_deposits_contract_coin_cb ( static int test_lookup_deposits_contract_and_coin ( const struct InstanceData *instance, - const struct GNUNET_HashCode *h_contract, + const struct TALER_PrivateContractHash *h_contract, const struct TALER_CoinSpendPublicKeyP *coin_pub, unsigned int deposits_length, const struct DepositData *deposits) @@ -2816,7 +2820,7 @@ static void lookup_deposits_order_cb (void *cls, uint64_t deposit_serial, const char *exchange_url, - const struct GNUNET_HashCode *h_wire, + const struct TALER_MerchantWireHash *h_wire, const struct TALER_Amount *amount_with_fee, const struct TALER_Amount *deposit_fee, const struct TALER_CoinSpendPublicKeyP *coin_pub) @@ -2933,7 +2937,7 @@ static void get_deposit_serial_cb (void *cls, uint64_t deposit_serial, const char *exchange_url, - const struct GNUNET_HashCode *h_wire, + const struct TALER_MerchantWireHash *h_wire, const struct TALER_Amount *amount_with_fee, const struct TALER_Amount *deposit_fee, const struct TALER_CoinSpendPublicKeyP *coin_pub) @@ -5026,11 +5030,11 @@ test_lookup_tip_details (const struct InstanceData *instance, * @param sigs the signatures to free. */ static void -free_rsa_signature_array (unsigned int sigs_length, - struct GNUNET_CRYPTO_RsaSignature **sigs) +free_signature_array (unsigned int sigs_length, + struct TALER_BlindedDenominationSignature *sigs) { for (unsigned int i = 0; sigs_length > i; ++i) - GNUNET_free (sigs[i]); + TALER_blinded_denom_sig_free (&sigs[i]); } @@ -5047,22 +5051,23 @@ free_rsa_signature_array (unsigned int sigs_length, * @return 0 on success, 1 otherwise. */ static int -test_lookup_pickup (const struct InstanceData *instance, - const struct TipData *tip, - const struct GNUNET_HashCode *pickup_id, - const char *expected_exchange_url, - const struct - TALER_ReservePrivateKeyP *expected_reserve_priv, - unsigned int expected_sigs_length, - const struct GNUNET_CRYPTO_RsaSignature **expected_sigs) +test_lookup_pickup ( + const struct InstanceData *instance, + const struct TipData *tip, + const struct GNUNET_HashCode *pickup_id, + const char *expected_exchange_url, + const struct TALER_ReservePrivateKeyP *expected_reserve_priv, + unsigned int expected_sigs_length, + const struct TALER_BlindedDenominationSignature *expected_sigs) { char *exchange_url = NULL; struct TALER_ReservePrivateKeyP reserve_priv; - struct GNUNET_CRYPTO_RsaSignature *sigs[expected_sigs_length]; + struct TALER_BlindedDenominationSignature sigs[expected_sigs_length]; unsigned int results_matching[expected_sigs_length]; + memset (sigs, 0, - sizeof (struct GNUNET_CRYPTO_RsaSignature *) * expected_sigs_length); + sizeof (sigs)); if (0 > plugin->lookup_pickup (plugin->cls, instance->instance.id, &tip->details.tip_id, @@ -5075,8 +5080,8 @@ test_lookup_pickup (const struct InstanceData *instance, GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Lookup pickup failed\n"); GNUNET_free (exchange_url); - free_rsa_signature_array (expected_sigs_length, - sigs); + free_signature_array (expected_sigs_length, + sigs); return 1; } if ((0 != strcmp (expected_exchange_url, @@ -5087,8 +5092,8 @@ test_lookup_pickup (const struct InstanceData *instance, GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Lookup pickup failed: mismatched data\n"); GNUNET_free (exchange_url); - free_rsa_signature_array (expected_sigs_length, - sigs); + free_signature_array (expected_sigs_length, + sigs); return 1; } memset (results_matching, @@ -5099,8 +5104,9 @@ test_lookup_pickup (const struct InstanceData *instance, for (unsigned int j = 0; expected_sigs_length > j; ++j) { /* compare expected_sigs[i] to sigs[j] */ - if (0 == GNUNET_CRYPTO_rsa_signature_cmp (expected_sigs[i], - sigs[j])) + if (0 == + TALER_blinded_denom_sig_cmp (&expected_sigs[i], + &sigs[j])) { results_matching[i] += 1; } @@ -5113,8 +5119,8 @@ test_lookup_pickup (const struct InstanceData *instance, GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Lookup pickup failed: mismatched data\n"); GNUNET_free (exchange_url); - free_rsa_signature_array (expected_sigs_length, - sigs); + free_signature_array (expected_sigs_length, + sigs); return 1; } } @@ -5309,7 +5315,7 @@ struct TestTips_Closure /** * Signature for the pickup. */ - struct GNUNET_CRYPTO_RsaSignature *pickup_sig; + struct TALER_BlindedDenominationSignature pickup_sig; }; @@ -5370,8 +5376,10 @@ pre_test_tips (struct TestTips_Closure *cls) } cls->pickup_priv = GNUNET_CRYPTO_rsa_private_key_create (2048); - cls->pickup_sig = GNUNET_CRYPTO_rsa_sign_fdh (cls->pickup_priv, - &cls->pickup_id); + cls->pickup_sig.cipher = TALER_DENOMINATION_RSA; + cls->pickup_sig.details.blinded_rsa_signature + = GNUNET_CRYPTO_rsa_sign_fdh (cls->pickup_priv, + &cls->pickup_id); } @@ -5383,9 +5391,8 @@ static void post_test_tips (struct TestTips_Closure *cls) { free_instance_data (&cls->instance); - GNUNET_CRYPTO_rsa_private_key_free (cls->pickup_priv); - GNUNET_CRYPTO_rsa_signature_free (cls->pickup_sig); + TALER_blinded_denom_sig_free (&cls->pickup_sig); } @@ -5463,7 +5470,7 @@ run_test_tips (struct TestTips_Closure *cls) plugin->insert_pickup_blind_signature (plugin->cls, &cls->pickup_id, 0, - cls->pickup_sig), + &cls->pickup_sig), "Insert pickup blind signature failed\n"); /* Test that overdrawing the reserve fails */ TEST_COND_RET_ON_FAIL (TALER_EC_NONE != @@ -5693,7 +5700,7 @@ lookup_refunds_cb (void *cls, */ static int test_lookup_refunds (const struct InstanceData *instance, - const struct GNUNET_HashCode *h_contract_terms, + const struct TALER_PrivateContractHash *h_contract_terms, unsigned int refunds_length, const struct TALER_CoinSpendPublicKeyP *coin_pubs, const struct TALER_Amount *refund_amounts) @@ -5898,7 +5905,8 @@ lookup_refunds_detailed_cb (void *cls, */ static int test_lookup_refunds_detailed (const struct InstanceData *instance, - const struct GNUNET_HashCode *h_contract_terms, + const struct + TALER_PrivateContractHash *h_contract_terms, bool cmp_timestamps, unsigned int refunds_length, const struct RefundData *refunds) @@ -6011,7 +6019,7 @@ get_refund_serial_cb (void *cls, */ static uint64_t get_refund_serial (const struct InstanceData *instance, - const struct GNUNET_HashCode *h_contract_terms, + const struct TALER_PrivateContractHash *h_contract_terms, const struct RefundData *refund) { struct LookupRefundSerial_Closure lookup_cls = { @@ -6656,7 +6664,7 @@ test_lookup_orders_all_filters (void) static void kyc_status_ok (void *cls, - const struct GNUNET_HashCode *h_wire, + const struct TALER_MerchantWireHash *h_wire, uint64_t exchange_kyc_serial, const char *payto_uri, const char *exchange_url, @@ -6672,7 +6680,7 @@ kyc_status_ok (void *cls, static void kyc_status_fail (void *cls, - const struct GNUNET_HashCode *h_wire, + const struct TALER_MerchantWireHash *h_wire, uint64_t exchange_kyc_serial, const char *payto_uri, const char *exchange_url, |