From 57c334fb1ffedf6e692273852bacbed8711862d1 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sat, 23 Oct 2021 06:20:28 +0200 Subject: fix remaining libtalerutil tests FTBFS issues --- src/util/test_crypto.c | 27 +++++++++-------- src/util/test_helper_rsa.c | 73 +++++++++++++++++++++++++--------------------- 2 files changed, 54 insertions(+), 46 deletions(-) (limited to 'src') diff --git a/src/util/test_crypto.c b/src/util/test_crypto.c index 27e48b9e3..f1d41add2 100644 --- a/src/util/test_crypto.c +++ b/src/util/test_crypto.c @@ -1,6 +1,6 @@ /* This file is part of TALER - (C) 2015, 2020 Taler Systems SA + (C) 2015, 2020, 2021 Taler Systems SA TALER is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -90,18 +90,21 @@ test_planchets (void) struct TALER_PlanchetDetail pd; struct GNUNET_CRYPTO_RsaSignature *blind_sig; struct TALER_FreshCoin coin; - struct GNUNET_HashCode c_hash; - - dk_priv.rsa_private_key = GNUNET_CRYPTO_rsa_private_key_create (1024); - dk_pub.rsa_public_key = GNUNET_CRYPTO_rsa_private_key_get_public ( - dk_priv.rsa_private_key); + struct TALER_CoinPubHash c_hash; + + dk_priv.cipher = TALER_DENOMINATION_RSA; + dk_priv.details.rsa_private_key + = GNUNET_CRYPTO_rsa_private_key_create (1024); + TALER_denom_priv_to_pub (&dk_priv, + 0, + &dk_pub); TALER_planchet_setup_random (&ps); GNUNET_assert (GNUNET_OK == TALER_planchet_prepare (&dk_pub, &ps, &c_hash, &pd)); - blind_sig = GNUNET_CRYPTO_rsa_sign_blinded (dk_priv.rsa_private_key, + blind_sig = GNUNET_CRYPTO_rsa_sign_blinded (dk_priv.details.rsa_private_key, pd.coin_ev, pd.coin_ev_size); GNUNET_assert (NULL != blind_sig); @@ -112,15 +115,15 @@ test_planchets (void) &c_hash, &coin)); GNUNET_CRYPTO_rsa_signature_free (blind_sig); - GNUNET_CRYPTO_rsa_signature_free (coin.sig.rsa_signature); - GNUNET_CRYPTO_rsa_private_key_free (dk_priv.rsa_private_key); - GNUNET_CRYPTO_rsa_public_key_free (dk_pub.rsa_public_key); + GNUNET_CRYPTO_rsa_signature_free (coin.sig.details.rsa_signature); + GNUNET_CRYPTO_rsa_private_key_free (dk_priv.details.rsa_private_key); + GNUNET_CRYPTO_rsa_public_key_free (dk_pub.details.rsa_public_key); return 0; } static int -test_exchange_sigs () +test_exchange_sigs (void) { const char *pt = "payto://x-taler-bank/localhost/Account"; struct TALER_MasterPrivateKeyP priv; @@ -155,7 +158,7 @@ test_exchange_sigs () static int -test_merchant_sigs () +test_merchant_sigs (void) { const char *pt = "payto://x-taler-bank/localhost/Account"; struct TALER_WireSalt salt; diff --git a/src/util/test_helper_rsa.c b/src/util/test_helper_rsa.c index 7011afb22..4e4abe2cf 100644 --- a/src/util/test_helper_rsa.c +++ b/src/util/test_helper_rsa.c @@ -1,6 +1,6 @@ /* This file is part of TALER - (C) 2020 Taler Systems SA + (C) 2020, 2021 Taler Systems SA TALER is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -62,7 +62,7 @@ struct KeyData /** * Hash of the public key. */ - struct GNUNET_HashCode h_denom_pub; + struct TALER_DenominationHash h_denom_pub; /** * Full public key. @@ -110,7 +110,7 @@ key_cb (void *cls, const char *section_name, struct GNUNET_TIME_Absolute start_time, struct GNUNET_TIME_Relative validity_duration, - const struct GNUNET_HashCode *h_denom_pub, + const struct TALER_DenominationHash *h_denom_pub, const struct TALER_DenominationPublicKey *denom_pub, const struct TALER_SecurityModulePublicKeyP *sm_pub, const struct TALER_SecurityModuleSignatureP *sm_sig) @@ -119,7 +119,7 @@ key_cb (void *cls, (void) sm_sig; GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Key notification about key %s in `%s'\n", - GNUNET_h2s (h_denom_pub), + GNUNET_h2s (&h_denom_pub->hash), section_name); if (0 == validity_duration.rel_value_us) { @@ -133,8 +133,9 @@ key_cb (void *cls, { keys[i].valid = false; keys[i].revoked = false; - GNUNET_CRYPTO_rsa_public_key_free (keys[i].denom_pub.rsa_public_key); - keys[i].denom_pub.rsa_public_key = NULL; + GNUNET_CRYPTO_rsa_public_key_free ( + keys[i].denom_pub.details.rsa_public_key); + keys[i].denom_pub.details.rsa_public_key = NULL; GNUNET_assert (num_keys > 0); num_keys--; found = true; @@ -155,8 +156,9 @@ key_cb (void *cls, keys[i].h_denom_pub = *h_denom_pub; keys[i].start_time = start_time; keys[i].validity_duration = validity_duration; - keys[i].denom_pub.rsa_public_key - = GNUNET_CRYPTO_rsa_public_key_dup (denom_pub->rsa_public_key); + keys[i].denom_pub = *denom_pub; + keys[i].denom_pub.details.rsa_public_key + = GNUNET_CRYPTO_rsa_public_key_dup (denom_pub->details.rsa_public_key); num_keys++; return; } @@ -199,7 +201,7 @@ test_revocation (struct TALER_CRYPTO_DenominationHelper *dh) keys[j].revoked = true; fprintf (stderr, "Revoking key %s ...", - GNUNET_h2s (&keys[j].h_denom_pub)); + GNUNET_h2s (&keys[j].h_denom_pub.hash)); TALER_CRYPTO_helper_denom_revoke (dh, &keys[j].h_denom_pub); for (unsigned int k = 0; k<1000; k++) @@ -238,7 +240,7 @@ test_signing (struct TALER_CRYPTO_DenominationHelper *dh) struct TALER_DenominationSignature ds; enum TALER_ErrorCode ec; bool success = false; - struct GNUNET_HashCode m_hash; + struct TALER_CoinPubHash m_hash; struct GNUNET_CRYPTO_RsaBlindingKeySecret bks; GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, @@ -246,7 +248,7 @@ test_signing (struct TALER_CRYPTO_DenominationHelper *dh) sizeof (bks)); GNUNET_CRYPTO_hash ("Hello", strlen ("Hello"), - &m_hash); + &m_hash.hash); for (unsigned int i = 0; i 0); num_keys--; } -- cgit v1.2.3