[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-anastasis] branch master updated: fixed warnings fixed json in an
From: |
gnunet |
Subject: |
[taler-anastasis] branch master updated: fixed warnings fixed json in anastasis.c |
Date: |
Wed, 22 Apr 2020 16:11:57 +0200 |
This is an automated email from the git hooks/post-receive script.
ds-meister pushed a commit to branch master
in repository anastasis.
The following commit(s) were added to refs/heads/master by this push:
new 8b8385b fixed warnings fixed json in anastasis.c
8b8385b is described below
commit 8b8385b0127809ce8eb4a526ceb0923c0b437daa
Author: Dominik Meister <address@hidden>
AuthorDate: Wed Apr 22 16:11:35 2020 +0200
fixed warnings fixed json in anastasis.c
---
src/lib/anastasis.c | 88 ++++++++++++++++++++++++++++-------------------------
1 file changed, 46 insertions(+), 42 deletions(-)
diff --git a/src/lib/anastasis.c b/src/lib/anastasis.c
index 1f74d5d..eaa60c8 100644
--- a/src/lib/anastasis.c
+++ b/src/lib/anastasis.c
@@ -780,23 +780,6 @@ struct ANASTASIS_SecretShare
const char *payment_order_id;
};
-/**
- * FIXME NOT SURE IF NEEDED
- * Internal struct which defines an escrow method
- */
-struct ANASTASIS_TruthMethod
-{
- char *url;
- char *escrow_method;
- uuid_t uuid;
- struct ANASTASIS_CRYPTO_TruthKey truth_key;
- struct ANASTASIS_CRYPTO_Salt salt;
- void *challenge;
- size_t challenge_size;
-};
-
-
-
static void
policy_store_cb (void *cls,
enum ANASTASIS_ErrorCode ec,
@@ -838,31 +821,29 @@ ANASTASIS_secret_share (const json_t *id_data,
struct ANASTASIS_SecretShare *ss;
ss = GNUNET_new (struct ANASTASIS_SecretShare);
- void *encrypted_core_secret;
+
struct ANASTASIS_CRYPTO_EncryptedMasterKey
encrypted_master_keys[policies_len];
struct ANASTASIS_CRYPTO_PolicyKey policy_keys[policies_len];
- struct ANASTASIS_DecryptionPolicy decryption_policies[policies_len];
- struct ANASTASIS_TruthMethod truth_methods[truths_len];
struct SaltState *st = src_cls;
st->http_status = MHD_HTTP_OK;
+
+ void *encrypted_core_secret;
void *enc_rec_doc;
size_t enc_rec_doc_size;
+
+
+ //Recovery document contains the array decryption policies and the array
escrow methods
json_t *recovery_document;
+ //json array
+ json_t *dec_policies;
+ //json array
+ json_t *esc_methods;
for (unsigned int i = 0; i < policies_len; i++)
{
policy_keys[i] = policies[i]->policy_key;
}
- // FIXME CHALLENGE
- for (unsigned int l = 0; l < truths_len; l++)
- {
- memcpy (truth_methods[l].uuid, truths[l]->uuid, sizeof(uuid_t));
- truth_methods[l].url = truths[l]->url;
- truth_methods[l].truth_key = truths[l]->truth_key;
- truth_methods[l].salt = *truths[l]->salt;
- truth_methods[l].escrow_method = truths[l]->method;
- }
ANASTASIS_CRYPTO_core_secret_encrypt (policy_keys,
policies_len,
@@ -871,27 +852,50 @@ ANASTASIS_secret_share (const json_t *id_data,
&encrypted_core_secret,
encrypted_master_keys);
- for (unsigned int j = 0; j < policies_len; j++)
+ dec_policies = json_array();
+ esc_methods = json_array();
+ for (unsigned int k = 0; k < policies_len; k++ )
{
- decryption_policies[j].emk = &encrypted_master_keys[j];
- decryption_policies[j].uuids_length = policies[j]->uuid_length;
- decryption_policies[j].escrow_uuids = policies[j]->uuids;
+ json_t *dec_policy = json_pack ("{s:o," /* encrypted master key */
+ " s:o}", /* policy uuids */
+ "master_key",
+ GNUNET_JSON_from_data_auto
(&encrypted_master_keys[k]),
+ "uuids",
+ GNUNET_JSON_from_data (policies[k]->uuids,
policies[k]->uuid_length * sizeof(uuid_t)));
+
+ json_array_append_new(dec_policies, dec_policy);
+ }
+ // FIXME CHALLENGE
+ for (unsigned int l = 0; l < truths_len; l++)
+ {
+ json_t *esc_method = json_pack ("{s:o," /* truth uuid */
+ " s:s," /* provider url */
+ " s:o," /* truth key */
+ " s:o," /* truth salt */
+ " s:s}", /* escrow method */
+ "uuid",
+ GNUNET_JSON_from_data (truths[l]->uuid,
sizeof(uuid_t)),
+ "url", truths[l]->url,
+ "truth_key",
GNUNET_JSON_from_data_auto(&truths[l]->truth_key),
+ "salt",
GNUNET_JSON_from_data_auto(truths[l]->salt),
+ "escrow_method", truths[l]->method);
+ json_array_append_new(esc_methods, esc_method);
}
- // FIXME
recovery_document = json_pack (
- " s:[fmt]," /* escrow methods */
- " s:[fmt]," /* decryption policies */
+ "{s:o," /* policies */
+ " s:o," /* decryption policies */
" s:o}", /* encrypted core secret */
- "escrow_methods", &truth_methods,
- "decryption_policies", &decryption_policies,
- "core_secret", GNUNET_JSON_from_data (
- core_secret, core_secret_size));
+ "policies", dec_policies,
+ "escrow_methods", esc_methods,
+ "core_secret", GNUNET_JSON_from_data (&encrypted_core_secret,
core_secret_size));
+
st->so = ANASTASIS_salt (ss->ctx,
- truth_methods[0].url,
+ truths[0]->url,
&salt_cb,
st);
+
ANASTASIS_CRYPTO_user_identifier_derive (id_data,
&st->so->salt,
&ss->id);
@@ -907,7 +911,7 @@ ANASTASIS_secret_share (const json_t *id_data,
&enc_rec_doc_size);
ss->pso = ANASTASIS_policy_store (ss->ctx,
- truth_methods[0].url,
+ truths[0]->url,
&ss->priv_key,
last_etag,
enc_rec_doc,
--
To stop receiving notification emails like this one, please contact
address@hidden.
- [taler-anastasis] branch master updated: fixed warnings fixed json in anastasis.c,
gnunet <=