[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-anastasis] branch master updated (28825d7 -> 692ef24)
From: |
gnunet |
Subject: |
[taler-anastasis] branch master updated (28825d7 -> 692ef24) |
Date: |
Mon, 30 Mar 2020 08:48:57 +0200 |
This is an automated email from the git hooks/post-receive script.
dennis-neufeld pushed a change to branch master
in repository anastasis.
from 28825d7 error fixed name dup
new fc8f736 worked on eddsa priv/pub key derivation
new 363dbf3 merge
new 692ef24 worked on poliy key derivation
The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
src/include/anastasis_crypto_lib.h | 4 +--
src/util/anastasis_crypto.c | 65 +++++++++++++++++++++++++++++++++++---
2 files changed, 62 insertions(+), 7 deletions(-)
diff --git a/src/include/anastasis_crypto_lib.h
b/src/include/anastasis_crypto_lib.h
index 18bde96..9baf96f 100644
--- a/src/include/anastasis_crypto_lib.h
+++ b/src/include/anastasis_crypto_lib.h
@@ -133,8 +133,8 @@ ANASTASIS_CRYPTO_user_identifier_derive (
*/
void
ANASTASIS_CRYPTO_account_public_key_derive (
- struct ANASTASIS_CRYPTO_AccountPublicKey *pub_key,
- const struct ANASTASIS_CRYPTO_UserIdentifier *id);
+ const struct ANASTASIS_CRYPTO_UserIdentifier *id,
+ struct ANASTASIS_CRYPTO_AccountPublicKey *pub_key);
/**
* Encrypt and signs the recovery document with AES256, the recovery document
is
diff --git a/src/util/anastasis_crypto.c b/src/util/anastasis_crypto.c
index 953d86b..cf786a8 100644
--- a/src/util/anastasis_crypto.c
+++ b/src/util/anastasis_crypto.c
@@ -226,6 +226,31 @@ ANASTASIS_CRYPTO_user_identifier_derive (
}
+/**
+ * Generates the eddsa private key used to authorize operations on policy
+ * @param id holds a hashed user secret which is used as entropy source for
the public key generation
+ * @param priv_key handle for the generated private key
+ */
+static void
+ANASTASIS_CRYPTO_account_private_key_derive (
+ const struct ANASTASIS_CRYPTO_UserIdentifier *id,
+ struct GNUNET_CRYPTO_EddsaPrivateKey *priv_key)
+{
+ void *ver_secret;
+ GNUNET_CRYPTO_hkdf (&ver_secret,
+ sizeof (ver_secret),
+ GCRY_MD_SHA512,
+ GCRY_MD_SHA256,
+ id,
+ sizeof (struct ANASTASIS_CRYPTO_UserIdentifier),
+ "ver",
+ strlen ("ver"),
+ NULL,
+ 0);
+ // *priv_key = eddsa_d_to_a (id);
+}
+
+
/**
* Generates the eddsa public Key used as the account identifier on the
providers
* @param id holds a hashed user secret which is used as entropy source for
the public key generation
@@ -233,10 +258,12 @@ ANASTASIS_CRYPTO_user_identifier_derive (
*/
void
ANASTASIS_CRYPTO_account_public_key_derive (
- struct ANASTASIS_CRYPTO_AccountPublicKey *pub_key,
- const struct ANASTASIS_CRYPTO_UserIdentifier *id)
+ const struct ANASTASIS_CRYPTO_UserIdentifier *id,
+ struct ANASTASIS_CRYPTO_AccountPublicKey *pub_key)
{
-
+ struct GNUNET_CRYPTO_EddsaPrivateKey *priv;
+ ANASTASIS_CRYPTO_account_private_key_derive (id, priv);
+ GNUNET_CRYPTO_eddsa_key_get_public (priv, &pub_key->pub);
}
@@ -415,7 +442,9 @@ void
ANASTASIS_CRYPTO_key_share_create (
struct ANASTASIS_CRYPTO_KeyShare *key_share)
{
-
+ GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_STRONG,
+ key_share,
+ sizeof (struct ANASTASIS_CRYPTO_KeyShare));
}
@@ -433,7 +462,33 @@ ANASTASIS_CRYPTO_policy_key_derive (
unsigned int keyshare_length,
struct ANASTASIS_CRYPTO_PolicyKey *policy_key)
{
-
+ struct GNUNET_HashCode p;
+ struct GNUNET_HashCode b;
+ for (unsigned int i = 0; i < keyshare_length; i++)
+ {
+ struct GNUNET_HashCode ks;
+ GNUNET_CRYPTO_hash (&key_shares[i],
+ sizeof (struct ANASTASIS_CRYPTO_KeyShare),
+ &ks);
+ if (i = 0)
+ b = ks;
+ else
+ {
+ GNUNET_CRYPTO_hash_xor (&ks,
+ &b,
+ &p);
+ }
+ }
+ GNUNET_assert (0 ==
+ gcry_kdf_derive (&p,
+ sizeof (struct GNUNET_HashCode),
+ GCRY_KDF_SCRYPT,
+ 1, // subalgo
+ "policykey",
+ strlen ("policykey"),
+ 1000, // iterations
+ sizeof (struct ANASTASIS_CRYPTO_PolicyKey),
+ policy_key));
}
--
To stop receiving notification emails like this one, please contact
address@hidden.
- [taler-anastasis] branch master updated (28825d7 -> 692ef24),
gnunet <=