From 32bb3b14bf5cd623714985c8ca7fed0c5a923336 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 24 May 2016 20:13:31 +0200 Subject: fix #4483 --- src/include/taler_crypto_lib.h | 74 ++++++++++++----------------------- src/include/taler_exchange_service.h | 2 +- src/include/taler_exchangedb_plugin.h | 4 +- 3 files changed, 27 insertions(+), 53 deletions(-) (limited to 'src/include') diff --git a/src/include/taler_crypto_lib.h b/src/include/taler_crypto_lib.h index 0f36f378f..af451b208 100644 --- a/src/include/taler_crypto_lib.h +++ b/src/include/taler_crypto_lib.h @@ -277,20 +277,21 @@ struct TALER_CoinSpendSignatureP }; -GNUNET_NETWORK_STRUCT_END - /** * @brief Type of blinding keys for Taler. */ -struct TALER_DenominationBlindingKey +struct TALER_DenominationBlindingKeyP { /** - * Taler uses RSA for blinding. + * Taler uses RSA for blind signatures. */ - struct GNUNET_CRYPTO_RsaBlindingKey *rsa_blinding_key; + struct GNUNET_CRYPTO_RsaBlindingKeySecret bks; }; +GNUNET_NETWORK_STRUCT_END + + /** * @brief Type of (unblinded) coin signatures for Taler. */ @@ -412,7 +413,7 @@ struct TALER_EncryptedLinkSecretP /** * @brief Representation of an refresh link in cleartext. */ -struct TALER_RefreshLinkDecrypted +struct TALER_RefreshLinkDecryptedP { /** @@ -423,7 +424,7 @@ struct TALER_RefreshLinkDecrypted /** * Blinding key. */ - struct TALER_DenominationBlindingKey blinding_key; + struct TALER_DenominationBlindingKeyP blinding_key; }; @@ -483,25 +484,17 @@ struct TALER_WireTransferIdentifierP }; -GNUNET_NETWORK_STRUCT_END - - /** * @brief Representation of an encrypted refresh link. */ -struct TALER_RefreshLinkEncrypted +struct TALER_RefreshLinkEncryptedP { /** * Encrypted blinding key with @e blinding_key_enc_size bytes, * must be allocated at the end of this struct. */ - const char *blinding_key_enc; - - /** - * Number of bytes in @e blinding_key_enc. - */ - size_t blinding_key_enc_size; + char blinding_key_enc[sizeof (struct TALER_DenominationBlindingKeyP)]; /** * Encrypted private key of the coin. @@ -511,6 +504,10 @@ struct TALER_RefreshLinkEncrypted }; +GNUNET_NETWORK_STRUCT_END + + + /** * Decrypt the shared @a secret from the information in the * encrypted link secret @e secret_enc using the transfer @@ -618,11 +615,12 @@ TALER_transfer_encrypt (const struct TALER_LinkSecretP *secret, * * @param input encrypted refresh link data * @param secret shared secret to use for decryption - * @return NULL on error + * @param[out] output where to write decrypted refresh link */ -struct TALER_RefreshLinkDecrypted * -TALER_refresh_decrypt (const struct TALER_RefreshLinkEncrypted *input, - const struct TALER_LinkSecretP *secret); +void +TALER_refresh_decrypt (const struct TALER_RefreshLinkEncryptedP *input, + const struct TALER_LinkSecretP *secret, + struct TALER_RefreshLinkDecryptedP *output); /** @@ -630,36 +628,12 @@ TALER_refresh_decrypt (const struct TALER_RefreshLinkEncrypted *input, * * @param input plaintext refresh link data * @param secret shared secret to use for encryption - * @return NULL on error (should never happen) - */ -struct TALER_RefreshLinkEncrypted * -TALER_refresh_encrypt (const struct TALER_RefreshLinkDecrypted *input, - const struct TALER_LinkSecretP *secret); - - -/** - * Decode encrypted refresh link information from buffer. - * - * @param buf buffer with refresh link data - * @param buf_len number of bytes in @a buf - * @return NULL on error (@a buf_len too small) + * @param[out] output where to write encrypted refresh link */ -struct TALER_RefreshLinkEncrypted * -TALER_refresh_link_encrypted_decode (const char *buf, - size_t buf_len); - - -/** - * Encode encrypted refresh link information to buffer. - * - * @param rle refresh link to encode - * @param[out] buf_len set number of bytes returned - * @return NULL on error, otherwise buffer with encoded @a rle - */ -char * -TALER_refresh_link_encrypted_encode (const struct TALER_RefreshLinkEncrypted *rle, - size_t *buf_len); - +void +TALER_refresh_encrypt (const struct TALER_RefreshLinkDecryptedP *input, + const struct TALER_LinkSecretP *secret, + struct TALER_RefreshLinkEncryptedP *output); #endif diff --git a/src/include/taler_exchange_service.h b/src/include/taler_exchange_service.h index 1655e1a67..bcc794107 100644 --- a/src/include/taler_exchange_service.h +++ b/src/include/taler_exchange_service.h @@ -725,7 +725,7 @@ TALER_EXCHANGE_reserve_withdraw (struct TALER_EXCHANGE_Handle *exchange, const struct TALER_EXCHANGE_DenomPublicKey *pk, const struct TALER_ReservePrivateKeyP *reserve_priv, const struct TALER_CoinSpendPrivateKeyP *coin_priv, - const struct TALER_DenominationBlindingKey *blinding_key, + const struct TALER_DenominationBlindingKeyP *blinding_key, TALER_EXCHANGE_ReserveWithdrawResultCallback res_cb, void *res_cb_cls); diff --git a/src/include/taler_exchangedb_plugin.h b/src/include/taler_exchangedb_plugin.h index 6a3f9249c..59e33a9eb 100644 --- a/src/include/taler_exchangedb_plugin.h +++ b/src/include/taler_exchangedb_plugin.h @@ -442,7 +442,7 @@ struct TALER_EXCHANGEDB_RefreshCommitCoin * Encrypted data allowing those able to decrypt it to derive * the private keys of the new coins created by the refresh. */ - struct TALER_RefreshLinkEncrypted *refresh_link; + struct TALER_RefreshLinkEncryptedP refresh_link; /** * Blinded message to be signed (in envelope), with @e coin_env_size bytes. @@ -471,7 +471,7 @@ struct TALER_EXCHANGEDB_LinkDataList * Link data, used to recover the private key of the coin * by the owner of the old coin. */ - struct TALER_RefreshLinkEncrypted *link_data_enc; + struct TALER_RefreshLinkEncryptedP link_data_enc; /** * Denomination public key, determines the value of the coin. -- cgit v1.2.3