From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 18 Nov 2026 16:01:54 +0100 Subject: [PATCH] secmod: answer every RSA batch sign request The client waits for one reply per announced sub-request, so the helper must not silently skip a trailing request of header size, and the client must not send an empty blinded message in the first place. Issue: https://bugs.taler.net/n/12190 Assisted by LLM --- src/util/crypto_helper_rsa.c | 8 +++++++- src/util/secmod_rsa.c | 9 ++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/util/crypto_helper_rsa.c b/src/util/crypto_helper_rsa.c index 1307dfc02..727239ca7 100644 --- a/src/util/crypto_helper_rsa.c +++ b/src/util/crypto_helper_rsa.c @@ -423,9 +423,15 @@ TALER_CRYPTO_helper_rsa_batch_sign ( 0, sizeof (*bss) * rsrs_length); /* Every request must fit into an IPC message of its own, together - with the batch header; otherwise it could never be transmitted. */ + with the batch header; otherwise it could never be transmitted. + An RSA blinded message is never empty. */ for (unsigned int i = 0; i= UINT16_MAX - sizeof (struct TALER_CRYPTO_BatchSignRequest) diff --git a/src/util/secmod_rsa.c b/src/util/secmod_rsa.c index 148202305..50feedfc7 100644 --- a/src/util/secmod_rsa.c +++ b/src/util/secmod_rsa.c @@ -784,7 +784,7 @@ handle_batch_sign_request (struct TES_Client *client, struct BatchJob jobs[bs]; while ( (idx < bs) && - (size > sizeof (struct TALER_CRYPTO_SignRequest)) ) + (size >= sizeof (struct TALER_CRYPTO_SignRequest)) ) { const struct TALER_CRYPTO_SignRequest *sr = off; uint16_t s = ntohs (sr->header.size); @@ -802,6 +802,13 @@ handle_batch_sign_request (struct TES_Client *client, size -= s; } GNUNET_break_op (0 == size); + if (idx < bs) + { + /* fewer requests than announced: the client waits for a reply + to each of them, so it must learn that the batch failed */ + GNUNET_break_op (0); + failure = true; + } bs = GNUNET_MIN (bs, idx); /* Note: we must finish (and thus reap) *every* job we started, -- 2.47.3