From 68f5813fdac760d6bc8d832b298f2621bc0e7023 Mon Sep 17 00:00:00 2001 From: "Schanzenbach, Martin" Date: Wed, 7 Dec 2016 10:53:45 +0100 Subject: [PATCH] - add signature check --- src/credential/gnunet-service-credential.c | 4 ++-- src/credential/plugin_gnsrecord_credential.c | 4 ++-- src/credential/test_credential_verify_simple.sh | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/credential/gnunet-service-credential.c b/src/credential/gnunet-service-credential.c index 4f06806d1..272ccebdf 100644 --- a/src/credential/gnunet-service-credential.c +++ b/src/credential/gnunet-service-credential.c @@ -434,7 +434,7 @@ handle_credential_query (void* cls, GNUNET_CONTAINER_DLL_insert_tail (vrh->cred_chain_head, vrh->cred_chain_tail, cr_entry); - /*if(GNUNET_OK != GNUNET_CRYPTO_ecdsa_verify(GNUNET_SIGNATURE_PURPOSE_CREDENTIAL, + if(GNUNET_OK != GNUNET_CRYPTO_ecdsa_verify(GNUNET_SIGNATURE_PURPOSE_CREDENTIAL, &crd->purpose, &crd->sig, &crd->issuer_key)) @@ -442,7 +442,7 @@ handle_credential_query (void* cls, GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Invalid credential found\n"); continue; - }*/ + } if (0 != memcmp (&crd->issuer_key, &vrh->issuer_key, sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey))) diff --git a/src/credential/plugin_gnsrecord_credential.c b/src/credential/plugin_gnsrecord_credential.c index ff95ec119..90ac393d0 100644 --- a/src/credential/plugin_gnsrecord_credential.c +++ b/src/credential/plugin_gnsrecord_credential.c @@ -182,8 +182,8 @@ credential_string_to_value (void *cls, cred->sig = *sig; cred->expiration = GNUNET_htonll (etime_abs.abs_value_us); cred->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_CREDENTIAL); - cred->purpose.size = strlen (name) + 1 + sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) + - sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey) + sizeof (uint64_t); + cred->purpose.size = htonl (strlen (name) + 1 + sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) + + sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey) + sizeof (uint64_t)); GNUNET_free (sig); GNUNET_memcpy (&cred[1], name, diff --git a/src/credential/test_credential_verify_simple.sh b/src/credential/test_credential_verify_simple.sh index ce0a2207a..2fac4659e 100755 --- a/src/credential/test_credential_verify_simple.sh +++ b/src/credential/test_credential_verify_simple.sh @@ -19,7 +19,7 @@ rm -rf `gnunet-config -c test_credential_lookup.conf -s PATHS -o GNUNET_HOME -f` which timeout &> /dev/null && DO_TIMEOUT="timeout 30" -gnunet-arm -s -c test_credential_lookup.conf +#gnunet-arm -s -c test_credential_lookup.conf gnunet-identity -C testissuer -c test_credential_lookup.conf gnunet-identity -C testsubject -c test_credential_lookup.conf @@ -45,6 +45,6 @@ if [ "$RES_CRED" == "Successful." ] then exit 0 else - echo "FAIL: Failed to verify credential $RES_IP." + echo "FAIL: Failed to verify credential." exit 1 fi -- 2.25.1