diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-06-22 18:11:34 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-06-22 18:11:34 +0200 |
commit | d98d085ff570e8a4a45a17909b958bd436aade08 (patch) | |
tree | c93ce3d3d6b0cb5d936dc096110606126b058c01 /src/mint-lib/mint_api_json.c | |
parent | b381a3093df0751ff3b600e7566c437d523250a7 (diff) | |
parent | 214bcf54c7099974fba0f3ea242e9488139e0d0b (diff) |
Merge branch 'master' of git+ssh://git.taler.net/var/git/mint
Diffstat (limited to 'src/mint-lib/mint_api_json.c')
-rw-r--r-- | src/mint-lib/mint_api_json.c | 40 |
1 files changed, 34 insertions, 6 deletions
diff --git a/src/mint-lib/mint_api_json.c b/src/mint-lib/mint_api_json.c index 81511c1c..e2a73bdd 100644 --- a/src/mint-lib/mint_api_json.c +++ b/src/mint-lib/mint_api_json.c @@ -202,12 +202,40 @@ parse_json (json_t *root, case MAJ_CMD_EDDSA_SIGNATURE: { - /* FIXME: parse the JSON signature - and the purpose, then check that the - signature is valid and the size field - is also correct; if all checks out, - return the purpose */ - GNUNET_break (0); // FIXME: implement! #3516 + struct TALER_CoinSpendSignatureP sig; + struct GNUNET_CRYPTO_EccSignaturePurpose *purpose; + size_t size; + struct MAJ_Specification sig_spec[] = { + MAJ_spec_fixed_auto ("eddsa_sig", &sig), + MAJ_spec_varsize ("eddsa_val", (void**) &purpose, &size), + MAJ_spec_end + }; + + if (GNUNET_OK != + MAJ_parse_json (pos, + sig_spec)) + { + GNUNET_break_op (0); + MAJ_parse_free (sig_spec); + return i; + } + if (size != ntohl (purpose->size)) + { + GNUNET_break_op (0); + MAJ_parse_free (sig_spec); + return i; + } + if (GNUNET_OK != + GNUNET_CRYPTO_eddsa_verify (ntohl (purpose->purpose), + purpose, + &sig.eddsa_signature, + spec[i].details.eddsa_signature.pub_key)) + { + GNUNET_break_op (0); + MAJ_parse_free (sig_spec); + return i; + } + *spec[i].details.eddsa_signature.purpose_p = purpose; } break; |