commit 2e23faee1e2bb6c1260872c5a6e2c0406228db88
parent 22ac409a1116d97050d17771dfe8649e8b79c301
Author: Christian Grothoff <christian@grothoff.org>
Date: Wed, 6 May 2026 22:03:02 +0200
DCE: remove dead non-batch variants
Diffstat:
7 files changed, 50 insertions(+), 770 deletions(-)
diff --git a/src/exchange/taler-exchange-httpd_secmod-helpers.c b/src/exchange/taler-exchange-httpd_secmod-helpers.c
@@ -565,43 +565,6 @@ TEH_SECMOD_iterate_esign_keys (
}
-// FIXME: rename!
-enum TALER_ErrorCode
-TEH_SECMOD_denom_cs_compute_r_pub (
- const struct TEH_SECMOD_CsDeriveData *cdd,
- bool for_melt,
- struct GNUNET_CRYPTO_CSPublicRPairP *r_pub)
-{
- const struct TALER_DenominationHashP *h_denom_pub = cdd->h_denom_pub;
- const struct GNUNET_CRYPTO_CsSessionNonce *nonce = cdd->nonce;
- struct HelperDenomination *hd;
-
- hd = GNUNET_CONTAINER_multihashmap_get (denom_keys,
- &h_denom_pub->hash);
- if (NULL == hd)
- {
- return TALER_EC_EXCHANGE_GENERIC_DENOMINATION_KEY_UNKNOWN;
- }
- if (GNUNET_CRYPTO_BSA_CS !=
- hd->denom_pub.bsign_pub_key->cipher)
- {
- return TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE;
- }
-
- {
- struct TALER_CRYPTO_CsDeriveRequest cdr = {
- .h_cs = &hd->h_details.h_cs,
- .nonce = nonce
- };
- return TALER_CRYPTO_helper_cs_r_derive (csdh,
- &cdr,
- for_melt,
- r_pub);
- }
-}
-
-
-// FIXME: rename!
enum TALER_ErrorCode
TEH_SECMOD_denom_cs_batch_r_pub_simple (
unsigned int cdds_length,
@@ -640,7 +603,6 @@ TEH_SECMOD_denom_cs_batch_r_pub_simple (
}
-// FIXME: rename!
enum TALER_ErrorCode
TEH_SECMOD_denom_cs_batch_r_pub (
size_t num,
@@ -832,7 +794,6 @@ TEH_SECMOD_exchange_sign (
}
-// FIXME: rename
enum GNUNET_GenericReturnValue
TEH_SECMOD_denom_load_meta (
const struct TALER_DenominationHashP *h_denom_pub,
@@ -877,7 +838,6 @@ TEH_SECMOD_denom_load_meta (
}
-// FIXME: rename
enum GNUNET_GenericReturnValue
TEH_SECMOD_esign_load_meta (const struct TALER_ExchangePublicKeyP *exchange_pub,
struct TALER_EXCHANGEDB_SignkeyMetaData *meta)
@@ -921,7 +881,6 @@ TEH_SECMOD_denom_priv_check_lost (
}
-// FIXME: rename!
void
TEH_SECMOD_esign_revoke (
const struct TALER_ExchangePublicKeyP *exchange_pub)
@@ -932,7 +891,6 @@ TEH_SECMOD_esign_revoke (
}
-// FIXME: rename!
void
TEH_SECMOD_denom_revoke (
const struct TALER_DenominationHashP *h_denom_pub)
diff --git a/src/exchange/taler-exchange-httpd_secmod-helpers.h b/src/exchange/taler-exchange-httpd_secmod-helpers.h
@@ -234,21 +234,6 @@ struct TEH_SECMOD_CsDeriveData
/**
- * Request to derive CS @a r_pub using the denomination and nonce from @a cdd.
- *
- * @param cdd data to compute @a r_pub from
- * @param for_melt true if this is for a melt operation
- * @param[out] r_pub where to write the result
- * @return #TALER_EC_NONE on success
- */
-enum TALER_ErrorCode
-TEH_SECMOD_denom_cs_compute_r_pub (
- const struct TEH_SECMOD_CsDeriveData *cdd,
- bool for_melt,
- struct GNUNET_CRYPTO_CSPublicRPairP *r_pub);
-
-
-/**
* Request to derive a bunch of CS @a r_pubs using the
* denominations and nonces from @a cdds.
*
diff --git a/src/include/taler/taler_crypto_lib.h b/src/include/taler/taler_crypto_lib.h
@@ -3515,28 +3515,6 @@ struct TALER_CRYPTO_RsaSignRequest
/**
- * Request helper @a dh to sign message in @a rsr using the public key
- * corresponding to the key in @a rsr.
- *
- * 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 rsr details about the requested signature
- * @param[out] bs set to the blind signature
- * @return #TALER_EC_NONE on success
- */
-enum TALER_ErrorCode
-TALER_CRYPTO_helper_rsa_sign (
- struct TALER_CRYPTO_RsaDenominationHelper *dh,
- const struct TALER_CRYPTO_RsaSignRequest *rsr,
- struct TALER_BlindedDenominationSignature *bs);
-
-
-/**
* Request helper @a dh to batch sign messages in @a rsrs using the public key
* corresponding to the keys in @a rsrs.
*
@@ -3547,9 +3525,7 @@ TALER_CRYPTO_helper_rsa_sign (
* differences in the signature counters. Retrying in this case may work.
*
* Note that in case of errors, the @a bss array may still have been partially
- * filled with signatures, which in this case must be freed by the caller
- * (this is in contrast to the #TALER_CRYPTO_helper_rsa_sign() API which never
- * returns any signatures if there was an error).
+ * filled with signatures, which in this case must be freed by the caller.
*
* @param dh helper process connection
* @param rsrs array with details about the requested signatures
@@ -3682,29 +3658,6 @@ struct TALER_CRYPTO_CsSignRequest
/**
- * Request helper @a dh to sign @a req.
- *
- * 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 req information about the key to sign with and the value to sign
- * @param for_melt true if for melt operation
- * @param[out] bs set to the blind signature
- * @return #TALER_EC_NONE on success
- */
-enum TALER_ErrorCode
-TALER_CRYPTO_helper_cs_sign (
- struct TALER_CRYPTO_CsDenominationHelper *dh,
- const struct TALER_CRYPTO_CsSignRequest *req,
- bool for_melt,
- 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
@@ -3768,30 +3721,6 @@ struct TALER_CRYPTO_CsDeriveRequest
/**
- * Ask the helper to derive R using the information
- * from @a cdr.
- *
- * This operation will block until the R 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 to process connection
- * @param cdr derivation input data
- * @param for_melt true if this is for a melt operation
- * @param[out] crp set to the pair of R values
- * @return set to the error code (or #TALER_EC_NONE on success)
- */
-enum TALER_ErrorCode
-TALER_CRYPTO_helper_cs_r_derive (
- struct TALER_CRYPTO_CsDenominationHelper *dh,
- const struct TALER_CRYPTO_CsDeriveRequest *cdr,
- bool for_melt,
- struct GNUNET_CRYPTO_CSPublicRPairP *crp);
-
-
-/**
* Ask the helper to derive R using the information from @a cdrs.
*
* This operation will block until the R has been obtained. Should
@@ -6407,6 +6336,26 @@ TALER_exchange_secmod_eddsa_sign (
/**
+ * Create security module denomination signature.
+ *
+ * @param h_cs hash of the CS public key to sign
+ * @param section_name name of the section in the configuration
+ * @param start_sign starting point of validity for signing
+ * @param duration how long will the key be in use
+ * @param secm_priv security module key to sign with
+ * @param[out] secm_sig where to write the signature
+ */
+void
+TALER_exchange_secmod_cs_sign (
+ const struct TALER_CsPubHashP *h_cs,
+ const char *section_name,
+ struct GNUNET_TIME_Timestamp start_sign,
+ struct GNUNET_TIME_Relative duration,
+ const struct TALER_SecurityModulePrivateKeyP *secm_priv,
+ struct TALER_SecurityModuleSignatureP *secm_sig);
+
+
+/**
* Verify security module EdDSA signature.
*
* @param exchange_pub public signing key to validate
@@ -6467,26 +6416,6 @@ TALER_exchange_secmod_rsa_verify (
/**
- * Create security module denomination signature.
- *
- * @param h_cs hash of the CS public key to sign
- * @param section_name name of the section in the configuration
- * @param start_sign starting point of validity for signing
- * @param duration how long will the key be in use
- * @param secm_priv security module key to sign with
- * @param[out] secm_sig where to write the signature
- */
-void
-TALER_exchange_secmod_cs_sign (
- const struct TALER_CsPubHashP *h_cs,
- const char *section_name,
- struct GNUNET_TIME_Timestamp start_sign,
- struct GNUNET_TIME_Relative duration,
- const struct TALER_SecurityModulePrivateKeyP *secm_priv,
- struct TALER_SecurityModuleSignatureP *secm_sig);
-
-
-/**
* Verify security module denomination signature.
*
* @param h_cs hash of the public key to validate
diff --git a/src/util/crypto_helper_cs.c b/src/util/crypto_helper_cs.c
@@ -392,210 +392,6 @@ more:
}
-enum TALER_ErrorCode
-TALER_CRYPTO_helper_cs_sign (
- struct TALER_CRYPTO_CsDenominationHelper *dh,
- const struct TALER_CRYPTO_CsSignRequest *req,
- bool for_melt,
- struct TALER_BlindedDenominationSignature *bs)
-{
- enum TALER_ErrorCode ec = TALER_EC_INVALID;
- const struct TALER_CsPubHashP *h_cs = req->h_cs;
-
- memset (bs,
- 0,
- sizeof (*bs));
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Starting signature process\n");
- if (GNUNET_OK !=
- try_connect (dh))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "Failed to connect to helper\n");
- return TALER_EC_EXCHANGE_DENOMINATION_HELPER_UNAVAILABLE;
- }
-
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Requesting signature\n");
- {
- char buf[sizeof (struct TALER_CRYPTO_CsSignRequestMessage)];
- struct TALER_CRYPTO_CsSignRequestMessage *sr
- = (struct TALER_CRYPTO_CsSignRequestMessage *) buf;
-
- sr->header.size = htons (sizeof (buf));
- sr->header.type = htons (TALER_HELPER_CS_MT_REQ_SIGN);
- sr->for_melt = htonl (for_melt ? 1 : 0);
- sr->h_cs = *h_cs;
- sr->message = *req->blinded_planchet;
- if (GNUNET_OK !=
- TALER_crypto_helper_send_all (dh->sock,
- buf,
- sizeof (buf)))
- {
- GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING,
- "send");
- do_disconnect (dh);
- return TALER_EC_EXCHANGE_DENOMINATION_HELPER_UNAVAILABLE;
- }
- }
-
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Awaiting reply\n");
- {
- char buf[UINT16_MAX];
- size_t off = 0;
- const struct GNUNET_MessageHeader *hdr
- = (const struct GNUNET_MessageHeader *) buf;
- bool finished = false;
-
- while (1)
- {
- uint16_t msize;
- ssize_t ret;
-
- ret = recv (dh->sock,
- &buf[off],
- sizeof (buf) - off,
- (finished && (0 == off))
- ? MSG_DONTWAIT
- : 0);
- if (ret < 0)
- {
- if (EINTR == errno)
- continue;
- if (EAGAIN == errno)
- {
- GNUNET_assert (finished);
- GNUNET_assert (0 == off);
- return ec;
- }
- GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING,
- "recv");
- do_disconnect (dh);
- ec = TALER_EC_EXCHANGE_DENOMINATION_HELPER_UNAVAILABLE;
- break;
- }
- if (0 == ret)
- {
- GNUNET_break (0 == off);
- if (! finished)
- ec = TALER_EC_EXCHANGE_SIGNKEY_HELPER_BUG;
- return ec;
- }
- off += ret;
-more:
- if (off < sizeof (struct GNUNET_MessageHeader))
- continue;
- msize = ntohs (hdr->size);
- if (off < msize)
- continue;
- switch (ntohs (hdr->type))
- {
- case TALER_HELPER_CS_MT_RES_SIGNATURE:
- if (msize != sizeof (struct TALER_CRYPTO_SignResponse))
- {
- GNUNET_break_op (0);
- do_disconnect (dh);
- ec = TALER_EC_EXCHANGE_DENOMINATION_HELPER_BUG;
- goto end;
- }
- if (finished)
- {
- GNUNET_break_op (0);
- do_disconnect (dh);
- ec = TALER_EC_EXCHANGE_DENOMINATION_HELPER_BUG;
- goto end;
- }
- {
- const struct TALER_CRYPTO_SignResponse *sr =
- (const struct TALER_CRYPTO_SignResponse *) buf;
- struct GNUNET_CRYPTO_BlindedSignature *blinded_sig;
-
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Received signature\n");
- ec = TALER_EC_NONE;
- finished = true;
- blinded_sig = GNUNET_new (struct GNUNET_CRYPTO_BlindedSignature);
- blinded_sig->cipher = GNUNET_CRYPTO_BSA_CS;
- blinded_sig->rc = 1;
- blinded_sig->details.blinded_cs_answer.b = ntohl (sr->b);
- blinded_sig->details.blinded_cs_answer.s_scalar = sr->cs_answer;
- bs->blinded_sig = blinded_sig;
- break;
- }
- case TALER_HELPER_CS_MT_RES_SIGN_FAILURE:
- if (msize != sizeof (struct TALER_CRYPTO_SignFailure))
- {
- GNUNET_break_op (0);
- do_disconnect (dh);
- ec = TALER_EC_EXCHANGE_DENOMINATION_HELPER_BUG;
- goto end;
- }
- {
- const struct TALER_CRYPTO_SignFailure *sf =
- (const struct TALER_CRYPTO_SignFailure *) buf;
-
- ec = (enum TALER_ErrorCode) (int) ntohl (sf->ec);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Signing failed with status %d!\n",
- ec);
- finished = true;
- break;
- }
- case TALER_HELPER_CS_MT_AVAIL:
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Received new key!\n");
- if (GNUNET_OK !=
- handle_mt_avail (dh,
- hdr))
- {
- GNUNET_break_op (0);
- do_disconnect (dh);
- ec = TALER_EC_EXCHANGE_DENOMINATION_HELPER_BUG;
- goto end;
- }
- break; /* while(1) loop ensures we recvfrom() again */
- case TALER_HELPER_CS_MT_PURGE:
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Received revocation!\n");
- if (GNUNET_OK !=
- handle_mt_purge (dh,
- hdr))
- {
- GNUNET_break_op (0);
- do_disconnect (dh);
- ec = TALER_EC_EXCHANGE_DENOMINATION_HELPER_BUG;
- goto end;
- }
- break; /* while(1) loop ensures we recvfrom() again */
- case TALER_HELPER_CS_SYNCED:
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "Synchronized add odd time with CS helper!\n");
- dh->synced = true;
- break;
- default:
- GNUNET_break_op (0);
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Received unexpected message of type %u\n",
- ntohs (hdr->type));
- do_disconnect (dh);
- ec = TALER_EC_EXCHANGE_DENOMINATION_HELPER_BUG;
- goto end;
- }
- memmove (buf,
- &buf[msize],
- off - msize);
- off -= msize;
- goto more;
- } /* while(1) */
-end:
- if (finished)
- TALER_blinded_denom_sig_free (bs);
- return ec;
- }
-}
-
-
void
TALER_CRYPTO_helper_cs_revoke (
struct TALER_CRYPTO_CsDenominationHelper *dh,
@@ -627,191 +423,6 @@ TALER_CRYPTO_helper_cs_revoke (
enum TALER_ErrorCode
-TALER_CRYPTO_helper_cs_r_derive (struct TALER_CRYPTO_CsDenominationHelper *dh,
- const struct TALER_CRYPTO_CsDeriveRequest *cdr,
- bool for_melt,
- struct GNUNET_CRYPTO_CSPublicRPairP *crp)
-{
- enum TALER_ErrorCode ec = TALER_EC_INVALID;
- const struct TALER_CsPubHashP *h_cs = cdr->h_cs;
- const struct GNUNET_CRYPTO_CsSessionNonce *nonce = cdr->nonce;
-
- memset (crp,
- 0,
- sizeof (*crp));
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Starting R derivation process\n");
- if (GNUNET_OK !=
- try_connect (dh))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "Failed to connect to helper\n");
- return TALER_EC_EXCHANGE_DENOMINATION_HELPER_UNAVAILABLE;
- }
-
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Requesting R\n");
- {
- struct TALER_CRYPTO_CsRDeriveRequest rdr = {
- .header.size = htons (sizeof (rdr)),
- .header.type = htons (TALER_HELPER_CS_MT_REQ_RDERIVE),
- .for_melt = htonl (for_melt ? 1 : 0),
- .h_cs = *h_cs,
- .nonce = *nonce
- };
-
- if (GNUNET_OK !=
- TALER_crypto_helper_send_all (dh->sock,
- &rdr,
- sizeof (rdr)))
- {
- GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING,
- "send");
- do_disconnect (dh);
- return TALER_EC_EXCHANGE_DENOMINATION_HELPER_UNAVAILABLE;
- }
- }
-
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Awaiting reply\n");
- {
- char buf[UINT16_MAX];
- size_t off = 0;
- const struct GNUNET_MessageHeader *hdr
- = (const struct GNUNET_MessageHeader *) buf;
- bool finished = false;
-
- while (1)
- {
- uint16_t msize;
- ssize_t ret;
-
- ret = recv (dh->sock,
- &buf[off],
- sizeof (buf) - off,
- (finished && (0 == off))
- ? MSG_DONTWAIT
- : 0);
- if (ret < 0)
- {
- if (EINTR == errno)
- continue;
- if (EAGAIN == errno)
- {
- GNUNET_assert (finished);
- GNUNET_assert (0 == off);
- return ec;
- }
- GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING,
- "recv");
- do_disconnect (dh);
- return TALER_EC_EXCHANGE_DENOMINATION_HELPER_UNAVAILABLE;
- }
- if (0 == ret)
- {
- GNUNET_break (0 == off);
- if (! finished)
- return TALER_EC_EXCHANGE_SIGNKEY_HELPER_BUG;
- return ec;
- }
- off += ret;
-more:
- if (off < sizeof (struct GNUNET_MessageHeader))
- continue;
- msize = ntohs (hdr->size);
- if (off < msize)
- continue;
- switch (ntohs (hdr->type))
- {
- case TALER_HELPER_CS_MT_RES_RDERIVE:
- if (msize != sizeof (struct TALER_CRYPTO_RDeriveResponse))
- {
- GNUNET_break_op (0);
- do_disconnect (dh);
- return TALER_EC_EXCHANGE_DENOMINATION_HELPER_BUG;
- }
- if (finished)
- {
- GNUNET_break_op (0);
- do_disconnect (dh);
- return TALER_EC_EXCHANGE_DENOMINATION_HELPER_BUG;
- }
- {
- const struct TALER_CRYPTO_RDeriveResponse *rdr =
- (const struct TALER_CRYPTO_RDeriveResponse *) buf;
-
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Received R\n");
- finished = true;
- ec = TALER_EC_NONE;
- *crp = rdr->r_pub;
- break;
- }
- case TALER_HELPER_CS_MT_RES_RDERIVE_FAILURE:
- if (msize != sizeof (struct TALER_CRYPTO_RDeriveFailure))
- {
- GNUNET_break_op (0);
- do_disconnect (dh);
- return TALER_EC_EXCHANGE_DENOMINATION_HELPER_BUG;
- }
- {
- const struct TALER_CRYPTO_RDeriveFailure *rdf =
- (const struct TALER_CRYPTO_RDeriveFailure *) buf;
-
- ec = (enum TALER_ErrorCode) (int) ntohl (rdf->ec);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "R derivation failed!\n");
- finished = true;
- break;
- }
- case TALER_HELPER_CS_MT_AVAIL:
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Received new key!\n");
- if (GNUNET_OK !=
- handle_mt_avail (dh,
- hdr))
- {
- GNUNET_break_op (0);
- do_disconnect (dh);
- return TALER_EC_EXCHANGE_DENOMINATION_HELPER_BUG;
- }
- break; /* while(1) loop ensures we recvfrom() again */
- case TALER_HELPER_CS_MT_PURGE:
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Received revocation!\n");
- if (GNUNET_OK !=
- handle_mt_purge (dh,
- hdr))
- {
- GNUNET_break_op (0);
- do_disconnect (dh);
- return TALER_EC_EXCHANGE_DENOMINATION_HELPER_BUG;
- }
- break; /* while(1) loop ensures we recvfrom() again */
- case TALER_HELPER_CS_SYNCED:
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "Synchronized add odd time with CS helper!\n");
- dh->synced = true;
- break;
- default:
- GNUNET_break_op (0);
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Received unexpected message of type %u\n",
- ntohs (hdr->type));
- do_disconnect (dh);
- return TALER_EC_EXCHANGE_DENOMINATION_HELPER_BUG;
- }
- memmove (buf,
- &buf[msize],
- off - msize);
- off -= msize;
- goto more;
- } /* while(1) */
- }
-}
-
-
-enum TALER_ErrorCode
TALER_CRYPTO_helper_cs_batch_sign (
struct TALER_CRYPTO_CsDenominationHelper *dh,
unsigned int reqs_length,
diff --git a/src/util/crypto_helper_rsa.c b/src/util/crypto_helper_rsa.c
@@ -402,219 +402,6 @@ more:
enum TALER_ErrorCode
-TALER_CRYPTO_helper_rsa_sign (
- struct TALER_CRYPTO_RsaDenominationHelper *dh,
- const struct TALER_CRYPTO_RsaSignRequest *rsr,
- struct TALER_BlindedDenominationSignature *bs)
-{
- enum TALER_ErrorCode ec = TALER_EC_INVALID;
-
- memset (bs,
- 0,
- sizeof (*bs));
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Starting signature process\n");
- if (GNUNET_OK !=
- try_connect (dh))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "Failed to connect to helper\n");
- return TALER_EC_EXCHANGE_DENOMINATION_HELPER_UNAVAILABLE;
- }
-
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Requesting signature\n");
- {
- char buf[sizeof (struct TALER_CRYPTO_SignRequest) + rsr->msg_size];
- struct TALER_CRYPTO_SignRequest *sr
- = (struct TALER_CRYPTO_SignRequest *) buf;
-
- sr->header.size = htons (sizeof (buf));
- sr->header.type = htons (TALER_HELPER_RSA_MT_REQ_SIGN);
- sr->reserved = htonl (0);
- sr->h_rsa = *rsr->h_rsa;
- GNUNET_memcpy (&sr[1],
- rsr->msg,
- rsr->msg_size);
- if (GNUNET_OK !=
- TALER_crypto_helper_send_all (dh->sock,
- buf,
- sizeof (buf)))
- {
- GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING,
- "send");
- do_disconnect (dh);
- return TALER_EC_EXCHANGE_DENOMINATION_HELPER_UNAVAILABLE;
- }
- }
-
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Awaiting reply\n");
- {
- char buf[UINT16_MAX];
- size_t off = 0;
- const struct GNUNET_MessageHeader *hdr
- = (const struct GNUNET_MessageHeader *) buf;
- bool finished = false;
-
- while (1)
- {
- uint16_t msize;
- ssize_t ret;
-
- ret = recv (dh->sock,
- &buf[off],
- sizeof (buf) - off,
- (finished && (0 == off))
- ? MSG_DONTWAIT
- : 0);
- if (ret < 0)
- {
- if (EINTR == errno)
- continue;
- if (EAGAIN == errno)
- {
- GNUNET_assert (finished);
- GNUNET_assert (0 == off);
- return ec;
- }
- GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING,
- "recv");
- do_disconnect (dh);
- ec = TALER_EC_EXCHANGE_DENOMINATION_HELPER_UNAVAILABLE;
- break;
- }
- if (0 == ret)
- {
- GNUNET_break (0 == off);
- if (! finished)
- ec = TALER_EC_EXCHANGE_SIGNKEY_HELPER_BUG;
- return ec;
- }
- off += ret;
-more:
- if (off < sizeof (struct GNUNET_MessageHeader))
- continue;
- msize = ntohs (hdr->size);
- if (off < msize)
- continue;
- switch (ntohs (hdr->type))
- {
- case TALER_HELPER_RSA_MT_RES_SIGNATURE:
- if (msize < sizeof (struct TALER_CRYPTO_SignResponse))
- {
- GNUNET_break_op (0);
- do_disconnect (dh);
- ec = TALER_EC_EXCHANGE_DENOMINATION_HELPER_BUG;
- goto end;
- }
- if (finished)
- {
- GNUNET_break_op (0);
- do_disconnect (dh);
- ec = TALER_EC_EXCHANGE_DENOMINATION_HELPER_BUG;
- goto end;
- }
- {
- const struct TALER_CRYPTO_SignResponse *sr =
- (const struct TALER_CRYPTO_SignResponse *) buf;
- struct GNUNET_CRYPTO_RsaSignature *rsa_signature;
- struct GNUNET_CRYPTO_BlindedSignature *blind_sig;
-
- rsa_signature = GNUNET_CRYPTO_rsa_signature_decode (
- &sr[1],
- msize - sizeof (*sr));
- if (NULL == rsa_signature)
- {
- GNUNET_break_op (0);
- do_disconnect (dh);
- ec = TALER_EC_EXCHANGE_DENOMINATION_HELPER_BUG;
- goto end;
- }
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Received signature\n");
- ec = TALER_EC_NONE;
- finished = true;
- blind_sig = GNUNET_new (struct GNUNET_CRYPTO_BlindedSignature);
- blind_sig->cipher = GNUNET_CRYPTO_BSA_RSA;
- blind_sig->rc = 1;
- blind_sig->details.blinded_rsa_signature = rsa_signature;
- bs->blinded_sig = blind_sig;
- break;
- }
- case TALER_HELPER_RSA_MT_RES_SIGN_FAILURE:
- if (msize != sizeof (struct TALER_CRYPTO_SignFailure))
- {
- GNUNET_break_op (0);
- do_disconnect (dh);
- ec = TALER_EC_EXCHANGE_DENOMINATION_HELPER_BUG;
- goto end;
- }
- {
- const struct TALER_CRYPTO_SignFailure *sf =
- (const struct TALER_CRYPTO_SignFailure *) buf;
-
- ec = (enum TALER_ErrorCode) (int) ntohl (sf->ec);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Signing failed!\n");
- finished = true;
- break;
- }
- case TALER_HELPER_RSA_MT_AVAIL:
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Received new key!\n");
- if (GNUNET_OK !=
- handle_mt_avail (dh,
- hdr))
- {
- GNUNET_break_op (0);
- do_disconnect (dh);
- ec = TALER_EC_EXCHANGE_DENOMINATION_HELPER_BUG;
- goto end;
- }
- break; /* while(1) loop ensures we recvfrom() again */
- case TALER_HELPER_RSA_MT_PURGE:
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Received revocation!\n");
- if (GNUNET_OK !=
- handle_mt_purge (dh,
- hdr))
- {
- GNUNET_break_op (0);
- do_disconnect (dh);
- ec = TALER_EC_EXCHANGE_DENOMINATION_HELPER_BUG;
- goto end;
- }
- break; /* while(1) loop ensures we recvfrom() again */
- case TALER_HELPER_RSA_SYNCED:
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "Synchronized add odd time with RSA helper!\n");
- dh->synced = true;
- break;
- default:
- GNUNET_break_op (0);
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Received unexpected message of type %u\n",
- ntohs (hdr->type));
- do_disconnect (dh);
- ec = TALER_EC_EXCHANGE_DENOMINATION_HELPER_BUG;
- goto end;
- }
- memmove (buf,
- &buf[msize],
- off - msize);
- off -= msize;
- goto more;
- } /* while(1) */
-end:
- if (finished)
- TALER_blinded_denom_sig_free (bs);
- return ec;
- }
-}
-
-
-enum TALER_ErrorCode
TALER_CRYPTO_helper_rsa_batch_sign (
struct TALER_CRYPTO_RsaDenominationHelper *dh,
unsigned int rsrs_length,
diff --git a/src/util/test_helper_cs.c b/src/util/test_helper_cs.c
@@ -300,8 +300,9 @@ test_r_derive (struct TALER_CRYPTO_CsDenominationHelper *dh)
.nonce = &nonce.cs_nonce
};
- ec = TALER_CRYPTO_helper_cs_r_derive (
+ ec = TALER_CRYPTO_helper_cs_r_batch_derive (
dh,
+ 1,
&cdr,
false,
&bi.details.cs_values);
@@ -398,10 +399,11 @@ test_r_derive (struct TALER_CRYPTO_CsDenominationHelper *dh)
GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
&nonce,
sizeof (nonce));
- ec = TALER_CRYPTO_helper_cs_r_derive (dh,
- &cdr,
- false,
- &crp);
+ ec = TALER_CRYPTO_helper_cs_r_batch_derive (dh,
+ 1,
+ &cdr,
+ false,
+ &crp);
if (TALER_EC_EXCHANGE_GENERIC_DENOMINATION_KEY_UNKNOWN != ec)
{
GNUNET_break (0);
@@ -454,8 +456,9 @@ test_signing (struct TALER_CRYPTO_CsDenominationHelper *dh)
TALER_cs_withdraw_nonce_derive (&ps,
&nonce.cs_nonce);
- ec = TALER_CRYPTO_helper_cs_r_derive (
+ ec = TALER_CRYPTO_helper_cs_r_batch_derive (
dh,
+ 1,
&cdr,
false,
&bi.details.cs_values);
@@ -482,8 +485,9 @@ test_signing (struct TALER_CRYPTO_CsDenominationHelper *dh)
csr.h_cs = &keys[i].h_cs;
csr.blinded_planchet
= &pd.blinded_planchet.blinded_message->details.cs_blinded_message;
- ec = TALER_CRYPTO_helper_cs_sign (
+ ec = TALER_CRYPTO_helper_cs_batch_sign (
dh,
+ 1,
&csr,
false,
&ds);
@@ -590,8 +594,9 @@ test_signing (struct TALER_CRYPTO_CsDenominationHelper *dh)
csr.h_cs = &rnd;
csr.blinded_planchet
= &pd.blinded_planchet.blinded_message->details.cs_blinded_message;
- ec = TALER_CRYPTO_helper_cs_sign (
+ ec = TALER_CRYPTO_helper_cs_batch_sign (
dh,
+ 1,
&csr,
false,
&ds);
@@ -885,8 +890,9 @@ perf_signing (struct TALER_CRYPTO_CsDenominationHelper *dh,
TALER_cs_withdraw_nonce_derive (
&ps,
&nonce.cs_nonce);
- ec = TALER_CRYPTO_helper_cs_r_derive (
+ ec = TALER_CRYPTO_helper_cs_r_batch_derive (
dh,
+ 1,
&cdr,
true,
&bv.details.cs_values);
@@ -917,8 +923,9 @@ perf_signing (struct TALER_CRYPTO_CsDenominationHelper *dh,
csr.h_cs = &keys[i].h_cs;
csr.blinded_planchet
= &pd.blinded_planchet.blinded_message->details.cs_blinded_message;
- ec = TALER_CRYPTO_helper_cs_sign (
+ ec = TALER_CRYPTO_helper_cs_batch_sign (
dh,
+ 1,
&csr,
true,
&ds);
diff --git a/src/util/test_helper_rsa.c b/src/util/test_helper_rsa.c
@@ -322,9 +322,10 @@ test_signing (struct TALER_CRYPTO_RsaDenominationHelper *dh)
"Requesting signature over %u bytes with key %s\n",
(unsigned int) rsr.msg_size,
GNUNET_h2s (&rsr.h_rsa->hash));
- ec = TALER_CRYPTO_helper_rsa_sign (dh,
- &rsr,
- &ds);
+ ec = TALER_CRYPTO_helper_rsa_batch_sign (dh,
+ 1,
+ &rsr,
+ &ds);
}
TALER_blinded_planchet_free (&pd.blinded_planchet);
}
@@ -427,9 +428,10 @@ test_signing (struct TALER_CRYPTO_RsaDenominationHelper *dh)
GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
&rnd,
sizeof (rnd));
- ec = TALER_CRYPTO_helper_rsa_sign (dh,
- &rsr,
- &ds);
+ ec = TALER_CRYPTO_helper_rsa_batch_sign (dh,
+ 1,
+ &rsr,
+ &ds);
if (TALER_EC_EXCHANGE_GENERIC_DENOMINATION_KEY_UNKNOWN != ec)
{
if (TALER_EC_NONE == ec)
@@ -745,9 +747,10 @@ perf_signing (struct TALER_CRYPTO_RsaDenominationHelper *dh,
blinded_msg_size
};
- ec = TALER_CRYPTO_helper_rsa_sign (dh,
- &rsr,
- &ds);
+ ec = TALER_CRYPTO_helper_rsa_batch_sign (dh,
+ 1,
+ &rsr,
+ &ds);
if (TALER_EC_NONE != ec)
break;
delay = GNUNET_TIME_absolute_get_duration (start);