diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-06-21 21:49:05 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-06-21 21:49:05 +0200 |
commit | 6d323a50d2387a74f5822d83cb81c45682eae478 (patch) | |
tree | 387b7fa24b1b211eb4f04ecf1591482ec1f539b1 /src/mint-lib/mint_api_json.c | |
parent | a334005e3d6dd349923dea3030b4105be73a3e06 (diff) | |
download | exchange-6d323a50d2387a74f5822d83cb81c45682eae478.tar.xz |
marking remaining FIXMEs for #3516
Diffstat (limited to 'src/mint-lib/mint_api_json.c')
-rw-r--r-- | src/mint-lib/mint_api_json.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/mint-lib/mint_api_json.c b/src/mint-lib/mint_api_json.c index b702ba0d9..81511c1c0 100644 --- a/src/mint-lib/mint_api_json.c +++ b/src/mint-lib/mint_api_json.c @@ -200,6 +200,17 @@ parse_json (json_t *root, } break; + 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 + } + break; + default: GNUNET_break (0); return i; @@ -248,6 +259,9 @@ parse_free (struct MAJ_Specification *spec, GNUNET_CRYPTO_rsa_signature_free (*spec[i].details.rsa_signature); *spec[i].details.rsa_signature = NULL; break; + case MAJ_CMD_EDDSA_SIGNATURE: + GNUNET_free (*spec[i].details.eddsa_signature.purpose_p); + *spec[i].details.eddsa_signature.purpose_p = NULL; default: GNUNET_break (0); break; @@ -378,4 +392,28 @@ MAJ_spec_rsa_signature (const char *name, } +/** + * Specification for parsing an EdDSA object signature with purpose. + * Also validates the signature (!). + * + * @param name name of the JSON field + * @param purpose_p where to store the purpose + * @param pub_key public key to use for validation + */ +struct MAJ_Specification +MAJ_spec_eddsa_signed_purpose (const char *name, + struct GNUNET_CRYPTO_EccSignaturePurpose **purpose_p, + const struct GNUNET_CRYPTO_EddsaPublicKey *pub_key) +{ + struct MAJ_Specification ret = + { + .cmd = MAJ_CMD_EDDSA_SIGNATURE, + .field = name, + .details.eddsa_signature.purpose_p = purpose_p, + .details.eddsa_signature.pub_key = pub_key + }; + return ret; +} + + /* end of mint_api_json.c */ |