-clean up crypto

This commit is contained in:
Christian Grothoff 2022-02-09 10:49:10 +01:00
parent d559610da7
commit 12290af845
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
4 changed files with 23 additions and 1 deletions

View File

@ -1146,10 +1146,12 @@ TALER_denom_sign_blinded (struct TALER_BlindedDenominationSignature *denom_sig,
* Unblind blinded signature. * Unblind blinded signature.
* *
* @param[out] denom_sig where to write the unblinded signature * @param[out] denom_sig where to write the unblinded signature
* @param dk denomination public key
* @param bdenom_sig the blinded signature * @param bdenom_sig the blinded signature
* @param bks blinding secret to use * @param bks blinding secret to use
* @param denom_pub public key used for signing * @param c_hash hash of the coin's public key for verification of the signature
* @param alg_values algorithm specific values * @param alg_values algorithm specific values
* @param denom_pub public key used for signing
* @return #GNUNET_OK on success * @return #GNUNET_OK on success
*/ */
enum GNUNET_GenericReturnValue enum GNUNET_GenericReturnValue
@ -1157,6 +1159,8 @@ TALER_denom_sig_unblind (
struct TALER_DenominationSignature *denom_sig, struct TALER_DenominationSignature *denom_sig,
const struct TALER_BlindedDenominationSignature *bdenom_sig, const struct TALER_BlindedDenominationSignature *bdenom_sig,
const union TALER_DenominationBlindingKeyP *bks, const union TALER_DenominationBlindingKeyP *bks,
const struct TALER_CoinPubHash *c_hash,
const struct TALER_ExchangeWithdrawValues *alg_values,
const struct TALER_DenominationPublicKey *denom_pub); const struct TALER_DenominationPublicKey *denom_pub);

View File

@ -398,6 +398,8 @@ TALER_planchet_to_coin (
TALER_denom_sig_unblind (&coin->sig, TALER_denom_sig_unblind (&coin->sig,
blind_sig, blind_sig,
bks, bks,
c_hash,
alg_values,
dk)) dk))
{ {
GNUNET_break_op (0); GNUNET_break_op (0);

View File

@ -170,6 +170,8 @@ TALER_denom_sig_unblind (
struct TALER_DenominationSignature *denom_sig, struct TALER_DenominationSignature *denom_sig,
const struct TALER_BlindedDenominationSignature *bdenom_sig, const struct TALER_BlindedDenominationSignature *bdenom_sig,
const union TALER_DenominationBlindingKeyP *bks, const union TALER_DenominationBlindingKeyP *bks,
const struct TALER_CoinPubHash *c_hash,
const struct TALER_ExchangeWithdrawValues *alg_values,
const struct TALER_DenominationPublicKey *denom_pub) const struct TALER_DenominationPublicKey *denom_pub)
{ {
if (bdenom_sig->cipher != denom_pub->cipher) if (bdenom_sig->cipher != denom_pub->cipher)
@ -198,9 +200,21 @@ TALER_denom_sig_unblind (
case TALER_DENOMINATION_CS: case TALER_DENOMINATION_CS:
{ {
struct GNUNET_CRYPTO_CsBlindingSecret bs[2]; struct GNUNET_CRYPTO_CsBlindingSecret bs[2];
struct GNUNET_CRYPTO_CsC c[2];
struct TALER_DenominationCSPublicRPairP r_pub_blind;
GNUNET_CRYPTO_cs_blinding_secrets_derive (&bks->nonce, GNUNET_CRYPTO_cs_blinding_secrets_derive (&bks->nonce,
bs); bs);
GNUNET_CRYPTO_cs_calc_blinded_c (
bs,
alg_values->details.cs_values.r_pub_pair.r_pub,
&denom_pub->details.cs_public_key,
&c_hash->hash,
sizeof(struct GNUNET_HashCode),
c,
r_pub_blind.r_pub);
denom_sig->details.cs_signature.r_point
= r_pub_blind.r_pub[bdenom_sig->details.blinded_cs_answer.b];
GNUNET_CRYPTO_cs_unblind (&bdenom_sig->details.blinded_cs_answer.s_scalar, GNUNET_CRYPTO_cs_unblind (&bdenom_sig->details.blinded_cs_answer.s_scalar,
&bs[bdenom_sig->details.blinded_cs_answer.b], &bs[bdenom_sig->details.blinded_cs_answer.b],
&denom_sig->details.cs_signature.s_scalar); &denom_sig->details.cs_signature.s_scalar);

View File

@ -341,6 +341,8 @@ test_signing (struct TALER_CRYPTO_RsaDenominationHelper *dh)
TALER_denom_sig_unblind (&rs, TALER_denom_sig_unblind (&rs,
&ds, &ds,
&bks, &bks,
&c_hash,
&alg_values,
&keys[i].denom_pub)) &keys[i].denom_pub))
{ {
GNUNET_break (0); GNUNET_break (0);