-fixing more FTBFS

This commit is contained in:
Christian Grothoff 2021-10-22 23:15:04 +02:00
parent fc371ea18b
commit 42bdb5aa6e
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
5 changed files with 52 additions and 46 deletions

View File

@ -563,7 +563,8 @@ struct TALER_DenominationPrivateKey
* If we use #TALER_DENOMINATION_RSA in @a cipher. * If we use #TALER_DENOMINATION_RSA in @a cipher.
*/ */
struct GNUNET_CRYPTO_RsaPrivateKey *rsa_private_key; struct GNUNET_CRYPTO_RsaPrivateKey *rsa_private_key;
};
} details;
}; };

View File

@ -1178,7 +1178,27 @@ struct TALER_MasterWireDetailsPS
struct GNUNET_CRYPTO_EccSignaturePurpose purpose; struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
/** /**
* Hash over the account holder's payto:// URL and * Hash over the account holder's payto:// URL.
*/
struct TALER_PaytoHash h_wire_details GNUNET_PACKED;
};
/**
* @brief Information signed by the exchange's master
* key affirming the IBAN details for the exchange.
*/
struct TALER_MerchantWireDetailsPS
{
/**
* Purpose is #TALER_SIGNATURE_MERCHANT_WIRE_DETAILS.
*/
struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
/**
* Salted hash over the account holder's payto:// URL and
* the salt, as done by #TALER_exchange_wire_signature_hash(). * the salt, as done by #TALER_exchange_wire_signature_hash().
*/ */
struct TALER_MerchantWireHash h_wire_details GNUNET_PACKED; struct TALER_MerchantWireHash h_wire_details GNUNET_PACKED;

View File

@ -286,7 +286,7 @@ TALER_CRYPTO_helper_denom_connect (
* @param hdr message that we received * @param hdr message that we received
* @return #GNUNET_OK on success * @return #GNUNET_OK on success
*/ */
static int static enum GNUNET_GenericReturnValue
handle_mt_avail (struct TALER_CRYPTO_DenominationHelper *dh, handle_mt_avail (struct TALER_CRYPTO_DenominationHelper *dh,
const struct GNUNET_MessageHeader *hdr) const struct GNUNET_MessageHeader *hdr)
{ {
@ -317,24 +317,26 @@ handle_mt_avail (struct TALER_CRYPTO_DenominationHelper *dh,
{ {
struct TALER_DenominationPublicKey denom_pub; struct TALER_DenominationPublicKey denom_pub;
struct GNUNET_HashCode h_denom_pub; struct TALER_DenominationHash h_denom_pub;
denom_pub.rsa_public_key denom_pub.cipher = TALER_DENOMINATION_RSA;
denom_pub.age_mask = 0; // FIXME-Oec!
denom_pub.details.rsa_public_key
= GNUNET_CRYPTO_rsa_public_key_decode (buf, = GNUNET_CRYPTO_rsa_public_key_decode (buf,
ntohs (kan->pub_size)); ntohs (kan->pub_size));
if (NULL == denom_pub.rsa_public_key) if (NULL == denom_pub.details.rsa_public_key)
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
GNUNET_CRYPTO_rsa_public_key_hash (denom_pub.rsa_public_key, TALER_denom_pub_hash (&denom_pub,
&h_denom_pub); &h_denom_pub);
GNUNET_log (GNUNET_ERROR_TYPE_INFO, GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Received RSA key %s (%s)\n", "Received RSA key %s (%s)\n",
GNUNET_h2s (&h_denom_pub), GNUNET_h2s (&h_denom_pub.hash),
section_name); section_name);
if (GNUNET_OK != if (GNUNET_OK !=
TALER_exchange_secmod_rsa_verify ( TALER_exchange_secmod_denom_verify (
&h_denom_pub, &h_denom_pub,
section_name, section_name,
GNUNET_TIME_absolute_ntoh (kan->anchor_time), GNUNET_TIME_absolute_ntoh (kan->anchor_time),
@ -343,7 +345,7 @@ handle_mt_avail (struct TALER_CRYPTO_DenominationHelper *dh,
&kan->secm_sig)) &kan->secm_sig))
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
GNUNET_CRYPTO_rsa_public_key_free (denom_pub.rsa_public_key); GNUNET_CRYPTO_rsa_public_key_free (denom_pub.details.rsa_public_key);
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
dh->dkc (dh->dkc_cls, dh->dkc (dh->dkc_cls,
@ -354,7 +356,7 @@ handle_mt_avail (struct TALER_CRYPTO_DenominationHelper *dh,
&denom_pub, &denom_pub,
&kan->secm_pub, &kan->secm_pub,
&kan->secm_sig); &kan->secm_sig);
GNUNET_CRYPTO_rsa_public_key_free (denom_pub.rsa_public_key); GNUNET_CRYPTO_rsa_public_key_free (denom_pub.details.rsa_public_key);
} }
return GNUNET_OK; return GNUNET_OK;
} }
@ -367,7 +369,7 @@ handle_mt_avail (struct TALER_CRYPTO_DenominationHelper *dh,
* @param hdr message that we received * @param hdr message that we received
* @return #GNUNET_OK on success * @return #GNUNET_OK on success
*/ */
static int static enum GNUNET_GenericReturnValue
handle_mt_purge (struct TALER_CRYPTO_DenominationHelper *dh, handle_mt_purge (struct TALER_CRYPTO_DenominationHelper *dh,
const struct GNUNET_MessageHeader *hdr) const struct GNUNET_MessageHeader *hdr)
{ {
@ -381,7 +383,7 @@ handle_mt_purge (struct TALER_CRYPTO_DenominationHelper *dh,
} }
GNUNET_log (GNUNET_ERROR_TYPE_INFO, GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Received revocation of denomination key %s\n", "Received revocation of denomination key %s\n",
GNUNET_h2s (&pn->h_denom_pub)); GNUNET_h2s (&pn->h_denom_pub.hash));
dh->dkc (dh->dkc_cls, dh->dkc (dh->dkc_cls,
NULL, NULL,
GNUNET_TIME_UNIT_ZERO_ABS, GNUNET_TIME_UNIT_ZERO_ABS,
@ -542,12 +544,14 @@ TALER_CRYPTO_helper_denom_poll (struct TALER_CRYPTO_DenominationHelper *dh)
struct TALER_DenominationSignature struct TALER_DenominationSignature
TALER_CRYPTO_helper_denom_sign ( TALER_CRYPTO_helper_denom_sign (
struct TALER_CRYPTO_DenominationHelper *dh, struct TALER_CRYPTO_DenominationHelper *dh,
const struct GNUNET_HashCode *h_denom_pub, const struct TALER_DenominationHash *h_denom_pub,
const void *msg, const void *msg,
size_t msg_size, size_t msg_size,
enum TALER_ErrorCode *ec) enum TALER_ErrorCode *ec)
{ {
struct TALER_DenominationSignature ds = { NULL }; struct TALER_DenominationSignature ds = {
.details.rsa_signature = NULL
};
{ {
char buf[sizeof (struct TALER_CRYPTO_SignRequest) + msg_size]; char buf[sizeof (struct TALER_CRYPTO_SignRequest) + msg_size];
struct TALER_CRYPTO_SignRequest *sr struct TALER_CRYPTO_SignRequest *sr
@ -647,7 +651,8 @@ TALER_CRYPTO_helper_denom_sign (
return ds; return ds;
} }
*ec = TALER_EC_NONE; *ec = TALER_EC_NONE;
ds.rsa_signature = rsa_signature; ds.cipher = TALER_DENOMINATION_RSA;
ds.details.rsa_signature = rsa_signature;
return ds; return ds;
} }
case TALER_HELPER_RSA_MT_RES_SIGN_FAILURE: case TALER_HELPER_RSA_MT_RES_SIGN_FAILURE:
@ -700,7 +705,7 @@ TALER_CRYPTO_helper_denom_sign (
void void
TALER_CRYPTO_helper_denom_revoke ( TALER_CRYPTO_helper_denom_revoke (
struct TALER_CRYPTO_DenominationHelper *dh, struct TALER_CRYPTO_DenominationHelper *dh,
const struct GNUNET_HashCode *h_denom_pub) const struct TALER_DenominationHash *h_denom_pub)
{ {
struct TALER_CRYPTO_RevokeRequest rr = { struct TALER_CRYPTO_RevokeRequest rr = {
.header.size = htons (sizeof (rr)), .header.size = htons (sizeof (rr)),
@ -729,7 +734,7 @@ TALER_CRYPTO_helper_denom_revoke (
GNUNET_break (((size_t) ret) == sizeof (rr)); GNUNET_break (((size_t) ret) == sizeof (rr));
GNUNET_log (GNUNET_ERROR_TYPE_INFO, GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Requested revocation of denomination key %s\n", "Requested revocation of denomination key %s\n",
GNUNET_h2s (h_denom_pub)); GNUNET_h2s (&h_denom_pub->hash));
} }

View File

@ -32,7 +32,7 @@
*/ */
void void
TALER_exchange_wire_signature_hash (const char *payto_uri, TALER_exchange_wire_signature_hash (const char *payto_uri,
struct GNUNET_HashCode *hc) struct TALER_PaytoHash *hc)
{ {
GNUNET_assert (GNUNET_YES == GNUNET_assert (GNUNET_YES ==
GNUNET_CRYPTO_kdf (hc, GNUNET_CRYPTO_kdf (hc,
@ -111,10 +111,8 @@ TALER_exchange_wire_signature_make (
void void
TALER_merchant_wire_signature_hash (const char *payto_uri, TALER_merchant_wire_signature_hash (const char *payto_uri,
const struct TALER_WireSalt *salt, const struct TALER_WireSalt *salt,
struct GNUNET_HashCode *hc) struct TALER_MerchantWireHash *hc)
{ {
#if FIXED_7032
/* new logic to use once #7032 is being addressed */
GNUNET_assert (GNUNET_YES == GNUNET_assert (GNUNET_YES ==
GNUNET_CRYPTO_kdf (hc, GNUNET_CRYPTO_kdf (hc,
sizeof (*hc), sizeof (*hc),
@ -125,24 +123,6 @@ TALER_merchant_wire_signature_hash (const char *payto_uri,
"merchant-wire-signature", "merchant-wire-signature",
strlen ("merchant-wire-signature"), strlen ("merchant-wire-signature"),
NULL, 0)); NULL, 0));
#else
/* compatibility logic to avoid protocol breakage... */
char *sstr;
sstr = GNUNET_STRINGS_data_to_string_alloc (salt,
sizeof (*salt));
GNUNET_assert (GNUNET_YES ==
GNUNET_CRYPTO_kdf (hc,
sizeof (*hc),
sstr,
strlen (sstr) + 1,
payto_uri,
strlen (payto_uri) + 1,
"merchant-wire-signature",
strlen ("merchant-wire-signature"),
NULL, 0));
GNUNET_free (sstr);
#endif
} }
@ -170,7 +150,7 @@ TALER_merchant_wire_signature_check (
const struct TALER_MerchantPublicKeyP *merch_pub, const struct TALER_MerchantPublicKeyP *merch_pub,
const struct TALER_MerchantSignatureP *merch_sig) const struct TALER_MerchantSignatureP *merch_sig)
{ {
struct TALER_MasterWireDetailsPS wd = { struct TALER_MerchantWireDetailsPS wd = {
.purpose.purpose = htonl (TALER_SIGNATURE_MERCHANT_WIRE_DETAILS), .purpose.purpose = htonl (TALER_SIGNATURE_MERCHANT_WIRE_DETAILS),
.purpose.size = htonl (sizeof (wd)) .purpose.size = htonl (sizeof (wd))
}; };
@ -200,7 +180,7 @@ TALER_merchant_wire_signature_make (
const struct TALER_MerchantPrivateKeyP *merch_priv, const struct TALER_MerchantPrivateKeyP *merch_priv,
struct TALER_MerchantSignatureP *merch_sig) struct TALER_MerchantSignatureP *merch_sig)
{ {
struct TALER_MasterWireDetailsPS wd = { struct TALER_MerchantWireDetailsPS wd = {
.purpose.purpose = htonl (TALER_SIGNATURE_MERCHANT_WIRE_DETAILS), .purpose.purpose = htonl (TALER_SIGNATURE_MERCHANT_WIRE_DETAILS),
.purpose.size = htonl (sizeof (wd)) .purpose.size = htonl (sizeof (wd))
}; };

View File

@ -102,7 +102,7 @@ struct TALER_CRYPTO_RsaKeyPurgeNotification
/** /**
* Hash of the public key of the purged RSA key. * Hash of the public key of the purged RSA key.
*/ */
struct GNUNET_HashCode h_denom_pub; struct TALER_DenominationHash h_denom_pub;
}; };
@ -125,7 +125,7 @@ struct TALER_CRYPTO_SignRequest
/** /**
* Hash of the public key of the RSA key to use for the signature. * Hash of the public key of the RSA key to use for the signature.
*/ */
struct GNUNET_HashCode h_denom_pub; struct TALER_DenominationHash h_denom_pub;
/* followed by message to sign */ /* followed by message to sign */
}; };
@ -149,7 +149,7 @@ struct TALER_CRYPTO_RevokeRequest
/** /**
* Hash of the public key of the revoked RSA key. * Hash of the public key of the revoked RSA key.
*/ */
struct GNUNET_HashCode h_denom_pub; struct TALER_DenominationHash h_denom_pub;
}; };