[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet] branch master updated: -remove (hopefully) unnecessary clamping
From: |
gnunet |
Subject: |
[gnunet] branch master updated: -remove (hopefully) unnecessary clamping |
Date: |
Mon, 03 May 2021 12:27:07 +0200 |
This is an automated email from the git hooks/post-receive script.
martin-schanzenbach pushed a commit to branch master
in repository gnunet.
The following commit(s) were added to refs/heads/master by this push:
new 9b1065bca -remove (hopefully) unnecessary clamping
9b1065bca is described below
commit 9b1065bcad0e82350e3e72e474ae425293defe42
Author: Martin Schanzenbach <mschanzenbach@posteo.de>
AuthorDate: Mon May 3 12:24:53 2021 +0200
-remove (hopefully) unnecessary clamping
---
src/gnsrecord/test_gnsrecord_crypto.c | 14 ++++++++++++++
src/util/crypto_ecc_gnsrecord.c | 22 ++++------------------
2 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/src/gnsrecord/test_gnsrecord_crypto.c
b/src/gnsrecord/test_gnsrecord_crypto.c
index 9394f562d..b9b2b5ba5 100644
--- a/src/gnsrecord/test_gnsrecord_crypto.c
+++ b/src/gnsrecord/test_gnsrecord_crypto.c
@@ -148,15 +148,29 @@ run (void *cls,
{
struct GNUNET_IDENTITY_PrivateKey privkey;
struct GNUNET_IDENTITY_PrivateKey privkey_ed;
+ struct GNUNET_TIME_Absolute start;
+ struct GNUNET_TIME_Absolute end;
privkey.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY);
GNUNET_CRYPTO_ecdsa_key_create (&privkey.ecdsa_key);
+ start = GNUNET_TIME_absolute_get ();
test_with_type (&privkey);
+ end = GNUNET_TIME_absolute_get ();
+ printf ("Time: %llu ms\n", (unsigned long long)
+ GNUNET_TIME_absolute_get_difference (start,
+ end).rel_value_us);
privkey_ed.type = htonl (GNUNET_GNSRECORD_TYPE_EDKEY);
GNUNET_CRYPTO_eddsa_key_create (&privkey_ed.eddsa_key);
+ start = GNUNET_TIME_absolute_get ();
test_with_type(&privkey_ed);
+ end = GNUNET_TIME_absolute_get ();
+ printf ("Time: %llu ms\n", (unsigned long long)
+ GNUNET_TIME_absolute_get_difference (start,
+ end).rel_value_us);
+
+
}
diff --git a/src/util/crypto_ecc_gnsrecord.c b/src/util/crypto_ecc_gnsrecord.c
index 213f05863..93bd9907e 100644
--- a/src/util/crypto_ecc_gnsrecord.c
+++ b/src/util/crypto_ecc_gnsrecord.c
@@ -115,7 +115,7 @@ GNUNET_CRYPTO_eddsa_sign_with_scalar (
* derived private scalar.
*/
crypto_scalarmult_ed25519_base_noclamp (zk,
- priv->s);
+ sk);
/**
* Calculate r:
@@ -163,16 +163,9 @@ GNUNET_CRYPTO_eddsa_sign_with_scalar (
crypto_core_ed25519_scalar_reduce (hram_mod, hram);
/**
- * Clamp the private scalar
- */
- sk[0] &= 248;
- sk[31] &= 127;
- sk[31] |= 64;
-
- /**
- * Calculate
- * S := r + hram * s mod L
- */
+ * Calculate
+ * S := r + hram * s mod L
+ */
crypto_core_ed25519_scalar_mul (tmp, hram_mod, sk);
crypto_core_ed25519_scalar_add (sig->s, tmp, r_mod);
@@ -328,7 +321,6 @@ GNUNET_CRYPTO_eddsa_private_key_derive (
*/
derive_h (&pub, sizeof (pub), label, context, &hc);
GNUNET_CRYPTO_mpi_scan_unsigned (&h, (unsigned char *) &hc, sizeof(hc));
-
h_mod_n = gcry_mpi_new (256);
gcry_mpi_mod (h_mod_n, h, n);
/* Convert scalar to big endian for libgcrypt */
@@ -368,12 +360,6 @@ GNUNET_CRYPTO_eddsa_private_key_derive (
/* Convert to little endian for libsodium */
for (size_t i = 0; i < 32; i++)
result->s[i] = dc[31 - i];
- /**
- * Clamp the scalar
- */
- result->s[0] &= 248;
- result->s[31] &= 127;
- result->s[31] |= 64;
sodium_memzero (dc, sizeof(dc));
gcry_mpi_release (d);
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnunet] branch master updated: -remove (hopefully) unnecessary clamping,
gnunet <=