diff options
author | Martin Schanzenbach <mschanzenbach@posteo.de> | 2021-05-03 18:49:17 +0200 |
---|---|---|
committer | Martin Schanzenbach <mschanzenbach@posteo.de> | 2021-05-03 18:49:17 +0200 |
commit | d552acf5e7114f92d8251276ef76827a9db92257 (patch) | |
tree | 4b5ed54763b6acbd8292d52ef9fda9a789c56ec8 /src/util/crypto_ecc_gnsrecord.c | |
parent | 5bb2578678064ff4d537fcbc8d9a552a6779892d (diff) | |
download | gnunet-d552acf5e7114f92d8251276ef76827a9db92257.tar.gz gnunet-d552acf5e7114f92d8251276ef76827a9db92257.zip |
-add more tests for eddsa and gnsrecord
Diffstat (limited to 'src/util/crypto_ecc_gnsrecord.c')
-rw-r--r-- | src/util/crypto_ecc_gnsrecord.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/src/util/crypto_ecc_gnsrecord.c b/src/util/crypto_ecc_gnsrecord.c index 59efff8ab..a78511105 100644 --- a/src/util/crypto_ecc_gnsrecord.c +++ b/src/util/crypto_ecc_gnsrecord.c | |||
@@ -114,8 +114,8 @@ GNUNET_CRYPTO_eddsa_sign_with_scalar ( | |||
114 | * Calculate the derived zone key zk' from the | 114 | * Calculate the derived zone key zk' from the |
115 | * derived private scalar. | 115 | * derived private scalar. |
116 | */ | 116 | */ |
117 | crypto_scalarmult_ed25519_base (zk, | 117 | crypto_scalarmult_ed25519_base_noclamp (zk, |
118 | sk); | 118 | sk); |
119 | 119 | ||
120 | /** | 120 | /** |
121 | * Calculate r: | 121 | * Calculate r: |
@@ -352,7 +352,7 @@ GNUNET_CRYPTO_eddsa_private_key_derive ( | |||
352 | GNUNET_CRYPTO_mpi_print_unsigned (dc, sizeof(dc), d); | 352 | GNUNET_CRYPTO_mpi_print_unsigned (dc, sizeof(dc), d); |
353 | /** | 353 | /** |
354 | * Note that we copy all of SHA512(d) into the result and | 354 | * Note that we copy all of SHA512(d) into the result and |
355 | * then overrwrite the derived private scalar. | 355 | * then overwrite the derived private scalar. |
356 | * This means that we re-use SHA512(d)[32..63] | 356 | * This means that we re-use SHA512(d)[32..63] |
357 | * FIXME: Do we want to derive this part as well?? | 357 | * FIXME: Do we want to derive this part as well?? |
358 | */ | 358 | */ |
@@ -420,3 +420,21 @@ GNUNET_CRYPTO_eddsa_public_key_derive ( | |||
420 | gcry_ctx_release (ctx); | 420 | gcry_ctx_release (ctx); |
421 | 421 | ||
422 | } | 422 | } |
423 | |||
424 | |||
425 | void | ||
426 | GNUNET_CRYPTO_eddsa_key_get_public_from_scalar ( | ||
427 | const struct GNUNET_CRYPTO_EddsaPrivateScalar *priv, | ||
428 | struct GNUNET_CRYPTO_EddsaPublicKey *pkey) | ||
429 | { | ||
430 | unsigned char sk[32]; | ||
431 | |||
432 | memcpy (sk, priv->s, 32); | ||
433 | |||
434 | /** | ||
435 | * Calculate the derived zone key zk' from the | ||
436 | * derived private scalar. | ||
437 | */ | ||
438 | crypto_scalarmult_ed25519_base_noclamp (pkey->q_y, | ||
439 | sk); | ||
440 | } | ||