diff options
author | Christian Grothoff <christian@grothoff.org> | 2019-10-05 15:09:28 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2019-10-05 15:09:28 +0200 |
commit | c4e9ba925ffd758aaa3feee2ccfc0b76f26fe207 (patch) | |
tree | cac3ce030d77b4cbe7c7dc62ed58cfe6d24f73e1 /src/util/perf_crypto_paillier.c | |
parent | fbb71d527c7d6babf269a8fefce1db291b9f7068 (diff) | |
download | gnunet-c4e9ba925ffd758aaa3feee2ccfc0b76f26fe207.tar.gz gnunet-c4e9ba925ffd758aaa3feee2ccfc0b76f26fe207.zip |
global reindent, now with uncrustify hook enabled
Diffstat (limited to 'src/util/perf_crypto_paillier.c')
-rw-r--r-- | src/util/perf_crypto_paillier.c | 83 |
1 files changed, 43 insertions, 40 deletions
diff --git a/src/util/perf_crypto_paillier.c b/src/util/perf_crypto_paillier.c index f2aa132d5..dd5622108 100644 --- a/src/util/perf_crypto_paillier.c +++ b/src/util/perf_crypto_paillier.c | |||
@@ -29,7 +29,7 @@ | |||
29 | 29 | ||
30 | 30 | ||
31 | int | 31 | int |
32 | main(int argc, char *argv[]) | 32 | main (int argc, char *argv[]) |
33 | { | 33 | { |
34 | struct GNUNET_TIME_Absolute start; | 34 | struct GNUNET_TIME_Absolute start; |
35 | struct GNUNET_CRYPTO_PaillierPublicKey public_key; | 35 | struct GNUNET_CRYPTO_PaillierPublicKey public_key; |
@@ -38,51 +38,54 @@ main(int argc, char *argv[]) | |||
38 | gcry_mpi_t m1; | 38 | gcry_mpi_t m1; |
39 | unsigned int i; | 39 | unsigned int i; |
40 | 40 | ||
41 | start = GNUNET_TIME_absolute_get(); | 41 | start = GNUNET_TIME_absolute_get (); |
42 | for (i = 0; i < 10; i++) | 42 | for (i = 0; i < 10; i++) |
43 | GNUNET_CRYPTO_paillier_create(&public_key, | 43 | GNUNET_CRYPTO_paillier_create (&public_key, |
44 | &private_key); | 44 | &private_key); |
45 | printf("10x key generation took %s\n", | 45 | printf ("10x key generation took %s\n", |
46 | GNUNET_STRINGS_relative_time_to_string(GNUNET_TIME_absolute_get_duration(start), | 46 | GNUNET_STRINGS_relative_time_to_string ( |
47 | GNUNET_YES)); | 47 | GNUNET_TIME_absolute_get_duration (start), |
48 | GAUGER("UTIL", "Paillier key generation", | 48 | GNUNET_YES)); |
49 | 64 * 1024 / (1 + | 49 | GAUGER ("UTIL", "Paillier key generation", |
50 | GNUNET_TIME_absolute_get_duration | 50 | 64 * 1024 / (1 |
51 | (start).rel_value_us / 1000LL), "keys/ms"); | 51 | + GNUNET_TIME_absolute_get_duration |
52 | (start).rel_value_us / 1000LL), "keys/ms"); | ||
52 | 53 | ||
53 | m1 = gcry_mpi_new(0); | 54 | m1 = gcry_mpi_new (0); |
54 | m1 = gcry_mpi_set_ui(m1, 1); | 55 | m1 = gcry_mpi_set_ui (m1, 1); |
55 | /* m1 = m1 * 2 ^ (GCPB - 3) */ | 56 | /* m1 = m1 * 2 ^ (GCPB - 3) */ |
56 | gcry_mpi_mul_2exp(m1, | 57 | gcry_mpi_mul_2exp (m1, |
57 | m1, | 58 | m1, |
58 | GNUNET_CRYPTO_PAILLIER_BITS - 3); | 59 | GNUNET_CRYPTO_PAILLIER_BITS - 3); |
59 | start = GNUNET_TIME_absolute_get(); | 60 | start = GNUNET_TIME_absolute_get (); |
60 | for (i = 0; i < 10; i++) | 61 | for (i = 0; i < 10; i++) |
61 | GNUNET_CRYPTO_paillier_encrypt(&public_key, | 62 | GNUNET_CRYPTO_paillier_encrypt (&public_key, |
62 | m1, | 63 | m1, |
63 | 2, | 64 | 2, |
64 | &c1); | 65 | &c1); |
65 | printf("10x encryption took %s\n", | 66 | printf ("10x encryption took %s\n", |
66 | GNUNET_STRINGS_relative_time_to_string(GNUNET_TIME_absolute_get_duration(start), | 67 | GNUNET_STRINGS_relative_time_to_string ( |
67 | GNUNET_YES)); | 68 | GNUNET_TIME_absolute_get_duration (start), |
68 | GAUGER("UTIL", "Paillier encryption", | 69 | GNUNET_YES)); |
69 | 64 * 1024 / (1 + | 70 | GAUGER ("UTIL", "Paillier encryption", |
70 | GNUNET_TIME_absolute_get_duration | 71 | 64 * 1024 / (1 |
71 | (start).rel_value_us / 1000LL), "ops/ms"); | 72 | + GNUNET_TIME_absolute_get_duration |
73 | (start).rel_value_us / 1000LL), "ops/ms"); | ||
72 | 74 | ||
73 | start = GNUNET_TIME_absolute_get(); | 75 | start = GNUNET_TIME_absolute_get (); |
74 | for (i = 0; i < 10; i++) | 76 | for (i = 0; i < 10; i++) |
75 | GNUNET_CRYPTO_paillier_decrypt(&private_key, | 77 | GNUNET_CRYPTO_paillier_decrypt (&private_key, |
76 | &public_key, | 78 | &public_key, |
77 | &c1, | 79 | &c1, |
78 | m1); | 80 | m1); |
79 | printf("10x decryption took %s\n", | 81 | printf ("10x decryption took %s\n", |
80 | GNUNET_STRINGS_relative_time_to_string(GNUNET_TIME_absolute_get_duration(start), | 82 | GNUNET_STRINGS_relative_time_to_string ( |
81 | GNUNET_YES)); | 83 | GNUNET_TIME_absolute_get_duration (start), |
82 | GAUGER("UTIL", "Paillier decryption", | 84 | GNUNET_YES)); |
83 | 64 * 1024 / (1 + | 85 | GAUGER ("UTIL", "Paillier decryption", |
84 | GNUNET_TIME_absolute_get_duration | 86 | 64 * 1024 / (1 |
85 | (start).rel_value_us / 1000LL), "ops/ms"); | 87 | + GNUNET_TIME_absolute_get_duration |
88 | (start).rel_value_us / 1000LL), "ops/ms"); | ||
86 | 89 | ||
87 | 90 | ||
88 | return 0; | 91 | return 0; |