gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-anastasis] branch master updated: refactor account pub


From: gnunet
Subject: [taler-anastasis] branch master updated: refactor account pub
Date: Tue, 31 Mar 2020 14:54:29 +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 40717cf  refactor account pub
40717cf is described below

commit 40717cf0266958f3550c080a23bd366b6ccc424c
Author: Dominik Meister <address@hidden>
AuthorDate: Tue Mar 31 14:54:11 2020 +0200

    refactor account pub
---
 src/backend/anastasis-httpd_policy.c        |  4 ++--
 src/backend/anastasis-httpd_policy.h        |  2 +-
 src/backend/anastasis-httpd_policy_upload.c |  4 ++--
 src/include/anastasis_crypto_lib.h          |  8 ++++++++
 src/include/anastasis_database_plugin.h     | 20 ++++++++++++--------
 src/include/anastasis_service.h             | 25 +------------------------
 src/include/anastasis_testing_lib.h         |  9 +++++----
 src/lib/anastasis.c                         | 15 +++++++++++++++
 src/lib/anastasis_api_policy_lookup.c       |  8 +++++---
 src/lib/anastasis_api_policy_store.c        |  4 ++--
 src/lib/testing_api_cmd_policy_lookup.c     |  4 ++--
 src/lib/testing_api_cmd_policy_store.c      |  8 ++++----
 src/lib/testing_api_trait_account_priv.c    |  4 ++--
 src/lib/testing_api_trait_account_pub.c     |  4 ++--
 14 files changed, 63 insertions(+), 56 deletions(-)

diff --git a/src/backend/anastasis-httpd_policy.c 
b/src/backend/anastasis-httpd_policy.c
index ba29a9b..6c203df 100644
--- a/src/backend/anastasis-httpd_policy.c
+++ b/src/backend/anastasis-httpd_policy.c
@@ -50,7 +50,7 @@
  */
 int
 AH_return_policy (struct MHD_Connection *connection,
-                  const struct ANASTASIS_AccountPubP *account,
+                  const struct ANASTASIS_CRYPTO_AccountPublicKey *account,
                   unsigned int default_http_status)
 {
   enum ANASTASIS_DB_QueryStatus qs;
@@ -163,7 +163,7 @@ int
 AH_handler_policy_get (struct MHD_Connection *connection,
                        const char *url)
 {
-  struct ANASTASIS_AccountPubP accountPubP;
+  struct ANASTASIS_CRYPTO_AccountPublicKey accountPubP;
   void *res_recovery_data;
   size_t res_recovery_data_size;
   struct ANASTASIS_AccountSignatureP account_sig;
diff --git a/src/backend/anastasis-httpd_policy.h 
b/src/backend/anastasis-httpd_policy.h
index 0b02269..d05d46a 100644
--- a/src/backend/anastasis-httpd_policy.h
+++ b/src/backend/anastasis-httpd_policy.h
@@ -60,7 +60,7 @@ AH_handler_policy_post (struct MHD_Connection *connection,
  */
 int
 AH_return_policy (struct MHD_Connection *connection,
-                  const struct ANASTASIS_AccountPubP *account,
+                  const struct ANASTASIS_CRYPTO_AccountPublicKey *account,
                   unsigned int default_http_status);
 
 
diff --git a/src/backend/anastasis-httpd_policy_upload.c 
b/src/backend/anastasis-httpd_policy_upload.c
index 432c9dd..92a1302 100644
--- a/src/backend/anastasis-httpd_policy_upload.c
+++ b/src/backend/anastasis-httpd_policy_upload.c
@@ -57,7 +57,7 @@ struct PolicyUploadContext
   /**
    * Public key of the account holder.
    */
-  struct ANASTASIS_AccountPubP account;
+  struct ANASTASIS_CRYPTO_AccountPublicKey account;
 
   /**
    * Hash of the previous upload, or zeros if first upload.
@@ -616,7 +616,7 @@ AH_handler_policy_post (struct MHD_Connection *connection,
                         size_t *recovery_data_size)
 {
   struct PolicyUploadContext *puc;
-  struct ANASTASIS_AccountPubP accountPubP;
+  struct ANASTASIS_CRYPTO_AccountPublicKey accountPubP;
   puc = *con_cls;
   if (NULL == puc)
   {
diff --git a/src/include/anastasis_crypto_lib.h 
b/src/include/anastasis_crypto_lib.h
index 9baf96f..fb4b5b0 100644
--- a/src/include/anastasis_crypto_lib.h
+++ b/src/include/anastasis_crypto_lib.h
@@ -33,6 +33,14 @@ struct ANASTASIS_CRYPTO_AccountPublicKey
   struct GNUNET_CRYPTO_EddsaPublicKey pub;
 };
 
+/**
+ * An EdDSA private key that is used to identify a user's account.
+ */
+struct ANASTASIS_CRYPTO_AccountPrivateKey
+{
+  struct GNUNET_CRYPTO_EddsaPrivateKey priv;
+};
+
 /**
  * Specifies a Key Share from an escrow provider, the combined keyshares 
generate the EscrowMasterKey
  * which is used to decrypt the Secret from the user.
diff --git a/src/include/anastasis_database_plugin.h 
b/src/include/anastasis_database_plugin.h
index 54b7c8a..562f962 100644
--- a/src/include/anastasis_database_plugin.h
+++ b/src/include/anastasis_database_plugin.h
@@ -24,7 +24,6 @@
 #include <gnunet/gnunet_util_lib.h>
 #include <anastasis_error_codes.h>
 #include "anastasis_service.h"
-#include "anastasis_crypto_lib.h"
 #include <jansson.h>
 #include <taler/taler_util.h>
 #include <uuid/uuid.h>
@@ -180,7 +179,7 @@ struct ANASTASIS_DatabasePlugin
   enum ANASTASIS_DB_QueryStatus
   (*store_recovery_document)(void *cls,
                              const struct
-                             ANASTASIS_AccountPubP *anastasis_pub,
+                             ANASTASIS_CRYPTO_AccountPublicKey *anastasis_pub,
                              const struct
                              ANASTASIS_AccountSignatureP *account_sig,
                              const struct
@@ -205,7 +204,8 @@ struct ANASTASIS_DatabasePlugin
    */
   enum ANASTASIS_DB_QueryStatus
   (*get_recovery_document)(void *cls,
-                           const struct ANASTASIS_AccountPubP *anastasis_pub,
+                           const struct
+                           ANASTASIS_CRYPTO_AccountPublicKey *anastasis_pub,
                            struct
                            ANASTASIS_AccountSignatureP *account_sig,
                            struct
@@ -229,7 +229,8 @@ struct ANASTASIS_DatabasePlugin
   enum ANASTASIS_DB_QueryStatus
   (*get_latest_recovery_document)(void *cls,
                                   const struct
-                                  ANASTASIS_AccountPubP *anastasis_pub,
+                                  ANASTASIS_CRYPTO_AccountPublicKey *
+                                  anastasis_pub,
                                   struct
                                   ANASTASIS_AccountSignatureP *account_sig,
                                   struct
@@ -309,7 +310,7 @@ struct ANASTASIS_DatabasePlugin
   enum ANASTASIS_DB_QueryStatus
   (*lookup_account)(void *cls,
                     const struct
-                    ANASTASIS_AccountPubP *anastasis_pub);
+                    ANASTASIS_CRYPTO_AccountPublicKey *anastasis_pub);
 
   /**
  * Lookup pending payments by account.
@@ -322,7 +323,8 @@ struct ANASTASIS_DatabasePlugin
   enum ANASTASIS_DB_QueryStatus
   (*lookup_pending_payments_by_account)(void *cls,
                                         const struct
-                                        ANASTASIS_AccountPubP *anastasis_pub,
+                                        ANASTASIS_CRYPTO_AccountPublicKey *
+                                        anastasis_pub,
                                         ANASTASIS_DB_PaymentPendingIterator it,
                                         void *it_cls);
 
@@ -337,7 +339,8 @@ struct ANASTASIS_DatabasePlugin
    */
   enum ANASTASIS_DB_QueryStatus
   (*increment_lifetime)(void *cls,
-                        const struct ANASTASIS_AccountPubP *anastasis_pub,
+                        const struct
+                        ANASTASIS_CRYPTO_AccountPublicKey *anastasis_pub,
                         const struct
                         ANASTASIS_PaymentSecretP *payment_identifier,
                         struct GNUNET_TIME_Relative lifetime);
@@ -357,7 +360,8 @@ struct ANASTASIS_DatabasePlugin
    */
   enum ANASTASIS_DB_QueryStatus
   (*record_payment)(void *cls,
-                    const struct ANASTASIS_AccountPubP *anastasis_pub,
+                    const struct
+                    ANASTASIS_CRYPTO_AccountPublicKey *anastasis_pub,
                     uint32_t post_counter,
                     const struct ANASTASIS_PaymentSecretP *payment_secret,
                     const struct TALER_Amount *amount);
diff --git a/src/include/anastasis_service.h b/src/include/anastasis_service.h
index b24d19e..90d4392 100644
--- a/src/include/anastasis_service.h
+++ b/src/include/anastasis_service.h
@@ -25,29 +25,13 @@
 
 #include <gnunet/gnunet_util_lib.h>
 #include <gnunet/gnunet_curl_lib.h>
+#include "anastasis_crypto_lib.h"
 #include <jansson.h>
 #include "anastasis_error_codes.h"
 #include <uuid/uuid.h>
 
 GNUNET_NETWORK_STRUCT_BEGIN
 
-/**
- * An EdDSA public key that is used to identify a user's account.
- */
-struct ANASTASIS_AccountPubP
-{
-  struct GNUNET_CRYPTO_EddsaPublicKey pub;
-};
-
-
-/**
- * An EdDSA private key that is used to sign upload data.
- */
-struct ANASTASIS_AccountPrivP
-{
-  struct GNUNET_CRYPTO_EddsaPrivateKey priv;
-};
-
 /**
  * Random identifier used to later charge a payment.
  */
@@ -65,13 +49,6 @@ struct ANASTASIS_UuidP
 {
   uuid_t uuid;
 };
-/**
- * Truth Key used for the decryption of the truth on the server
- */
-struct ANASTASIS_TruthKey
-{
-  uint32_t key[8];
-};
 
 /**
  * Data signed by the account public key of a sync client to
diff --git a/src/include/anastasis_testing_lib.h 
b/src/include/anastasis_testing_lib.h
index f4e7a9c..7d1b980 100644
--- a/src/include/anastasis_testing_lib.h
+++ b/src/include/anastasis_testing_lib.h
@@ -87,7 +87,7 @@ ANASTASIS_TESTING_get_trait_account_pub (const struct
                                          TALER_TESTING_Command *cmd,
                                          unsigned int index,
                                          const struct
-                                         ANASTASIS_AccountPubP **pub);
+                                         ANASTASIS_CRYPTO_AccountPublicKey 
**pub);
 
 
 /**
@@ -100,7 +100,7 @@ ANASTASIS_TESTING_get_trait_account_pub (const struct
 struct TALER_TESTING_Trait
 ANASTASIS_TESTING_make_trait_account_pub (unsigned int index,
                                           const struct
-                                          ANASTASIS_AccountPubP *h);
+                                          ANASTASIS_CRYPTO_AccountPublicKey 
*h);
 
 
 /**
@@ -116,7 +116,8 @@ ANASTASIS_TESTING_get_trait_account_priv (const struct
                                           TALER_TESTING_Command *cmd,
                                           unsigned int index,
                                           const struct
-                                          ANASTASIS_AccountPrivP **priv);
+                                          ANASTASIS_CRYPTO_AccountPublicKey **
+                                          priv);
 
 
 /**
@@ -129,7 +130,7 @@ ANASTASIS_TESTING_get_trait_account_priv (const struct
 struct TALER_TESTING_Trait
 ANASTASIS_TESTING_make_trait_account_priv (unsigned int index,
                                            const struct
-                                           ANASTASIS_AccountPrivP *priv);
+                                           ANASTASIS_CRYPTO_AccountPrivKey 
*priv);
 
 /**
  * Obtain an account public key from @a cmd.
diff --git a/src/lib/anastasis.c b/src/lib/anastasis.c
index f1120cd..f6e6eae 100644
--- a/src/lib/anastasis.c
+++ b/src/lib/anastasis.c
@@ -24,6 +24,8 @@
 #include "anastasis_crypto_lib.h"
 #include <taler/taler_json_lib.h>
 #include <gnunet/gnunet_util_lib.h>
+#include "anastasis_service.h"
+
 /**
  * Challenge struct contains the UUID's needed for the recovery process and a 
reference to
  * ANASTASIS_Recovery.
@@ -109,6 +111,19 @@ ANASTASIS_recovery_begin (const json_t *id_data,
                           ANASTASIS_CoreSecretCallback csc,
                           void *csc_cls)
 {
+  // Derivation of user input into the account public key and user identifier 
for the encryption
+  struct ANASTASIS_CRYPTO_UserIdentifier id;
+  struct ANASTASIS_CRYPTO_AccountPublicKey pub_key;
+
+  ANASTASIS_CRYPTO_user_identifier_derive (id_data, &id);
+  ANASTASIS_CRYPTO_account_public_key_derive (&id, &pub_key);
+
+
+
+
+
+
+
 
 }
 /**
diff --git a/src/lib/anastasis_api_policy_lookup.c 
b/src/lib/anastasis_api_policy_lookup.c
index 8c2fba1..a216c2d 100644
--- a/src/lib/anastasis_api_policy_lookup.c
+++ b/src/lib/anastasis_api_policy_lookup.c
@@ -71,7 +71,7 @@ struct ANASTASIS_PolicyLookupOperation
   /**
    * Public key of the account we are downloading from.
    */
-  struct ANASTASIS_AccountPubP account_pub;
+  struct ANASTASIS_CRYPTO_AccountPublicKey account_pub;
 
   /**
    * Signature returned in the "Sync-Signature"
@@ -281,7 +281,8 @@ handle_header (char *buffer,
 struct ANASTASIS_PolicyLookupOperation *
 ANASTASIS_policy_lookup (struct GNUNET_CURL_Context *ctx,
                          const char *backend_url,
-                         const struct ANASTASIS_AccountPubP *anastasis_pub,
+                         const struct
+                         ANASTASIS_CRYPTO_AccountPublicKey *anastasis_pub,
                          ANASTASIS_PolicyLookupCallback cb,
                          void *cb_cls)
 {
@@ -337,7 +338,8 @@ struct ANASTASIS_PolicyLookupOperation *
 ANASTASIS_policy_lookup_version (struct GNUNET_CURL_Context *ctx,
                                  const char *backend_url,
                                  const struct
-                                 ANASTASIS_AccountPubP *anastasis_pub,
+                                 ANASTASIS_CRYPTO_AccountPublicKey *
+                                 anastasis_pub,
                                  ANASTASIS_PolicyLookupCallback cb,
                                  void *cb_cls,
                                  uint32_t *version)
diff --git a/src/lib/anastasis_api_policy_store.c 
b/src/lib/anastasis_api_policy_store.c
index 6b66327..413de05 100644
--- a/src/lib/anastasis_api_policy_store.c
+++ b/src/lib/anastasis_api_policy_store.c
@@ -270,7 +270,7 @@ struct ANASTASIS_PolicyStoreOperation *
 ANASTASIS_policy_store (struct GNUNET_CURL_Context *ctx,
                         const char *backend_url,
                         const struct
-                        ANASTASIS_AccountPrivP *anastasis_priv,
+                        ANASTASIS_CRYPTO_AccountPrivateKey *anastasis_priv,
                         const struct
                         GNUNET_HashCode *prev_recovery_data_hash,
                         const void *recovery_data,
@@ -393,7 +393,7 @@ ANASTASIS_policy_store (struct GNUNET_CURL_Context *ctx,
   {
     char *acc_pub_str;
     char *path;
-    struct ANASTASIS_AccountPubP pub;
+    struct ANASTASIS_CRYPTO_AccountPublicKey pub;
 
     GNUNET_CRYPTO_eddsa_key_get_public (&anastasis_priv->priv,
                                         &pub.pub);
diff --git a/src/lib/testing_api_cmd_policy_lookup.c 
b/src/lib/testing_api_cmd_policy_lookup.c
index 0b5d07b..90b5e5f 100644
--- a/src/lib/testing_api_cmd_policy_lookup.c
+++ b/src/lib/testing_api_cmd_policy_lookup.c
@@ -44,7 +44,7 @@ struct PolicyLookupState
   /**
    * Eddsa Publickey.
    */
-  struct ANASTASIS_AccountPubP anastasis_pub;
+  struct ANASTASIS_CRYPTO_AccountPublicKey anastasis_pub;
 
   /**
    * Hash of the upload (all zeros if there was no upload).
@@ -149,7 +149,7 @@ policy_lookup_run (void *cls,
   if (NULL != pls->upload_reference)
   {
     const struct TALER_TESTING_Command *upload_cmd;
-    const struct ANASTASIS_AccountPubP *anastasis_pub;
+    const struct ANASTASIS_CRYPTO_AccountPublicKey *anastasis_pub;
 
     upload_cmd = TALER_TESTING_interpreter_lookup_command
                    (is,
diff --git a/src/lib/testing_api_cmd_policy_store.c 
b/src/lib/testing_api_cmd_policy_store.c
index 5830ff8..9225a8d 100644
--- a/src/lib/testing_api_cmd_policy_store.c
+++ b/src/lib/testing_api_cmd_policy_store.c
@@ -53,12 +53,12 @@ struct PolicyStoreState
   /**
    * Eddsa Publickey.
    */
-  struct ANASTASIS_AccountPubP anastasis_pub;
+  struct ANASTASIS_CRYPTO_AccountPublicKey anastasis_pub;
 
   /**
    * Eddsa Privatekey.
    */
-  struct ANASTASIS_AccountPrivP anastasis_priv;
+  struct ANASTASIS_CRYPTO_AccountPrivateKey anastasis_priv;
 
   /**
    * Hash of the previous upload (maybe bogus if
@@ -288,7 +288,7 @@ policy_store_run (void *cls,
       pss->prev_hash = *h;
     }
     {
-      const struct ANASTASIS_AccountPrivP *priv;
+      const struct ANASTASIS_CRYPTO_AccountPrivateKey *priv;
 
       if (GNUNET_OK !=
           ANASTASIS_TESTING_get_trait_account_priv (ref,
@@ -302,7 +302,7 @@ policy_store_run (void *cls,
       pss->anastasis_priv = *priv;
     }
     {
-      const struct ANASTASIS_AccountPubP *pub;
+      const struct ANASTASIS_CRYPTO_AccountPublicKey *pub;
 
       if (GNUNET_OK !=
           ANASTASIS_TESTING_get_trait_account_pub (ref,
diff --git a/src/lib/testing_api_trait_account_priv.c 
b/src/lib/testing_api_trait_account_priv.c
index 0f699a9..97ab6e0 100644
--- a/src/lib/testing_api_trait_account_priv.c
+++ b/src/lib/testing_api_trait_account_priv.c
@@ -40,7 +40,7 @@ int
 ANASTASIS_TESTING_get_trait_account_priv
   (const struct TALER_TESTING_Command *cmd,
   unsigned int index,
-  const struct ANASTASIS_AccountPrivP **priv)
+  const struct ANASTASIS_CRYPTO_AccountPrivateKey **priv)
 {
   return cmd->traits (cmd->cls,
                       (const void **) priv,
@@ -59,7 +59,7 @@ ANASTASIS_TESTING_get_trait_account_priv
 struct TALER_TESTING_Trait
 ANASTASIS_TESTING_make_trait_account_priv
   (unsigned int index,
-  const struct ANASTASIS_AccountPrivP *priv)
+  const struct ANASTASIS_CRYPTO_AccountPrivateKey *priv)
 {
   struct TALER_TESTING_Trait ret = {
     .index = index,
diff --git a/src/lib/testing_api_trait_account_pub.c 
b/src/lib/testing_api_trait_account_pub.c
index 60d4b28..08cd52d 100644
--- a/src/lib/testing_api_trait_account_pub.c
+++ b/src/lib/testing_api_trait_account_pub.c
@@ -40,7 +40,7 @@ int
 ANASTASIS_TESTING_get_trait_account_pub
   (const struct TALER_TESTING_Command *cmd,
   unsigned int index,
-  const struct ANASTASIS_AccountPubP **pub)
+  const struct ANASTASIS_CRYPTO_AccountPublicKey **pub)
 {
   return cmd->traits (cmd->cls,
                       (const void **) pub,
@@ -59,7 +59,7 @@ ANASTASIS_TESTING_get_trait_account_pub
 struct TALER_TESTING_Trait
 ANASTASIS_TESTING_make_trait_account_pub
   (unsigned int index,
-  const struct ANASTASIS_AccountPubP *h)
+  const struct ANASTASIS_CRYPTO_AccountPublicKey *h)
 {
   struct TALER_TESTING_Trait ret = {
     .index = index,

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]