-remove addessed documentation FIXMEs

This commit is contained in:
Christian Grothoff 2022-02-12 12:10:33 +01:00
parent ea4be7ba6f
commit db8cdc8c4c
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
5 changed files with 55 additions and 40 deletions

View File

@ -26,6 +26,25 @@
#include "taler_json_lib.h" #include "taler_json_lib.h"
/**
* Convert string value to numeric cipher value.
*
* @param cipher_s input string
* @return numeric cipher value
*/
static enum TALER_DenominationCipher
string_to_cipher (const char *cipher_s)
{
if (0 == strcasecmp (cipher_s,
"RSA"))
return TALER_DENOMINATION_RSA;
if (0 == strcasecmp (cipher_s,
"CS"))
return TALER_DENOMINATION_CS;
return TALER_DENOMINATION_INVALID;
}
json_t * json_t *
TALER_JSON_from_amount (const struct TALER_Amount *amount) TALER_JSON_from_amount (const struct TALER_Amount *amount)
{ {
@ -229,9 +248,9 @@ parse_denom_pub (void *cls,
struct GNUNET_JSON_Specification *spec) struct GNUNET_JSON_Specification *spec)
{ {
struct TALER_DenominationPublicKey *denom_pub = spec->ptr; struct TALER_DenominationPublicKey *denom_pub = spec->ptr;
uint32_t cipher; const char *cipher;
struct GNUNET_JSON_Specification dspec[] = { struct GNUNET_JSON_Specification dspec[] = {
GNUNET_JSON_spec_uint32 ("cipher", GNUNET_JSON_spec_string ("cipher",
&cipher), &cipher),
GNUNET_JSON_spec_uint32 ("age_mask", GNUNET_JSON_spec_uint32 ("age_mask",
&denom_pub->age_mask.mask), &denom_pub->age_mask.mask),
@ -250,7 +269,7 @@ parse_denom_pub (void *cls,
GNUNET_break_op (0); GNUNET_break_op (0);
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
denom_pub->cipher = (enum TALER_DenominationCipher) cipher; denom_pub->cipher = string_to_cipher (cipher);
switch (denom_pub->cipher) switch (denom_pub->cipher)
{ {
case TALER_DENOMINATION_RSA: case TALER_DENOMINATION_RSA:
@ -346,9 +365,9 @@ parse_denom_sig (void *cls,
struct GNUNET_JSON_Specification *spec) struct GNUNET_JSON_Specification *spec)
{ {
struct TALER_DenominationSignature *denom_sig = spec->ptr; struct TALER_DenominationSignature *denom_sig = spec->ptr;
uint32_t cipher; const char *cipher;
struct GNUNET_JSON_Specification dspec[] = { struct GNUNET_JSON_Specification dspec[] = {
GNUNET_JSON_spec_uint32 ("cipher", GNUNET_JSON_spec_string ("cipher",
&cipher), &cipher),
GNUNET_JSON_spec_end () GNUNET_JSON_spec_end ()
}; };
@ -365,7 +384,7 @@ parse_denom_sig (void *cls,
GNUNET_break_op (0); GNUNET_break_op (0);
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
denom_sig->cipher = (enum TALER_DenominationCipher) cipher; denom_sig->cipher = string_to_cipher (cipher);
switch (denom_sig->cipher) switch (denom_sig->cipher)
{ {
case TALER_DENOMINATION_RSA: case TALER_DENOMINATION_RSA:
@ -462,9 +481,9 @@ parse_blinded_denom_sig (void *cls,
struct GNUNET_JSON_Specification *spec) struct GNUNET_JSON_Specification *spec)
{ {
struct TALER_BlindedDenominationSignature *denom_sig = spec->ptr; struct TALER_BlindedDenominationSignature *denom_sig = spec->ptr;
uint32_t cipher; const char *cipher;
struct GNUNET_JSON_Specification dspec[] = { struct GNUNET_JSON_Specification dspec[] = {
GNUNET_JSON_spec_uint32 ("cipher", GNUNET_JSON_spec_string ("cipher",
&cipher), &cipher),
GNUNET_JSON_spec_end () GNUNET_JSON_spec_end ()
}; };
@ -481,7 +500,7 @@ parse_blinded_denom_sig (void *cls,
GNUNET_break_op (0); GNUNET_break_op (0);
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
denom_sig->cipher = (enum TALER_DenominationCipher) cipher; denom_sig->cipher = string_to_cipher (cipher);
switch (denom_sig->cipher) switch (denom_sig->cipher)
{ {
case TALER_DENOMINATION_RSA: case TALER_DENOMINATION_RSA:
@ -581,9 +600,9 @@ parse_blinded_planchet (void *cls,
struct GNUNET_JSON_Specification *spec) struct GNUNET_JSON_Specification *spec)
{ {
struct TALER_BlindedPlanchet *blinded_planchet = spec->ptr; struct TALER_BlindedPlanchet *blinded_planchet = spec->ptr;
uint32_t cipher; const char *cipher;
struct GNUNET_JSON_Specification dspec[] = { struct GNUNET_JSON_Specification dspec[] = {
GNUNET_JSON_spec_uint32 ("cipher", GNUNET_JSON_spec_string ("cipher",
&cipher), &cipher),
GNUNET_JSON_spec_end () GNUNET_JSON_spec_end ()
}; };
@ -600,7 +619,7 @@ parse_blinded_planchet (void *cls,
GNUNET_break_op (0); GNUNET_break_op (0);
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
blinded_planchet->cipher = (enum TALER_DenominationCipher) cipher; blinded_planchet->cipher = string_to_cipher (cipher);
switch (blinded_planchet->cipher) switch (blinded_planchet->cipher)
{ {
case TALER_DENOMINATION_RSA: case TALER_DENOMINATION_RSA:
@ -704,9 +723,9 @@ parse_exchange_withdraw_values (void *cls,
struct GNUNET_JSON_Specification *spec) struct GNUNET_JSON_Specification *spec)
{ {
struct TALER_ExchangeWithdrawValues *ewv = spec->ptr; struct TALER_ExchangeWithdrawValues *ewv = spec->ptr;
uint32_t cipher; const char *cipher;
struct GNUNET_JSON_Specification dspec[] = { struct GNUNET_JSON_Specification dspec[] = {
GNUNET_JSON_spec_uint32 ("cipher", GNUNET_JSON_spec_string ("cipher",
&cipher), &cipher),
GNUNET_JSON_spec_end () GNUNET_JSON_spec_end ()
}; };
@ -723,8 +742,8 @@ parse_exchange_withdraw_values (void *cls,
GNUNET_break_op (0); GNUNET_break_op (0);
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
ewv->cipher = (enum TALER_DenominationCipher) cipher; ewv->cipher = string_to_cipher (cipher);
switch (cipher) switch (ewv->cipher)
{ {
case TALER_DENOMINATION_RSA: case TALER_DENOMINATION_RSA:
return GNUNET_OK; return GNUNET_OK;

View File

@ -61,8 +61,8 @@ TALER_JSON_pack_denom_pub (
case TALER_DENOMINATION_RSA: case TALER_DENOMINATION_RSA:
ps.object ps.object
= GNUNET_JSON_PACK ( = GNUNET_JSON_PACK (
GNUNET_JSON_pack_uint64 ("cipher", GNUNET_JSON_pack_string ("cipher",
TALER_DENOMINATION_RSA), "RSA"),
GNUNET_JSON_pack_uint64 ("age_mask", GNUNET_JSON_pack_uint64 ("age_mask",
pk->age_mask.mask), pk->age_mask.mask),
GNUNET_JSON_pack_rsa_public_key ("rsa_public_key", GNUNET_JSON_pack_rsa_public_key ("rsa_public_key",
@ -71,8 +71,8 @@ TALER_JSON_pack_denom_pub (
case TALER_DENOMINATION_CS: case TALER_DENOMINATION_CS:
ps.object ps.object
= GNUNET_JSON_PACK ( = GNUNET_JSON_PACK (
GNUNET_JSON_pack_uint64 ("cipher", GNUNET_JSON_pack_string ("cipher",
TALER_DENOMINATION_CS), "CS"),
GNUNET_JSON_pack_uint64 ("age_mask", GNUNET_JSON_pack_uint64 ("age_mask",
pk->age_mask.mask), pk->age_mask.mask),
GNUNET_JSON_pack_data_varsize ("cs_public_key", GNUNET_JSON_pack_data_varsize ("cs_public_key",
@ -99,15 +99,15 @@ TALER_JSON_pack_denom_sig (
{ {
case TALER_DENOMINATION_RSA: case TALER_DENOMINATION_RSA:
ps.object = GNUNET_JSON_PACK ( ps.object = GNUNET_JSON_PACK (
GNUNET_JSON_pack_uint64 ("cipher", GNUNET_JSON_pack_string ("cipher",
TALER_DENOMINATION_RSA), "RSA"),
GNUNET_JSON_pack_rsa_signature ("rsa_signature", GNUNET_JSON_pack_rsa_signature ("rsa_signature",
sig->details.rsa_signature)); sig->details.rsa_signature));
break; break;
case TALER_DENOMINATION_CS: case TALER_DENOMINATION_CS:
ps.object = GNUNET_JSON_PACK ( ps.object = GNUNET_JSON_PACK (
GNUNET_JSON_pack_uint64 ("cipher", GNUNET_JSON_pack_string ("cipher",
TALER_DENOMINATION_CS), "CS"),
GNUNET_JSON_pack_data_auto ("cs_signature_r", GNUNET_JSON_pack_data_auto ("cs_signature_r",
&sig->details.cs_signature.r_point), &sig->details.cs_signature.r_point),
GNUNET_JSON_pack_data_auto ("cs_signature_s", GNUNET_JSON_pack_data_auto ("cs_signature_s",
@ -133,13 +133,13 @@ TALER_JSON_pack_exchange_withdraw_values (
{ {
case TALER_DENOMINATION_RSA: case TALER_DENOMINATION_RSA:
ps.object = GNUNET_JSON_PACK ( ps.object = GNUNET_JSON_PACK (
GNUNET_JSON_pack_uint64 ("cipher", GNUNET_JSON_pack_string ("cipher",
TALER_DENOMINATION_RSA)); "RSA"));
break; break;
case TALER_DENOMINATION_CS: case TALER_DENOMINATION_CS:
ps.object = GNUNET_JSON_PACK ( ps.object = GNUNET_JSON_PACK (
GNUNET_JSON_pack_uint64 ("cipher", GNUNET_JSON_pack_string ("cipher",
TALER_DENOMINATION_CS), "CS"),
GNUNET_JSON_pack_data_varsize ( GNUNET_JSON_pack_data_varsize (
"r_pub_0", "r_pub_0",
&ewv->details.cs_values.r_pub[0], &ewv->details.cs_values.r_pub[0],
@ -170,15 +170,15 @@ TALER_JSON_pack_blinded_denom_sig (
{ {
case TALER_DENOMINATION_RSA: case TALER_DENOMINATION_RSA:
ps.object = GNUNET_JSON_PACK ( ps.object = GNUNET_JSON_PACK (
GNUNET_JSON_pack_uint64 ("cipher", GNUNET_JSON_pack_string ("cipher",
TALER_DENOMINATION_RSA), "RSA"),
GNUNET_JSON_pack_rsa_signature ("blinded_rsa_signature", GNUNET_JSON_pack_rsa_signature ("blinded_rsa_signature",
sig->details.blinded_rsa_signature)); sig->details.blinded_rsa_signature));
break; break;
case TALER_DENOMINATION_CS: case TALER_DENOMINATION_CS:
ps.object = GNUNET_JSON_PACK ( ps.object = GNUNET_JSON_PACK (
GNUNET_JSON_pack_uint64 ("cipher", GNUNET_JSON_pack_string ("cipher",
TALER_DENOMINATION_CS), "CS"),
GNUNET_JSON_pack_uint64 ("b", GNUNET_JSON_pack_uint64 ("b",
sig->details.blinded_cs_answer.b), sig->details.blinded_cs_answer.b),
GNUNET_JSON_pack_data_auto ("s", GNUNET_JSON_pack_data_auto ("s",
@ -204,8 +204,8 @@ TALER_JSON_pack_blinded_planchet (
{ {
case TALER_DENOMINATION_RSA: case TALER_DENOMINATION_RSA:
ps.object = GNUNET_JSON_PACK ( ps.object = GNUNET_JSON_PACK (
GNUNET_JSON_pack_uint64 ("cipher", GNUNET_JSON_pack_string ("cipher",
TALER_DENOMINATION_RSA), "RSA"),
GNUNET_JSON_pack_data_varsize ( GNUNET_JSON_pack_data_varsize (
"rsa_blinded_planchet", "rsa_blinded_planchet",
blinded_planchet->details.rsa_blinded_planchet.blinded_msg, blinded_planchet->details.rsa_blinded_planchet.blinded_msg,
@ -213,8 +213,8 @@ TALER_JSON_pack_blinded_planchet (
break; break;
case TALER_DENOMINATION_CS: case TALER_DENOMINATION_CS:
ps.object = GNUNET_JSON_PACK ( ps.object = GNUNET_JSON_PACK (
GNUNET_JSON_pack_uint64 ("cipher", GNUNET_JSON_pack_string ("cipher",
TALER_DENOMINATION_CS), "CS"),
GNUNET_JSON_pack_data_auto ( GNUNET_JSON_pack_data_auto (
"cs_nonce", "cs_nonce",
&blinded_planchet->details.cs_blinded_planchet.nonce), &blinded_planchet->details.cs_blinded_planchet.nonce),

View File

@ -102,12 +102,10 @@ parse_link_coin (const struct TALER_EXCHANGE_LinkHandle *lh,
&rpub), &rpub),
TALER_JSON_spec_blinded_denom_sig ("ev_sig", TALER_JSON_spec_blinded_denom_sig ("ev_sig",
&bsig), &bsig),
// FIXME: add to spec!
TALER_JSON_spec_exchange_withdraw_values ("ewv", TALER_JSON_spec_exchange_withdraw_values ("ewv",
&alg_values), &alg_values),
GNUNET_JSON_spec_fixed_auto ("link_sig", GNUNET_JSON_spec_fixed_auto ("link_sig",
&link_sig), &link_sig),
// FIXME: add to spec!
GNUNET_JSON_spec_uint32 ("coin_idx", GNUNET_JSON_spec_uint32 ("coin_idx",
&coin_idx), &coin_idx),
GNUNET_JSON_spec_end () GNUNET_JSON_spec_end ()

View File

@ -322,7 +322,6 @@ TALER_EXCHANGE_recoup (struct TALER_EXCHANGE_Handle *exchange,
&h_denom_pub), &h_denom_pub),
TALER_JSON_pack_denom_sig ("denom_sig", TALER_JSON_pack_denom_sig ("denom_sig",
denom_sig), denom_sig),
// FIXME: add this to the spec!
TALER_JSON_pack_exchange_withdraw_values ("ewv", TALER_JSON_pack_exchange_withdraw_values ("ewv",
exchange_vals), exchange_vals),
GNUNET_JSON_pack_data_auto ("coin_sig", GNUNET_JSON_pack_data_auto ("coin_sig",

View File

@ -326,7 +326,6 @@ TALER_EXCHANGE_recoup_refresh (
&h_denom_pub), &h_denom_pub),
TALER_JSON_pack_denom_sig ("denom_sig", TALER_JSON_pack_denom_sig ("denom_sig",
denom_sig), denom_sig),
// FIXME: add this to the spec!
TALER_JSON_pack_exchange_withdraw_values ("ewv", TALER_JSON_pack_exchange_withdraw_values ("ewv",
exchange_vals), exchange_vals),
GNUNET_JSON_pack_data_auto ("coin_sig", GNUNET_JSON_pack_data_auto ("coin_sig",