diff options
author | Schanzenbach, Martin <mschanzenbach@posteo.de> | 2016-12-05 19:26:27 +0100 |
---|---|---|
committer | Schanzenbach, Martin <mschanzenbach@posteo.de> | 2016-12-05 19:26:27 +0100 |
commit | fcb5ecaede036d2bb89e5123345fd391520c344a (patch) | |
tree | 28745989144d41fa0ee0171626092a7c7f8492ee /src/credential/plugin_gnsrecord_credential.c | |
parent | 646723dd495657a184d1f7e439f4958a72bee1df (diff) |
-add issue test
Diffstat (limited to 'src/credential/plugin_gnsrecord_credential.c')
-rw-r--r-- | src/credential/plugin_gnsrecord_credential.c | 56 |
1 files changed, 27 insertions, 29 deletions
diff --git a/src/credential/plugin_gnsrecord_credential.c b/src/credential/plugin_gnsrecord_credential.c index c7cbb8bdd1..67fd32e496 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; |