This commit is contained in:
Gian Demarmels 2022-01-07 16:33:00 +01:00
parent 2d70c8c6d0
commit 4c7aa09784
No known key found for this signature in database
GPG Key ID: 030CEDDCCC92D778
2 changed files with 14 additions and 15 deletions

View File

@ -1081,7 +1081,6 @@ parse_key (struct Denomination *denom,
const void *buf, const void *buf,
size_t buf_size) size_t buf_size)
{ {
struct GNUNET_CRYPTO_CsPrivateKey priv;
char *anchor_s; char *anchor_s;
char dummy; char dummy;
unsigned long long anchor_ll; unsigned long long anchor_ll;
@ -1119,8 +1118,9 @@ parse_key (struct Denomination *denom,
return; return;
} }
// TODO: memcpy or cast? const struct GNUNET_CRYPTO_CsPrivateKey priv
memcpy (&priv, buf, sizeof(priv)); = *((struct GNUNET_CRYPTO_CsPrivateKey *) buf);
// memcpy (&priv, buf, sizeof(priv));
GNUNET_log (GNUNET_ERROR_TYPE_INFO, GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"privkey %zu\n", "privkey %zu\n",

View File

@ -264,7 +264,6 @@ test_revocation (struct TALER_CRYPTO_CsDenominationHelper *dh)
static int static int
test_r_derive (struct TALER_CRYPTO_CsDenominationHelper *dh) test_r_derive (struct TALER_CRYPTO_CsDenominationHelper *dh)
{ {
struct TALER_DenominationCsPublicR r_pub;
enum TALER_ErrorCode ec; enum TALER_ErrorCode ec;
bool success = false; bool success = false;
struct TALER_PlanchetSecretsP ps; struct TALER_PlanchetSecretsP ps;
@ -287,11 +286,12 @@ test_r_derive (struct TALER_CRYPTO_CsDenominationHelper *dh)
GNUNET_log (GNUNET_ERROR_TYPE_INFO, GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Requesting R derivation with key %s\n", "Requesting R derivation with key %s\n",
GNUNET_h2s (&keys[i].h_cs.hash)); GNUNET_h2s (&keys[i].h_cs.hash));
r_pub = TALER_CRYPTO_helper_cs_r_derive (dh, ps.cs_r_pub = TALER_CRYPTO_helper_cs_r_derive (dh,
&keys[i].h_cs, &keys[i].h_cs,
&pd.blinded_planchet.details. &pd.blinded_planchet.
cs_blinded_planchet.nonce, details.
&ec); cs_blinded_planchet.nonce,
&ec);
} }
switch (ec) switch (ec)
{ {
@ -318,12 +318,11 @@ test_r_derive (struct TALER_CRYPTO_CsDenominationHelper *dh)
GNUNET_log (GNUNET_ERROR_TYPE_INFO, GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Received valid R for key %s\n", "Received valid R for key %s\n",
GNUNET_h2s (&keys[i].h_cs.hash)); GNUNET_h2s (&keys[i].h_cs.hash));
ps.cs_r_pub = r_pub;
TALER_blinding_secret_create (&ps.blinding_key, TALER_blinding_secret_create (&ps.blinding_key,
TALER_DENOMINATION_CS, TALER_DENOMINATION_CS,
&ps.coin_priv, &ps.coin_priv,
&ps.cs_r_pub); &ps.cs_r_pub);
// TODO: sometimes the tests fail here in a calculation in gnunet. needs to be further analysed.
GNUNET_assert (GNUNET_OK == GNUNET_assert (GNUNET_OK ==
TALER_planchet_prepare (&keys[i].denom_pub, TALER_planchet_prepare (&keys[i].denom_pub,
&ps, &ps,
@ -376,10 +375,10 @@ test_r_derive (struct TALER_CRYPTO_CsDenominationHelper *dh)
GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
&nonce, &nonce,
sizeof (nonce)); sizeof (nonce));
r_pub = TALER_CRYPTO_helper_cs_r_derive (dh, ps.cs_r_pub = TALER_CRYPTO_helper_cs_r_derive (dh,
&rnd, &rnd,
&nonce, &nonce,
&ec); &ec);
if (TALER_EC_EXCHANGE_GENERIC_DENOMINATION_KEY_UNKNOWN != ec) if (TALER_EC_EXCHANGE_GENERIC_DENOMINATION_KEY_UNKNOWN != ec)
{ {
GNUNET_break (0); GNUNET_break (0);