add batch logic to taler-exchange-secmod-cs

This commit is contained in:
Christian Grothoff 2022-11-13 19:03:52 +01:00
parent 9838e0fc33
commit 18aba0abbb
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
5 changed files with 843 additions and 141 deletions

View File

@ -2484,8 +2484,7 @@ struct TALER_CRYPTO_CsSignRequest
/** /**
* Request helper @a dh to sign @a msg using the public key corresponding to * Request helper @a dh to sign @a req.
* @a h_denom_pub.
* *
* This operation will block until the signature has been obtained. Should * This operation will block until the signature has been obtained. Should
* this process receive a signal (that is not ignored) while the operation is * this process receive a signal (that is not ignored) while the operation is
@ -2506,8 +2505,30 @@ TALER_CRYPTO_helper_cs_sign_melt (
/** /**
* Request helper @a dh to sign @a msg using the public key corresponding to * Request helper @a dh to batch sign batch @a reqs.
* @a h_denom_pub. *
* This operation will block until the signature has been obtained. Should
* this process receive a signal (that is not ignored) while the operation is
* pending, the operation will fail. Note that the helper may still believe
* that it created the signature. Thus, signals may result in a small
* differences in the signature counters. Retrying in this case may work.
*
* @param dh helper process connection
* @param reqs array with information about the keys to sign with and the values to sign
* @param reqs_length length of the @a reqs array
* @param[out] bss array set to the blind signatures, must be of length @a reqs_length!
* @return #TALER_EC_NONE on success
*/
enum TALER_ErrorCode
TALER_CRYPTO_helper_cs_batch_sign_melt (
struct TALER_CRYPTO_CsDenominationHelper *dh,
const struct TALER_CRYPTO_CsSignRequest *reqs,
unsigned int reqs_length,
struct TALER_BlindedDenominationSignature *bss);
/**
* Request helper @a dh to sign @a req.
* *
* This operation will block until the signature has been obtained. Should * This operation will block until the signature has been obtained. Should
* this process receive a signal (that is not ignored) while the operation is * this process receive a signal (that is not ignored) while the operation is
@ -2527,6 +2548,29 @@ TALER_CRYPTO_helper_cs_sign_withdraw (
struct TALER_BlindedDenominationSignature *bs); struct TALER_BlindedDenominationSignature *bs);
/**
* Request helper @a dh to sign batch of @a reqs requests.
*
* This operation will block until the signature has been obtained. Should
* this process receive a signal (that is not ignored) while the operation is
* pending, the operation will fail. Note that the helper may still believe
* that it created the signature. Thus, signals may result in a small
* differences in the signature counters. Retrying in this case may work.
*
* @param dh helper process connection
* @param reqs information about the keys to sign with and the values to sign
* @param reqs_length length of the @a reqs array
* @param[out] bs array set to the blind signatures, must be of length @a reqs_length!
* @return #TALER_EC_NONE on success
*/
enum TALER_ErrorCode
TALER_CRYPTO_helper_cs_batch_sign_withdraw (
struct TALER_CRYPTO_CsDenominationHelper *dh,
const struct TALER_CRYPTO_CsSignRequest *reqs,
unsigned int reqs_length,
struct TALER_BlindedDenominationSignature *bss);
/** /**
* Ask the helper to revoke the public key associated with @a h_cs. * Ask the helper to revoke the public key associated with @a h_cs.
* Will cause the helper to tell all clients that the key is now unavailable, * Will cause the helper to tell all clients that the key is now unavailable,

View File

@ -493,7 +493,7 @@ more:
switch (ntohs (hdr->type)) switch (ntohs (hdr->type))
{ {
case TALER_HELPER_CS_MT_RES_SIGNATURE: case TALER_HELPER_CS_MT_RES_SIGNATURE:
if (msize < sizeof (struct TALER_CRYPTO_SignResponse)) if (msize != sizeof (struct TALER_CRYPTO_SignResponse))
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
do_disconnect (dh); do_disconnect (dh);

File diff suppressed because it is too large Load Diff

View File

@ -35,10 +35,12 @@
#define TALER_HELPER_CS_MT_RES_SIGNATURE 9 #define TALER_HELPER_CS_MT_RES_SIGNATURE 9
#define TALER_HELPER_CS_MT_RES_SIGN_FAILURE 10 #define TALER_HELPER_CS_MT_RES_SIGN_FAILURE 10
#define TALER_HELPER_CS_MT_RES_RDERIVE 11 #define TALER_HELPER_CS_MT_RES_BATCH_SIGN_FAILURE 11
#define TALER_HELPER_CS_MT_RES_RDERIVE_FAILURE 12 #define TALER_HELPER_CS_MT_RES_RDERIVE 12
#define TALER_HELPER_CS_MT_RES_RDERIVE_FAILURE 13
#define TALER_HELPER_CS_MT_RES_BATCH_RDERIVE_FAILURE 14
#define TALER_HELPER_CS_SYNCED 13 #define TALER_HELPER_CS_SYNCED 15
GNUNET_NETWORK_STRUCT_BEGIN GNUNET_NETWORK_STRUCT_BEGIN
@ -134,8 +136,7 @@ struct TALER_CRYPTO_CsSignRequestMessage
struct TALER_CsPubHashP h_cs; struct TALER_CsPubHashP h_cs;
/** /**
* Planchet containing message to sign * Planchet containing message to sign and nonce to derive R from
* and nonce to derive R from
*/ */
struct TALER_BlindedCsPlanchet planchet; struct TALER_BlindedCsPlanchet planchet;

View File

@ -1568,7 +1568,9 @@ parse_key (struct Denomination *denom,
NULL != pos; NULL != pos;
pos = pos->next) pos = pos->next)
{ {
if (GNUNET_TIME_timestamp_cmp (pos->anchor, >, anchor)) if (GNUNET_TIME_timestamp_cmp (pos->anchor,
>,
anchor))
break; break;
before = pos; before = pos;
} }