aboutsummaryrefslogtreecommitdiff
path: root/src/gnsrecord
diff options
context:
space:
mode:
authorMartin Schanzenbach <mschanzenbach@posteo.de>2020-10-14 19:47:32 +0200
committerMartin Schanzenbach <mschanzenbach@posteo.de>2020-10-15 12:11:18 +0200
commit96c802b46be51e5c45f34e2de823f787d26c2929 (patch)
tree457ccfd8f9a61563af86318739c4a8f964a57025 /src/gnsrecord
parentc14e3a2769ff0f15fdbb32797e37e43ce2344fa3 (diff)
downloadgnunet-96c802b46be51e5c45f34e2de823f787d26c2929.tar.gz
gnunet-96c802b46be51e5c45f34e2de823f787d26c2929.zip
- towards crypto agility; wip
Diffstat (limited to 'src/gnsrecord')
-rw-r--r--src/gnsrecord/Makefile.am1
-rw-r--r--src/gnsrecord/gnsrecord_crypto.c148
-rw-r--r--src/gnsrecord/gnsrecord_misc.c21
-rw-r--r--src/gnsrecord/gnunet-gnsrecord-tvg.c22
-rw-r--r--src/gnsrecord/perf_gnsrecord_crypto.c5
-rw-r--r--src/gnsrecord/plugin_gnsrecord_dns.c2
-rw-r--r--src/gnsrecord/test_gnsrecord_crypto.c11
7 files changed, 138 insertions, 72 deletions
diff --git a/src/gnsrecord/Makefile.am b/src/gnsrecord/Makefile.am
index 2e6eca7ba..1748ad39d 100644
--- a/src/gnsrecord/Makefile.am
+++ b/src/gnsrecord/Makefile.am
@@ -47,6 +47,7 @@ libgnunetgnsrecord_la_SOURCES = \
47 gnsrecord_misc.c 47 gnsrecord_misc.c
48libgnunetgnsrecord_la_LIBADD = \ 48libgnunetgnsrecord_la_LIBADD = \
49 $(top_builddir)/src/util/libgnunetutil.la \ 49 $(top_builddir)/src/util/libgnunetutil.la \
50 $(top_builddir)/src/identity/libgnunetidentity.la \
50 $(GN_LIBINTL) 51 $(GN_LIBINTL)
51libgnunetgnsrecord_la_LDFLAGS = \ 52libgnunetgnsrecord_la_LDFLAGS = \
52 $(GN_LIB_LDFLAGS) \ 53 $(GN_LIB_LDFLAGS) \
diff --git a/src/gnsrecord/gnsrecord_crypto.c b/src/gnsrecord/gnsrecord_crypto.c
index c8919760a..b32b148fe 100644
--- a/src/gnsrecord/gnsrecord_crypto.c
+++ b/src/gnsrecord/gnsrecord_crypto.c
@@ -152,7 +152,8 @@ block_create (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key,
152 label, 152 label,
153 "gns"); 153 "gns");
154 GNUNET_CRYPTO_ecdsa_key_get_public (dkey, 154 GNUNET_CRYPTO_ecdsa_key_get_public (dkey,
155 &block->derived_key); 155 &block->derived_key.ecdsa_key);
156 block->derived_key.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY);
156 derive_block_aes_key (&iv, 157 derive_block_aes_key (&iv,
157 &skey, 158 &skey,
158 label, 159 label,
@@ -191,7 +192,7 @@ block_create (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key,
191 * @return NULL on error (block too large) 192 * @return NULL on error (block too large)
192 */ 193 */
193struct GNUNET_GNSRECORD_Block * 194struct GNUNET_GNSRECORD_Block *
194GNUNET_GNSRECORD_block_create (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, 195GNUNET_GNSRECORD_block_create (const struct GNUNET_IDENTITY_PrivateKey *key,
195 struct GNUNET_TIME_Absolute expire, 196 struct GNUNET_TIME_Absolute expire,
196 const char *label, 197 const char *label,
197 const struct GNUNET_GNSRECORD_Data *rd, 198 const struct GNUNET_GNSRECORD_Data *rd,
@@ -199,14 +200,21 @@ GNUNET_GNSRECORD_block_create (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key,
199{ 200{
200 struct GNUNET_CRYPTO_EcdsaPublicKey pkey; 201 struct GNUNET_CRYPTO_EcdsaPublicKey pkey;
201 202
202 GNUNET_CRYPTO_ecdsa_key_get_public (key, 203 switch (ntohl (key->type))
203 &pkey); 204 {
204 return block_create (key, 205 case GNUNET_GNSRECORD_TYPE_PKEY:
205 &pkey, 206 GNUNET_CRYPTO_ecdsa_key_get_public (&key->ecdsa_key,
206 expire, 207 &pkey);
207 label, 208 return block_create (&key->ecdsa_key,
208 rd, 209 &pkey,
209 rd_count); 210 expire,
211 label,
212 rd,
213 rd_count);
214 default:
215 GNUNET_assert (0);
216 }
217 return NULL;
210} 218}
211 219
212 220
@@ -240,12 +248,19 @@ struct KeyCacheLine
240 * @return NULL on error (block too large) 248 * @return NULL on error (block too large)
241 */ 249 */
242struct GNUNET_GNSRECORD_Block * 250struct GNUNET_GNSRECORD_Block *
243GNUNET_GNSRECORD_block_create2 (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, 251GNUNET_GNSRECORD_block_create2 (const struct GNUNET_IDENTITY_PrivateKey *pkey,
244 struct GNUNET_TIME_Absolute expire, 252 struct GNUNET_TIME_Absolute expire,
245 const char *label, 253 const char *label,
246 const struct GNUNET_GNSRECORD_Data *rd, 254 const struct GNUNET_GNSRECORD_Data *rd,
247 unsigned int rd_count) 255 unsigned int rd_count)
248{ 256{
257 const struct GNUNET_CRYPTO_EcdsaPrivateKey *key;
258
259 if (GNUNET_IDENTITY_TYPE_ECDSA != ntohl (pkey->type))
260 {
261 return NULL; //FIXME
262 }
263 key = &pkey->ecdsa_key;
249#define CSIZE 64 264#define CSIZE 64
250 static struct KeyCacheLine cache[CSIZE]; 265 static struct KeyCacheLine cache[CSIZE];
251 struct KeyCacheLine *line; 266 struct KeyCacheLine *line;
@@ -277,29 +292,27 @@ GNUNET_GNSRECORD_block_create2 (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key,
277 * @param block block to verify 292 * @param block block to verify
278 * @return #GNUNET_OK if the signature is valid 293 * @return #GNUNET_OK if the signature is valid
279 */ 294 */
280int 295enum GNUNET_GenericReturnValue
281GNUNET_GNSRECORD_block_verify (const struct GNUNET_GNSRECORD_Block *block) 296GNUNET_GNSRECORD_block_verify (const struct GNUNET_GNSRECORD_Block *block)
282{ 297{
298 const struct GNUNET_CRYPTO_EcdsaPublicKey *key;
299
300 if (GNUNET_GNSRECORD_TYPE_PKEY != ntohl (block->derived_key.type))
301 {
302 GNUNET_break (0);
303 return GNUNET_NO;
304 }
305 key = &block->derived_key.ecdsa_key;
306
283 return GNUNET_CRYPTO_ecdsa_verify_ (GNUNET_SIGNATURE_PURPOSE_GNS_RECORD_SIGN, 307 return GNUNET_CRYPTO_ecdsa_verify_ (GNUNET_SIGNATURE_PURPOSE_GNS_RECORD_SIGN,
284 &block->purpose, 308 &block->purpose,
285 &block->signature, 309 &block->signature,
286 &block->derived_key); 310 key);
287} 311}
288 312
289 313
290/** 314enum GNUNET_GenericReturnValue
291 * Decrypt block. 315block_decrypt (const struct GNUNET_GNSRECORD_Block *block,
292 *
293 * @param block block to decrypt
294 * @param zone_key public key of the zone
295 * @param label the name for the records
296 * @param proc function to call with the result
297 * @param proc_cls closure for proc
298 * @return #GNUNET_OK on success, #GNUNET_SYSERR if the block was
299 * not well-formed
300 */
301int
302GNUNET_GNSRECORD_block_decrypt (const struct GNUNET_GNSRECORD_Block *block,
303 const struct 316 const struct
304 GNUNET_CRYPTO_EcdsaPublicKey *zone_key, 317 GNUNET_CRYPTO_EcdsaPublicKey *zone_key,
305 const char *label, 318 const char *label,
@@ -426,6 +439,39 @@ GNUNET_GNSRECORD_block_decrypt (const struct GNUNET_GNSRECORD_Block *block,
426 439
427 440
428/** 441/**
442 * Decrypt block.
443 *
444 * @param block block to decrypt
445 * @param zone_key public key of the zone
446 * @param label the name for the records
447 * @param proc function to call with the result
448 * @param proc_cls closure for proc
449 * @return #GNUNET_OK on success, #GNUNET_SYSERR if the block was
450 * not well-formed
451 */
452enum GNUNET_GenericReturnValue
453GNUNET_GNSRECORD_block_decrypt (const struct GNUNET_GNSRECORD_Block *block,
454 const struct
455 GNUNET_IDENTITY_PublicKey *zone_key,
456 const char *label,
457 GNUNET_GNSRECORD_RecordCallback proc,
458 void *proc_cls)
459{
460 const struct GNUNET_CRYPTO_EcdsaPublicKey *key;
461
462 if (GNUNET_IDENTITY_TYPE_ECDSA != ntohl (zone_key->type))
463 {
464 return GNUNET_NO;
465 }
466 key = &zone_key->ecdsa_key;
467
468 return block_decrypt (block, key, label, proc, proc_cls);
469
470}
471
472
473
474/**
429 * Calculate the DHT query for a given @a label in a given @a zone. 475 * Calculate the DHT query for a given @a label in a given @a zone.
430 * 476 *
431 * @param zone private key of the zone 477 * @param zone private key of the zone
@@ -434,17 +480,24 @@ GNUNET_GNSRECORD_block_decrypt (const struct GNUNET_GNSRECORD_Block *block,
434 */ 480 */
435void 481void
436GNUNET_GNSRECORD_query_from_private_key (const struct 482GNUNET_GNSRECORD_query_from_private_key (const struct
437 GNUNET_CRYPTO_EcdsaPrivateKey *zone, 483 GNUNET_IDENTITY_PrivateKey *zone,
438 const char *label, 484 const char *label,
439 struct GNUNET_HashCode *query) 485 struct GNUNET_HashCode *query)
440{ 486{
441 struct GNUNET_CRYPTO_EcdsaPublicKey pub; 487 struct GNUNET_IDENTITY_PublicKey pub;
442 488 switch (ntohl (zone->type))
443 GNUNET_CRYPTO_ecdsa_key_get_public (zone, 489 {
444 &pub); 490 case GNUNET_GNSRECORD_TYPE_PKEY:
445 GNUNET_GNSRECORD_query_from_public_key (&pub, 491
446 label, 492 GNUNET_IDENTITY_key_get_public (zone,
447 query); 493 &pub);
494 GNUNET_GNSRECORD_query_from_public_key (&pub,
495 label,
496 query);
497 break;
498 default:
499 GNUNET_assert (0);
500 }
448} 501}
449 502
450 503
@@ -457,18 +510,27 @@ GNUNET_GNSRECORD_query_from_private_key (const struct
457 */ 510 */
458void 511void
459GNUNET_GNSRECORD_query_from_public_key (const struct 512GNUNET_GNSRECORD_query_from_public_key (const struct
460 GNUNET_CRYPTO_EcdsaPublicKey *pub, 513 GNUNET_IDENTITY_PublicKey *pub,
461 const char *label, 514 const char *label,
462 struct GNUNET_HashCode *query) 515 struct GNUNET_HashCode *query)
463{ 516{
464 struct GNUNET_CRYPTO_EcdsaPublicKey pd; 517 struct GNUNET_IDENTITY_PublicKey pd;
465 GNUNET_CRYPTO_ecdsa_public_key_derive (pub, 518
466 label, 519 switch (ntohl (pub->type))
467 "gns", 520 {
468 &pd); 521 case GNUNET_GNSRECORD_TYPE_PKEY:
469 GNUNET_CRYPTO_hash (&pd, 522 pd.type = pub->type;
470 sizeof(pd), 523 GNUNET_CRYPTO_ecdsa_public_key_derive (&pub->ecdsa_key,
471 query); 524 label,
525 "gns",
526 &pd.ecdsa_key);
527 GNUNET_CRYPTO_hash (&pd,
528 sizeof(pd),
529 query);
530 break;
531 default:
532 GNUNET_assert (0);
533 }
472} 534}
473 535
474 536
diff --git a/src/gnsrecord/gnsrecord_misc.c b/src/gnsrecord/gnsrecord_misc.c
index 5061f8493..8b590e35f 100644
--- a/src/gnsrecord/gnsrecord_misc.c
+++ b/src/gnsrecord/gnsrecord_misc.c
@@ -62,14 +62,14 @@ GNUNET_GNSRECORD_string_to_lowercase (const char *src)
62 * @return string form; will be overwritten by next call to #GNUNET_GNSRECORD_z2s 62 * @return string form; will be overwritten by next call to #GNUNET_GNSRECORD_z2s
63 */ 63 */
64const char * 64const char *
65GNUNET_GNSRECORD_z2s (const struct GNUNET_CRYPTO_EcdsaPublicKey *z) 65GNUNET_GNSRECORD_z2s (const struct GNUNET_IDENTITY_PublicKey *z)
66{ 66{
67 static char buf[sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey) * 8]; 67 static char buf[sizeof(struct GNUNET_IDENTITY_PublicKey) * 8];
68 char *end; 68 char *end;
69 69
70 end = GNUNET_STRINGS_data_to_string ((const unsigned char *) z, 70 end = GNUNET_STRINGS_data_to_string ((const unsigned char *) z,
71 sizeof(struct 71 sizeof(struct
72 GNUNET_CRYPTO_EcdsaPublicKey), 72 GNUNET_IDENTITY_PublicKey),
73 buf, sizeof(buf)); 73 buf, sizeof(buf));
74 if (NULL == end) 74 if (NULL == end)
75 { 75 {
@@ -99,7 +99,7 @@ GNUNET_GNSRECORD_records_cmp (const struct GNUNET_GNSRECORD_Data *a,
99 if (a->record_type != b->record_type) 99 if (a->record_type != b->record_type)
100 { 100 {
101 LOG (GNUNET_ERROR_TYPE_DEBUG, 101 LOG (GNUNET_ERROR_TYPE_DEBUG,
102 "Record type %lu != %lu\n", a->record_type, b->record_type); 102 "Record type %u != %u\n", a->record_type, b->record_type);
103 return GNUNET_NO; 103 return GNUNET_NO;
104 } 104 }
105 if ((a->expiration_time != b->expiration_time) && 105 if ((a->expiration_time != b->expiration_time) &&
@@ -115,7 +115,7 @@ GNUNET_GNSRECORD_records_cmp (const struct GNUNET_GNSRECORD_Data *a,
115 != (b->flags & GNUNET_GNSRECORD_RF_RCMP_FLAGS)) 115 != (b->flags & GNUNET_GNSRECORD_RF_RCMP_FLAGS))
116 { 116 {
117 LOG (GNUNET_ERROR_TYPE_DEBUG, 117 LOG (GNUNET_ERROR_TYPE_DEBUG,
118 "Flags %lu (%lu) != %lu (%lu)\n", a->flags, 118 "Flags %u (%u) != %u (%u)\n", a->flags,
119 a->flags & GNUNET_GNSRECORD_RF_RCMP_FLAGS, b->flags, 119 a->flags & GNUNET_GNSRECORD_RF_RCMP_FLAGS, b->flags,
120 b->flags & GNUNET_GNSRECORD_RF_RCMP_FLAGS); 120 b->flags & GNUNET_GNSRECORD_RF_RCMP_FLAGS);
121 return GNUNET_NO; 121 return GNUNET_NO;
@@ -236,12 +236,12 @@ GNUNET_GNSRECORD_is_expired (const struct GNUNET_GNSRECORD_Data *rd)
236 * key in an encoding suitable for DNS labels. 236 * key in an encoding suitable for DNS labels.
237 */ 237 */
238const char * 238const char *
239GNUNET_GNSRECORD_pkey_to_zkey (const struct GNUNET_CRYPTO_EcdsaPublicKey *pkey) 239GNUNET_GNSRECORD_pkey_to_zkey (const struct GNUNET_IDENTITY_PublicKey *pkey)
240{ 240{
241 static char ret[128]; 241 static char ret[128];
242 char *pkeys; 242 char *pkeys;
243 243
244 pkeys = GNUNET_CRYPTO_ecdsa_public_key_to_string (pkey); 244 pkeys = GNUNET_IDENTITY_public_key_to_string (pkey);
245 GNUNET_snprintf (ret, 245 GNUNET_snprintf (ret,
246 sizeof(ret), 246 sizeof(ret),
247 "%s", 247 "%s",
@@ -262,12 +262,11 @@ GNUNET_GNSRECORD_pkey_to_zkey (const struct GNUNET_CRYPTO_EcdsaPublicKey *pkey)
262 */ 262 */
263int 263int
264GNUNET_GNSRECORD_zkey_to_pkey (const char *zkey, 264GNUNET_GNSRECORD_zkey_to_pkey (const char *zkey,
265 struct GNUNET_CRYPTO_EcdsaPublicKey *pkey) 265 struct GNUNET_IDENTITY_PublicKey *pkey)
266{ 266{
267 if (GNUNET_OK != 267 if (GNUNET_OK !=
268 GNUNET_CRYPTO_ecdsa_public_key_from_string (zkey, 268 GNUNET_IDENTITY_public_key_from_string (zkey,
269 strlen (zkey), 269 pkey))
270 pkey))
271 return GNUNET_SYSERR; 270 return GNUNET_SYSERR;
272 return GNUNET_OK; 271 return GNUNET_OK;
273} 272}
diff --git a/src/gnsrecord/gnunet-gnsrecord-tvg.c b/src/gnsrecord/gnunet-gnsrecord-tvg.c
index 789ff8aa3..31f077722 100644
--- a/src/gnsrecord/gnunet-gnsrecord-tvg.c
+++ b/src/gnsrecord/gnunet-gnsrecord-tvg.c
@@ -90,18 +90,19 @@ run (void *cls,
90 struct GNUNET_TIME_Absolute exp_abs = GNUNET_TIME_absolute_get (); 90 struct GNUNET_TIME_Absolute exp_abs = GNUNET_TIME_absolute_get ();
91 struct GNUNET_GNSRECORD_Block *rrblock; 91 struct GNUNET_GNSRECORD_Block *rrblock;
92 char *bdata; 92 char *bdata;
93 struct GNUNET_CRYPTO_EcdsaPrivateKey id_priv; 93 struct GNUNET_IDENTITY_PrivateKey id_priv;
94 struct GNUNET_CRYPTO_EcdsaPublicKey id_pub; 94 struct GNUNET_IDENTITY_PublicKey id_pub;
95 struct GNUNET_CRYPTO_EcdsaPrivateKey pkey_data_p; 95 struct GNUNET_IDENTITY_PrivateKey pkey_data_p;
96 struct GNUNET_CRYPTO_EcdsaPublicKey pkey_data; 96 struct GNUNET_IDENTITY_PublicKey pkey_data;
97 void *data; 97 void *data;
98 size_t data_size; 98 size_t data_size;
99 char *rdata; 99 char *rdata;
100 size_t rdata_size; 100 size_t rdata_size;
101 101
102 GNUNET_CRYPTO_ecdsa_key_create (&id_priv); 102 id_priv.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY);
103 GNUNET_CRYPTO_ecdsa_key_get_public (&id_priv, 103 GNUNET_CRYPTO_ecdsa_key_create (&id_priv.ecdsa_key);
104 &id_pub); 104 GNUNET_IDENTITY_key_get_public (&id_priv,
105 &id_pub);
105 fprintf (stdout, "Zone private key (d, little-endian scalar):\n"); 106 fprintf (stdout, "Zone private key (d, little-endian scalar):\n");
106 print_bytes (&id_priv, sizeof(id_priv), 0); 107 print_bytes (&id_priv, sizeof(id_priv), 0);
107 fprintf (stdout, "\n"); 108 fprintf (stdout, "\n");
@@ -109,9 +110,10 @@ run (void *cls,
109 print_bytes (&id_pub, sizeof(id_pub), 0); 110 print_bytes (&id_pub, sizeof(id_pub), 0);
110 fprintf (stdout, "\n"); 111 fprintf (stdout, "\n");
111 112
112 GNUNET_CRYPTO_ecdsa_key_create (&pkey_data_p); 113 pkey_data_p.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY);
113 GNUNET_CRYPTO_ecdsa_key_get_public (&pkey_data_p, 114 GNUNET_CRYPTO_ecdsa_key_create (&pkey_data_p.ecdsa_key);
114 &pkey_data); 115 GNUNET_IDENTITY_key_get_public (&pkey_data_p,
116 &pkey_data);
115 fprintf (stdout, 117 fprintf (stdout,
116 "Label: %s\nRRCOUNT: %d\n\n", TEST_RECORD_LABEL, TEST_RRCOUNT); 118 "Label: %s\nRRCOUNT: %d\n\n", TEST_RECORD_LABEL, TEST_RRCOUNT);
117 memset (rd, 0, sizeof (struct GNUNET_GNSRECORD_Data) * 2); 119 memset (rd, 0, sizeof (struct GNUNET_GNSRECORD_Data) * 2);
diff --git a/src/gnsrecord/perf_gnsrecord_crypto.c b/src/gnsrecord/perf_gnsrecord_crypto.c
index eb4633f75..d9a3c20cf 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_IDENTITY_PrivateKey privkey;
77 struct GNUNET_TIME_Absolute expire; 77 struct GNUNET_TIME_Absolute expire;
78 78
79 (void) cls; 79 (void) cls;
@@ -81,7 +81,8 @@ 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 GNUNET_CRYPTO_ecdsa_key_create (&privkey); 84 privkey.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY);
85 GNUNET_CRYPTO_ecdsa_key_create (&privkey.ecdsa_key);
85 86
86 /* test block creation */ 87 /* test block creation */
87 s_name = "DUMMY.dummy.gnunet"; 88 s_name = "DUMMY.dummy.gnunet";
diff --git a/src/gnsrecord/plugin_gnsrecord_dns.c b/src/gnsrecord/plugin_gnsrecord_dns.c
index 9ac6fb9e6..bde9944e2 100644
--- a/src/gnsrecord/plugin_gnsrecord_dns.c
+++ b/src/gnsrecord/plugin_gnsrecord_dns.c
@@ -100,7 +100,7 @@ dns_value_to_string (void *cls,
100 return NULL; 100 return NULL;
101 } 101 }
102 GNUNET_asprintf (&result, 102 GNUNET_asprintf (&result,
103 "rname=%s mname=%s %lu,%lu,%lu,%lu,%lu", 103 "rname=%s mname=%s %u,%u,%u,%u,%u",
104 soa->rname, 104 soa->rname,
105 soa->mname, 105 soa->mname,
106 soa->serial, 106 soa->serial,
diff --git a/src/gnsrecord/test_gnsrecord_crypto.c b/src/gnsrecord/test_gnsrecord_crypto.c
index b67e9a123..d541f3076 100644
--- a/src/gnsrecord/test_gnsrecord_crypto.c
+++ b/src/gnsrecord/test_gnsrecord_crypto.c
@@ -100,17 +100,18 @@ run (void *cls,
100 const struct GNUNET_CONFIGURATION_Handle *cfg) 100 const struct GNUNET_CONFIGURATION_Handle *cfg)
101{ 101{
102 struct GNUNET_GNSRECORD_Block *block; 102 struct GNUNET_GNSRECORD_Block *block;
103 struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; 103 struct GNUNET_IDENTITY_PublicKey pubkey;
104 struct GNUNET_HashCode query_pub; 104 struct GNUNET_HashCode query_pub;
105 struct GNUNET_HashCode query_priv; 105 struct GNUNET_HashCode query_priv;
106 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; 107 struct GNUNET_IDENTITY_PrivateKey privkey;
108 108
109 109
110 GNUNET_CRYPTO_ecdsa_key_create (&privkey); 110 privkey.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY);
111 GNUNET_CRYPTO_ecdsa_key_create (&privkey.ecdsa_key);
111 /* get public key */ 112 /* get public key */
112 GNUNET_CRYPTO_ecdsa_key_get_public (&privkey, 113 GNUNET_IDENTITY_key_get_public (&privkey,
113 &pubkey); 114 &pubkey);
114 115
115 /* test query derivation */ 116 /* test query derivation */
116 GNUNET_GNSRECORD_query_from_private_key (&privkey, 117 GNUNET_GNSRECORD_query_from_private_key (&privkey,