aboutsummaryrefslogtreecommitdiff
path: root/src/credential/plugin_gnsrecord_credential.c
diff options
context:
space:
mode:
authorSchanzenbach, Martin <mschanzenbach@posteo.de>2016-12-05 19:26:27 +0100
committerSchanzenbach, Martin <mschanzenbach@posteo.de>2016-12-05 19:26:27 +0100
commitfcb5ecaede036d2bb89e5123345fd391520c344a (patch)
tree28745989144d41fa0ee0171626092a7c7f8492ee /src/credential/plugin_gnsrecord_credential.c
parent646723dd495657a184d1f7e439f4958a72bee1df (diff)
downloadgnunet-fcb5ecaede036d2bb89e5123345fd391520c344a.tar.gz
gnunet-fcb5ecaede036d2bb89e5123345fd391520c344a.zip
-add issue test
Diffstat (limited to 'src/credential/plugin_gnsrecord_credential.c')
-rw-r--r--src/credential/plugin_gnsrecord_credential.c56
1 files changed, 27 insertions, 29 deletions
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,
73 } 73 }
74 case GNUNET_GNSRECORD_TYPE_CREDENTIAL: 74 case GNUNET_GNSRECORD_TYPE_CREDENTIAL:
75 { 75 {
76 struct GNUNET_CREDENTIAL_CredentialRecordData cred; 76 struct GNUNET_CREDENTIAL_CredentialRecordData cred;
77 char *cred_str; 77 char *cred_str;
78 char *subject_pkey; 78 char *subject_pkey;
79 char *issuer_pkey; 79 char *issuer_pkey;
80 if (data_size < sizeof (struct GNUNET_CREDENTIAL_CredentialRecordData)) 80 if (data_size < sizeof (struct GNUNET_CREDENTIAL_CredentialRecordData))
81 return NULL; /* malformed */ 81 return NULL; /* malformed */
82 memcpy (&cred, 82 memcpy (&cred,
83 data, 83 data,
84 sizeof (cred)); 84 sizeof (cred));
85 cdata = data; 85 cdata = data;
86 subject_pkey = GNUNET_CRYPTO_ecdsa_public_key_to_string (&cred.subject_key); 86 subject_pkey = GNUNET_CRYPTO_ecdsa_public_key_to_string (&cred.subject_key);
87 issuer_pkey = GNUNET_CRYPTO_ecdsa_public_key_to_string (&cred.issuer_key); 87 issuer_pkey = GNUNET_CRYPTO_ecdsa_public_key_to_string (&cred.issuer_key);
88 88
89 GNUNET_asprintf (&cred_str, 89 GNUNET_asprintf (&cred_str,
90 "%s %s %s", 90 "%s %s %s",
91 subject_pkey, 91 subject_pkey,
92 issuer_pkey, 92 issuer_pkey,
93 &cdata[sizeof (cred)]); 93 &cdata[sizeof (cred)]);
94 GNUNET_free (subject_pkey); 94 GNUNET_free (subject_pkey);
95 GNUNET_free (issuer_pkey); 95 GNUNET_free (issuer_pkey);
96 96
97 97 return cred_str;
98 98 }
99 return cred_str; 99 default:
100 } 100 return NULL;
101 default:
102 return NULL;
103 } 101 }
104} 102}
105 103
@@ -117,10 +115,10 @@ credential_value_to_string (void *cls,
117 */ 115 */
118static int 116static int
119credential_string_to_value (void *cls, 117credential_string_to_value (void *cls,
120 uint32_t type, 118 uint32_t type,
121 const char *s, 119 const char *s,
122 void **data, 120 void **data,
123 size_t *data_size) 121 size_t *data_size)
124{ 122{
125 if (NULL == s) 123 if (NULL == s)
126 return GNUNET_SYSERR; 124 return GNUNET_SYSERR;