gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [gnunet] 22/171: -add issue test


From: gnunet
Subject: [GNUnet-SVN] [gnunet] 22/171: -add issue test
Date: Thu, 04 Jan 2018 16:08:50 +0100

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

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

commit fcb5ecaede036d2bb89e5123345fd391520c344a
Author: Schanzenbach, Martin <address@hidden>
AuthorDate: Mon Dec 5 19:26:27 2016 +0100

    -add issue test
---
 src/credential/credential_api.c              |  2 +-
 src/credential/gnunet-credential.c           | 28 +++++++-------
 src/credential/plugin_gnsrecord_credential.c | 56 ++++++++++++++--------------
 3 files changed, 43 insertions(+), 43 deletions(-)

diff --git a/src/credential/credential_api.c b/src/credential/credential_api.c
index 8d3c96ca8..88f5f4e17 100644
--- a/src/credential/credential_api.c
+++ b/src/credential/credential_api.c
@@ -433,7 +433,7 @@ GNUNET_CREDENTIAL_issue (struct GNUNET_CREDENTIAL_Handle 
*handle,
   crd->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_CREDENTIAL);
   GNUNET_CRYPTO_ecdsa_key_get_public (issuer,
                                       &crd->issuer_key);
-
+  crd->subject_key = *subject;
   GNUNET_memcpy (&crd[1],
                  attribute,
                  strlen (attribute));
diff --git a/src/credential/gnunet-credential.c 
b/src/credential/gnunet-credential.c
index eaad6d5cf..874aa29cb 100644
--- a/src/credential/gnunet-credential.c
+++ b/src/credential/gnunet-credential.c
@@ -180,6 +180,7 @@ identity_cb (void *cls,
 {
   const struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey;
   struct GNUNET_CREDENTIAL_CredentialRecordData *crd;
+  char *res;
 
   el = NULL;
   if (NULL == ego)
@@ -200,10 +201,11 @@ identity_cb (void *cls,
                                  privkey,
                                  &subject_pkey,
                                  issuer_attr);
-  printf ("Success.\n");
-  printf (GNUNET_GNSRECORD_value_to_string (GNUNET_GNSRECORD_TYPE_CREDENTIAL,
-                                            crd,
-                                            sizeof (crd) + strlen 
(issuer_attr) + 1));
+  res =  GNUNET_GNSRECORD_value_to_string (GNUNET_GNSRECORD_TYPE_CREDENTIAL,
+                                           crd,
+                                           sizeof (struct 
GNUNET_CREDENTIAL_CredentialRecordData) + strlen (issuer_attr) + 1);
+  printf ("%s\n", res);
+  GNUNET_SCHEDULER_shutdown ();
 }
 
 
@@ -225,15 +227,6 @@ run (void *cls,
 {
 
   cfg = c;
-  credential = GNUNET_CREDENTIAL_connect (cfg);
-
-  if (NULL == credential)
-  {
-    fprintf (stderr,
-             _("Failed to connect to CREDENTIAL\n"));
-    return;
-  }
-
 
 
   tt = GNUNET_SCHEDULER_add_delayed (timeout,
@@ -281,6 +274,15 @@ run (void *cls,
                issuer_key);
       GNUNET_SCHEDULER_shutdown ();
     }
+    credential = GNUNET_CREDENTIAL_connect (cfg);
+
+    if (NULL == credential)
+    {
+      fprintf (stderr,
+               _("Failed to connect to CREDENTIAL\n"));
+      return;
+    }
+
 
     verify_request = GNUNET_CREDENTIAL_verify(credential,
                                               &issuer_pkey,
diff --git a/src/credential/plugin_gnsrecord_credential.c 
b/src/credential/plugin_gnsrecord_credential.c
index c7cbb8bdd..67fd32e49 100644
--- a/src/credential/plugin_gnsrecord_credential.c
+++ b/src/credential/plugin_gnsrecord_credential.c
@@ -73,33 +73,31 @@ credential_value_to_string (void *cls,
    }
    case GNUNET_GNSRECORD_TYPE_CREDENTIAL:
    {
-    struct GNUNET_CREDENTIAL_CredentialRecordData cred;
-    char *cred_str;
-    char *subject_pkey;
-    char *issuer_pkey;
-    if (data_size < sizeof (struct GNUNET_CREDENTIAL_CredentialRecordData))
-        return NULL; /* malformed */
-    memcpy (&cred,
-              data,
-              sizeof (cred));
-    cdata = data;  
-    subject_pkey = GNUNET_CRYPTO_ecdsa_public_key_to_string 
(&cred.subject_key);
-    issuer_pkey = GNUNET_CRYPTO_ecdsa_public_key_to_string (&cred.issuer_key);
+     struct GNUNET_CREDENTIAL_CredentialRecordData cred;
+     char *cred_str;
+     char *subject_pkey;
+     char *issuer_pkey;
+     if (data_size < sizeof (struct GNUNET_CREDENTIAL_CredentialRecordData))
+       return NULL; /* malformed */
+     memcpy (&cred,
+             data,
+             sizeof (cred));
+     cdata = data;  
+     subject_pkey = GNUNET_CRYPTO_ecdsa_public_key_to_string 
(&cred.subject_key);
+     issuer_pkey = GNUNET_CRYPTO_ecdsa_public_key_to_string (&cred.issuer_key);
 
      GNUNET_asprintf (&cred_str,
-                     "%s %s %s",
-                     subject_pkey,
-                     issuer_pkey,
-                     &cdata[sizeof (cred)]);
-      GNUNET_free (subject_pkey);
-      GNUNET_free (issuer_pkey);
-
-
-
-    return cred_str;
-    }
-  default:
-    return NULL;
+                      "%s %s %s",
+                      subject_pkey,
+                      issuer_pkey,
+                      &cdata[sizeof (cred)]);
+     GNUNET_free (subject_pkey);
+     GNUNET_free (issuer_pkey);
+
+     return cred_str;
+   }
+   default:
+   return NULL;
   }
 }
 
@@ -117,10 +115,10 @@ credential_value_to_string (void *cls,
  */
 static int
 credential_string_to_value (void *cls,
-                     uint32_t type,
-                     const char *s,
-                     void **data,
-                     size_t *data_size)
+                            uint32_t type,
+                            const char *s,
+                            void **data,
+                            size_t *data_size)
 {
   if (NULL == s)
     return GNUNET_SYSERR;

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



reply via email to

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