[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
- [GNUnet-SVN] [gnunet] 23/171: -add simple test, (continued)
- [GNUnet-SVN] [gnunet] 23/171: -add simple test, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 19/171: Merge branch 'credentials' of git+ssh://gnunet.org/gnunet into credentials, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 20/171: -fix compile, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 18/171: Merge branch 'credentials' of git+ssh://gnunet.org/gnunet into credentials, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 27/171: - remove purpose from cred, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 25/171: -fix verifymessage, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 16/171: -update test, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 21/171: - add verify and issue to cli, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 03/171: - move towards verification, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 14/171: -cleanup cli tool, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 22/171: -add issue test,
gnunet <=
- [GNUnet-SVN] [gnunet] 24/171: -add tests, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 29/171: Merge branch 'credentials' of git+ssh://gnunet.org/gnunet into credentials, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 36/171: -fix, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 26/171: - add signature to cred, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 28/171: - starting backward resolution, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 31/171: Merge branch 'credentials' of git+ssh://gnunet.org/gnunet into credentials, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 41/171: - fix test, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 34/171: - minor fixes, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 33/171: -fix, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 32/171: -add expiration to cred, gnunet, 2018/01/04