diff options
-rw-r--r-- | src/include/taler_crypto_lib.h | 11 | ||||
-rw-r--r-- | src/util/crypto.c | 7 | ||||
-rw-r--r-- | src/util/test_crypto.c | 28 |
3 files changed, 35 insertions, 11 deletions
diff --git a/src/include/taler_crypto_lib.h b/src/include/taler_crypto_lib.h index e74d49f6d..e3c5caa46 100644 --- a/src/include/taler_crypto_lib.h +++ b/src/include/taler_crypto_lib.h @@ -1530,13 +1530,22 @@ TALER_planchet_prepare (const struct TALER_DenominationPublicKey *dk, * Frees blinded message inside blinded planchet depending on blinded_planchet->cipher * Does not free the @a blinded_planchet itself! * - * @param blinded_planchet blnded planchet + * @param[in] blinded_planchet blinded planchet */ void TALER_blinded_planchet_free (struct TALER_BlindedPlanchet *blinded_planchet); /** + * Frees blinded message inside planchet detail. + * + * @param[in] pd planchet detail to free + */ +void +TALER_planchet_detail_free (struct TALER_PlanchetDetail *pd); + + +/** * Obtain a coin from the planchet's secrets and the blind signature * of the exchange. * diff --git a/src/util/crypto.c b/src/util/crypto.c index b4e610ab0..8d70b791e 100644 --- a/src/util/crypto.c +++ b/src/util/crypto.c @@ -385,6 +385,13 @@ TALER_planchet_prepare (const struct TALER_DenominationPublicKey *dk, void +TALER_planchet_detail_free (struct TALER_PlanchetDetail *pd) +{ + TALER_blinded_planchet_free (&pd->blinded_planchet); +} + + +void TALER_blinded_planchet_free (struct TALER_BlindedPlanchet *blinded_planchet) { switch (blinded_planchet->cipher) diff --git a/src/util/test_crypto.c b/src/util/test_crypto.c index d930b7739..8b136e73f 100644 --- a/src/util/test_crypto.c +++ b/src/util/test_crypto.c @@ -82,13 +82,16 @@ test_high_level (void) TALER_planchet_setup_refresh (&secret, 1, &ps2); - TALER_planchet_setup_coin_priv (&ps1, + TALER_planchet_setup_coin_priv (&ps2, &alg2, &coin_priv2); TALER_planchet_blinding_secret_create (&ps2, &alg2, &bks2); GNUNET_assert (0 != + GNUNET_memcmp (&ps1, + &ps2)); + GNUNET_assert (0 != GNUNET_memcmp (&coin_priv1, &coin_priv2)); GNUNET_assert (0 != @@ -138,10 +141,12 @@ test_planchets_rsa (void) TALER_DENOMINATION_RSA, 1024)); alg_values.cipher = TALER_DENOMINATION_RSA; - - TALER_planchet_setup_coin_priv (&ps, &alg_values, &coin_priv); - TALER_planchet_blinding_secret_create (&ps, &alg_values, &bks); - + TALER_planchet_setup_coin_priv (&ps, + &alg_values, + &coin_priv); + TALER_planchet_blinding_secret_create (&ps, + &alg_values, + &bks); GNUNET_assert (GNUNET_OK == TALER_planchet_prepare (&dk_pub, &alg_values, @@ -153,6 +158,7 @@ test_planchets_rsa (void) TALER_denom_sign_blinded (&blind_sig, &dk_priv, &pd.blinded_planchet)); + TALER_planchet_detail_free (&pd); GNUNET_assert (GNUNET_OK == TALER_planchet_to_coin (&dk_pub, &blind_sig, @@ -200,16 +206,18 @@ test_planchets_cs (void) alg_values.cipher = TALER_DENOMINATION_CS; - TALER_cs_withdraw_nonce_derive (&ps, - &pd.blinded_planchet.details. - cs_blinded_planchet.nonce); + TALER_cs_withdraw_nonce_derive ( + &ps, + &pd.blinded_planchet.details.cs_blinded_planchet.nonce); GNUNET_assert (GNUNET_OK == TALER_denom_cs_derive_r_public ( &pd.blinded_planchet.details.cs_blinded_planchet.nonce, &dk_priv, &alg_values.details.cs_values.r_pub)); - TALER_planchet_setup_coin_priv (&ps, &alg_values, &coin_priv); + TALER_planchet_setup_coin_priv (&ps, + &alg_values, + &coin_priv); TALER_planchet_blinding_secret_create (&ps, &alg_values, &bks); @@ -226,7 +234,7 @@ test_planchets_cs (void) TALER_denom_sign_blinded (&blind_sig, &dk_priv, &pd.blinded_planchet)); - + TALER_planchet_detail_free (&pd); GNUNET_assert (GNUNET_OK == TALER_planchet_to_coin (&dk_pub, &blind_sig, |