aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/include')
-rw-r--r--src/include/taler_crypto_lib.h33
-rw-r--r--src/include/taler_exchange_service.h9
-rw-r--r--src/include/taler_testing_lib.h30
-rw-r--r--src/include/taler_util.h7
4 files changed, 65 insertions, 14 deletions
diff --git a/src/include/taler_crypto_lib.h b/src/include/taler_crypto_lib.h
index 3ad441cb..373fc5c2 100644
--- a/src/include/taler_crypto_lib.h
+++ b/src/include/taler_crypto_lib.h
@@ -5947,34 +5947,55 @@ TALER_age_commitment_verify (
/**
* @brief helper function to free memory of a struct TALER_AgeCommitment
*
- * @param p the commitment from which all memory should be freed.
+ * @param ac the commitment from which all memory should be freed.
*/
void
TALER_age_commitment_free (
- struct TALER_AgeCommitment *p);
+ struct TALER_AgeCommitment *ac);
/**
* @brief helper function to free memory of a struct TALER_AgeProof
*
- * @param p the proof of commitment from which all memory should be freed.
+ * @param ap the proof of commitment from which all memory should be freed.
*/
void
TALER_age_proof_free (
- struct TALER_AgeProof *p);
+ struct TALER_AgeProof *ap);
/**
* @brief helper function to free memory of a struct TALER_AgeCommitmentProof
*
- * @param p the commitment and its proof from which all memory should be freed.
+ * @param acp the commitment and its proof from which all memory should be freed.
*/
void
TALER_age_commitment_proof_free (
- struct TALER_AgeCommitmentProof *p);
+ struct TALER_AgeCommitmentProof *acp);
/**
+ * @brief helper function to allocate and copy a struct TALER_AgeCommitmentProof
+ *
+ * @param[in] acp The original age commitment proof
+ * @return The deep copy of @e acp, allocated
+ */
+struct TALER_AgeCommitmentProof *
+TALER_age_commitment_proof_duplicate (
+ const struct TALER_AgeCommitmentProof *acp);
+
+/**
+ * @brief helper function to copy a struct TALER_AgeCommitmentProof
+ *
+ * @param[in] acp The original age commitment proof
+ * @param[out] nacp The struct to copy the data into, with freshly allocated and copied keys.
+ */
+void
+TALER_age_commitment_proof_deep_copy (
+ const struct TALER_AgeCommitmentProof *acp,
+ struct TALER_AgeCommitmentProof *nacp);
+
+/**
* @brief For age-withdraw, clients have to prove that the public keys for all
* age groups larger than the allowed maximum age group are derived by scalar
* multiplication from this Edx25519 public key (in Crockford Base32 encoding):
diff --git a/src/include/taler_exchange_service.h b/src/include/taler_exchange_service.h
index 1f3bbffe..77705379 100644
--- a/src/include/taler_exchange_service.h
+++ b/src/include/taler_exchange_service.h
@@ -3053,7 +3053,7 @@ struct TALER_EXCHANGE_RevealedCoinInfo
* Age commitment and its hash of the coin, might be NULL.
*/
struct TALER_AgeCommitmentProof *age_commitment_proof;
- struct TALER_AgeCommitmentHash *h_age_commitment;
+ struct TALER_AgeCommitmentHash h_age_commitment;
/**
* Blinding keys used to blind the fresh coin.
@@ -3197,10 +3197,11 @@ struct TALER_EXCHANGE_LinkedCoinInfo
struct TALER_CoinSpendPrivateKeyP coin_priv;
/**
- * Age commitment and its hash, if applicable. Might be NULL.
+ * Age commitment and its hash, if applicable.
*/
- struct TALER_AgeCommitmentProof *age_commitment_proof;
- struct TALER_AgeCommitmentHash *h_age_commitment;
+ bool has_age_commitment;
+ struct TALER_AgeCommitmentProof age_commitment_proof;
+ struct TALER_AgeCommitmentHash h_age_commitment;
/**
* Master secret of this coin.
diff --git a/src/include/taler_testing_lib.h b/src/include/taler_testing_lib.h
index 4996fbe2..d8793f4a 100644
--- a/src/include/taler_testing_lib.h
+++ b/src/include/taler_testing_lib.h
@@ -57,18 +57,44 @@
*
* @param is interpreter to fail
* @param status unexpected HTTP status code received
+ * @param expected expected HTTP status code
*/
-#define TALER_TESTING_unexpected_status(is,status) \
+#define TALER_TESTING_unexpected_status(is,status, expected) \
do { \
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, \
- "Unexpected response code %u to command %s in %s:%u\n", \
+ "Unexpected response code %u (expected: %u) to command %s in %s:%u\n", \
status, \
+ expected, \
TALER_TESTING_interpreter_get_current_label (is), \
__FILE__, \
__LINE__); \
TALER_TESTING_interpreter_fail (is); \
} while (0)
+/**
+ * Log an error message about us receiving an unexpected HTTP
+ * status code at the current command and fail the test and print the response
+ * body (expected as json).
+ *
+ * @param is interpreter to fail
+ * @param status unexpected HTTP status code received
+ * @param expected expected HTTP status code
+ * @param body received JSON-reply
+ */
+#define TALER_TESTING_unexpected_status_with_body(is,status, expected, body) \
+ do { \
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, \
+ "Unexpected response code %u (expected: %u) to " \
+ "command %s in %s:%u\nwith body:\n>>%s<<\n", \
+ status, \
+ expected, \
+ TALER_TESTING_interpreter_get_current_label (is), \
+ __FILE__, \
+ __LINE__, \
+ json_dumps (body, JSON_INDENT (2))); \
+ TALER_TESTING_interpreter_fail (is); \
+ } while (0)
+
/**
* Log an error message about a command not having
diff --git a/src/include/taler_util.h b/src/include/taler_util.h
index e0473bff..8762f7dc 100644
--- a/src/include/taler_util.h
+++ b/src/include/taler_util.h
@@ -578,11 +578,14 @@ TALER_parse_age_group_string (
/**
* @brief Encodes the age mask into a string, like "8:10:12:14:16:18:21"
*
+ * NOTE: This function uses a static buffer. It is not safe to call this
+ * function concurrently.
+ *
* @param mask Age mask
- * @return String representation of the age mask, allocated by GNUNET_malloc.
+ * @return String representation of the age mask.
* Can be used as value in the TALER config.
*/
-char *
+const char *
TALER_age_mask_to_string (
const struct TALER_AgeMask *mask);