gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis] branch master updated (a735150 -> 8b5083a)


From: gnunet
Subject: [taler-anastasis] branch master updated (a735150 -> 8b5083a)
Date: Wed, 19 Aug 2020 12:32:21 +0200

This is an automated email from the git hooks/post-receive script.

dennis-neufeld pushed a change to branch master
in repository anastasis.

    from a735150  adapt to GNUnet API change
     new 8a9e100  worked on dependency-fix
     new c329ef6  fixed Anastasis to build, testing fails
     new 2ee1034  fixed error with GNUNET_CRYPTO_pow_hash
     new b96fa45  fixed some dependencies in testing
     new 5a4a7c0  fixed salt issue with GNUNET_CRYPTO_pow_hash
     new 8b5083a  fix api test

The 6 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/backend/anastasis-httpd_policy_upload.c | 87 +++++++++++++++++------------
 src/backend/anastasis-httpd_salt.c          |  2 +-
 src/backend/anastasis-httpd_truth.c         |  2 +-
 src/backend/anastasis.conf                  |  4 +-
 src/cli/anastasis-cli-assembler.c           |  4 +-
 src/cli/anastasis-cli-splitter.c            | 12 ++--
 src/include/anastasis.h                     |  6 +-
 src/include/anastasis_crypto_lib.h          | 10 +++-
 src/include/anastasis_service.h             |  4 +-
 src/include/anastasis_testing_lib.h         |  4 +-
 src/lib/Makefile.am                         |  1 -
 src/lib/anastasis.c                         | 16 +++---
 src/lib/anastasis_api_policy_store.c        |  2 +-
 src/lib/anastasis_api_truth_store.c         |  2 +-
 src/lib/test_anastasis.c                    | 33 ++++++-----
 src/lib/test_anastasis_api.c                | 42 +++++++-------
 src/lib/testing_api_cmd_policy_store.c      |  5 +-
 src/lib/testing_api_cmd_salt.c              |  4 +-
 src/lib/testing_api_cmd_truth_store.c       |  2 +-
 src/lib/testing_api_helpers.c               |  6 +-
 src/lib/testing_api_trait_salt.c            |  4 +-
 src/lib/testing_cmd_policy_create.c         |  2 +-
 src/lib/testing_cmd_recover_secret.c        |  4 +-
 src/lib/testing_cmd_secret_share.c          |  2 +-
 src/lib/testing_cmd_truth_upload.c          |  2 +-
 src/util/anastasis_crypto.c                 |  8 +--
 src/util/test_anastasis_crypto.c            | 21 ++-----
 27 files changed, 148 insertions(+), 143 deletions(-)

diff --git a/src/backend/anastasis-httpd_policy_upload.c 
b/src/backend/anastasis-httpd_policy_upload.c
index 5c29894..7cd9ac8 100644
--- a/src/backend/anastasis-httpd_policy_upload.c
+++ b/src/backend/anastasis-httpd_policy_upload.c
@@ -98,12 +98,12 @@ struct PolicyUploadContext
   /**
    * Used while we are awaiting proposal creation.
    */
-  struct TALER_MERCHANT_ProposalOperation *po;
+  struct TALER_MERCHANT_PostOrdersOperation *po;
 
   /**
    * Used while we are waiting payment.
    */
-  struct TALER_MERCHANT_CheckPaymentOperation *cpo;
+  struct TALER_MERCHANT_OrderMerchantGetHandle *cpo;
 
   /**
    * HTTP response code to use on resume, if non-NULL.
@@ -146,6 +146,16 @@ struct PolicyUploadContext
    */
   unsigned int response_code;
 
+  /**
+   * Whether to generate a claim token.
+   */
+  bool make_claim_token;
+
+  /**
+   * The claim token
+   */
+  struct TALER_ClaimTokenP claim_token;
+
 };
 
 
@@ -176,12 +186,12 @@ AH_resume_all_bc ()
     MHD_resume_connection (puc->con);
     if (NULL != puc->po)
     {
-      TALER_MERCHANT_proposal_cancel (puc->po);
+      TALER_MERCHANT_orders_post_cancel (puc->po);
       puc->po = NULL;
     }
     if (NULL != puc->cpo)
     {
-      TALER_MERCHANT_check_payment_cancel (puc->cpo);
+      TALER_MERCHANT_merchant_order_get_cancel (puc->cpo);
       puc->cpo = NULL;
     }
   }
@@ -199,13 +209,13 @@ cleanup_ctx (struct TM_HandlerContext *hc)
   struct PolicyUploadContext *puc = (struct PolicyUploadContext *) hc;
 
   if (NULL != puc->po)
-    TALER_MERCHANT_proposal_cancel (puc->po);
+    TALER_MERCHANT_orders_post_cancel (puc->po);
   if (NULL != puc->hash_ctx)
     GNUNET_CRYPTO_hash_context_abort (puc->hash_ctx);
   if (NULL != puc->resp)
     MHD_destroy_response (puc->resp);
-  GNUNET_free_non_null (puc->existing_order_id);
-  GNUNET_free_non_null (puc->upload);
+  GNUNET_free (puc->existing_order_id);
+  GNUNET_free (puc->upload);
   GNUNET_free (puc);
 }
 
@@ -273,13 +283,16 @@ amount_to_post_counter (const struct TALER_Amount *amount)
 static void
 proposal_cb (void *cls,
              const struct TALER_MERCHANT_HttpResponse *hr,
-             const char *order_id)
+             const char *order_id,
+             const struct TALER_ClaimTokenP *claim_token)
 {
   struct PolicyUploadContext *puc = cls;
   enum ANASTASIS_DB_QueryStatus qs;
   uint32_t post_counter;
 
   puc->po = NULL;
+  if (NULL != claim_token)
+    puc->claim_token = *claim_token;
   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
               "Resuming connection with order `%s'\n",
               order_id);
@@ -370,7 +383,7 @@ ongoing_payment_cb (void *cls,
   if ( (NULL == puc->existing_order_id) ||
        (puc->existing_order_timestamp.abs_value_us < timestamp.abs_value_us) )
   {
-    GNUNET_free_non_null (puc->existing_order_id);
+    GNUNET_free (puc->existing_order_id);
     puc->existing_order_id = GNUNET_strdup (order_id);
     puc->existing_order_timestamp = timestamp;
   }
@@ -381,24 +394,18 @@ ongoing_payment_cb (void *cls,
  * Callback to process a GET /check-payment request
  *
  * @param cls our `struct PolicyUploadContext`
- * @param hr HTTP response
- * @param paid #GNUNET_YES if the payment is settled, #GNUNET_NO if not
- *        settled, $GNUNET_SYSERR on error
- *        (note that refunded payments are returned as paid!)
- * @param refunded #GNUNET_YES if there is at least on refund on this payment,
- *        #GNUNET_NO if refunded, #GNUNET_SYSERR or error
- * @param refunded_amount amount that was refunded, NULL if there
- *        was no refund
- * @param taler_pay_uri the URI that instructs the wallets to process
- *                      the payment
+ * @param hr HTTP response details
+ * @param osr order status
  */
 static void
 check_payment_cb (void *cls,
                   const struct TALER_MERCHANT_HttpResponse *hr,
-                  int paid,
-                  int refunded,
-                  struct TALER_Amount *refund_amount,
-                  const char *taler_pay_uri)
+                  // int paid, FIXME: DELETE
+                  // int refunded, FIXME: DELETE
+                  // struct TALER_Amount *refund_amount, FIXME: DELETE
+                  // const char *taler_pay_uri) FIXME: DELETE
+                  const struct TALER_MERCHANT_OrderStatusResponse *osr)
+
 {
   struct PolicyUploadContext *puc = cls;
 
@@ -406,15 +413,19 @@ check_payment_cb (void *cls,
   puc->cpo = NULL;
   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
               "Payment status checked: %s\n",
-              paid ? "paid" : "unpaid");
+              osr->paid ? "paid" : "unpaid");
   GNUNET_CONTAINER_DLL_remove (puc_head,
                                puc_tail,
                                puc);
   MHD_resume_connection (puc->con);
   AH_trigger_daemon ();
+
+  /**
+   * FIXME: DELETE
   GNUNET_break ( (GNUNET_NO == refunded) &&
                  (NULL == refund_amount) );
-  if (paid)
+  */
+  if (osr->paid)
   {
     enum ANASTASIS_DB_QueryStatus qs;
 
@@ -467,13 +478,14 @@ await_payment (struct PolicyUploadContext *puc,
                                puc);
   MHD_suspend_connection (puc->con);
   puc->order_id = order_id;
-  puc->cpo = TALER_MERCHANT_check_payment (AH_ctx,
-                                           AH_backend_url,
-                                           order_id,
-                                           NULL /* our payments are NOT 
session-bound */,
-                                           timeout,
-                                           &check_payment_cb,
-                                           puc);
+  puc->cpo = TALER_MERCHANT_merchant_order_get (AH_ctx,
+                                                AH_backend_url,
+                                                order_id,
+                                                NULL /* our payments are NOT 
session-bound */,
+                                                false,
+                                                timeout,
+                                                &check_payment_cb,
+                                                puc);
   AH_trigger_curl ();
 }
 
@@ -544,11 +556,12 @@ begin_payment (struct PolicyUploadContext *puc,
                      "fulfillment_url", AH_fulfillment_url,
                      "order_id", order_id);
 
-  puc->po = TALER_MERCHANT_order_put (AH_ctx,
-                                      AH_backend_url,
-                                      order,
-                                      &proposal_cb,
-                                      puc);
+  puc->po = TALER_MERCHANT_orders_post (AH_ctx,
+                                        AH_backend_url,
+                                        order,
+                                        GNUNET_TIME_UNIT_ZERO,
+                                        &proposal_cb,
+                                        puc);
 
   AH_trigger_curl ();
   json_decref (order);
diff --git a/src/backend/anastasis-httpd_salt.c 
b/src/backend/anastasis-httpd_salt.c
index 99099cc..34b2315 100644
--- a/src/backend/anastasis-httpd_salt.c
+++ b/src/backend/anastasis-httpd_salt.c
@@ -38,7 +38,7 @@ AH_handler_salt (struct MHD_Connection *connection,
                  const char *url,
                  void **con_cls)
 {
-  struct ANASTASIS_CRYPTO_SaltP salt;
+  struct ANASTASIS_CRYPTO_PowSaltP salt;
 
   GNUNET_CRYPTO_hash (AH_server_salt,
                       strlen (AH_server_salt),
diff --git a/src/backend/anastasis-httpd_truth.c 
b/src/backend/anastasis-httpd_truth.c
index b97bec3..053402b 100644
--- a/src/backend/anastasis-httpd_truth.c
+++ b/src/backend/anastasis-httpd_truth.c
@@ -190,6 +190,6 @@ AH_handler_truth_get (struct MHD_Connection *connection,
       }
     }
   }
-  GNUNET_free_non_null (decrypted_truth);
+  GNUNET_free (decrypted_truth);
   return MHD_NO;
 }
\ No newline at end of file
diff --git a/src/backend/anastasis.conf b/src/backend/anastasis.conf
index 3bb226e..eef9860 100644
--- a/src/backend/anastasis.conf
+++ b/src/backend/anastasis.conf
@@ -41,8 +41,8 @@ PAYMENT_BACKEND_URL = http://localhost:9976/
 # Standard expiration time in microseconds range of truth (2 years)
 TRUTH_EXPIRATION = 63115200000000
 
-# Server salt 256 bits
-SERVER_SALT = 
gUfO1KGOKYIFlFQgBv9NeYqiSgS16Y0dcgj74YewVnSEsEkXaG5duaGphWXgQGI84OOezaS9tlffQ0J27u6iAcvWMMdR8oANz5GeoWZFAAQDW65qMrUoTfDK170hY7krj6GZ04PFgBzBRtNAyGqPTkRbOFQ04lu6pa0bYF9JAwmwrFD0csVliuvapL33ukOwHdKDyg81FQuRW1bNbj9D0GMPoVcacJUrOXk0mIWhyG3Q2OoVOfW1LiIaXwfitLGd
+# Server salt 16 Byte
+SERVER_SALT = gUfO1KGOKYIFlFQg
 
 # Supported methods
 SUPPORTED_METHODS = question
diff --git a/src/cli/anastasis-cli-assembler.c 
b/src/cli/anastasis-cli-assembler.c
index ebb0ac6..8a5ed5a 100644
--- a/src/cli/anastasis-cli-assembler.c
+++ b/src/cli/anastasis-cli-assembler.c
@@ -164,7 +164,7 @@ struct RecoverSecretState
   /**
    * Salt to be used to derive the id
    */
-  struct ANASTASIS_CRYPTO_SaltP *salt;
+  struct ANASTASIS_CRYPTO_PowSaltP *salt;
 
   /**
    * Recovery information from the lookup
@@ -697,7 +697,7 @@ core_secret_cb (void *cls,
 static void
 salt_cb (void *cls,
          unsigned int http_status,
-         const struct ANASTASIS_CRYPTO_SaltP *salt)
+         const struct ANASTASIS_CRYPTO_PowSaltP *salt)
 {
   struct RecoverSecretState *rss = cls;
 
diff --git a/src/cli/anastasis-cli-splitter.c b/src/cli/anastasis-cli-splitter.c
index 07f29f9..d43888b 100644
--- a/src/cli/anastasis-cli-splitter.c
+++ b/src/cli/anastasis-cli-splitter.c
@@ -137,7 +137,7 @@ struct ServerInfo
   /**
    * server salt of the anastasis backend.
    */
-  const struct ANASTASIS_CRYPTO_SaltP *backend_salt;
+  const struct ANASTASIS_CRYPTO_PowSaltP *backend_salt;
 
   /**
    * insurance of the anastasis backend.
@@ -173,7 +173,7 @@ struct SaltState
   /**
    * The salt value from server.
    */
-  struct ANASTASIS_CRYPTO_SaltP salt;
+  struct ANASTASIS_CRYPTO_PowSaltP salt;
 
   /**
    * Reference to a ServerInfo.
@@ -624,7 +624,7 @@ config_cb (void *cls,
 static void
 salt_cb (void *cls,
          unsigned int http_status,
-         const struct ANASTASIS_CRYPTO_SaltP *salt)
+         const struct ANASTASIS_CRYPTO_PowSaltP *salt)
 {
   struct SaltState *ss = cls;
   struct ConfigState *cs = GNUNET_new (struct ConfigState);
@@ -1253,7 +1253,7 @@ shutdown_task (void *cls)
     {
       GNUNET_free (tu_states[i].truth);
       GNUNET_free (tu_states[i].method);
-      GNUNET_free_non_null (tu_states[i].secret_answer);
+      GNUNET_free (tu_states[i].secret_answer);
     }
   }
 
@@ -1265,9 +1265,9 @@ shutdown_task (void *cls)
       GNUNET_free (servers[i].backend_methods);
     }
   }
-  GNUNET_free_non_null (servers);
+  GNUNET_free (servers);
 
-  GNUNET_free_non_null (pds);
+  GNUNET_free (pds);
 
   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
               "Shutdown complete\n");
diff --git a/src/include/anastasis.h b/src/include/anastasis.h
index 407a999..17f6a36 100644
--- a/src/include/anastasis.h
+++ b/src/include/anastasis.h
@@ -83,7 +83,7 @@ struct ANASTASIS_RecoveryInformation
 
   unsigned int cs_len;
 
-  struct ANASTASIS_CRYPTO_SaltP salt;
+  struct ANASTASIS_CRYPTO_PowSaltP salt;
 
   unsigned int version;     // actual version obtained
 };
@@ -246,7 +246,7 @@ ANASTASIS_recovery_begin (struct GNUNET_CURL_Context *ctx,
                           const json_t *id_data,
                           unsigned int version,
                           const char *anastasis_provider_url,
-                          const struct ANASTASIS_CRYPTO_SaltP *salt,
+                          const struct ANASTASIS_CRYPTO_PowSaltP *salt,
                           ANASTASIS_PolicyCallback pc,
                           void *pc_cls,
                           ANASTASIS_CoreSecretCallback csc,
@@ -319,7 +319,7 @@ ANASTASIS_truth_upload (struct GNUNET_CURL_Context *ctx,
                         const char *method,
                         const char *instructions,
                         const char *mime_type,
-                        const struct ANASTASIS_CRYPTO_SaltP *salt,
+                        const struct ANASTASIS_CRYPTO_PowSaltP *salt,
                         const void *truth_data,
                         size_t truth_data_size,
                         ANASTASIS_TruthPaymentCallback tpc,
diff --git a/src/include/anastasis_crypto_lib.h 
b/src/include/anastasis_crypto_lib.h
index a26c010..23d18db 100644
--- a/src/include/anastasis_crypto_lib.h
+++ b/src/include/anastasis_crypto_lib.h
@@ -77,6 +77,14 @@ struct ANASTASIS_CRYPTO_SaltP
   struct GNUNET_HashCode salt GNUNET_PACKED;
 };
 
+/**
+ * Specifies a Salt value of size 16 Byte for GNUNET_CRYPTO_pow_hash.
+*/
+struct ANASTASIS_CRYPTO_PowSaltP
+{
+  uint8_t salt[16];
+};
+
 
 /**
  * Specifies a policy key which is used to decrypt the master key
@@ -184,7 +192,7 @@ GNUNET_NETWORK_STRUCT_END
 void
 ANASTASIS_CRYPTO_user_identifier_derive (
   const json_t *id_data,
-  const struct ANASTASIS_CRYPTO_SaltP *server_salt,
+  const struct ANASTASIS_CRYPTO_PowSaltP *server_salt,
   struct ANASTASIS_CRYPTO_UserIdentifierP *id);
 
 /**
diff --git a/src/include/anastasis_service.h b/src/include/anastasis_service.h
index 70abc62..e849828 100644
--- a/src/include/anastasis_service.h
+++ b/src/include/anastasis_service.h
@@ -319,7 +319,7 @@ struct ANASTASIS_ConfigOperation
 typedef void
 (*ANASTASIS_SaltCallback)(void *cls,
                           unsigned int http_status,
-                          const struct ANASTASIS_CRYPTO_SaltP *salt);
+                          const struct ANASTASIS_CRYPTO_PowSaltP *salt);
 
 
 struct ANASTASIS_SaltOperation *
@@ -366,7 +366,7 @@ struct ANASTASIS_SaltOperation
   /**
    * Server salt.
    */
-  struct ANASTASIS_CRYPTO_SaltP salt;
+  struct ANASTASIS_CRYPTO_PowSaltP salt;
 };
 
 
diff --git a/src/include/anastasis_testing_lib.h 
b/src/include/anastasis_testing_lib.h
index 2249a65..c3ff3c2 100644
--- a/src/include/anastasis_testing_lib.h
+++ b/src/include/anastasis_testing_lib.h
@@ -434,7 +434,7 @@ ANASTASIS_TESTING_cmd_keyshare_lookup (const char *label,
 int
 ANASTASIS_TESTING_get_trait_salt (const struct TALER_TESTING_Command *cmd,
                                   unsigned int index,
-                                  const struct ANASTASIS_CRYPTO_SaltP **s);
+                                  const struct ANASTASIS_CRYPTO_PowSaltP **s);
 
 
 /**
@@ -446,7 +446,7 @@ ANASTASIS_TESTING_get_trait_salt (const struct 
TALER_TESTING_Command *cmd,
  */
 struct TALER_TESTING_Trait
 ANASTASIS_TESTING_make_trait_salt (unsigned int index,
-                                   const struct ANASTASIS_CRYPTO_SaltP *s);
+                                   const struct ANASTASIS_CRYPTO_PowSaltP *s);
 
 
 /**
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
index cd1d449..3aeff6a 100644
--- a/src/lib/Makefile.am
+++ b/src/lib/Makefile.am
@@ -30,7 +30,6 @@ libanastasisrest_la_LIBADD = \
   -lgnunetutil \
   -ljansson \
   -ltalerutil \
-  -lanastasisutil \
   $(XLIB)
 
 if HAVE_LIBCURL
diff --git a/src/lib/anastasis.c b/src/lib/anastasis.c
index 76cb9ae..ca5780e 100644
--- a/src/lib/anastasis.c
+++ b/src/lib/anastasis.c
@@ -87,15 +87,15 @@ struct ANASTASIS_Recovery
    */
   size_t enc_core_secret_size;
   /**
-   * Length of available decryption policies
+   * Length of available decryption policies //FIXME: Copy paste?
    */
-  struct ANASTASIS_CRYPTO_SaltP policy_salt;
+  struct ANASTASIS_CRYPTO_PowSaltP policy_salt;
   /**
-   * Length of available decryption policies
+   * Length of available decryption policies //FIXME: Copy paste?
    */
   struct ANASTASIS_Challenge *solved_challenges;
   /**
-   * Length of available decryption policies
+   * Length of available decryption policies //FIXME: Copy paste?
    */
   unsigned int solved_challenge_pos;
   /**
@@ -709,7 +709,7 @@ ANASTASIS_recovery_begin (struct GNUNET_CURL_Context *ctx,
                           const json_t *id_data,
                           unsigned int version,
                           const char *anastasis_provider_url,
-                          const struct ANASTASIS_CRYPTO_SaltP *salt,
+                          const struct ANASTASIS_CRYPTO_PowSaltP *salt,
                           ANASTASIS_PolicyCallback pc,
                           void *pc_cls,
                           ANASTASIS_CoreSecretCallback csc,
@@ -822,7 +822,7 @@ struct ANASTASIS_Truth
   /**
    * server salt used to derive user identifier
    */
-  const struct ANASTASIS_CRYPTO_SaltP *salt;
+  const struct ANASTASIS_CRYPTO_PowSaltP *salt;
 };
 
 /**
@@ -976,7 +976,7 @@ ANASTASIS_truth_upload (struct GNUNET_CURL_Context *ctx,
                         const char *method,
                         const char *instructions,
                         const char *mime_type,
-                        const struct ANASTASIS_CRYPTO_SaltP *salt,
+                        const struct ANASTASIS_CRYPTO_PowSaltP *salt,
                         const void *truth_data,
                         size_t truth_data_size,
                         ANASTASIS_TruthPaymentCallback tpc,
@@ -1282,7 +1282,7 @@ struct PolicyStoreState
   /**
    * Server salt
    */
-  const struct ANASTASIS_CRYPTO_SaltP *server_salt;
+  const struct ANASTASIS_CRYPTO_PowSaltP *server_salt;
 
   /**
    * Status of the transaction
diff --git a/src/lib/anastasis_api_policy_store.c 
b/src/lib/anastasis_api_policy_store.c
index 5f2465c..5adcf86 100644
--- a/src/lib/anastasis_api_policy_store.c
+++ b/src/lib/anastasis_api_policy_store.c
@@ -90,7 +90,7 @@ ANASTASIS_policy_store_cancel (struct
     GNUNET_CURL_job_cancel (pso->job);
     pso->job = NULL;
   }
-  GNUNET_free_non_null (pso->pay_uri);
+  GNUNET_free (pso->pay_uri);
   GNUNET_free (pso->url);
   GNUNET_free (pso);
 }
diff --git a/src/lib/anastasis_api_truth_store.c 
b/src/lib/anastasis_api_truth_store.c
index 3370224..e010315 100644
--- a/src/lib/anastasis_api_truth_store.c
+++ b/src/lib/anastasis_api_truth_store.c
@@ -81,7 +81,7 @@ ANASTASIS_truth_store_cancel (struct
     GNUNET_CURL_job_cancel (tso->job);
     tso->job = NULL;
   }
-  GNUNET_free_non_null (tso->pay_uri);
+  GNUNET_free (tso->pay_uri);
   GNUNET_free (tso->url);
   GNUNET_free (tso);
 }
diff --git a/src/lib/test_anastasis.c b/src/lib/test_anastasis.c
index c2f4b8e..ccbd12e 100644
--- a/src/lib/test_anastasis.c
+++ b/src/lib/test_anastasis.c
@@ -151,6 +151,13 @@ run (void *cls,
      struct TALER_TESTING_Interpreter *is)
 {
   struct TALER_TESTING_Command pay[] = {
+    TALER_TESTING_cmd_merchant_post_instances ("instance-create-default",
+                                               merchant_url,
+                                               "default",
+                                               merchant_payto,
+                                               "EUR",
+                                               MHD_HTTP_NO_CONTENT),
+
     /**
      * Move money to the exchange's bank account.
      */
@@ -255,20 +262,20 @@ run (void *cls,
                                         NULL),
 
     /* what would we have to pay? */
-    TALER_TESTING_cmd_proposal_lookup ("fetch-proposal",
-                                       merchant_url,
-                                       MHD_HTTP_OK,
-                                       "secret-share-1",
-                                       NULL),
+    TALER_TESTING_cmd_merchant_claim_order ("fetch-proposal",
+                                            merchant_url,
+                                            MHD_HTTP_OK,
+                                            "secret-share-1",
+                                            NULL),
     /* make the payment */
-    TALER_TESTING_cmd_pay ("pay-account",
-                           merchant_url,
-                           MHD_HTTP_OK,
-                           "fetch-proposal",
-                           "withdraw-coin-1",
-                           "EUR:5",
-                           "EUR:4.99", /* must match ANNUAL_FEE in config! */
-                           "EUR:0.01"),
+    TALER_TESTING_cmd_merchant_pay_order ("pay-account",
+                                          merchant_url,
+                                          MHD_HTTP_OK,
+                                          "fetch-proposal",
+                                          "withdraw-coin-1",
+                                          "EUR:5",
+                                          "EUR:4.99", /* must match ANNUAL_FEE 
in config! */
+                                          NULL),
 
     ANASTASIS_TESTING_cmd_secret_share ("secret-share-2",
                                         anastasis_url,
diff --git a/src/lib/test_anastasis_api.c b/src/lib/test_anastasis_api.c
index fb8ec66..bcb2e40 100644
--- a/src/lib/test_anastasis_api.c
+++ b/src/lib/test_anastasis_api.c
@@ -152,6 +152,12 @@ run (void *cls,
      struct TALER_TESTING_Interpreter *is)
 {
   struct TALER_TESTING_Command pay[] = {
+    TALER_TESTING_cmd_merchant_post_instances ("instance-create-default",
+                                               merchant_url,
+                                               "default",
+                                               merchant_payto,
+                                               "EUR",
+                                               MHD_HTTP_NO_CONTENT),
     /**
      * Move money to the exchange's bank account.
      */
@@ -188,16 +194,6 @@ run (void *cls,
 
     // FIXME: Code for policy handling
 
-    ANASTASIS_TESTING_cmd_policy_store ("policy-store-1",
-                                        anastasis_url,
-                                        NULL /* prev upload */,
-                                        NULL /* last upload */,
-                                        MHD_HTTP_PAYMENT_REQUIRED,
-                                        ANASTASIS_TESTING_PSO_NONE,
-                                        "Test-1",
-                                        strlen ("Test-1")),
-
-
     ANASTASIS_TESTING_cmd_policy_store ("policy-store-1",
                                         anastasis_url,
                                         NULL /* prev upload */,
@@ -208,20 +204,20 @@ run (void *cls,
                                         strlen ("Test-1")),
 
     /* what would we have to pay? */
-    TALER_TESTING_cmd_proposal_lookup ("fetch-proposal",
-                                       merchant_url,
-                                       MHD_HTTP_OK,
-                                       "policy-store-1",
-                                       NULL),
+    TALER_TESTING_cmd_merchant_claim_order ("fetch-proposal",
+                                            merchant_url,
+                                            MHD_HTTP_OK,
+                                            "policy-store-1",
+                                            NULL),
     /* make the payment */
-    TALER_TESTING_cmd_pay ("pay-account",
-                           merchant_url,
-                           MHD_HTTP_OK,
-                           "fetch-proposal",
-                           "withdraw-coin-1",
-                           "EUR:5",
-                           "EUR:4.99", /* must match ANNUAL_FEE in config! */
-                           "EUR:0.01"),
+    TALER_TESTING_cmd_merchant_pay_order ("pay-account",
+                                          merchant_url,
+                                          MHD_HTTP_OK,
+                                          "fetch-proposal",
+                                          "withdraw-coin-1",
+                                          "EUR:5",
+                                          "EUR:4.99", /* must match ANNUAL_FEE 
in config! */
+                                          NULL),
 
     ANASTASIS_TESTING_cmd_policy_store ("policy-store-2",
                                         anastasis_url,
diff --git a/src/lib/testing_api_cmd_policy_store.c 
b/src/lib/testing_api_cmd_policy_store.c
index 0d3eeb3..229811c 100644
--- a/src/lib/testing_api_cmd_policy_store.c
+++ b/src/lib/testing_api_cmd_policy_store.c
@@ -35,7 +35,6 @@
  */
 struct PolicyStoreState
 {
-
   /**
    * The policy data.
    */
@@ -408,7 +407,7 @@ policy_store_cleanup (void *cls,
     pss->pso = NULL;
   }
 
-  GNUNET_free_non_null (pss->payment_order_id);
+  GNUNET_free (pss->payment_order_id);
   GNUNET_free (pss);
 }
 
@@ -439,7 +438,7 @@ policy_store_traits (void *cls,
     ANASTASIS_TESTING_make_trait_account_priv (0,
                                                &pss->anastasis_priv),
     TALER_TESTING_make_trait_order_id (0,
-                                       pss->payment_order_id),
+                                       pss->payment_order_id),                 
              
     TALER_TESTING_trait_end ()
   };
 
diff --git a/src/lib/testing_api_cmd_salt.c b/src/lib/testing_api_cmd_salt.c
index c891215..aea43f5 100644
--- a/src/lib/testing_api_cmd_salt.c
+++ b/src/lib/testing_api_cmd_salt.c
@@ -54,7 +54,7 @@ struct SaltState
   /**
    * The salt value from server.
    */
-  struct ANASTASIS_CRYPTO_SaltP salt;
+  struct ANASTASIS_CRYPTO_PowSaltP salt;
 };
 
 
@@ -68,7 +68,7 @@ struct SaltState
 static void
 salt_cb (void *cls,
          unsigned int http_status,
-         const struct ANASTASIS_CRYPTO_SaltP *salt)
+         const struct ANASTASIS_CRYPTO_PowSaltP *salt)
 {
   struct SaltState *ss = cls;
 
diff --git a/src/lib/testing_api_cmd_truth_store.c 
b/src/lib/testing_api_cmd_truth_store.c
index 910cf77..93789aa 100644
--- a/src/lib/testing_api_cmd_truth_store.c
+++ b/src/lib/testing_api_cmd_truth_store.c
@@ -308,7 +308,7 @@ truth_store_cleanup (void *cls,
     tss->tso = NULL;
   }
 
-  GNUNET_free_non_null ((void *) tss->payment_order_id);
+  GNUNET_free (tss->payment_order_id);
   GNUNET_free (tss);
 }
 
diff --git a/src/lib/testing_api_helpers.c b/src/lib/testing_api_helpers.c
index 8d5895f..e86cb86 100644
--- a/src/lib/testing_api_helpers.c
+++ b/src/lib/testing_api_helpers.c
@@ -49,8 +49,7 @@ ANASTASIS_TESTING_run_anastasis (const char *config_filename,
   char *wget_cmd;
 
   anastasis_proc
-    = GNUNET_OS_start_process (GNUNET_NO,
-                               GNUNET_OS_INHERIT_STD_ALL,
+    = GNUNET_OS_start_process (GNUNET_OS_INHERIT_STD_ALL,
                                NULL, NULL, NULL,
                                "anastasis-httpd",
                                "anastasis-httpd",
@@ -146,8 +145,7 @@ ANASTASIS_TESTING_prepare_anastasis (const char 
*config_filename)
 
   /* DB preparation */
   if (NULL == (dbinit_proc = GNUNET_OS_start_process
-                               (GNUNET_NO,
-                               GNUNET_OS_INHERIT_STD_ALL,
+                               (GNUNET_OS_INHERIT_STD_ALL,
                                NULL, NULL, NULL,
                                "anastasis-dbinit",
                                "anastasis-dbinit",
diff --git a/src/lib/testing_api_trait_salt.c b/src/lib/testing_api_trait_salt.c
index 0bf5f3a..88976ce 100644
--- a/src/lib/testing_api_trait_salt.c
+++ b/src/lib/testing_api_trait_salt.c
@@ -41,7 +41,7 @@ int
 ANASTASIS_TESTING_get_trait_salt
   (const struct TALER_TESTING_Command *cmd,
   unsigned int index,
-  const struct ANASTASIS_CRYPTO_SaltP **s)
+  const struct ANASTASIS_CRYPTO_PowSaltP **s)
 {
   return cmd->traits (cmd->cls,
                       (const void **) s,
@@ -60,7 +60,7 @@ ANASTASIS_TESTING_get_trait_salt
 struct TALER_TESTING_Trait
 ANASTASIS_TESTING_make_trait_salt
   (unsigned int index,
-  const struct ANASTASIS_CRYPTO_SaltP *s)
+  const struct ANASTASIS_CRYPTO_PowSaltP *s)
 {
   struct TALER_TESTING_Trait ret = {
     .index = index,
diff --git a/src/lib/testing_cmd_policy_create.c 
b/src/lib/testing_cmd_policy_create.c
index d1086e7..07d3a66 100644
--- a/src/lib/testing_cmd_policy_create.c
+++ b/src/lib/testing_cmd_policy_create.c
@@ -141,7 +141,7 @@ policy_create_cleanup (void *cls,
 {
   struct PolicyCreateState *pcs = cls;
 
-  GNUNET_free_non_null (pcs->cmd_label_array);
+  GNUNET_free (pcs->cmd_label_array);
   GNUNET_free (pcs);
 }
 
diff --git a/src/lib/testing_cmd_recover_secret.c 
b/src/lib/testing_cmd_recover_secret.c
index 3cd6d6d..8ec7243 100644
--- a/src/lib/testing_cmd_recover_secret.c
+++ b/src/lib/testing_cmd_recover_secret.c
@@ -75,7 +75,7 @@ struct RecoverSecretState
   /**
    * Salt to be used to derive the id
    */
-  struct ANASTASIS_CRYPTO_SaltP *salt;
+  struct ANASTASIS_CRYPTO_PowSaltP *salt;
   /**
    * Recovery information from the lookup
    */
@@ -134,7 +134,7 @@ recover_secret_run (void *cls,
 {
   struct RecoverSecretState *rss = cls;
   const struct TALER_TESTING_Command *ref;
-  const struct ANASTASIS_CRYPTO_SaltP *salt;
+  const struct ANASTASIS_CRYPTO_PowSaltP *salt;
   rss->is = is;
 
   if (NULL != rss->download_reference)
diff --git a/src/lib/testing_cmd_secret_share.c 
b/src/lib/testing_cmd_secret_share.c
index 1304cee..02fd4fb 100644
--- a/src/lib/testing_cmd_secret_share.c
+++ b/src/lib/testing_cmd_secret_share.c
@@ -369,7 +369,7 @@ secret_share_cleanup (void *cls,
 {
   struct SecretShareState *sss = cls;
 
-  GNUNET_free_non_null (sss->cmd_label_array);
+  GNUNET_free (sss->cmd_label_array);
   GNUNET_free (sss);
 }
 
diff --git a/src/lib/testing_cmd_truth_upload.c 
b/src/lib/testing_cmd_truth_upload.c
index 7d7e7e7..122cfe3 100644
--- a/src/lib/testing_cmd_truth_upload.c
+++ b/src/lib/testing_cmd_truth_upload.c
@@ -168,7 +168,7 @@ truth_upload_run (void *cls,
 {
   struct TruthUploadState *tus = cls;
   const struct TALER_TESTING_Command *ref;
-  const struct ANASTASIS_CRYPTO_SaltP *salt;
+  const struct ANASTASIS_CRYPTO_PowSaltP *salt;
 
   tus->is = is;
   if (NULL != tus->upload_reference)
diff --git a/src/util/anastasis_crypto.c b/src/util/anastasis_crypto.c
index 69a464d..78b95c8 100644
--- a/src/util/anastasis_crypto.c
+++ b/src/util/anastasis_crypto.c
@@ -319,24 +319,20 @@ anastasis_decrypt (const void *key,
 void
 ANASTASIS_CRYPTO_user_identifier_derive (
   const json_t *id_data,
-  const struct ANASTASIS_CRYPTO_SaltP *server_salt,
+  const struct ANASTASIS_CRYPTO_PowSaltP *server_salt,
   struct ANASTASIS_CRYPTO_UserIdentifierP *id)
 {
   char *json_enc;
-  char *salt_str;
 
-  salt_str = GNUNET_STRINGS_data_to_string_alloc (server_salt,
-                                                  sizeof (*server_salt));
   json_enc = json_dumps (id_data,
                          JSON_COMPACT | JSON_SORT_KEYS);
   GNUNET_assert (NULL != json_enc);
-  GNUNET_CRYPTO_pow_hash (salt_str,
+  GNUNET_CRYPTO_pow_hash (server_salt,
                           json_enc,
                           strlen (json_enc),
                           &id->hash);
 
   free (json_enc);
-  GNUNET_free (salt_str);
 }
 
 
diff --git a/src/util/test_anastasis_crypto.c b/src/util/test_anastasis_crypto.c
index 9171119..8797882 100644
--- a/src/util/test_anastasis_crypto.c
+++ b/src/util/test_anastasis_crypto.c
@@ -41,11 +41,6 @@ test_user_identifier_derive (void)
   struct ANASTASIS_CRYPTO_UserIdentifierP id_1;
   struct ANASTASIS_CRYPTO_UserIdentifierP id_2;
   struct ANASTASIS_CRYPTO_UserIdentifierP id_3;
-  struct ANASTASIS_CRYPTO_SaltP salt;
-
-  GNUNET_CRYPTO_hash_from_string2 ("Server Salt",
-                                   strlen ("Server Salt"),
-                                   &salt.salt);
 
   // sample data 1
   id_data_1 = json_object ();
@@ -58,13 +53,13 @@ test_user_identifier_derive (void)
   json_object_set_new (id_data_3, "arg1", json_string ("Hallo2"));
 
   ANASTASIS_CRYPTO_user_identifier_derive (id_data_1,
-                                           &salt,
+                                           "Server-Salt-Test",
                                            &id_1);
   ANASTASIS_CRYPTO_user_identifier_derive (id_data_2,
-                                           &salt,
+                                           "Server-Salt-Test",
                                            &id_2);
   ANASTASIS_CRYPTO_user_identifier_derive (id_data_3,
-                                           &salt,
+                                           "Server-Salt-Test",
                                            &id_3);
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "UserIdentifier_1: %s\n",
@@ -96,19 +91,13 @@ test_recovery_document (void)
   void *plaintext;
   size_t size_plaintext;
   struct ANASTASIS_CRYPTO_UserIdentifierP id;
-  struct ANASTASIS_CRYPTO_SaltP salt;
   int ret;
 
   json_t *id_data = json_object ();
   const char *test = "TEST_ERD";
-
-  GNUNET_CRYPTO_hash_from_string2 ("Server Salt",
-                                   strlen ("Server Salt"),
-                                   &salt.salt);
-
   json_object_set_new (id_data, "arg1", json_string ("ID_DATA"));
   ANASTASIS_CRYPTO_user_identifier_derive (id_data,
-                                           &salt,
+                                           "Server-Salt-Test",
                                            &id);
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -311,7 +300,7 @@ test_public_key_derive ()
 {
   struct ANASTASIS_CRYPTO_UserIdentifierP id;
   struct ANASTASIS_CRYPTO_AccountPublicKeyP pub_key;
-  struct ANASTASIS_CRYPTO_SaltP server_salt;
+  struct ANASTASIS_CRYPTO_PowSaltP server_salt;
 
   json_t *id_data = json_object ();
 

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

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