WiP: age-withdraw, finalize_age_withdraw_and_sign continued, 9/n

This commit is contained in:
Özgür Kesim 2023-04-22 17:15:43 +02:00
parent ed57e6dc86
commit 9ffb7e2fd8
Signed by: oec
GPG Key ID: 3D76A56D79EDD9D7

View File

@ -796,24 +796,51 @@ verify_commitment_and_max_age (
* @return GNUNET_OK on success, GNUNET_SYSERR otherwise
*/
static enum GNUNET_GenericReturnValue
sign_and_persist_blinded_coins (
finalize_age_withdraw_and_sign (
struct MHD_Connection *connection,
const struct TALER_AgeWithdrawCommitmentHashP *h_commitment_orig,
const struct TALER_AgeWithdrawCommitmentHashP *h_commitment,
const uint32_t num_coins,
const struct TALER_BlindedPlanchet *coin_evs,
const struct TEH_DenominationKey *denom_keys,
MHD_RESULT *result)
{
enum GNUNET_GenericReturnValue ret = GNUNET_SYSERR;
struct TEH_CoinSignData csds[num_coins];
struct TALER_BlindedDenominationSignature bss[num_coins];
for (uint32_t i = 0; i<num_coins; i++)
{
csds[i].h_denom_pub = &denom_keys[i].h_denom_pub;
csds[i].bp = &coin_evs[i];
}
/* First, sign the the blinded coins */
{
enum TALER_ErrorCode ec;
ec = TEH_keys_denomination_batch_sign (csds,
num_coins,
false,
bss);
if (TALER_EC_NONE != ec)
{
GNUNET_break (0);
*result = TALER_MHD_reply_with_ec (connection,
ec,
NULL);
return GNUNET_SYSERR;
}
}
/* TODO[oec]:
* - sign the planchets
* - in a transaction: save the coins.
* - add signature response
*/
#pragma message "FIXME[oec]: implement sign_and_persist_blinded_coins"
#pragma message "FIXME[oec]: implement finalize_age_withdraw_and_sign"
return ret;
}
MHD_RESULT
TEH_handler_age_withdraw_reveal (
struct TEH_RequestContext *rc,
@ -895,7 +922,7 @@ TEH_handler_age_withdraw_reveal (
break;
/* Finally, sign and persist the coins */
if (GNUNET_OK != sign_and_persist_blinded_coins (
if (GNUNET_OK != finalize_age_withdraw_and_sign (
rc->connection,
&actx.commitment.h_commitment,
actx.num_coins,