From 95f99d32dd433e36e17f7ce7ce335b8187ab39ba Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 1 May 2015 09:59:18 +0200 Subject: minor bugfixes --- src/mint/taler-mint-httpd_responses.c | 8 +++++++- src/util/crypto.c | 20 ++++++++++---------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/mint/taler-mint-httpd_responses.c b/src/mint/taler-mint-httpd_responses.c index 4cd5f87ed..e37eea188 100644 --- a/src/mint/taler-mint-httpd_responses.c +++ b/src/mint/taler-mint-httpd_responses.c @@ -548,7 +548,13 @@ compile_reserve_history (const struct TALER_MINTDB_ReserveHistory *rh, break; } } - + if (0 == ret) + { + /* history is empty!? */ + GNUNET_break (0); + json_decref (json_history); + return NULL; + } if (GNUNET_SYSERR == TALER_amount_subtract (balance, &deposit_total, diff --git a/src/util/crypto.c b/src/util/crypto.c index a00783701..529caa930 100644 --- a/src/util/crypto.c +++ b/src/util/crypto.c @@ -290,7 +290,7 @@ TALER_refresh_link_encrypted_decode (const char *buf, { struct TALER_RefreshLinkEncrypted *rle; - if (buf_len < sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey)) + if (buf_len < sizeof (union TALER_CoinSpendPrivateKeyP)) return NULL; if (buf_len >= GNUNET_MAX_MALLOC_CHECKED) { @@ -298,9 +298,9 @@ TALER_refresh_link_encrypted_decode (const char *buf, return NULL; } rle = GNUNET_malloc (sizeof (struct TALER_RefreshLinkEncrypted) + - buf_len - sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey)); + buf_len - sizeof (union TALER_CoinSpendPrivateKeyP)); rle->blinding_key_enc = (const char *) &rle[1]; - rle->blinding_key_enc_size = buf_len - sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey); + rle->blinding_key_enc_size = buf_len - sizeof (union TALER_CoinSpendPrivateKeyP); memcpy (rle->coin_priv_enc, buf, buf_len); @@ -321,12 +321,12 @@ TALER_refresh_link_encrypted_encode (const struct TALER_RefreshLinkEncrypted *rl { char *buf; - if (rle->blinding_key_enc_size >= GNUNET_MAX_MALLOC_CHECKED - sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey)) + if (rle->blinding_key_enc_size >= GNUNET_MAX_MALLOC_CHECKED - sizeof (union TALER_CoinSpendPrivateKeyP)) { GNUNET_break (0); return NULL; } - *buf_len = sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey) + rle->blinding_key_enc_size; + *buf_len = sizeof (union TALER_CoinSpendPrivateKeyP) + rle->blinding_key_enc_size; buf = GNUNET_malloc (*buf_len); memcpy (buf, rle->coin_priv_enc, @@ -369,7 +369,7 @@ TALER_test_coin_valid (const struct TALER_CoinPublicInfo *coin_public_info) * Decrypt the shared @a secret from the information in the * encrypted link secret @e secret_enc using the transfer * private key and the coin's public key. - * + * * @param secret_enc encrypted link secret * @param transfer_priv transfer private key * @param coin_pub coin public key @@ -408,7 +408,7 @@ TALER_link_decrypt_secret (const struct TALER_EncryptedLinkSecretP *secret_enc, * Decrypt the shared @a secret from the information in the * encrypted link secret @e secret_enc using the transfer * public key and the coin's private key. - * + * * @param secret_enc encrypted link secret * @param transfer_pub transfer public key * @param coin_priv coin private key @@ -425,7 +425,7 @@ TALER_link_decrypt_secret2 (const struct TALER_EncryptedLinkSecretP *secret_enc, if (GNUNET_OK != GNUNET_CRYPTO_ecc_ecdh (&coin_priv->ecdhe_priv, - &trans_pub->ecdhe_pub, + &trans_pub->ecdhe_pub, &transfer_secret.key)) { GNUNET_break (0); @@ -446,8 +446,8 @@ TALER_link_decrypt_secret2 (const struct TALER_EncryptedLinkSecretP *secret_enc, /** * Encrypt the shared @a secret to generate the encrypted link secret. * Also creates the transfer key. - * - * @param secret link secret to encrypt + * + * @param secret link secret to encrypt * @param coin_pub coin public key * @param transfer_priv[out] set to transfer private key * @param transfer_pub[out] set to transfer public key -- cgit v1.2.3