diff options
author | Christian Grothoff <christian@grothoff.org> | 2020-04-11 21:43:28 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2020-04-11 21:43:34 +0200 |
commit | 90ff9edfa9c5fcfa3a36d1653ff105e89b888e21 (patch) | |
tree | 780a2071f5072c8e8e044db741eb295c3f3ea2a7 /src/gnsrecord | |
parent | 3bcfe59f1ce533246bda271f00b3ee957cae304d (diff) | |
download | gnunet-90ff9edfa9c5fcfa3a36d1653ff105e89b888e21.tar.gz gnunet-90ff9edfa9c5fcfa3a36d1653ff105e89b888e21.zip |
fixing #6149
Diffstat (limited to 'src/gnsrecord')
-rw-r--r-- | src/gnsrecord/perf_gnsrecord_crypto.c | 10 | ||||
-rw-r--r-- | src/gnsrecord/test_gnsrecord_crypto.c | 14 |
2 files changed, 10 insertions, 14 deletions
diff --git a/src/gnsrecord/perf_gnsrecord_crypto.c b/src/gnsrecord/perf_gnsrecord_crypto.c index 3bb4ca4e1..b2614eb77 100644 --- a/src/gnsrecord/perf_gnsrecord_crypto.c +++ b/src/gnsrecord/perf_gnsrecord_crypto.c | |||
@@ -73,7 +73,7 @@ run (void *cls, | |||
73 | struct GNUNET_GNSRECORD_Data *s_rd; | 73 | struct GNUNET_GNSRECORD_Data *s_rd; |
74 | const char *s_name; | 74 | const char *s_name; |
75 | struct GNUNET_TIME_Absolute start_time; | 75 | struct GNUNET_TIME_Absolute start_time; |
76 | struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey; | 76 | struct GNUNET_CRYPTO_EcdsaPrivateKey privkey; |
77 | struct GNUNET_TIME_Absolute expire; | 77 | struct GNUNET_TIME_Absolute expire; |
78 | 78 | ||
79 | (void) cls; | 79 | (void) cls; |
@@ -81,8 +81,7 @@ run (void *cls, | |||
81 | (void) cfgfile; | 81 | (void) cfgfile; |
82 | (void) cfg; | 82 | (void) cfg; |
83 | expire = GNUNET_TIME_absolute_get (); | 83 | expire = GNUNET_TIME_absolute_get (); |
84 | privkey = GNUNET_CRYPTO_ecdsa_key_create (); | 84 | GNUNET_CRYPTO_ecdsa_key_create (&privkey); |
85 | GNUNET_assert (NULL != privkey); | ||
86 | 85 | ||
87 | /* test block creation */ | 86 | /* test block creation */ |
88 | s_name = "DUMMY.dummy.gnunet"; | 87 | s_name = "DUMMY.dummy.gnunet"; |
@@ -91,12 +90,12 @@ run (void *cls, | |||
91 | for (unsigned int i = 0; i < ROUNDS; i++) | 90 | for (unsigned int i = 0; i < ROUNDS; i++) |
92 | { | 91 | { |
93 | GNUNET_assert (NULL != (block = | 92 | GNUNET_assert (NULL != (block = |
94 | GNUNET_GNSRECORD_block_create2 (privkey, | 93 | GNUNET_GNSRECORD_block_create2 (&privkey, |
95 | expire, | 94 | expire, |
96 | s_name, | 95 | s_name, |
97 | s_rd, | 96 | s_rd, |
98 | RECORDS))); | 97 | RECORDS))); |
99 | GNUNET_GNSRECORD_query_from_private_key (privkey, | 98 | GNUNET_GNSRECORD_query_from_private_key (&privkey, |
100 | s_name, | 99 | s_name, |
101 | &query); | 100 | &query); |
102 | GNUNET_free (block); | 101 | GNUNET_free (block); |
@@ -110,7 +109,6 @@ run (void *cls, | |||
110 | for (unsigned int i = 0; i < RECORDS; i++) | 109 | for (unsigned int i = 0; i < RECORDS; i++) |
111 | GNUNET_free ((void *) s_rd[i].data); | 110 | GNUNET_free ((void *) s_rd[i].data); |
112 | GNUNET_free (s_rd); | 111 | GNUNET_free (s_rd); |
113 | GNUNET_free (privkey); | ||
114 | } | 112 | } |
115 | 113 | ||
116 | 114 | ||
diff --git a/src/gnsrecord/test_gnsrecord_crypto.c b/src/gnsrecord/test_gnsrecord_crypto.c index 0da19fbe9..b67e9a123 100644 --- a/src/gnsrecord/test_gnsrecord_crypto.c +++ b/src/gnsrecord/test_gnsrecord_crypto.c | |||
@@ -41,8 +41,6 @@ | |||
41 | #define TEST_REMOVE_RECORD_DATA 'b' | 41 | #define TEST_REMOVE_RECORD_DATA 'b' |
42 | 42 | ||
43 | 43 | ||
44 | static struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey; | ||
45 | |||
46 | static struct GNUNET_GNSRECORD_Data *s_rd; | 44 | static struct GNUNET_GNSRECORD_Data *s_rd; |
47 | 45 | ||
48 | static char *s_name; | 46 | static char *s_name; |
@@ -106,15 +104,16 @@ run (void *cls, | |||
106 | struct GNUNET_HashCode query_pub; | 104 | struct GNUNET_HashCode query_pub; |
107 | struct GNUNET_HashCode query_priv; | 105 | struct GNUNET_HashCode query_priv; |
108 | struct GNUNET_TIME_Absolute expire = GNUNET_TIME_absolute_get (); | 106 | struct GNUNET_TIME_Absolute expire = GNUNET_TIME_absolute_get (); |
107 | struct GNUNET_CRYPTO_EcdsaPrivateKey privkey; | ||
108 | |||
109 | 109 | ||
110 | privkey = GNUNET_CRYPTO_ecdsa_key_create (); | 110 | GNUNET_CRYPTO_ecdsa_key_create (&privkey); |
111 | GNUNET_assert (NULL != privkey); | ||
112 | /* get public key */ | 111 | /* get public key */ |
113 | GNUNET_CRYPTO_ecdsa_key_get_public (privkey, | 112 | GNUNET_CRYPTO_ecdsa_key_get_public (&privkey, |
114 | &pubkey); | 113 | &pubkey); |
115 | 114 | ||
116 | /* test query derivation */ | 115 | /* test query derivation */ |
117 | GNUNET_GNSRECORD_query_from_private_key (privkey, | 116 | GNUNET_GNSRECORD_query_from_private_key (&privkey, |
118 | "testlabel", | 117 | "testlabel", |
119 | &query_priv); | 118 | &query_priv); |
120 | GNUNET_GNSRECORD_query_from_public_key (&pubkey, | 119 | GNUNET_GNSRECORD_query_from_public_key (&pubkey, |
@@ -129,7 +128,7 @@ run (void *cls, | |||
129 | 128 | ||
130 | /* Create block */ | 129 | /* Create block */ |
131 | GNUNET_assert (NULL != (block = | 130 | GNUNET_assert (NULL != (block = |
132 | GNUNET_GNSRECORD_block_create (privkey, | 131 | GNUNET_GNSRECORD_block_create (&privkey, |
133 | expire, | 132 | expire, |
134 | s_name, | 133 | s_name, |
135 | s_rd, | 134 | s_rd, |
@@ -143,7 +142,6 @@ run (void *cls, | |||
143 | &rd_decrypt_cb, | 142 | &rd_decrypt_cb, |
144 | s_name)); | 143 | s_name)); |
145 | GNUNET_free (block); | 144 | GNUNET_free (block); |
146 | GNUNET_free (privkey); | ||
147 | } | 145 | } |
148 | 146 | ||
149 | 147 | ||