diff --git a/src/include/taler_crypto_lib.h b/src/include/taler_crypto_lib.h index 3fe51d79b..185c29a14 100644 --- a/src/include/taler_crypto_lib.h +++ b/src/include/taler_crypto_lib.h @@ -563,7 +563,8 @@ struct TALER_DenominationPrivateKey * If we use #TALER_DENOMINATION_RSA in @a cipher. */ struct GNUNET_CRYPTO_RsaPrivateKey *rsa_private_key; - }; + + } details; }; diff --git a/src/include/taler_signatures.h b/src/include/taler_signatures.h index b7279a66c..34d133807 100644 --- a/src/include/taler_signatures.h +++ b/src/include/taler_signatures.h @@ -1178,7 +1178,27 @@ struct TALER_MasterWireDetailsPS 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(). */ struct TALER_MerchantWireHash h_wire_details GNUNET_PACKED; diff --git a/src/util/crypto_helper_denom.c b/src/util/crypto_helper_denom.c index f8e77ae4f..ba56a4e71 100644 --- a/src/util/crypto_helper_denom.c +++ b/src/util/crypto_helper_denom.c @@ -286,7 +286,7 @@ TALER_CRYPTO_helper_denom_connect ( * @param hdr message that we received * @return #GNUNET_OK on success */ -static int +static enum GNUNET_GenericReturnValue handle_mt_avail (struct TALER_CRYPTO_DenominationHelper *dh, const struct GNUNET_MessageHeader *hdr) { @@ -317,24 +317,26 @@ handle_mt_avail (struct TALER_CRYPTO_DenominationHelper *dh, { 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, ntohs (kan->pub_size)); - if (NULL == denom_pub.rsa_public_key) + if (NULL == denom_pub.details.rsa_public_key) { GNUNET_break_op (0); return GNUNET_SYSERR; } - GNUNET_CRYPTO_rsa_public_key_hash (denom_pub.rsa_public_key, - &h_denom_pub); + TALER_denom_pub_hash (&denom_pub, + &h_denom_pub); GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Received RSA key %s (%s)\n", - GNUNET_h2s (&h_denom_pub), + GNUNET_h2s (&h_denom_pub.hash), section_name); if (GNUNET_OK != - TALER_exchange_secmod_rsa_verify ( + TALER_exchange_secmod_denom_verify ( &h_denom_pub, section_name, GNUNET_TIME_absolute_ntoh (kan->anchor_time), @@ -343,7 +345,7 @@ handle_mt_avail (struct TALER_CRYPTO_DenominationHelper *dh, &kan->secm_sig)) { 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; } dh->dkc (dh->dkc_cls, @@ -354,7 +356,7 @@ handle_mt_avail (struct TALER_CRYPTO_DenominationHelper *dh, &denom_pub, &kan->secm_pub, &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; } @@ -367,7 +369,7 @@ handle_mt_avail (struct TALER_CRYPTO_DenominationHelper *dh, * @param hdr message that we received * @return #GNUNET_OK on success */ -static int +static enum GNUNET_GenericReturnValue handle_mt_purge (struct TALER_CRYPTO_DenominationHelper *dh, const struct GNUNET_MessageHeader *hdr) { @@ -381,7 +383,7 @@ handle_mt_purge (struct TALER_CRYPTO_DenominationHelper *dh, } GNUNET_log (GNUNET_ERROR_TYPE_INFO, "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, NULL, GNUNET_TIME_UNIT_ZERO_ABS, @@ -542,12 +544,14 @@ TALER_CRYPTO_helper_denom_poll (struct TALER_CRYPTO_DenominationHelper *dh) struct TALER_DenominationSignature TALER_CRYPTO_helper_denom_sign ( struct TALER_CRYPTO_DenominationHelper *dh, - const struct GNUNET_HashCode *h_denom_pub, + const struct TALER_DenominationHash *h_denom_pub, const void *msg, size_t msg_size, 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]; struct TALER_CRYPTO_SignRequest *sr @@ -647,7 +651,8 @@ TALER_CRYPTO_helper_denom_sign ( return ds; } *ec = TALER_EC_NONE; - ds.rsa_signature = rsa_signature; + ds.cipher = TALER_DENOMINATION_RSA; + ds.details.rsa_signature = rsa_signature; return ds; } case TALER_HELPER_RSA_MT_RES_SIGN_FAILURE: @@ -700,7 +705,7 @@ TALER_CRYPTO_helper_denom_sign ( void TALER_CRYPTO_helper_denom_revoke ( struct TALER_CRYPTO_DenominationHelper *dh, - const struct GNUNET_HashCode *h_denom_pub) + const struct TALER_DenominationHash *h_denom_pub) { struct TALER_CRYPTO_RevokeRequest rr = { .header.size = htons (sizeof (rr)), @@ -729,7 +734,7 @@ TALER_CRYPTO_helper_denom_revoke ( GNUNET_break (((size_t) ret) == sizeof (rr)); GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Requested revocation of denomination key %s\n", - GNUNET_h2s (h_denom_pub)); + GNUNET_h2s (&h_denom_pub->hash)); } diff --git a/src/util/crypto_wire.c b/src/util/crypto_wire.c index ee3215ca6..8560aaf30 100644 --- a/src/util/crypto_wire.c +++ b/src/util/crypto_wire.c @@ -32,7 +32,7 @@ */ void TALER_exchange_wire_signature_hash (const char *payto_uri, - struct GNUNET_HashCode *hc) + struct TALER_PaytoHash *hc) { GNUNET_assert (GNUNET_YES == GNUNET_CRYPTO_kdf (hc, @@ -111,10 +111,8 @@ TALER_exchange_wire_signature_make ( void TALER_merchant_wire_signature_hash (const char *payto_uri, 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_CRYPTO_kdf (hc, sizeof (*hc), @@ -125,24 +123,6 @@ TALER_merchant_wire_signature_hash (const char *payto_uri, "merchant-wire-signature", strlen ("merchant-wire-signature"), 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_MerchantSignatureP *merch_sig) { - struct TALER_MasterWireDetailsPS wd = { + struct TALER_MerchantWireDetailsPS wd = { .purpose.purpose = htonl (TALER_SIGNATURE_MERCHANT_WIRE_DETAILS), .purpose.size = htonl (sizeof (wd)) }; @@ -200,7 +180,7 @@ TALER_merchant_wire_signature_make ( const struct TALER_MerchantPrivateKeyP *merch_priv, struct TALER_MerchantSignatureP *merch_sig) { - struct TALER_MasterWireDetailsPS wd = { + struct TALER_MerchantWireDetailsPS wd = { .purpose.purpose = htonl (TALER_SIGNATURE_MERCHANT_WIRE_DETAILS), .purpose.size = htonl (sizeof (wd)) }; diff --git a/src/util/taler-exchange-secmod-rsa.h b/src/util/taler-exchange-secmod-rsa.h index 146b6948f..cf439e261 100644 --- a/src/util/taler-exchange-secmod-rsa.h +++ b/src/util/taler-exchange-secmod-rsa.h @@ -102,7 +102,7 @@ struct TALER_CRYPTO_RsaKeyPurgeNotification /** * 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. */ - struct GNUNET_HashCode h_denom_pub; + struct TALER_DenominationHash h_denom_pub; /* followed by message to sign */ }; @@ -149,7 +149,7 @@ struct TALER_CRYPTO_RevokeRequest /** * Hash of the public key of the revoked RSA key. */ - struct GNUNET_HashCode h_denom_pub; + struct TALER_DenominationHash h_denom_pub; };