gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis] branch master updated: error fixed name dup


From: gnunet
Subject: [taler-anastasis] branch master updated: error fixed name dup
Date: Mon, 30 Mar 2020 00:46:53 +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 28825d7  error fixed name dup
28825d7 is described below

commit 28825d7f627bf8b77afeae7c14f418cd349a9775
Author: Dominik Meister <address@hidden>
AuthorDate: Mon Mar 30 00:46:43 2020 +0200

    error fixed name dup
---
 src/include/Makefile.am     |   3 +-
 src/include/anastasis.h     |  42 +++++----
 src/lib/Makefile.am         |   1 -
 src/lib/anastasis.c         | 219 ++++++++++----------------------------------
 src/util/anastasis_crypto.c |  38 ++++----
 5 files changed, 92 insertions(+), 211 deletions(-)

diff --git a/src/include/Makefile.am b/src/include/Makefile.am
index 5f8d0a7..df4c007 100644
--- a/src/include/Makefile.am
+++ b/src/include/Makefile.am
@@ -8,4 +8,5 @@ anastasisinclude_HEADERS = \
   anastasis_database_plugin.h \
   anastasis_service.h \
   anastasis_error_codes.h \
-  anastasis_database_lib.h 
\ No newline at end of file
+  anastasis_database_lib.h \
+  anastasis.h
diff --git a/src/include/anastasis.h b/src/include/anastasis.h
index 253b382..aa96bd9 100644
--- a/src/include/anastasis.h
+++ b/src/include/anastasis.h
@@ -20,6 +20,10 @@
  * @author Dominik Meister
  * @author Dennis Neufeld
  */
+#include "platform.h"
+#include <taler/taler_json_lib.h>
+#include <gnunet/gnunet_util_lib.h>
+
 
 /*Download api*/
 /**
@@ -31,7 +35,7 @@ struct ANASTASIS_EscrowMethod
   struct ANASTASIS_Challenge *challenge;
 
   struct TALER_Amount cost;
-}
+};
 
 /**
  * Defines a Decryption Policy with multiple escrow methods
@@ -102,7 +106,7 @@ ANASTASIS_challenge_answer (struct ANASTASIS_Challenge 
*challenge,
                             const void *answer,
                             size_t answer_size,
                             ANASTASIS_AnswerFeedback af,
-                            void af_cls);
+                            void *af_cls);
 
 /**
  * Defines the instructions for a challenge, what does the user have to do to 
fulfill the challenge.
@@ -145,7 +149,7 @@ typedef void
 void
 ANASTASIS_challenge_run (struct ANASTASIS_Challenge *challenge,
                          ANASTASIS_ChallengeCallback cc,
-                         void cc_cls)
+                         void *cc_cls);
 
 /**
  * Defines a Callback for the payment of an escrow challenge. Sends back a 
payment link
@@ -172,7 +176,7 @@ typedef void
 void
 ANASTASIS_challenge_select_to_pay (struct ANASTASIS_Challenge *challenge,
                                    ANASTASIS_ChallengePaymentCallback cc,
-                                   void cc_cls)
+                                   void *cc_cls);
 
 /**
 * Callback which passes back the recovery document and its possible policies. 
Also passes
@@ -185,7 +189,7 @@ ANASTASIS_challenge_select_to_pay (struct 
ANASTASIS_Challenge *challenge,
 typedef void
 (*ANASTASIS_PolicyCallback)(void *cls,
                             const struct ANASTASIS_RecoveryInformation *ri,
-                            const enum TALER_ErrorCode ecs[]);
+                            const enum TALER_ErrorCode *ecs[]);
 
 /**
  * stores provider URIs, identity key material, decrypted recovery document 
(internally!)
@@ -241,9 +245,9 @@ struct ANASTASIS_Truth;
 * @param ec status code of the request
 */
 typedef void
-(ANASTASIS_TruthPaymentCallback)(void *cls,
-                                 const char *taler_pay_url,
-                                 enum TALER_ErrorCode ec);
+(*ANASTASIS_TruthPaymentCallback)(void *cls,
+                                  const char *taler_pay_url,
+                                  enum TALER_ErrorCode ec);
 
 /**
 * Upload information
@@ -253,8 +257,8 @@ typedef void
 * @param t Truth object (contains provider url and uuid)
 */
 typedef void
-(ANASTASIS_TruthCallback)(void *cls,
-                          struct ANASTASIS_Truth *t);
+(*ANASTASIS_TruthCallback)(void *cls,
+                           struct ANASTASIS_Truth *t);
 /**
 * Uploads a truth object onto a escrow provider
 *
@@ -294,7 +298,7 @@ ANASTASIS_truth_upload_cancel (struct ANASTASIS_TruthUpload 
*tu);
 * @param t object to clean up
 */
 void
-ANASTASIS_truth_free (struct ANASTASIS_Truth *t)
+ANASTASIS_truth_free (struct ANASTASIS_Truth *t);
 
 
 /**
@@ -327,9 +331,9 @@ ANASTASIS_policy_destroy (struct ANASTASIS_Policy *p);
 * @param ec status code of the request
 */
 typedef void
-(ANASTASIS_ShareResultCallback)(void *cls,
-                                const struct GNUNET_HashCode *current_etag,
-                                enum TALER_ErrorCode ec);
+(*ANASTASIS_ShareResultCallback)(void *cls,
+                                 const struct GNUNET_HashCode *current_etag,
+                                 enum TALER_ErrorCode ec);
 /**
 * Callback for a payment process for uploading a policy
 *
@@ -338,9 +342,9 @@ typedef void
 * @param ec status of the request
 */
 typedef void
-(ANASTASIS_SharePaymentCallback)(void *cls,
-                                 const char *taler_pay_url,
-                                 enum TALER_ErrorCode ec);
+(*ANASTASIS_SharePaymentCallback)(void *cls,
+                                  const char *taler_pay_url,
+                                  enum TALER_ErrorCode ec);
 
 /**
 * Defines a recovery document upload process (recovery document consists of 
multiple policies)
@@ -366,9 +370,9 @@ ANASTASIS_secret_share (const json_t *id_data,
                         const struct GNUNET_HashCode *last_etag,
                         struct ANASTASIS_Policy *policies[],
                         unsigned int policies_len,
-                        ANASTASIS SharePaymentCallback spc,
+                        ANASTASIS_SharePaymentCallback spc,
                         void *spc_cls,
-                        ANASTASIS ShareResultCallback src,
+                        ANASTASIS_ShareResultCallback src,
                         void *src_cls,
                         const void *core_secret,
                         size_t core_secret_size);
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
index 251a6a5..15e9555 100644
--- a/src/lib/Makefile.am
+++ b/src/lib/Makefile.am
@@ -43,7 +43,6 @@ libanastasis_la_LDFLAGS = \
 libanastasis_la_SOURCES = \
   anastasis.c
 libanastasis_la_LIBADD = \
-  $(top_builddir)/src/lib/libanastasisrest.la \
   -lgnunetutil \
   -ljansson \
   -ltalerutil \
diff --git a/src/lib/anastasis.c b/src/lib/anastasis.c
index 872bbfb..f1120cd 100644
--- a/src/lib/anastasis.c
+++ b/src/lib/anastasis.c
@@ -21,73 +21,15 @@
  */
 
 #include "anastasis.h"
-
-/*Download api*/
-/**
- * Defines an opaque handle to select a method
- * Contains the cost of a method (can be zero)
-*/
-struct ANASTASIS_EscrowMethod
-{
-  struct ANASTASIS_Challenge *challenge;
-
-  struct TALER_Amount cost;
-}
-
-/**
- * Defines a Decryption Policy with multiple escrow methods
-*/
-struct ANASTASIS_DecryptionPolicy
-{
-  // subset of methods that must be satisfied for this dp
-  struct ANASTASIS_EscrowMethod *ems;
-
-  unsigned int ems_len;
-
-};
-
-/**
- * Defines the recovery information (possible policies and version of the 
recovery document)
- */
-struct ANASTASIS_RecoveryInformation
-{
-
-  struct ANASTASIS_DecryptionPolicy *dps;
-
-  unsigned int dps_len;
-
-  unsigned int version;     // actual version obtained
-
-};
-
-/**
- * Core Secret Callback is opened at the begin of a recovery process, it 
passes back the core secret of
- * the user after the recovery process is completed.
- * @param cls handle for the callback
- * @param secret contains the core secret which is passed to the user
- * @param secret_size defines the size of the core secret
- */
-typedef void
-(*ANASTASIS_CoreSecretCallback)(void *cls,
-                                const void *secret,
-                                size_t secret_size);
-
+#include "anastasis_crypto_lib.h"
+#include <taler/taler_json_lib.h>
+#include <gnunet/gnunet_util_lib.h>
 /**
  * Challenge struct contains the UUID's needed for the recovery process and a 
reference to
  * ANASTASIS_Recovery.
  */
 struct ANASTASIS_Challenge;
 
-/**
- * The answer feedback defines the callback for an esrow challenge e.g. (wrong 
SMS Pin)
- *
- * @param af_cls handle for the callback
- * @param ec enum with the different possible states like wrong pin, success
- */
-typedef void
-(*ANASTASIS_AnswerFeedback)(void *af_cls,
-                            enum TALER_ErrorCode ec);
-
 /**
  * Challenge answer from the user like input SMS pin. Is referenced to a 
challenge and
  * sends back an AnswerFeedback.
@@ -103,37 +45,10 @@ ANASTASIS_challenge_answer (struct ANASTASIS_Challenge 
*challenge,
                             const void *answer,
                             size_t answer_size,
                             ANASTASIS_AnswerFeedback af,
-                            void af_cls);
-
-/**
- * Defines the instructions for a challenge, what does the user have to do to 
fulfill the challenge.
- * Also defines the method and other information for the challenge like a link 
for the video indent
- * or a information to which address an e-mail was sent.
- *
- * @param method which method is this challenge (E-Mail, Security Question, 
SMS...)
- * @param url can be NULL defines the url or mail address used for the 
challenge
- * @param instructions defines which steps need to be done e.g. ( please look 
for the pin for recovery #1234)
- */
-struct ANASTASIS_ChallengeInformation
+                            void *af_cls)
 {
-  const char *method;
-  const char *url;
-  const char *instructions;
-};
 
-/**
- * Defines a Challenge Callback which is initially sent with the challenge 
run. It gives back the previously
- * defined Challenge Information and a Status Code, cloud be payment missing.
- *
- * @param cls handle for the callback
- * @param ci reference to the challenge information struct
- * @param ec enum which defines the different status codes
- *
-*/
-typedef void
-(*ANASTASIS_ChallengeCallback)(void *cls,
-                               const struct ANASTASIS_ChallengeInformation *ci,
-                               enum TALER_ErrorCode ec); // i.e. payment 
missing
+}
 
 /**
  * Starts the process for a defined escrow challenge. Has a reference to the 
challenge and opens a
@@ -146,20 +61,10 @@ typedef void
 void
 ANASTASIS_challenge_run (struct ANASTASIS_Challenge *challenge,
                          ANASTASIS_ChallengeCallback cc,
-                         void cc_cls)
+                         void *cc_cls)
+{
 
-/**
- * Defines a Callback for the payment of an escrow challenge. Sends back a 
payment link
- * and a status code.
- *
- * @param cls handle to the request
- * @param order_url payment url is passed to the user (taler://pay/Foo)
- * @param ec Status code for the request e.g (truth ID unknown to provider)
- */
-typedef void
-(*ANASTASIS_ChallengePaymentCallback)(void *cls,
-                                      const char *order_url,
-                                      enum TALER_ErrorCode ec);
+}
 
 /**
  * User decides which method is to be used, and wants to pay for the 
authentication
@@ -173,25 +78,15 @@ typedef void
 void
 ANASTASIS_challenge_select_to_pay (struct ANASTASIS_Challenge *challenge,
                                    ANASTASIS_ChallengePaymentCallback cc,
-                                   void cc_cls)
+                                   void *cc_cls)
+{
 
-/**
-* Callback which passes back the recovery document and its possible policies. 
Also passes
-* back the version of the document for the user to check.
-*
-* @param cls closure for the callback
-* @param ri recovery information struct which contains the policies (NULL if 
all provider candidates gave us 404/errors)
-* @param ecs array of error codes, one per provider, EC_NONE-terminated
-*/
-typedef void
-(*ANASTASIS_PolicyCallback)(void *cls,
-                            const struct ANASTASIS_RecoveryInformation *ri,
-                            const enum TALER_ErrorCode ecs[]);
+}
 
 /**
  * stores provider URIs, identity key material, decrypted recovery document 
(internally!)
 */
-struct ANASTASIS_Recovery; //
+struct ANASTASIS_Recovery;
 
 /**
 * Starts the recovery process by opening callbacks for the coresecret and a 
policy callback. A list of
@@ -212,13 +107,19 @@ ANASTASIS_recovery_begin (const json_t *id_data,
                           ANASTASIS_PolicyCallback pc,
                           void *pc_cls,
                           ANASTASIS_CoreSecretCallback csc,
-                          void *csc_cls);
+                          void *csc_cls)
+{
+
+}
 /**
 * Cancels the recovery process
 * @param r handle to the recovery struct
 */
 void
-ANASTASIS_recovery_abort (struct ANASTASIS_Recovery *r);
+ANASTASIS_recovery_abort (struct ANASTASIS_Recovery *r)
+{
+
+}
 
 
 /* Upload api
@@ -234,28 +135,6 @@ struct ANASTASIS_TruthUpload;
 */
 struct ANASTASIS_Truth;
 
-/**
-* Initiates a callback for the payment of the truth upload
-*
-* @param cls closure for callback
-* @param taler_pay_url payment link for the transaction (taler://pay/Foo)
-* @param ec status code of the request
-*/
-typedef void
-(ANASTASIS_TruthPaymentCallback)(void *cls,
-                                 const char *taler_pay_url,
-                                 enum TALER_ErrorCode ec);
-
-/**
-* Upload information
-* caller MUST free 't' using ANASTASIS_truth_free()
-*
-* @param cls closure for callback
-* @param t Truth object (contains provider url and uuid)
-*/
-typedef void
-(ANASTASIS_TruthCallback)(void *cls,
-                          struct ANASTASIS_Truth *t);
 /**
 * Uploads a truth object onto a escrow provider
 *
@@ -281,14 +160,19 @@ ANASTASIS_truth_upload (const json_t *id_data,
                         ANASTASIS_TruthPaymentCallback tpc,
                         void *tpc_cls,
                         ANASTASIS_TruthCallback tc,
-                        void *tc_cls);
+                        void *tc_cls)
+{
 
+}
 /**
 * Cancels a upload process
 * @param tu handle for the upload
 */
 void
-ANASTASIS_truth_upload_cancel (struct ANASTASIS_TruthUpload *tu);
+ANASTASIS_truth_upload_cancel (struct ANASTASIS_TruthUpload *tu)
+{
+
+}
 
 /**
 * Free's the truth object which was allocated
@@ -296,7 +180,9 @@ ANASTASIS_truth_upload_cancel (struct ANASTASIS_TruthUpload 
*tu);
 */
 void
 ANASTASIS_truth_free (struct ANASTASIS_Truth *t)
+{
 
+}
 
 /**
 * Policy object to upload
@@ -311,37 +197,21 @@ struct ANASTASIS_Policy;
 */
 struct ANASTASIS_Policy *
 ANASTASIS_policy_create (struct ANASTASIS_Truth *truths[],
-                         unsigned int truths_len);
+                         unsigned int truths_len)
+{
+
+}
 
 /**
 * Destroys a policy object
 * @param p handle for the policy to destroy
 */
 void
-ANASTASIS_policy_destroy (struct ANASTASIS_Policy *p);
+ANASTASIS_policy_destroy (struct ANASTASIS_Policy *p)
+{
+
+}
 
-/**
-* Callback for a policy upload process.
-*
-* @param cls closure for callback
-* @param current_etag sends back the etag of the upload (used to prevent 
redundant uploads)
-* @param ec status code of the request
-*/
-typedef void
-(ANASTASIS_ShareResultCallback)(void *cls,
-                                const struct GNUNET_HashCode *current_etag,
-                                enum TALER_ErrorCode ec);
-/**
-* Callback for a payment process for uploading a policy
-*
-* @param cls closure for the callback
-* @param taler_pay_url url for the payment (taler://pay/Foo)
-* @param ec status of the request
-*/
-typedef void
-(ANASTASIS_SharePaymentCallback)(void *cls,
-                                 const char *taler_pay_url,
-                                 enum TALER_ErrorCode ec);
 
 /**
 * Defines a recovery document upload process (recovery document consists of 
multiple policies)
@@ -367,16 +237,23 @@ ANASTASIS_secret_share (const json_t *id_data,
                         const struct GNUNET_HashCode *last_etag,
                         struct ANASTASIS_Policy *policies[],
                         unsigned int policies_len,
-                        ANASTASIS SharePaymentCallback spc,
+                        ANASTASIS_SharePaymentCallback spc,
                         void *spc_cls,
-                        ANASTASIS ShareResultCallback src,
+                        ANASTASIS_ShareResultCallback src,
                         void *src_cls,
                         const void *core_secret,
-                        size_t core_secret_size);
+                        size_t core_secret_size)
+{
+
+
+}
 
 /**
 * Cancels a secret share request
 * @param ss handle to the request
 */
 void
-ANASTASIS_secret_share_cancel (struct ANASTASIS_SecretShare *ss);
+ANASTASIS_secret_share_cancel (struct ANASTASIS_SecretShare *ss)
+{
+
+}
diff --git a/src/util/anastasis_crypto.c b/src/util/anastasis_crypto.c
index 59a3861..953d86b 100644
--- a/src/util/anastasis_crypto.c
+++ b/src/util/anastasis_crypto.c
@@ -90,12 +90,12 @@ get_iv_key (const void *msec,
  * @param res_size size of the ciphertext
  */
 static void
-encrypt (const void *msec,
-         const void *data,
-         size_t data_size,
-         const char *salt,
-         void **res,
-         size_t *res_size)
+anastasis_encrypt (const void *msec,
+                   const void *data,
+                   size_t data_size,
+                   const char *salt,
+                   void **res,
+                   size_t *res_size)
 {
   struct ANASTASIS_CRYPTO_Nonce nonce;
   gcry_cipher_hd_t cipher;
@@ -152,12 +152,12 @@ encrypt (const void *msec,
  * @param res_size size of the plaintext
  */
 static void
-decrypt (const void *msec,
-         const void *data,
-         size_t data_size,
-         const char *salt,
-         void **res,
-         size_t *res_size)
+anastasis_decrypt (const void *msec,
+                   const void *data,
+                   size_t data_size,
+                   const char *salt,
+                   void **res,
+                   size_t *res_size)
 {
   struct ANASTASIS_CRYPTO_Nonce nonce;
   gcry_cipher_hd_t cipher;
@@ -263,7 +263,7 @@ ANASTASIS_CRYPTO_recovery_document_encrypt (
   *res_size = data_size + sizeof(struct ANASTASIS_CRYPTO_Nonce)
               + GCM_TAG_SIZE;
   *res = GNUNET_malloc (*res_size);
-  encrypt (id, data, data_size, salt, res, res_size);
+  anastasis_encrypt (id, data, data_size, salt, res, res_size);
 }
 
 
@@ -291,7 +291,7 @@ ANASTASIS_CRYPTO_recovery_document_decrypt (
   *res_size = data_size - sizeof (struct ANASTASIS_CRYPTO_Nonce)
               - GCM_TAG_SIZE;
   *res = GNUNET_malloc (*res_size);
-  decrypt (id, data, data_size, salt, res, res_size);
+  anastasis_decrypt (id, data, data_size, salt, res, res_size);
 }
 
 
@@ -319,8 +319,8 @@ ANASTASIS_CRYPTO_key_share_encrypt (
       bits from the response (e.g. some hash over the answer to the
       security question, see 12.6.-> interface EncryptedKeyShare in spec)
   */
-  encrypt (id, key_share, sizeof (struct ANASTASIS_CRYPTO_KeyShare), salt, res,
-           res_size);
+  anastasis_encrypt (id, key_share, sizeof (struct ANASTASIS_CRYPTO_KeyShare),
+                     salt, res,res_size);
 }
 
 
@@ -344,7 +344,7 @@ ANASTASIS_CRYPTO_key_share_decrypt (
   char *salt = "eks";
   *ks_size = sizeof (struct ANASTASIS_CRYPTO_KeyShare);
   *key_share = GNUNET_malloc (*ks_size);
-  decrypt (id, enc_key_share, eks_size, salt, key_share, ks_size);
+  anastasis_decrypt (id, enc_key_share, eks_size, salt, key_share, ks_size);
 }
 
 
@@ -373,7 +373,7 @@ ANASTASIS_CRYPTO_truth_encrypt (
               + sizeof (struct ANASTASIS_CRYPTO_Nonce)
               + GCM_TAG_SIZE;
   *res = GNUNET_malloc (*res_size);
-  encrypt (truth_enc_key, data, data_size, salt, res, res_size);
+  anastasis_encrypt (truth_enc_key, data, data_size, salt, res, res_size);
 }
 
 
@@ -401,7 +401,7 @@ ANASTASIS_CRYPTO_truth_decrypt (
               - sizeof (struct ANASTASIS_CRYPTO_Nonce)
               - GCM_TAG_SIZE;;
   *res = GNUNET_malloc (*res_size);
-  decrypt (truth_enc_key, data, data_size, salt, res, res_size);
+  anastasis_decrypt (truth_enc_key, data, data_size, salt, res, res_size);
 }
 
 

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



reply via email to

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