From b1197c16a4f1034cd4d46902f6a20327ac7a52c4 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 31 Oct 2021 18:01:19 +0100 Subject: [PATCH] -fix tests --- src/util/test_crypto.c | 22 ++++++++++++---------- src/util/test_helper_rsa.c | 10 +++++----- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/util/test_crypto.c b/src/util/test_crypto.c index f1d41add2..653df86f7 100644 --- a/src/util/test_crypto.c +++ b/src/util/test_crypto.c @@ -88,7 +88,7 @@ test_planchets (void) struct TALER_DenominationPrivateKey dk_priv; struct TALER_DenominationPublicKey dk_pub; struct TALER_PlanchetDetail pd; - struct GNUNET_CRYPTO_RsaSignature *blind_sig; + struct TALER_BlindedDenominationSignature blind_sig; struct TALER_FreshCoin coin; struct TALER_CoinPubHash c_hash; @@ -104,20 +104,22 @@ test_planchets (void) &ps, &c_hash, &pd)); - 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); + blind_sig.cipher = TALER_DENOMINATION_RSA; + blind_sig.details.blinded_rsa_signature + = GNUNET_CRYPTO_rsa_sign_blinded (dk_priv.details.rsa_private_key, + pd.coin_ev, + pd.coin_ev_size); + GNUNET_assert (NULL != blind_sig.details.blinded_rsa_signature); GNUNET_assert (GNUNET_OK == TALER_planchet_to_coin (&dk_pub, - blind_sig, + &blind_sig, &ps, &c_hash, &coin)); - GNUNET_CRYPTO_rsa_signature_free (blind_sig); - 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); + TALER_blinded_denom_sig_free (&blind_sig); + TALER_denom_sig_free (&coin.sig); + TALER_denom_priv_free (&dk_priv); + TALER_denom_pub_free (&dk_pub); return 0; } diff --git a/src/util/test_helper_rsa.c b/src/util/test_helper_rsa.c index 4e4abe2cf..24d7a4cca 100644 --- a/src/util/test_helper_rsa.c +++ b/src/util/test_helper_rsa.c @@ -237,7 +237,7 @@ test_revocation (struct TALER_CRYPTO_DenominationHelper *dh) static int test_signing (struct TALER_CRYPTO_DenominationHelper *dh) { - struct TALER_DenominationSignature ds; + struct TALER_BlindedDenominationSignature ds; enum TALER_ErrorCode ec; bool success = false; struct TALER_CoinPubHash m_hash; @@ -296,7 +296,7 @@ test_signing (struct TALER_CRYPTO_DenominationHelper *dh) rs.cipher = TALER_DENOMINATION_RSA; rs.details.rsa_signature - = TALER_rsa_unblind (ds.details.rsa_signature, + = TALER_rsa_unblind (ds.details.blinded_rsa_signature, &bks, keys[i].denom_pub.details.rsa_public_key); if (NULL == rs.details.rsa_signature) @@ -304,7 +304,7 @@ test_signing (struct TALER_CRYPTO_DenominationHelper *dh) GNUNET_break (0); return 6; } - GNUNET_CRYPTO_rsa_signature_free (ds.details.rsa_signature); + TALER_blinded_denom_sig_free (&ds); if (GNUNET_OK != TALER_denom_pub_verify (&keys[i].denom_pub, &rs, @@ -386,7 +386,7 @@ test_signing (struct TALER_CRYPTO_DenominationHelper *dh) static int perf_signing (struct TALER_CRYPTO_DenominationHelper *dh) { - struct TALER_DenominationSignature ds; + struct TALER_BlindedDenominationSignature ds; enum TALER_ErrorCode ec; struct TALER_CoinPubHash m_hash; struct GNUNET_CRYPTO_RsaBlindingKeySecret bks; @@ -438,7 +438,7 @@ perf_signing (struct TALER_CRYPTO_DenominationHelper *dh) delay = GNUNET_TIME_absolute_get_duration (start); duration = GNUNET_TIME_relative_add (duration, delay); - GNUNET_CRYPTO_rsa_signature_free (ds.details.rsa_signature); + TALER_blinded_denom_sig_free (&ds); j++; if (NUM_SIGN_TESTS == j) break;