aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Blättler <blatc2@bfh.ch>2024-06-06 13:30:15 +0200
committerChristian Blättler <blatc2@bfh.ch>2024-06-06 13:30:15 +0200
commit463cc84203aac25a3ffc0dd6bc750e00bb7d4513 (patch)
tree0e7ef4d2e8ec29b0e5664635441bb6df9cb868f4
parent4b748acb26818b75c2760e4218388cdafb5a771b (diff)
downloadexchange-463cc84203aac25a3ffc0dd6bc750e00bb7d4513.tar.xz
use gnunget query param helper
-rw-r--r--src/pq/pq_query_helper.c91
1 files changed, 1 insertions, 90 deletions
diff --git a/src/pq/pq_query_helper.c b/src/pq/pq_query_helper.c
index b1dfd4cf1..aa435deb4 100644
--- a/src/pq/pq_query_helper.c
+++ b/src/pq/pq_query_helper.c
@@ -305,100 +305,11 @@ TALER_PQ_query_param_denom_pub (
}
-/**
- * Function called to convert input argument into SQL parameters.
- *
- * @param cls closure
- * @param data pointer to input argument
- * @param data_len number of bytes in @a data (if applicable)
- * @param[out] param_values SQL data to set
- * @param[out] param_lengths SQL length data to set
- * @param[out] param_formats SQL format data to set
- * @param param_length number of entries available in the @a param_values, @a param_lengths and @a param_formats arrays
- * @param[out] scratch buffer for dynamic allocations (to be done via #GNUNET_malloc()
- * @param scratch_length number of entries left in @a scratch
- * @return -1 on error, number of offsets used in @a scratch otherwise
- */
-static int
-qconv_denom_sig (void *cls,
- const void *data,
- size_t data_len,
- void *param_values[],
- int param_lengths[],
- int param_formats[],
- unsigned int param_length,
- void *scratch[],
- unsigned int scratch_length)
-{
- const struct TALER_DenominationSignature *denom_sig = data;
- const struct GNUNET_CRYPTO_UnblindedSignature *ubs = denom_sig->unblinded_sig;
- size_t tlen;
- size_t len;
- uint32_t be[2];
- char *buf;
- void *tbuf;
-
- (void) cls;
- (void) data_len;
- GNUNET_assert (1 == param_length);
- GNUNET_assert (scratch_length > 0);
- GNUNET_break (NULL == cls);
- be[0] = htonl ((uint32_t) ubs->cipher);
- be[1] = htonl (0x00); /* magic marker: unblinded */
- switch (ubs->cipher)
- {
- case GNUNET_CRYPTO_BSA_RSA:
- tlen = GNUNET_CRYPTO_rsa_signature_encode (
- ubs->details.rsa_signature,
- &tbuf);
- break;
- case GNUNET_CRYPTO_BSA_CS:
- tlen = sizeof (ubs->details.cs_signature);
- break;
- default:
- GNUNET_assert (0);
- }
- len = tlen + sizeof (be);
- buf = GNUNET_malloc (len);
- GNUNET_memcpy (buf,
- &be,
- sizeof (be));
- switch (ubs->cipher)
- {
- case GNUNET_CRYPTO_BSA_RSA:
- GNUNET_memcpy (&buf[sizeof (be)],
- tbuf,
- tlen);
- GNUNET_free (tbuf);
- break;
- case GNUNET_CRYPTO_BSA_CS:
- GNUNET_memcpy (&buf[sizeof (be)],
- &ubs->details.cs_signature,
- tlen);
- break;
- default:
- GNUNET_assert (0);
- }
-
- scratch[0] = buf;
- param_values[0] = (void *) buf;
- param_lengths[0] = len;
- param_formats[0] = 1;
- return 1;
-}
-
-
struct GNUNET_PQ_QueryParam
TALER_PQ_query_param_denom_sig (
const struct TALER_DenominationSignature *denom_sig)
{
- struct GNUNET_PQ_QueryParam res = {
- .conv = &qconv_denom_sig,
- .data = denom_sig,
- .num_params = 1
- };
-
- return res;
+ return GNUNET_PQ_query_param_unblinded_sig (denom_sig->unblinded_sig);
}