gnunet-svn
[Top][All Lists]
Advanced

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

[gnunet] branch master updated: -minor API change


From: gnunet
Subject: [gnunet] branch master updated: -minor API change
Date: Tue, 10 Nov 2020 11:51:58 +0100

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

martin-schanzenbach pushed a commit to branch master
in repository gnunet.

The following commit(s) were added to refs/heads/master by this push:
     new 82b5c6385 -minor API change
82b5c6385 is described below

commit 82b5c638583860897fac1cab3dc1ebd2bed10949
Author: Martin Schanzenbach <schanzen@gnunet.org>
AuthorDate: Tue Nov 10 19:44:32 2020 +0900

    -minor API change
---
 src/fs/gnunet-publish.c                    |  9 +++---
 src/identity/identity_api.c                | 20 ++++++-------
 src/include/gnunet_identity_service.h      | 46 ++++++++++++++---------------
 src/pt/test_gns_vpn.c                      |  2 +-
 src/reclaim/oidc_helper.c                  | 47 ++++++++++++++++++------------
 src/revocation/revocation_api.c            | 30 ++++++++++---------
 src/testbed/test_testbed_api_template.conf |  2 +-
 7 files changed, 83 insertions(+), 73 deletions(-)

diff --git a/src/fs/gnunet-publish.c b/src/fs/gnunet-publish.c
index 518192283..dea467669 100644
--- a/src/fs/gnunet-publish.c
+++ b/src/fs/gnunet-publish.c
@@ -591,13 +591,12 @@ directory_trim_complete (struct GNUNET_FS_ShareTreeItem 
*directory_scan_result)
     GNUNET_SCHEDULER_shutdown ();
     return;
   }
-  if (NULL == namespace)
-    priv = NULL;
-  else
+  priv = NULL;
+  if (NULL != namespace)
   {
     pk = GNUNET_IDENTITY_ego_get_private_key (namespace);
-    if (GNUNET_IDENTITY_TYPE_ECDSA == ntohl (pk->type))
-      priv = &pk->ecdsa_key;
+    GNUNET_assert (GNUNET_IDENTITY_TYPE_ECDSA == ntohl (pk->type));
+    priv = &pk->ecdsa_key;
   }
   pc = GNUNET_FS_publish_start (ctx,
                                 fi,
diff --git a/src/identity/identity_api.c b/src/identity/identity_api.c
index f40472240..d44e8da96 100644
--- a/src/identity/identity_api.c
+++ b/src/identity/identity_api.c
@@ -1083,11 +1083,11 @@ GNUNET_IDENTITY_write_signature_to_buffer (const struct
 
 
 int
-GNUNET_IDENTITY_private_key_sign_ (const struct
-                                   GNUNET_IDENTITY_PrivateKey *priv,
-                                   const struct
-                                   GNUNET_CRYPTO_EccSignaturePurpose *purpose,
-                                   struct GNUNET_IDENTITY_Signature *sig)
+GNUNET_IDENTITY_sign_ (const struct
+                       GNUNET_IDENTITY_PrivateKey *priv,
+                       const struct
+                       GNUNET_CRYPTO_EccSignaturePurpose *purpose,
+                       struct GNUNET_IDENTITY_Signature *sig)
 {
   sig->type = priv->type;
   switch (ntohl (priv->type))
@@ -1109,11 +1109,11 @@ GNUNET_IDENTITY_private_key_sign_ (const struct
 
 
 int
-GNUNET_IDENTITY_public_key_verify_ (uint32_t purpose,
-                                    const struct
-                                    GNUNET_CRYPTO_EccSignaturePurpose 
*validate,
-                                    const struct GNUNET_IDENTITY_Signature 
*sig,
-                                    const struct GNUNET_IDENTITY_PublicKey 
*pub)
+GNUNET_IDENTITY_signature_verify_ (uint32_t purpose,
+                                   const struct
+                                   GNUNET_CRYPTO_EccSignaturePurpose *validate,
+                                   const struct GNUNET_IDENTITY_Signature *sig,
+                                   const struct GNUNET_IDENTITY_PublicKey *pub)
 {
   /* check type matching of 'sig' and 'pub' */
   GNUNET_assert (ntohl (pub->type) == ntohl (sig->type));
diff --git a/src/include/gnunet_identity_service.h 
b/src/include/gnunet_identity_service.h
index 0174e52aa..e59cf65af 100644
--- a/src/include/gnunet_identity_service.h
+++ b/src/include/gnunet_identity_service.h
@@ -501,7 +501,7 @@ GNUNET_IDENTITY_write_signature_to_buffer (const struct
  * The @a purpose data is the beginning of the data of which the signature is
  * to be created. The `size` field in @a purpose must correctly indicate the
  * number of bytes of the data structure, including its header. If possible,
- * use #GNUNET_IDENTITY_private_key_sign() instead of this function.
+ * use #GNUNET_IDENTITY_sign() instead of this function.
  *
  * @param priv private key to use for the signing
  * @param purpose what to sign (size, purpose)
@@ -509,7 +509,7 @@ GNUNET_IDENTITY_write_signature_to_buffer (const struct
  * @return #GNUNET_SYSERR on error, #GNUNET_OK on success
  */
 int
-GNUNET_IDENTITY_private_key_sign_ (const struct
+GNUNET_IDENTITY_sign_ (const struct
                                    GNUNET_IDENTITY_PrivateKey *priv,
                                    const struct
                                    GNUNET_CRYPTO_EccSignaturePurpose *purpose,
@@ -527,7 +527,7 @@ GNUNET_IDENTITY_private_key_sign_ (const struct
  * @param ps packed struct with what to sign, MUST begin with a purpose
  * @param[out] sig where to write the signature
  */
-#define GNUNET_IDENTITY_private_key_sign(priv,ps,sig) do {                \
+#define GNUNET_IDENTITY_sign(priv,ps,sig) do {                \
     /* check size is set correctly */                                     \
     GNUNET_assert (ntohl ((ps)->purpose.size) == sizeof (*(ps)));         \
     /* check 'ps' begins with the purpose */                              \
@@ -548,7 +548,7 @@ GNUNET_IDENTITY_private_key_sign_ (const struct
  * the number of bytes of the data structure, including its header.  If @a
  * purpose does not match the purpose given in @a validate (the latter must be
  * in big endian), signature verification fails.  If possible,
- * use #GNUNET_IDENTITY_public_key_verify() instead of this function (only if 
@a validate
+ * use #GNUNET_IDENTITY_signature_verify() instead of this function (only if 
@a validate
  * is not fixed-size, you must use this function directly).
  *
  * @param purpose what is the purpose that the signature should have?
@@ -558,12 +558,12 @@ GNUNET_IDENTITY_private_key_sign_ (const struct
  * @returns #GNUNET_OK if ok, #GNUNET_SYSERR if invalid
  */
 int
-GNUNET_IDENTITY_public_key_verify_ (uint32_t purpose,
-                                    const struct
-                                    GNUNET_CRYPTO_EccSignaturePurpose 
*validate,
-                                    const struct GNUNET_IDENTITY_Signature 
*sig,
-                                    const struct
-                                    GNUNET_IDENTITY_PublicKey *pub);
+GNUNET_IDENTITY_signature_verify_ (uint32_t purpose,
+                                   const struct
+                                   GNUNET_CRYPTO_EccSignaturePurpose *validate,
+                                   const struct GNUNET_IDENTITY_Signature *sig,
+                                   const struct
+                                   GNUNET_IDENTITY_PublicKey *pub);
 
 
 /**
@@ -579,7 +579,7 @@ GNUNET_IDENTITY_public_key_verify_ (uint32_t purpose,
  * @param sig where to read the signature from
  * @param pub public key to use for the verifying
  */
-#define GNUNET_IDENTITY_public_key_verify(purp,ps,sig,pub) ({             \
+#define GNUNET_IDENTITY_signature_verify(purp,ps,sig,pub) ({             \
     /* check size is set correctly */                                     \
     GNUNET_assert (ntohl ((ps)->purpose.size) == sizeof (*(ps)));         \
     /* check 'ps' begins with the purpose */                              \
@@ -608,11 +608,11 @@ GNUNET_IDENTITY_public_key_verify_ (uint32_t purpose,
  *          this size should be the same as @c len.
  */
 ssize_t
-GNUNET_IDENTITY_public_key_encrypt (const void *block,
-                                    size_t size,
-                                    const struct GNUNET_IDENTITY_PublicKey 
*pub,
-                                    struct GNUNET_CRYPTO_EcdhePublicKey *ecc,
-                                    void *result);
+GNUNET_IDENTITY_encrypt (const void *block,
+                         size_t size,
+                         const struct GNUNET_IDENTITY_PublicKey *pub,
+                         struct GNUNET_CRYPTO_EcdhePublicKey *ecc,
+                         void *result);
 
 
 /**
@@ -630,13 +630,13 @@ GNUNET_IDENTITY_public_key_encrypt (const void *block,
  *         this size should be the same as @c size.
  */
 ssize_t
-GNUNET_IDENTITY_private_key_decrypt (const void *block,
-                                     size_t size,
-                                     const struct
-                                     GNUNET_IDENTITY_PrivateKey *priv,
-                                     const struct
-                                     GNUNET_CRYPTO_EcdhePublicKey *ecc,
-                                     void *result);
+GNUNET_IDENTITY_decrypt (const void *block,
+                         size_t size,
+                         const struct
+                         GNUNET_IDENTITY_PrivateKey *priv,
+                         const struct
+                         GNUNET_CRYPTO_EcdhePublicKey *ecc,
+                         void *result);
 
 
 /**
diff --git a/src/pt/test_gns_vpn.c b/src/pt/test_gns_vpn.c
index cf0455477..7b4abaec2 100644
--- a/src/pt/test_gns_vpn.c
+++ b/src/pt/test_gns_vpn.c
@@ -560,7 +560,7 @@ identity_cb (void *cls,
              void **ctx,
              const char *name)
 {
-  const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key;
+  const struct GNUNET_IDENTITY_PrivateKey *zone_key;
   struct GNUNET_GNSRECORD_Data rd;
   char *rd_string;
   char *peername;
diff --git a/src/reclaim/oidc_helper.c b/src/reclaim/oidc_helper.c
index 0caa46b90..c6d56e02d 100644
--- a/src/reclaim/oidc_helper.c
+++ b/src/reclaim/oidc_helper.c
@@ -154,10 +154,12 @@ fix_base64 (char *str)
   replace_char (str, '/', '_');
 }
 
+
 static json_t*
-generate_userinfo_json(const struct GNUNET_IDENTITY_PublicKey *sub_key,
-                       const struct GNUNET_RECLAIM_AttributeList *attrs,
-                       const struct GNUNET_RECLAIM_PresentationList 
*presentations)
+generate_userinfo_json (const struct GNUNET_IDENTITY_PublicKey *sub_key,
+                        const struct GNUNET_RECLAIM_AttributeList *attrs,
+                        const struct
+                        GNUNET_RECLAIM_PresentationList *presentations)
 {
   struct GNUNET_RECLAIM_AttributeListEntry *le;
   struct GNUNET_RECLAIM_PresentationListEntry *ple;
@@ -206,7 +208,8 @@ generate_userinfo_json(const struct 
GNUNET_IDENTITY_PublicKey *sub_key,
                                                    ple->presentation->data,
                                                    
ple->presentation->data_size);
     json_object_set_new (aggr_sources_jwt,
-                         GNUNET_RECLAIM_presentation_number_to_typename 
(ple->presentation->type),
+                         GNUNET_RECLAIM_presentation_number_to_typename (
+                           ple->presentation->type),
                          json_string (pres_val_str) );
     json_object_set_new (aggr_sources, source_name, aggr_sources_jwt);
     GNUNET_free (pres_val_str);
@@ -286,6 +289,7 @@ generate_userinfo_json(const struct 
GNUNET_IDENTITY_PublicKey *sub_key,
   return body;
 }
 
+
 /**
  * Generate userinfo JSON as string
  *
@@ -297,12 +301,13 @@ generate_userinfo_json(const struct 
GNUNET_IDENTITY_PublicKey *sub_key,
 char *
 OIDC_generate_userinfo (const struct GNUNET_IDENTITY_PublicKey *sub_key,
                         const struct GNUNET_RECLAIM_AttributeList *attrs,
-                        const struct GNUNET_RECLAIM_PresentationList 
*presentations)
+                        const struct
+                        GNUNET_RECLAIM_PresentationList *presentations)
 {
   char *body_str;
-  json_t* body = generate_userinfo_json (sub_key,
-                                         attrs,
-                                         presentations);
+  json_t*body = generate_userinfo_json (sub_key,
+                                        attrs,
+                                        presentations);
   body_str = json_dumps (body, JSON_INDENT (0) | JSON_COMPACT);
   json_decref (body);
   return body_str;
@@ -324,7 +329,8 @@ char *
 OIDC_generate_id_token (const struct GNUNET_IDENTITY_PublicKey *aud_key,
                         const struct GNUNET_IDENTITY_PublicKey *sub_key,
                         const struct GNUNET_RECLAIM_AttributeList *attrs,
-                        const struct GNUNET_RECLAIM_PresentationList 
*presentations,
+                        const struct
+                        GNUNET_RECLAIM_PresentationList *presentations,
                         const struct GNUNET_TIME_Relative *expiration_time,
                         const char *nonce,
                         const char *secret_key)
@@ -441,7 +447,8 @@ char *
 OIDC_build_authz_code (const struct GNUNET_IDENTITY_PrivateKey *issuer,
                        const struct GNUNET_RECLAIM_Ticket *ticket,
                        const struct GNUNET_RECLAIM_AttributeList *attrs,
-                       const struct GNUNET_RECLAIM_PresentationList 
*presentations,
+                       const struct
+                       GNUNET_RECLAIM_PresentationList *presentations,
                        const char *nonce_str,
                        const char *code_challenge)
 {
@@ -544,10 +551,10 @@ OIDC_build_authz_code (const struct 
GNUNET_IDENTITY_PrivateKey *issuer,
   buf_ptr += payload_len;
   // Sign and store signature
   if (GNUNET_SYSERR ==
-      GNUNET_IDENTITY_private_key_sign_ (issuer,
-                                         purpose,
-                                         (struct GNUNET_IDENTITY_Signature *)
-                                         buf_ptr))
+      GNUNET_IDENTITY_sign_ (issuer,
+                             purpose,
+                             (struct GNUNET_IDENTITY_Signature *)
+                             buf_ptr))
   {
     GNUNET_break (0);
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Unable to sign code\n");
@@ -684,10 +691,11 @@ OIDC_parse_authz_code (const struct 
GNUNET_IDENTITY_PublicKey *audience,
     return GNUNET_SYSERR;
   }
   if (GNUNET_OK !=
-      GNUNET_IDENTITY_public_key_verify_ 
(GNUNET_SIGNATURE_PURPOSE_RECLAIM_CODE_SIGN,
-                                          purpose,
-                                          signature,
-                                          &(ticket->identity)))
+      GNUNET_IDENTITY_signature_verify_ (
+        GNUNET_SIGNATURE_PURPOSE_RECLAIM_CODE_SIGN,
+        purpose,
+        signature,
+        &(ticket->identity)))
   {
     GNUNET_free (code_payload);
     if (NULL != *nonce_str)
@@ -840,7 +848,8 @@ OIDC_check_scopes_for_claim_request (const char*scopes,
         }
       }
 
-    } else if (0 == strcmp (attr, scope_variable))
+    }
+    else if (0 == strcmp (attr, scope_variable))
     {
       /** attribute matches requested scope **/
       GNUNET_free (scope_variables);
diff --git a/src/revocation/revocation_api.c b/src/revocation/revocation_api.c
index 44c42ae49..791c3d008 100644
--- a/src/revocation/revocation_api.c
+++ b/src/revocation/revocation_api.c
@@ -444,12 +444,12 @@ check_signature_identity (const struct 
GNUNET_REVOCATION_PowP *pow,
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Expected signature payload len: %u\n",
               ntohl (spurp->purpose.size));
-  sig = (struct GNUNET_IDENTITY_Signature *) ((char*)&pow[1] + ksize);
+  sig = (struct GNUNET_IDENTITY_Signature *) ((char*) &pow[1] + ksize);
   if (GNUNET_OK !=
-      GNUNET_IDENTITY_public_key_verify_ (GNUNET_SIGNATURE_PURPOSE_REVOCATION,
-                                          &spurp->purpose,
-                                          sig,
-                                          key))
+      GNUNET_IDENTITY_signature_verify_ (GNUNET_SIGNATURE_PURPOSE_REVOCATION,
+                                         &spurp->purpose,
+                                         sig,
+                                         key))
   {
     return GNUNET_SYSERR;
   }
@@ -570,7 +570,7 @@ GNUNET_REVOCATION_check_pow (const struct 
GNUNET_REVOCATION_PowP *pow,
 
 enum GNUNET_GenericReturnValue
 sign_pow_identity (const struct GNUNET_IDENTITY_PrivateKey *key,
-                struct GNUNET_REVOCATION_PowP *pow)
+                   struct GNUNET_REVOCATION_PowP *pow)
 {
   struct GNUNET_TIME_Absolute ts = GNUNET_TIME_absolute_get ();
   struct GNUNET_REVOCATION_SignaturePurposePS *rp;
@@ -595,14 +595,16 @@ sign_pow_identity (const struct 
GNUNET_IDENTITY_PrivateKey *key,
               "Signature payload len: %u\n",
               ntohl (rp->purpose.size));
   GNUNET_IDENTITY_write_key_to_buffer (pk,
-                                       ((char*)&rp[1]),
+                                       ((char*) &rp[1]),
                                        ksize);
-  sig = ((char*)&pow[1]) + ksize;
-  int result = GNUNET_IDENTITY_private_key_sign_ (key,
-                                                  &rp->purpose,
-                                                  (void*) sig);
-  if (result == GNUNET_SYSERR) return GNUNET_NO;
-  else return result;
+  sig = ((char*) &pow[1]) + ksize;
+  int result = GNUNET_IDENTITY_sign_ (key,
+                                      &rp->purpose,
+                                      (void*) sig);
+  if (result == GNUNET_SYSERR)
+    return GNUNET_NO;
+  else
+    return result;
 }
 
 
@@ -772,7 +774,7 @@ GNUNET_REVOCATION_proof_get_size (const struct 
GNUNET_REVOCATION_PowP *pow)
   pk = (const struct GNUNET_IDENTITY_PublicKey *) &pow[1];
   ksize = GNUNET_IDENTITY_key_get_length (pk);
   size += ksize;
-  sig = (struct GNUNET_IDENTITY_Signature *) ((char*)&pow[1] + ksize);
+  sig = (struct GNUNET_IDENTITY_Signature *) ((char*) &pow[1] + ksize);
   size += GNUNET_IDENTITY_signature_get_length (sig);
   return size;
 }
diff --git a/src/testbed/test_testbed_api_template.conf 
b/src/testbed/test_testbed_api_template.conf
index 255c1b766..ae0368a8b 100644
--- a/src/testbed/test_testbed_api_template.conf
+++ b/src/testbed/test_testbed_api_template.conf
@@ -32,7 +32,7 @@ WAN_QUOTA_IN = 3932160
 USE_EPHEMERAL_KEYS = NO
 IMMEDIATE_START = YES
 
-[transport-udp]
+[transport-tcp]
 TIMEOUT = 300 s
 
 [PATHS]

-- 
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]