diff options
Diffstat (limited to 'src/gnsrecord/test_gnsrecord_crypto.c')
-rw-r--r-- | src/gnsrecord/test_gnsrecord_crypto.c | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/src/gnsrecord/test_gnsrecord_crypto.c b/src/gnsrecord/test_gnsrecord_crypto.c index 1df3f3730..5a78f8b25 100644 --- a/src/gnsrecord/test_gnsrecord_crypto.c +++ b/src/gnsrecord/test_gnsrecord_crypto.c | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2013 GNUnet e.V. | 3 | Copyright (C) 2013 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
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 | 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 General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | /** | 18 | /** |
21 | * @file gnsrecord/test_gnsrecord_crypto.c | 19 | * @file gnsrecord/test_gnsrecord_crypto.c |
@@ -23,11 +21,12 @@ | |||
23 | */ | 21 | */ |
24 | #include "platform.h" | 22 | #include "platform.h" |
25 | #include "gnunet_util_lib.h" | 23 | #include "gnunet_util_lib.h" |
24 | #include "gnunet_dnsparser_lib.h" | ||
26 | #include "gnunet_gnsrecord_lib.h" | 25 | #include "gnunet_gnsrecord_lib.h" |
27 | 26 | ||
28 | #define RECORDS 5 | 27 | #define RECORDS 5 |
29 | 28 | ||
30 | #define TEST_RECORD_TYPE 1234 | 29 | #define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT |
31 | 30 | ||
32 | #define TEST_RECORD_DATALEN 123 | 31 | #define TEST_RECORD_DATALEN 123 |
33 | 32 | ||
@@ -54,7 +53,7 @@ create_record (int count) | |||
54 | { | 53 | { |
55 | struct GNUNET_GNSRECORD_Data *rd; | 54 | struct GNUNET_GNSRECORD_Data *rd; |
56 | 55 | ||
57 | rd = GNUNET_malloc (count * sizeof (struct GNUNET_GNSRECORD_Data)); | 56 | rd = GNUNET_new_array (count, struct GNUNET_GNSRECORD_Data); |
58 | for (unsigned int c = 0; c < count; c++) | 57 | for (unsigned int c = 0; c < count; c++) |
59 | { | 58 | { |
60 | rd[c].expiration_time = GNUNET_TIME_absolute_get().abs_value_us + 1000000000; | 59 | rd[c].expiration_time = GNUNET_TIME_absolute_get().abs_value_us + 1000000000; |
@@ -103,11 +102,10 @@ run (void *cls, | |||
103 | struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; | 102 | struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; |
104 | struct GNUNET_HashCode query_pub; | 103 | struct GNUNET_HashCode query_pub; |
105 | struct GNUNET_HashCode query_priv; | 104 | struct GNUNET_HashCode query_priv; |
105 | struct GNUNET_TIME_Absolute expire = GNUNET_TIME_absolute_get(); | ||
106 | 106 | ||
107 | privkey = GNUNET_CRYPTO_ecdsa_key_create (); | 107 | privkey = GNUNET_CRYPTO_ecdsa_key_create (); |
108 | GNUNET_assert (NULL != privkey); | 108 | GNUNET_assert (NULL != privkey); |
109 | struct GNUNET_TIME_Absolute expire = GNUNET_TIME_absolute_get(); | ||
110 | |||
111 | /* get public key */ | 109 | /* get public key */ |
112 | GNUNET_CRYPTO_ecdsa_key_get_public (privkey, | 110 | GNUNET_CRYPTO_ecdsa_key_get_public (privkey, |
113 | &pubkey); | 111 | &pubkey); |
@@ -142,6 +140,7 @@ run (void *cls, | |||
142 | &rd_decrypt_cb, | 140 | &rd_decrypt_cb, |
143 | s_name)); | 141 | s_name)); |
144 | GNUNET_free (block); | 142 | GNUNET_free (block); |
143 | GNUNET_free (privkey); | ||
145 | } | 144 | } |
146 | 145 | ||
147 | 146 | ||