summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFederico Lucifredi <flucifredi@acm.org>2008-01-20 21:47:50 +0000
committerFederico Lucifredi <flucifredi@acm.org>2008-01-20 21:47:50 +0000
commit456dc751a0c3d48476277c8cbca338715948f2f7 (patch)
treeab48757bbb8992d181725dcad8800ed9de30ae28
parent4586d4466ffd0b8913f04b63c5dbfd261fc88017 (diff)
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
-rw-r--r--avahi-core/domain-util.c16
-rw-r--r--avahi-core/domain-util.h3
-rw-r--r--avahi-core/rr.h4
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(<rdata>, <rdlength>); */
+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 */