From a02ab8f81b68b59ef5228ce30583d9388f9bab4a Mon Sep 17 00:00:00 2001 From: Gian Demarmels Date: Wed, 22 Dec 2021 12:52:54 +0100 Subject: added CS get R functionality and planchet setup --- src/include/taler_crypto_lib.h | 75 +++++++++++++++++++++++++++++------------- 1 file changed, 53 insertions(+), 22 deletions(-) (limited to 'src/include/taler_crypto_lib.h') diff --git a/src/include/taler_crypto_lib.h b/src/include/taler_crypto_lib.h index 8e5df1fc..542146cc 100644 --- a/src/include/taler_crypto_lib.h +++ b/src/include/taler_crypto_lib.h @@ -794,6 +794,9 @@ struct TALER_BlindedPlanchet } details; }; +/** + * Withdraw nonce for CS denominations + */ struct TALER_WithdrawNonce { /** @@ -802,6 +805,9 @@ struct TALER_WithdrawNonce struct GNUNET_CRYPTO_CsNonce nonce; }; +/** + * Withdraw nonce for CS denominations + */ struct TALER_RefreshNonce { /** @@ -810,6 +816,23 @@ struct TALER_RefreshNonce struct GNUNET_CRYPTO_CsNonce nonce; }; +/** + * Public R for Cs denominations + */ +struct TALER_DenominationCsPublicR +{ + struct GNUNET_CRYPTO_CsRPublic r_pub[2]; +}; + +/** + * Secret r for Cs denominations + */ + +struct TALER_DenominationCsPrivateR +{ + struct GNUNET_CRYPTO_CsRSecret r[2]; +}; + /** * @brief RSA Parameters to create blinded messages * @@ -862,28 +885,6 @@ struct TALER_DenominationBlindMessageParams } details; }; -/** - * @brief CS Blinding Secret parameters to derive blinding secrets - * - */ -struct TALER_PlanchetDeriveCsBlindingSecrets -{ - /** - * Secret to derive blinding secrets from - */ - void *secret; - - /** - * size of the secret to derive blinding secrets from - */ - size_t secret_len; - - /** - * public R_0 and R_1 are hashed too - */ - struct GNUNET_CRYPTO_CsRPublic r_pub[2]; -}; - /** * @brief Public information about a coin (including the public key * of the coin, the denomination key and the signature with @@ -1012,6 +1013,36 @@ void TALER_denom_sig_free (struct TALER_DenominationSignature *denom_sig); +/** + * Function for CS signatures to derive the secret r_0 and r_1 + * + * @param nonce withdraw nonce from a client + * @param denom_priv denomination privkey as long-term secret + * @param r the resulting r_0 and r_1 + * @return enum GNUNET_GenericReturnValue, returns SYSERR when denom key has wrong type + */ +enum GNUNET_GenericReturnValue +TALER_denom_cs_derive_r_secret (const struct TALER_WithdrawNonce *nonce, + const struct + TALER_DenominationPrivateKey *denom_priv, + struct TALER_DenominationCsPrivateR *r); + +/** + * @brief Function for CS signatures to derive public R_0 and R_1 + * + * @param nonce withdraw nonce from a client + * @param denom_priv denomination privkey as long-term secret + * @param r_pub the resulting R_0 and R_1 + * @return enum GNUNET_GenericReturnValue + */ + +enum GNUNET_GenericReturnValue +TALER_denom_cs_derive_r_public (const struct TALER_WithdrawNonce *nonce, + const struct + TALER_DenominationPrivateKey *denom_priv, + struct TALER_DenominationCsPublicR *r_pub); + + /** * Blind coin for blind signing with @a dk using blinding secret @a coin_bks. * -- cgit v1.2.3