diff options
Diffstat (limited to 'src/util/perf_crypto_symmetric.c')
-rw-r--r-- | src/util/perf_crypto_symmetric.c | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/src/util/perf_crypto_symmetric.c b/src/util/perf_crypto_symmetric.c index 0bef04b7a..01bec8f11 100644 --- a/src/util/perf_crypto_symmetric.c +++ b/src/util/perf_crypto_symmetric.c | |||
@@ -11,12 +11,12 @@ | |||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Affero General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Affero General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | 17 | ||
18 | SPDX-License-Identifier: AGPL3.0-or-later | 18 | SPDX-License-Identifier: AGPL3.0-or-later |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * @author Christian Grothoff | 22 | * @author Christian Grothoff |
@@ -29,7 +29,7 @@ | |||
29 | 29 | ||
30 | 30 | ||
31 | static void | 31 | static void |
32 | perfEncrypt () | 32 | perfEncrypt() |
33 | { | 33 | { |
34 | unsigned int i; | 34 | unsigned int i; |
35 | char buf[64 * 1024]; | 35 | char buf[64 * 1024]; |
@@ -37,38 +37,38 @@ perfEncrypt () | |||
37 | struct GNUNET_CRYPTO_SymmetricSessionKey sk; | 37 | struct GNUNET_CRYPTO_SymmetricSessionKey sk; |
38 | struct GNUNET_CRYPTO_SymmetricInitializationVector iv; | 38 | struct GNUNET_CRYPTO_SymmetricInitializationVector iv; |
39 | 39 | ||
40 | GNUNET_CRYPTO_symmetric_create_session_key (&sk); | 40 | GNUNET_CRYPTO_symmetric_create_session_key(&sk); |
41 | 41 | ||
42 | memset (buf, 1, sizeof (buf)); | 42 | memset(buf, 1, sizeof(buf)); |
43 | for (i = 0; i < 1024; i++) | 43 | for (i = 0; i < 1024; i++) |
44 | { | 44 | { |
45 | memset (&iv, (int8_t) i, sizeof (iv)); | 45 | memset(&iv, (int8_t)i, sizeof(iv)); |
46 | GNUNET_CRYPTO_symmetric_encrypt (buf, sizeof (buf), | 46 | GNUNET_CRYPTO_symmetric_encrypt(buf, sizeof(buf), |
47 | &sk, &iv, | 47 | &sk, &iv, |
48 | rbuf); | 48 | rbuf); |
49 | GNUNET_CRYPTO_symmetric_decrypt (rbuf, sizeof (buf), | 49 | GNUNET_CRYPTO_symmetric_decrypt(rbuf, sizeof(buf), |
50 | &sk, &iv, | 50 | &sk, &iv, |
51 | buf); | 51 | buf); |
52 | } | 52 | } |
53 | memset (rbuf, 1, sizeof (rbuf)); | 53 | memset(rbuf, 1, sizeof(rbuf)); |
54 | GNUNET_assert (0 == memcmp (rbuf, buf, sizeof (buf))); | 54 | GNUNET_assert(0 == memcmp(rbuf, buf, sizeof(buf))); |
55 | } | 55 | } |
56 | 56 | ||
57 | 57 | ||
58 | int | 58 | int |
59 | main (int argc, char *argv[]) | 59 | main(int argc, char *argv[]) |
60 | { | 60 | { |
61 | struct GNUNET_TIME_Absolute start; | 61 | struct GNUNET_TIME_Absolute start; |
62 | 62 | ||
63 | start = GNUNET_TIME_absolute_get (); | 63 | start = GNUNET_TIME_absolute_get(); |
64 | perfEncrypt (); | 64 | perfEncrypt(); |
65 | printf ("Encrypt perf took %s\n", | 65 | printf("Encrypt perf took %s\n", |
66 | GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_duration (start), | 66 | GNUNET_STRINGS_relative_time_to_string(GNUNET_TIME_absolute_get_duration(start), |
67 | GNUNET_YES)); | 67 | GNUNET_YES)); |
68 | GAUGER ("UTIL", "Symmetric encryption", | 68 | GAUGER("UTIL", "Symmetric encryption", |
69 | 64 * 1024 / (1 + | 69 | 64 * 1024 / (1 + |
70 | GNUNET_TIME_absolute_get_duration | 70 | GNUNET_TIME_absolute_get_duration |
71 | (start).rel_value_us / 1000LL), "kb/ms"); | 71 | (start).rel_value_us / 1000LL), "kb/ms"); |
72 | return 0; | 72 | return 0; |
73 | } | 73 | } |
74 | 74 | ||