diff --git a/src/exchange/taler-exchange-httpd_keys.c b/src/exchange/taler-exchange-httpd_keys.c index 52aa9015c..cf20985c5 100644 --- a/src/exchange/taler-exchange-httpd_keys.c +++ b/src/exchange/taler-exchange-httpd_keys.c @@ -2874,10 +2874,15 @@ TEH_keys_denomination_cs_r_pub_melt ( return TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE; } - return TALER_CRYPTO_helper_cs_r_derive_melt (ksh->helpers->csdh, - &hd->h_details.h_cs, - nonce, - r_pub); + { + struct TALER_CRYPTO_CsDeriveRequest cdr = { + .h_cs = &hd->h_details.h_cs, + .nonce = nonce + }; + return TALER_CRYPTO_helper_cs_r_derive_melt (ksh->helpers->csdh, + &cdr, + r_pub); + } } @@ -2905,11 +2910,16 @@ TEH_keys_denomination_cs_r_pub_withdraw ( { 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_withdraw (ksh->helpers->csdh, - &hd->h_details.h_cs, - nonce, - r_pub); + return TALER_CRYPTO_helper_cs_r_derive_withdraw (ksh->helpers->csdh, + &cdr, + r_pub); + } } diff --git a/src/include/taler_crypto_lib.h b/src/include/taler_crypto_lib.h index 8027181fd..010a5bc71 100644 --- a/src/include/taler_crypto_lib.h +++ b/src/include/taler_crypto_lib.h @@ -2593,8 +2593,25 @@ TALER_CRYPTO_helper_cs_revoke ( /** - * Ask the helper to derive R using the @a nonce and denomination key - * associated with @a h_cs. + * Information about what we should derive for. + */ +struct TALER_CRYPTO_CsDeriveRequest +{ + /** + * Hash of the CS public key to use to sign. + */ + const struct TALER_CsPubHashP *h_cs; + + /** + * Nonce to use. + */ + const struct TALER_CsNonce *nonce; +}; + + +/** + * 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 @@ -2603,7 +2620,7 @@ TALER_CRYPTO_helper_cs_revoke ( * differences in the signature counters. Retrying in this case may work. * * @param dh helper to process connection - * @param h_cs hash of the CS public key to revoke + * @param cdr derivation input data * @param nonce witdhraw nonce * @param[out] crp set to the pair of R values * @return set to the error code (or #TALER_EC_NONE on success) @@ -2611,14 +2628,13 @@ TALER_CRYPTO_helper_cs_revoke ( enum TALER_ErrorCode TALER_CRYPTO_helper_cs_r_derive_withdraw ( struct TALER_CRYPTO_CsDenominationHelper *dh, - const struct TALER_CsPubHashP *h_cs, - const struct TALER_CsNonce *nonce, + const struct TALER_CRYPTO_CsDeriveRequest *cdr, struct TALER_DenominationCSPublicRPairP *crp); /** - * Ask the helper to derive R using the @a nonce and denomination key - * associated with @a h_cs. + * 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 @@ -2627,16 +2643,14 @@ TALER_CRYPTO_helper_cs_r_derive_withdraw ( * differences in the signature counters. Retrying in this case may work. * * @param dh helper to process connection - * @param h_cs hash of the CS public key to revoke - * @param nonce witdhraw nonce + * @param cdr derivation input data * @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_melt ( struct TALER_CRYPTO_CsDenominationHelper *dh, - const struct TALER_CsPubHashP *h_cs, - const struct TALER_CsNonce *nonce, + const struct TALER_CRYPTO_CsDeriveRequest *cdr, struct TALER_DenominationCSPublicRPairP *crp); diff --git a/src/util/crypto_helper_cs.c b/src/util/crypto_helper_cs.c index 66ecb26ad..409903b34 100644 --- a/src/util/crypto_helper_cs.c +++ b/src/util/crypto_helper_cs.c @@ -853,13 +853,12 @@ more: enum TALER_ErrorCode TALER_CRYPTO_helper_cs_r_derive_withdraw ( struct TALER_CRYPTO_CsDenominationHelper *dh, - const struct TALER_CsPubHashP *h_cs, - const struct TALER_CsNonce *nonce, + const struct TALER_CRYPTO_CsDeriveRequest *cdr, struct TALER_DenominationCSPublicRPairP *crp) { return helper_cs_r_derive (dh, - h_cs, - nonce, + cdr->h_cs, + cdr->nonce, false, crp); } @@ -868,18 +867,41 @@ TALER_CRYPTO_helper_cs_r_derive_withdraw ( enum TALER_ErrorCode TALER_CRYPTO_helper_cs_r_derive_melt ( struct TALER_CRYPTO_CsDenominationHelper *dh, - const struct TALER_CsPubHashP *h_cs, - const struct TALER_CsNonce *nonce, + const struct TALER_CRYPTO_CsDeriveRequest *cdr, struct TALER_DenominationCSPublicRPairP *crp) { return helper_cs_r_derive (dh, - h_cs, - nonce, + cdr->h_cs, + cdr->nonce, true, crp); } +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) +{ + GNUNET_break (0); // FIXME + return -1; +} + + +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) +{ + GNUNET_break (0); // FIXME + return -1; +} + + void TALER_CRYPTO_helper_cs_disconnect ( struct TALER_CRYPTO_CsDenominationHelper *dh) diff --git a/src/util/taler-exchange-secmod-cs.c b/src/util/taler-exchange-secmod-cs.c index 01f12e14d..13148a16c 100644 --- a/src/util/taler-exchange-secmod-cs.c +++ b/src/util/taler-exchange-secmod-cs.c @@ -2170,7 +2170,7 @@ run (void *cls, GNUNET_SCHEDULER_add_shutdown (&do_shutdown, NULL); if (0 == max_workers) - max_workers = 1; /* FIXME-#7272: or determine from CPU? */ + max_workers = sysconf (_SC_NPROCESSORS_CONF); for (unsigned int i = 0; i