diff options
Diffstat (limited to 'src/gnsrecord/gnsrecord_misc.c')
-rw-r--r-- | src/gnsrecord/gnsrecord_misc.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/gnsrecord/gnsrecord_misc.c b/src/gnsrecord/gnsrecord_misc.c index b907eed27..2fe315bd8 100644 --- a/src/gnsrecord/gnsrecord_misc.c +++ b/src/gnsrecord/gnsrecord_misc.c | |||
@@ -338,6 +338,12 @@ GNUNET_GNSRECORD_block_get_size (const struct GNUNET_GNSRECORD_Block *block) | |||
338 | + ntohl (block->ecdsa_block.purpose.size) /* Length of signed data */ | 338 | + ntohl (block->ecdsa_block.purpose.size) /* Length of signed data */ |
339 | - sizeof (block->ecdsa_block.purpose); /* Purpose already in EcdsaBlock */ | 339 | - sizeof (block->ecdsa_block.purpose); /* Purpose already in EcdsaBlock */ |
340 | break; | 340 | break; |
341 | case GNUNET_GNSRECORD_TYPE_EDKEY: | ||
342 | return sizeof (uint32_t) /* zone type */ | ||
343 | + sizeof (block->eddsa_block) /* EddsaBlock */ | ||
344 | + ntohl (block->eddsa_block.purpose.size) /* Length of signed data */ | ||
345 | - sizeof (block->ecdsa_block.purpose); /* Purpose already in EcdsaBlock */ | ||
346 | |||
341 | default: | 347 | default: |
342 | return 0; | 348 | return 0; |
343 | } | 349 | } |
@@ -354,6 +360,8 @@ GNUNET_GNSRECORD_block_get_expiration (const struct | |||
354 | { | 360 | { |
355 | case GNUNET_GNSRECORD_TYPE_PKEY: | 361 | case GNUNET_GNSRECORD_TYPE_PKEY: |
356 | return GNUNET_TIME_absolute_ntoh (block->ecdsa_block.expiration_time); | 362 | return GNUNET_TIME_absolute_ntoh (block->ecdsa_block.expiration_time); |
363 | case GNUNET_GNSRECORD_TYPE_EDKEY: | ||
364 | return GNUNET_TIME_absolute_ntoh (block->eddsa_block.expiration_time); | ||
357 | default: | 365 | default: |
358 | GNUNET_break (0); /* Hopefully we never get here, but we might */ | 366 | GNUNET_break (0); /* Hopefully we never get here, but we might */ |
359 | } | 367 | } |
@@ -373,6 +381,11 @@ GNUNET_GNSRECORD_query_from_block (const struct GNUNET_GNSRECORD_Block *block, | |||
373 | sizeof (block->ecdsa_block.derived_key), | 381 | sizeof (block->ecdsa_block.derived_key), |
374 | query); | 382 | query); |
375 | return GNUNET_OK; | 383 | return GNUNET_OK; |
384 | case GNUNET_GNSRECORD_TYPE_EDKEY: | ||
385 | GNUNET_CRYPTO_hash (&block->eddsa_block.derived_key, | ||
386 | sizeof (block->eddsa_block.derived_key), | ||
387 | query); | ||
388 | return GNUNET_OK; | ||
376 | default: | 389 | default: |
377 | return GNUNET_SYSERR; | 390 | return GNUNET_SYSERR; |
378 | } | 391 | } |
@@ -394,6 +407,10 @@ GNUNET_GNSRECORD_record_to_identity_key (const struct GNUNET_GNSRECORD_Data *rd, | |||
394 | key->type = htonl (rd->record_type); | 407 | key->type = htonl (rd->record_type); |
395 | memcpy (&key->ecdsa_key, rd->data, sizeof (key->ecdsa_key)); | 408 | memcpy (&key->ecdsa_key, rd->data, sizeof (key->ecdsa_key)); |
396 | return GNUNET_OK; | 409 | return GNUNET_OK; |
410 | case GNUNET_GNSRECORD_TYPE_EDKEY: | ||
411 | key->type = htonl (rd->record_type); | ||
412 | memcpy (&key->eddsa_key, rd->data, sizeof (key->eddsa_key)); | ||
413 | return GNUNET_OK; | ||
397 | default: | 414 | default: |
398 | return GNUNET_SYSERR; | 415 | return GNUNET_SYSERR; |
399 | } | 416 | } |