aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-09-05 17:44:50 +0000
committerChristian Grothoff <christian@grothoff.org>2015-09-05 17:44:50 +0000
commitf1a73a358739cd2bebf7b83ef1c097a04dc50cd4 (patch)
treec613cee2f4e64c86bc5c1d360e0868997bf6a7ae /src
parent59df216f6ad04e9131ee4fa43e14055252a71651 (diff)
downloadgnunet-f1a73a358739cd2bebf7b83ef1c097a04dc50cd4.tar.gz
gnunet-f1a73a358739cd2bebf7b83ef1c097a04dc50cd4.zip
add GNUNET_CRYPTO_ecc_pmul_mpi
Diffstat (limited to 'src')
-rw-r--r--src/include/gnunet_applications.h4
-rw-r--r--src/include/gnunet_crypto_lib.h15
-rw-r--r--src/include/gnunet_protocols.h50
-rw-r--r--src/util/crypto_ecc_dlog.c22
4 files changed, 74 insertions, 17 deletions
diff --git a/src/include/gnunet_applications.h b/src/include/gnunet_applications.h
index 1451df2dd..067a72f38 100644
--- a/src/include/gnunet_applications.h
+++ b/src/include/gnunet_applications.h
@@ -116,6 +116,10 @@ extern "C"
116 */ 116 */
117#define GNUNET_APPLICATION_TYPE_MULTICAST 26 117#define GNUNET_APPLICATION_TYPE_MULTICAST 26
118 118
119/**
120 * Vectorproduct, ECC variant. Used for two-peer scalarproduct operations
121 */
122#define GNUNET_APPLICATION_TYPE_SCALARPRODUCT_ECC 27
119 123
120#if 0 /* keep Emacsens' auto-indent happy */ 124#if 0 /* keep Emacsens' auto-indent happy */
121{ 125{
diff --git a/src/include/gnunet_crypto_lib.h b/src/include/gnunet_crypto_lib.h
index 0acced362..e3d938382 100644
--- a/src/include/gnunet_crypto_lib.h
+++ b/src/include/gnunet_crypto_lib.h
@@ -1358,6 +1358,21 @@ GNUNET_CRYPTO_ecc_dexp_mpi (struct GNUNET_CRYPTO_EccDlogContext *edc,
1358 1358
1359 1359
1360/** 1360/**
1361 * Multiply the point @a p on the elliptic curve by @a val.
1362 *
1363 * @param edc calculation context for ECC operations
1364 * @param p point to multiply
1365 * @param val (positive) value to encode into a point
1366 * @return representation of the value as an ECC point,
1367 * must be freed using #GNUNET_CRYPTO_ecc_free()
1368 */
1369gcry_mpi_point_t
1370GNUNET_CRYPTO_ecc_pmul_mpi (struct GNUNET_CRYPTO_EccDlogContext *edc,
1371 gcry_mpi_point_t p,
1372 gcry_mpi_t val);
1373
1374
1375/**
1361 * Convert point value to binary representation. 1376 * Convert point value to binary representation.
1362 * 1377 *
1363 * @param edc calculation context for ECC operations 1378 * @param edc calculation context for ECC operations
diff --git a/src/include/gnunet_protocols.h b/src/include/gnunet_protocols.h
index bf8d4cf7f..0063e1ff7 100644
--- a/src/include/gnunet_protocols.h
+++ b/src/include/gnunet_protocols.h
@@ -2117,6 +2117,22 @@ extern "C"
2117 */ 2117 */
2118#define GNUNET_MESSAGE_TYPE_SCALARPRODUCT_RESULT 649 2118#define GNUNET_MESSAGE_TYPE_SCALARPRODUCT_RESULT 649
2119 2119
2120/**
2121 * Alice -> Bob ECC session initialization
2122 */
2123#define GNUNET_MESSAGE_TYPE_SCALARPRODUCT_ECC_SESSION_INITIALIZATION 650
2124
2125/**
2126 * Alice -> Bob ECC crypto data
2127 */
2128#define GNUNET_MESSAGE_TYPE_SCALARPRODUCT_ECC_ALICE_CRYPTODATA 651
2129
2130/**
2131 * Bob -> Alice ECC crypto data
2132 */
2133#define GNUNET_MESSAGE_TYPE_SCALARPRODUCT_ECC_BOB_CRYPTODATA 652
2134
2135
2120 2136
2121 2137
2122 2138
@@ -2127,47 +2143,47 @@ extern "C"
2127/** 2143/**
2128 * Store a membership event. 2144 * Store a membership event.
2129 */ 2145 */
2130#define GNUNET_MESSAGE_TYPE_PSYCSTORE_MEMBERSHIP_STORE 650 2146#define GNUNET_MESSAGE_TYPE_PSYCSTORE_MEMBERSHIP_STORE 660
2131 2147
2132/** 2148/**
2133 * Test for membership of a member at a particular point in time. 2149 * Test for membership of a member at a particular point in time.
2134 */ 2150 */
2135#define GNUNET_MESSAGE_TYPE_PSYCSTORE_MEMBERSHIP_TEST 651 2151#define GNUNET_MESSAGE_TYPE_PSYCSTORE_MEMBERSHIP_TEST 661
2136 2152
2137#define GNUNET_MESSAGE_TYPE_PSYCSTORE_FRAGMENT_STORE 652 2153#define GNUNET_MESSAGE_TYPE_PSYCSTORE_FRAGMENT_STORE 662
2138 2154
2139#define GNUNET_MESSAGE_TYPE_PSYCSTORE_FRAGMENT_GET 653 2155#define GNUNET_MESSAGE_TYPE_PSYCSTORE_FRAGMENT_GET 663
2140 2156
2141#define GNUNET_MESSAGE_TYPE_PSYCSTORE_MESSAGE_GET 654 2157#define GNUNET_MESSAGE_TYPE_PSYCSTORE_MESSAGE_GET 664
2142 2158
2143#define GNUNET_MESSAGE_TYPE_PSYCSTORE_MESSAGE_GET_FRAGMENT 655 2159#define GNUNET_MESSAGE_TYPE_PSYCSTORE_MESSAGE_GET_FRAGMENT 665
2144 2160
2145#define GNUNET_MESSAGE_TYPE_PSYCSTORE_COUNTERS_GET 656 2161#define GNUNET_MESSAGE_TYPE_PSYCSTORE_COUNTERS_GET 666
2146 2162
2147/* 657 */ 2163/* 657 */
2148 2164
2149#define GNUNET_MESSAGE_TYPE_PSYCSTORE_STATE_MODIFY 658 2165#define GNUNET_MESSAGE_TYPE_PSYCSTORE_STATE_MODIFY 668
2150 2166
2151#define GNUNET_MESSAGE_TYPE_PSYCSTORE_STATE_SYNC 659 2167#define GNUNET_MESSAGE_TYPE_PSYCSTORE_STATE_SYNC 669
2152 2168
2153#define GNUNET_MESSAGE_TYPE_PSYCSTORE_STATE_RESET 660 2169#define GNUNET_MESSAGE_TYPE_PSYCSTORE_STATE_RESET 670
2154 2170
2155#define GNUNET_MESSAGE_TYPE_PSYCSTORE_STATE_HASH_UPDATE 661 2171#define GNUNET_MESSAGE_TYPE_PSYCSTORE_STATE_HASH_UPDATE 671
2156 2172
2157#define GNUNET_MESSAGE_TYPE_PSYCSTORE_STATE_GET 662 2173#define GNUNET_MESSAGE_TYPE_PSYCSTORE_STATE_GET 672
2158 2174
2159#define GNUNET_MESSAGE_TYPE_PSYCSTORE_STATE_GET_PREFIX 663 2175#define GNUNET_MESSAGE_TYPE_PSYCSTORE_STATE_GET_PREFIX 673
2160 2176
2161/** 2177/**
2162 * Generic response from PSYCstore service with success and/or error message. 2178 * Generic response from PSYCstore service with success and/or error message.
2163 */ 2179 */
2164#define GNUNET_MESSAGE_TYPE_PSYCSTORE_RESULT_CODE 664 2180#define GNUNET_MESSAGE_TYPE_PSYCSTORE_RESULT_CODE 674
2165 2181
2166#define GNUNET_MESSAGE_TYPE_PSYCSTORE_RESULT_FRAGMENT 665 2182#define GNUNET_MESSAGE_TYPE_PSYCSTORE_RESULT_FRAGMENT 675
2167 2183
2168#define GNUNET_MESSAGE_TYPE_PSYCSTORE_RESULT_COUNTERS 666 2184#define GNUNET_MESSAGE_TYPE_PSYCSTORE_RESULT_COUNTERS 676
2169 2185
2170#define GNUNET_MESSAGE_TYPE_PSYCSTORE_RESULT_STATE 667 2186#define GNUNET_MESSAGE_TYPE_PSYCSTORE_RESULT_STATE 677
2171 2187
2172 2188
2173/******************************************************************************* 2189/*******************************************************************************
diff --git a/src/util/crypto_ecc_dlog.c b/src/util/crypto_ecc_dlog.c
index 13ee1e6be..29cba3336 100644
--- a/src/util/crypto_ecc_dlog.c
+++ b/src/util/crypto_ecc_dlog.c
@@ -407,6 +407,28 @@ GNUNET_CRYPTO_ecc_add (struct GNUNET_CRYPTO_EccDlogContext *edc,
407 407
408 408
409/** 409/**
410 * Multiply the point @a p on the elliptic curve by @a val.
411 *
412 * @param edc calculation context for ECC operations
413 * @param p point to multiply
414 * @param val (positive) value to encode into a point
415 * @return representation of the value as an ECC point,
416 * must be freed using #GNUNET_CRYPTO_ecc_free()
417 */
418gcry_mpi_point_t
419GNUNET_CRYPTO_ecc_pmul_mpi (struct GNUNET_CRYPTO_EccDlogContext *edc,
420 gcry_mpi_point_t p,
421 gcry_mpi_t val)
422{
423 gcry_mpi_point_t r;
424
425 r = gcry_mpi_point_new (0);
426 gcry_mpi_ec_mul (r, val, p, edc->ctx);
427 return r;
428}
429
430
431/**
410 * Obtain a random point on the curve and its 432 * Obtain a random point on the curve and its
411 * additive inverse. Both returned values 433 * additive inverse. Both returned values
412 * must be freed using #GNUNET_CRYPTO_ecc_free(). 434 * must be freed using #GNUNET_CRYPTO_ecc_free().