From 456dc751a0c3d48476277c8cbca338715948f2f7 Mon Sep 17 00:00:00 2001 From: Federico Lucifredi Date: Sun, 20 Jan 2008 21:47:50 +0000 Subject: keytag generation (avahi_keytag()) and a few more constants for RRSIG generation. git-svn-id: file:///home/lennart/svn/public/avahi/branches/federico2@1732 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe --- avahi-core/domain-util.c | 16 +++++++++++++++- avahi-core/domain-util.h | 3 +++ avahi-core/rr.h | 4 +++- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/avahi-core/domain-util.c b/avahi-core/domain-util.c index 0d6ba14..7f562db 100644 --- a/avahi-core/domain-util.c +++ b/avahi-core/domain-util.c @@ -237,4 +237,18 @@ uint8_t avahi_count_canonical_labels(const char* input){ } return count; -} \ No newline at end of file +} + +/* reference keytag generator from RFC 4034 */ +/* invoke with avahi_keytag(, ); */ +uint16_t avahi_keytag(uint8_t key[], uint16_t keysize){ + uint32_t ac; + int i; + + for (ac = 0, i = 0; i < keysize; ++i) + ac += (i & 1) ? key[i] : key[i] << 8; + + ac += (ac >> 16) & 0xFFFF; + + return ac & 0xFFFF; + } diff --git a/avahi-core/domain-util.h b/avahi-core/domain-util.h index c3e3579..2e4cf3d 100644 --- a/avahi-core/domain-util.h +++ b/avahi-core/domain-util.h @@ -48,6 +48,9 @@ unsigned char * avahi_c_to_canonical_string(const char* input); /** returns the number of labels in a canonical DNS domain */ uint8_t avahi_count_canonical_labels(const char* input); +/* reference keytag generator from RFC 4034 */ +uint16_t avahi_keytag(uint8_t key[], uint16_t keysize) + AVAHI_C_DECL_END #endif diff --git a/avahi-core/rr.h b/avahi-core/rr.h index fc6a0e6..2437ef2 100644 --- a/avahi-core/rr.h +++ b/avahi-core/rr.h @@ -52,7 +52,9 @@ enum { /**DNSSEC protocol constants */ enum { - AVAHI_DNSSEC_PROTO = 0x3 + AVAHI_DNSSEC_PROTO = 0x3, + AVAHI_DNSSEC_VALIDITY = 30, + AVAHI_DNSSEC_TIME_DRIFT = 3600 }; /** DNS record classes, see RFC 1035, in addition to those defined in defs.h */ -- cgit