summaryrefslogtreecommitdiff
path: root/src/include/gnunet_crypto_lib.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/gnunet_crypto_lib.h')
-rw-r--r--src/include/gnunet_crypto_lib.h41
1 files changed, 24 insertions, 17 deletions
diff --git a/src/include/gnunet_crypto_lib.h b/src/include/gnunet_crypto_lib.h
index d01457b4a..0804bcfa9 100644
--- a/src/include/gnunet_crypto_lib.h
+++ b/src/include/gnunet_crypto_lib.h
@@ -1443,9 +1443,16 @@ struct GNUNET_CRYPTO_EccPoint
* Q consists of an x- and a y-value, each mod p (256 bits), given
* here in affine coordinates and Ed25519 standard compact format.
*/
- unsigned char q_y[256 / 8];
+ unsigned char v[256 / 8];
};
+/**
+ * A ECC scalar for use in point multiplications
+ */
+struct GNUNET_CRYPTO_EccScalar
+{
+ unsigned char v[256 / 8]; //TODO probably too small
+};
/**
* Do pre-calculation for ECC discrete logarithm for small factors.
@@ -1468,7 +1475,7 @@ GNUNET_CRYPTO_ecc_dlog_prepare (unsigned int max, unsigned int mem);
*/
int
GNUNET_CRYPTO_ecc_dlog (struct GNUNET_CRYPTO_EccDlogContext *edc,
- gcry_mpi_point_t input);
+ const struct GNUNET_CRYPTO_EccPoint *input);
/**
@@ -1484,7 +1491,7 @@ GNUNET_CRYPTO_ecc_dlog (struct GNUNET_CRYPTO_EccDlogContext *edc,
* @return representation of the value as an ECC point,
* must be freed using #GNUNET_CRYPTO_ecc_free()
*/
-gcry_mpi_point_t
+struct GNUNET_CRYPTO_EccPoint*
GNUNET_CRYPTO_ecc_dexp (struct GNUNET_CRYPTO_EccDlogContext *edc, int val);
@@ -1497,9 +1504,9 @@ GNUNET_CRYPTO_ecc_dexp (struct GNUNET_CRYPTO_EccDlogContext *edc, int val);
* @return representation of the value as an ECC point,
* must be freed using #GNUNET_CRYPTO_ecc_free()
*/
-gcry_mpi_point_t
+struct GNUNET_CRYPTO_EccPoint*
GNUNET_CRYPTO_ecc_dexp_mpi (struct GNUNET_CRYPTO_EccDlogContext *edc,
- gcry_mpi_t val);
+ const struct GNUNET_CRYPTO_EccScalar *val);
/**
@@ -1511,10 +1518,10 @@ GNUNET_CRYPTO_ecc_dexp_mpi (struct GNUNET_CRYPTO_EccDlogContext *edc,
* @return representation of the value as an ECC point,
* must be freed using #GNUNET_CRYPTO_ecc_free()
*/
-gcry_mpi_point_t
+struct GNUNET_CRYPTO_EccPoint*
GNUNET_CRYPTO_ecc_pmul_mpi (struct GNUNET_CRYPTO_EccDlogContext *edc,
- gcry_mpi_point_t p,
- gcry_mpi_t val);
+ const struct GNUNET_CRYPTO_EccPoint *p,
+ const struct GNUNET_CRYPTO_EccScalar *val);
/**
@@ -1550,10 +1557,10 @@ GNUNET_CRYPTO_ecc_bin_to_point (struct GNUNET_CRYPTO_EccDlogContext *edc,
* @param b some value
* @return @a a + @a b, must be freed using #GNUNET_CRYPTO_ecc_free()
*/
-gcry_mpi_point_t
+struct GNUNET_CRYPTO_EccPoint*
GNUNET_CRYPTO_ecc_add (struct GNUNET_CRYPTO_EccDlogContext *edc,
- gcry_mpi_point_t a,
- gcry_mpi_point_t b);
+ const struct GNUNET_CRYPTO_EccPoint *a,
+ const struct GNUNET_CRYPTO_EccPoint *b);
/**
@@ -1567,8 +1574,8 @@ GNUNET_CRYPTO_ecc_add (struct GNUNET_CRYPTO_EccDlogContext *edc,
*/
void
GNUNET_CRYPTO_ecc_rnd (struct GNUNET_CRYPTO_EccDlogContext *edc,
- gcry_mpi_point_t *r,
- gcry_mpi_point_t *r_inv);
+ struct GNUNET_CRYPTO_EccPoint **r,
+ struct GNUNET_CRYPTO_EccPoint **r_inv);
/**
@@ -1581,8 +1588,8 @@ GNUNET_CRYPTO_ecc_rnd (struct GNUNET_CRYPTO_EccDlogContext *edc,
*/
void
GNUNET_CRYPTO_ecc_rnd_mpi (struct GNUNET_CRYPTO_EccDlogContext *edc,
- gcry_mpi_t *r,
- gcry_mpi_t *r_inv);
+ struct GNUNET_CRYPTO_EccScalar **r,
+ struct GNUNET_CRYPTO_EccScalar **r_inv);
/**
@@ -1591,7 +1598,7 @@ GNUNET_CRYPTO_ecc_rnd_mpi (struct GNUNET_CRYPTO_EccDlogContext *edc,
* @param edc ECC context
* @return random value mod n.
*/
-gcry_mpi_t
+struct GNUNET_CRYPTO_EccScalar*
GNUNET_CRYPTO_ecc_random_mod_n (struct GNUNET_CRYPTO_EccDlogContext *edc);
@@ -1601,7 +1608,7 @@ GNUNET_CRYPTO_ecc_random_mod_n (struct GNUNET_CRYPTO_EccDlogContext *edc);
* @param p point to free
*/
void
-GNUNET_CRYPTO_ecc_free (gcry_mpi_point_t p);
+GNUNET_CRYPTO_ecc_free (struct GNUNET_CRYPTO_EccPoint* p);
/**