aboutsummaryrefslogtreecommitdiff
path: root/src/lib/util/crypto_elligator.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/util/crypto_elligator.c')
-rw-r--r--src/lib/util/crypto_elligator.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/lib/util/crypto_elligator.c b/src/lib/util/crypto_elligator.c
index 7ff37be46..d7f4bb1dd 100644
--- a/src/lib/util/crypto_elligator.c
+++ b/src/lib/util/crypto_elligator.c
@@ -620,3 +620,36 @@ GNUNET_CRYPTO_ecdhe_elligator_key_create (
620 repr->r[31] |= 64; 620 repr->r[31] |= 64;
621 } 621 }
622} 622}
623
624
625enum GNUNET_GenericReturnValue
626GNUNET_CRYPTO_eddsa_elligator_kem_encaps (const struct
627 GNUNET_CRYPTO_EddsaPublicKey *pub,
628 struct
629 GNUNET_CRYPTO_ElligatorRepresentative
630 *r,
631 struct GNUNET_HashCode *key_material)
632{
633 struct GNUNET_CRYPTO_EcdhePrivateKey sk_eph;
634 struct GNUNET_CRYPTO_EcdhePublicKey pub_eph;
635
636 GNUNET_CRYPTO_ecdhe_elligator_key_create (r, &sk_eph);
637 // TODO: probably makes more sense if key_create outputs ecdhe pub instead of repr because ecdhe pub is needed for ecdh on senders side.
638 GNUNET_CRYPTO_ecdhe_elligator_decoding (&pub_eph, NULL, r);
639
640 return GNUNET_CRYPTO_ecdh_eddsa (&sk_eph, pub, key_material);
641}
642
643
644enum GNUNET_GenericReturnValue
645GNUNET_CRYPTO_eddsa_elligator_kem_decaps (const struct
646 GNUNET_CRYPTO_EddsaPrivateKey *priv,
647 struct
648 GNUNET_CRYPTO_ElligatorRepresentative
649 *r,
650 struct GNUNET_HashCode *key_material)
651{
652 struct GNUNET_CRYPTO_EcdhePublicKey pub;
653 GNUNET_CRYPTO_ecdhe_elligator_decoding (&pub, NULL, r);
654 return GNUNET_CRYPTO_eddsa_ecdh (priv, &pub, key_material);
655} \ No newline at end of file