summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGian Demarmels <gian@demarmels.org>2021-12-21 15:27:27 +0100
committerGian Demarmels <gian@demarmels.org>2021-12-21 21:08:05 +0100
commitff714cca755a1bb47fe2b15a0710c096ca4d8111 (patch)
treed70d24729faa63b7640f0863d1a2ab89ff58bf44
parented65e2cac3e720c226f8dec07ac37ab62578724e (diff)
changed derive_secrets API
changed derive_secrets API repaired performance test uncrustify
-rw-r--r--src/include/gnunet_crypto_lib.h8
-rw-r--r--src/util/crypto_cs.c8
-rw-r--r--src/util/perf_crypto_cs.c8
-rw-r--r--src/util/perf_crypto_rsa.c1
-rw-r--r--src/util/test_crypto_cs.c10
5 files changed, 15 insertions, 20 deletions
diff --git a/src/include/gnunet_crypto_lib.h b/src/include/gnunet_crypto_lib.h
index 9c71edaab..bd318ab84 100644
--- a/src/include/gnunet_crypto_lib.h
+++ b/src/include/gnunet_crypto_lib.h
@@ -2607,7 +2607,6 @@ void
GNUNET_CRYPTO_cs_r_get_public (const struct GNUNET_CRYPTO_CsRSecret *r_priv,
struct GNUNET_CRYPTO_CsRPublic *r_pub);
-
/**
* Derives new random blinding factors.
* In original papers blinding factors are generated randomly
@@ -2615,13 +2614,12 @@ GNUNET_CRYPTO_cs_r_get_public (const struct GNUNET_CRYPTO_CsRSecret *r_priv,
* To ensure unpredictability a new nonce has to be used.
* Uses HKDF internally
*
- * @param secret is secret to derive blinding factors
- * @param secret_len secret length
+ * @param blind_seed is the blinding seed to derive blinding factors
* @param[out] bs array containing the two derived blinding secrets
*/
void
-GNUNET_CRYPTO_cs_blinding_secrets_derive (const void *secret,
- size_t secret_len,
+GNUNET_CRYPTO_cs_blinding_secrets_derive (const struct
+ GNUNET_CRYPTO_CsNonce *blind_seed,
struct GNUNET_CRYPTO_CsBlindingSecret
bs[2]);
diff --git a/src/util/crypto_cs.c b/src/util/crypto_cs.c
index 5c441b669..c89ba5d83 100644
--- a/src/util/crypto_cs.c
+++ b/src/util/crypto_cs.c
@@ -147,8 +147,8 @@ GNUNET_CRYPTO_cs_r_get_public (const struct GNUNET_CRYPTO_CsRSecret *r_priv,
* @param[out] bs array containing the two derived blinding secrets
*/
void
-GNUNET_CRYPTO_cs_blinding_secrets_derive (const void *secret,
- size_t secret_len,
+GNUNET_CRYPTO_cs_blinding_secrets_derive (const struct
+ GNUNET_CRYPTO_CsNonce *blind_seed,
struct GNUNET_CRYPTO_CsBlindingSecret
bs[2])
{
@@ -161,8 +161,8 @@ GNUNET_CRYPTO_cs_blinding_secrets_derive (const void *secret,
GCRY_MD_SHA256,
"alphabeta",
strlen ("alphabeta"),
- secret,
- secret_len,
+ blind_seed,
+ sizeof(*blind_seed),
NULL,
0));
map_to_scalar_subgroup (&bs[0].alpha);
diff --git a/src/util/perf_crypto_cs.c b/src/util/perf_crypto_cs.c
index a8c72052b..54c9c8e0e 100644
--- a/src/util/perf_crypto_cs.c
+++ b/src/util/perf_crypto_cs.c
@@ -103,8 +103,6 @@ eval ()
for (i = 0; i < ITER; i++)
{
GNUNET_CRYPTO_cs_blinding_secrets_derive (&nonce,
- sizeof(struct
- GNUNET_CRYPTO_CsNonce),
bs);
}
printf ("10x derive blinding secrets took %s\n",
@@ -167,9 +165,9 @@ eval ()
for (i = 0; i < ITER; i++)
{
GNUNET_CRYPTO_cs_verify (&sig,
- &pub,
- message,
- message_len);
+ &pub,
+ message,
+ message_len);
}
printf ("10x verifying signatures took %s\n",
GNUNET_STRINGS_relative_time_to_string (
diff --git a/src/util/perf_crypto_rsa.c b/src/util/perf_crypto_rsa.c
index aba61786f..a3e041bdf 100644
--- a/src/util/perf_crypto_rsa.c
+++ b/src/util/perf_crypto_rsa.c
@@ -203,6 +203,7 @@ main (int argc, char *argv[])
{
eval (1024);
eval (2048);
+ eval (3072);
/* eval (4096); */
return 0;
}
diff --git a/src/util/test_crypto_cs.c b/src/util/test_crypto_cs.c
index 2978fec0a..d3406516e 100644
--- a/src/util/test_crypto_cs.c
+++ b/src/util/test_crypto_cs.c
@@ -148,8 +148,7 @@ test_generate_rpublic (const struct GNUNET_CRYPTO_CsRSecret *r_priv,
void
-test_derive_blindingsecrets (const void *secret,
- size_t secret_len,
+test_derive_blindingsecrets (const struct GNUNET_CRYPTO_CsNonce *blind_seed,
struct GNUNET_CRYPTO_CsBlindingSecret bs[2])
{
/* TEST 1
@@ -159,7 +158,7 @@ test_derive_blindingsecrets (const void *secret,
memcpy (&other_bs[0], &bs[0], sizeof(struct GNUNET_CRYPTO_CsBlindingSecret)
* 2);
- GNUNET_CRYPTO_cs_blinding_secrets_derive (secret, secret_len, bs);
+ GNUNET_CRYPTO_cs_blinding_secrets_derive (blind_seed, bs);
GNUNET_assert (0 != memcmp (&other_bs[0],
&bs[0],
@@ -173,7 +172,7 @@ test_derive_blindingsecrets (const void *secret,
memcpy (&other_bs[0], &bs[0], sizeof(struct GNUNET_CRYPTO_CsBlindingSecret)
* 2);
for (int i = 0; i<ITER; i++) {
- GNUNET_CRYPTO_cs_blinding_secrets_derive (secret, secret_len, bs);
+ GNUNET_CRYPTO_cs_blinding_secrets_derive (blind_seed, bs);
GNUNET_assert (0 == memcmp (&other_bs[0],
&bs[0],
sizeof(struct GNUNET_CRYPTO_CsBlindingSecret)
@@ -493,8 +492,7 @@ main (int argc,
// generate blinding secrets
struct GNUNET_CRYPTO_CsBlindingSecret blindingsecrets[2];
test_derive_blindingsecrets (&nonce,
- sizeof(nonce),
- blindingsecrets);
+ blindingsecrets);
// calculate blinded c's
struct GNUNET_CRYPTO_CsC blinded_cs[2];