aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-05-16 14:15:34 +0200
committerChristian Grothoff <christian@grothoff.org>2015-05-16 14:15:34 +0200
commitf4a59d1cccd058b3180ea23ed9fdea69cb2129b8 (patch)
treead732a3b92fcd74f5c1295ceee5c06e3a63b3206 /src/util
parentd080e59e272e307b9ebc267f2c4dd2941cd79436 (diff)
eliminating ECDSA, replacing with EdDSA-ECDHE-combo in transfer protocol
Diffstat (limited to 'src/util')
-rw-r--r--src/util/crypto.c36
-rw-r--r--src/util/test_crypto.c16
2 files changed, 26 insertions, 26 deletions
diff --git a/src/util/crypto.c b/src/util/crypto.c
index 529caa930..966f010e4 100644
--- a/src/util/crypto.c
+++ b/src/util/crypto.c
@@ -214,7 +214,7 @@ TALER_refresh_decrypt (const struct TALER_RefreshLinkEncrypted *input,
ret = GNUNET_new (struct TALER_RefreshLinkDecrypted);
memcpy (&ret->coin_priv,
buf,
- sizeof (union TALER_CoinSpendPrivateKeyP));
+ sizeof (struct TALER_CoinSpendPrivateKeyP));
ret->blinding_key.rsa_blinding_key
= GNUNET_CRYPTO_rsa_blinding_key_decode (&buf[sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey)],
input->blinding_key_enc_size);
@@ -290,7 +290,7 @@ TALER_refresh_link_encrypted_decode (const char *buf,
{
struct TALER_RefreshLinkEncrypted *rle;
- if (buf_len < sizeof (union TALER_CoinSpendPrivateKeyP))
+ if (buf_len < sizeof (struct TALER_CoinSpendPrivateKeyP))
return NULL;
if (buf_len >= GNUNET_MAX_MALLOC_CHECKED)
{
@@ -298,9 +298,9 @@ TALER_refresh_link_encrypted_decode (const char *buf,
return NULL;
}
rle = GNUNET_malloc (sizeof (struct TALER_RefreshLinkEncrypted) +
- buf_len - sizeof (union TALER_CoinSpendPrivateKeyP));
+ buf_len - sizeof (struct TALER_CoinSpendPrivateKeyP));
rle->blinding_key_enc = (const char *) &rle[1];
- rle->blinding_key_enc_size = buf_len - sizeof (union TALER_CoinSpendPrivateKeyP);
+ rle->blinding_key_enc_size = buf_len - sizeof (struct TALER_CoinSpendPrivateKeyP);
memcpy (rle->coin_priv_enc,
buf,
buf_len);
@@ -321,12 +321,12 @@ TALER_refresh_link_encrypted_encode (const struct TALER_RefreshLinkEncrypted *rl
{
char *buf;
- if (rle->blinding_key_enc_size >= GNUNET_MAX_MALLOC_CHECKED - sizeof (union TALER_CoinSpendPrivateKeyP))
+ if (rle->blinding_key_enc_size >= GNUNET_MAX_MALLOC_CHECKED - sizeof (struct TALER_CoinSpendPrivateKeyP))
{
GNUNET_break (0);
return NULL;
}
- *buf_len = sizeof (union TALER_CoinSpendPrivateKeyP) + rle->blinding_key_enc_size;
+ *buf_len = sizeof (struct TALER_CoinSpendPrivateKeyP) + rle->blinding_key_enc_size;
buf = GNUNET_malloc (*buf_len);
memcpy (buf,
rle->coin_priv_enc,
@@ -379,15 +379,15 @@ TALER_test_coin_valid (const struct TALER_CoinPublicInfo *coin_public_info)
int
TALER_link_decrypt_secret (const struct TALER_EncryptedLinkSecretP *secret_enc,
const struct TALER_TransferPrivateKeyP *trans_priv,
- const union TALER_CoinSpendPublicKeyP *coin_pub,
+ const struct TALER_CoinSpendPublicKeyP *coin_pub,
struct TALER_LinkSecretP *secret)
{
struct TALER_TransferSecretP transfer_secret;
if (GNUNET_OK !=
- GNUNET_CRYPTO_ecc_ecdh (&trans_priv->ecdhe_priv,
- &coin_pub->ecdhe_pub,
- &transfer_secret.key))
+ GNUNET_CRYPTO_ecdh_eddsa (&trans_priv->ecdhe_priv,
+ &coin_pub->eddsa_pub,
+ &transfer_secret.key))
{
GNUNET_break (0);
return GNUNET_SYSERR;
@@ -418,15 +418,15 @@ TALER_link_decrypt_secret (const struct TALER_EncryptedLinkSecretP *secret_enc,
int
TALER_link_decrypt_secret2 (const struct TALER_EncryptedLinkSecretP *secret_enc,
const struct TALER_TransferPublicKeyP *trans_pub,
- const union TALER_CoinSpendPrivateKeyP *coin_priv,
+ const struct TALER_CoinSpendPrivateKeyP *coin_priv,
struct TALER_LinkSecretP *secret)
{
struct TALER_TransferSecretP transfer_secret;
if (GNUNET_OK !=
- GNUNET_CRYPTO_ecc_ecdh (&coin_priv->ecdhe_priv,
- &trans_pub->ecdhe_pub,
- &transfer_secret.key))
+ GNUNET_CRYPTO_eddsa_ecdh (&coin_priv->eddsa_priv,
+ &trans_pub->ecdhe_pub,
+ &transfer_secret.key))
{
GNUNET_break (0);
return GNUNET_SYSERR;
@@ -456,7 +456,7 @@ TALER_link_decrypt_secret2 (const struct TALER_EncryptedLinkSecretP *secret_enc,
*/
int
TALER_link_encrypt_secret (const struct TALER_LinkSecretP *secret,
- const union TALER_CoinSpendPublicKeyP *coin_pub,
+ const struct TALER_CoinSpendPublicKeyP *coin_pub,
struct TALER_TransferPrivateKeyP *trans_priv,
struct TALER_TransferPublicKeyP *trans_pub,
struct TALER_EncryptedLinkSecretP *secret_enc)
@@ -466,9 +466,9 @@ TALER_link_encrypt_secret (const struct TALER_LinkSecretP *secret,
pk = GNUNET_CRYPTO_ecdhe_key_create ();
if (GNUNET_OK !=
- GNUNET_CRYPTO_ecc_ecdh (pk,
- &coin_pub->ecdhe_pub,
- &transfer_secret.key))
+ GNUNET_CRYPTO_ecdh_eddsa (pk,
+ &coin_pub->eddsa_pub,
+ &transfer_secret.key))
{
GNUNET_break (0);
GNUNET_free (pk);
diff --git a/src/util/test_crypto.c b/src/util/test_crypto.c
index ce946dd53..a5313195a 100644
--- a/src/util/test_crypto.c
+++ b/src/util/test_crypto.c
@@ -71,7 +71,7 @@ test_basics ()
GNUNET_assert (NULL != rld);
GNUNET_assert (0 == memcmp (&rld->coin_priv,
&rl.coin_priv,
- sizeof (union TALER_CoinSpendPrivateKeyP)));
+ sizeof (struct TALER_CoinSpendPrivateKeyP)));
GNUNET_assert (0 ==
GNUNET_CRYPTO_rsa_blinding_key_cmp (rl.blinding_key.rsa_blinding_key,
rld->blinding_key.rsa_blinding_key));
@@ -121,21 +121,21 @@ test_rled ()
static int
test_high_level ()
{
- struct GNUNET_CRYPTO_EcdsaPrivateKey *pk;
+ struct GNUNET_CRYPTO_EddsaPrivateKey *pk;
struct TALER_LinkSecretP secret;
struct TALER_LinkSecretP secret2;
- union TALER_CoinSpendPublicKeyP coin_pub;
- union TALER_CoinSpendPrivateKeyP coin_priv;
+ struct TALER_CoinSpendPublicKeyP coin_pub;
+ struct TALER_CoinSpendPrivateKeyP coin_priv;
struct TALER_TransferPrivateKeyP trans_priv;
struct TALER_TransferPublicKeyP trans_pub;
struct TALER_EncryptedLinkSecretP secret_enc;
- pk = GNUNET_CRYPTO_ecdsa_key_create ();
+ pk = GNUNET_CRYPTO_eddsa_key_create ();
GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
&secret,
sizeof (secret));
- GNUNET_CRYPTO_ecdsa_key_get_public (pk,
- &coin_pub.ecdsa_pub);
+ GNUNET_CRYPTO_eddsa_key_get_public (pk,
+ &coin_pub.eddsa_pub);
GNUNET_assert (GNUNET_OK ==
TALER_link_encrypt_secret (&secret,
&coin_pub,
@@ -151,7 +151,7 @@ test_high_level ()
memcmp (&secret,
&secret2,
sizeof (secret)));
- coin_priv.ecdsa_priv = *pk;
+ coin_priv.eddsa_priv = *pk;
GNUNET_assert (GNUNET_OK ==
TALER_link_decrypt_secret2 (&secret_enc,
&trans_pub,