-fix crypto test

This commit is contained in:
Christian Grothoff 2023-05-04 16:04:29 +02:00
parent 4c1a2c0307
commit 2de2b6e3cf
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC

View File

@ -355,15 +355,24 @@ test_exchange_sigs (void)
struct TALER_MasterPrivateKeyP priv; struct TALER_MasterPrivateKeyP priv;
struct TALER_MasterPublicKeyP pub; struct TALER_MasterPublicKeyP pub;
struct TALER_MasterSignatureP sig; struct TALER_MasterSignatureP sig;
json_t *rest;
GNUNET_CRYPTO_eddsa_key_create (&priv.eddsa_priv); GNUNET_CRYPTO_eddsa_key_create (&priv.eddsa_priv);
rest = json_array ();
GNUNET_assert (NULL != rest);
TALER_exchange_wire_signature_make (pt, TALER_exchange_wire_signature_make (pt,
NULL,
rest,
rest,
&priv, &priv,
&sig); &sig);
GNUNET_CRYPTO_eddsa_key_get_public (&priv.eddsa_priv, GNUNET_CRYPTO_eddsa_key_get_public (&priv.eddsa_priv,
&pub.eddsa_pub); &pub.eddsa_pub);
if (GNUNET_OK != if (GNUNET_OK !=
TALER_exchange_wire_signature_check (pt, TALER_exchange_wire_signature_check (pt,
NULL,
rest,
rest,
&pub, &pub,
&sig)) &sig))
{ {
@ -373,12 +382,28 @@ test_exchange_sigs (void)
if (GNUNET_OK == if (GNUNET_OK ==
TALER_exchange_wire_signature_check ( TALER_exchange_wire_signature_check (
"payto://x-taler-bank/localhost/Other", "payto://x-taler-bank/localhost/Other",
NULL,
rest,
rest,
&pub, &pub,
&sig)) &sig))
{ {
GNUNET_break (0); GNUNET_break (0);
return 1; return 1;
} }
if (GNUNET_OK ==
TALER_exchange_wire_signature_check (
pt,
"http://example.com/",
rest,
rest,
&pub,
&sig))
{
GNUNET_break (0);
return 1;
}
json_decref (rest);
return 0; return 0;
} }