set planchet detail cipher, add cipher checks

This commit is contained in:
Lucien Heuzeveldt 2022-01-04 17:46:36 +01:00 committed by Gian Demarmels
parent 106664ed0c
commit 36f551ff33
No known key found for this signature in database
GPG Key ID: 030CEDDCCC92D778
3 changed files with 17 additions and 1 deletions

View File

@ -1444,7 +1444,8 @@ TALER_planchet_setup_random (struct TALER_PlanchetSecretsP *ps,
* @param ps secret planchet internals (for #TALER_planchet_to_coin)
* @param[out] c_hash set to the hash of the public key of the coin (needed later)
* @param[out] pd set to the planchet detail for TALER_MERCHANT_tip_pickup() and
* other withdraw operations
* other withdraw operations, pd->blinded_planchet.cipher will be set
* to cipher from dk
* @return #GNUNET_OK on success
*/
enum GNUNET_GenericReturnValue

View File

@ -319,6 +319,7 @@ TALER_planchet_prepare (const struct TALER_DenominationPublicKey *dk,
return GNUNET_SYSERR;
}
pd->blinded_planchet.cipher = dk->cipher;
TALER_denom_pub_hash (dk,
&pd->denom_pub_hash);
return GNUNET_OK;
@ -335,6 +336,12 @@ TALER_planchet_to_coin (const struct TALER_DenominationPublicKey *dk,
{
struct TALER_DenominationSignature sig;
if (dk->cipher != blind_sig->cipher)
{
GNUNET_break_op (0);
return GNUNET_SYSERR;
}
switch (dk->cipher)
{
case TALER_DENOMINATION_RSA:

View File

@ -112,6 +112,13 @@ TALER_denom_sign_blinded (struct TALER_BlindedDenominationSignature *denom_sig,
memset (denom_sig,
0,
sizeof (*denom_sig));
if (blinded_planchet->cipher != denom_priv->cipher)
{
GNUNET_break (0);
return GNUNET_SYSERR;
}
switch (denom_priv->cipher)
{
case TALER_DENOMINATION_INVALID:
@ -394,6 +401,7 @@ TALER_denom_pub_verify (const struct TALER_DenominationPublicKey *denom_pub,
GNUNET_break (0);
return GNUNET_SYSERR;
}
switch (denom_pub->cipher)
{
case TALER_DENOMINATION_INVALID: