summaryrefslogtreecommitdiffstats
path: root/avahi-core/wide-area.c
diff options
context:
space:
mode:
authorFederico Lucifredi <flucifredi@acm.org>2007-12-27 10:00:06 +0000
committerFederico Lucifredi <flucifredi@acm.org>2007-12-27 10:00:06 +0000
commitdaf15da70d1f58fa146b9e5aefac9915353726bb (patch)
tree305e389d9922740ee9b800ed1519faf8201c6821 /avahi-core/wide-area.c
parentb9e64a97755492ac41bd9a86e08f227db5555517 (diff)
completed fleshing out of MAC routine.
git-svn-id: file:///home/lennart/svn/public/avahi/branches/federico@1662 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe
Diffstat (limited to 'avahi-core/wide-area.c')
-rw-r--r--avahi-core/wide-area.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/avahi-core/wide-area.c b/avahi-core/wide-area.c
index de40021..fbe25b4 100644
--- a/avahi-core/wide-area.c
+++ b/avahi-core/wide-area.c
@@ -808,12 +808,25 @@ AvahiRecord* tsig_sign_packet(const char* keyname, const char* key, unsigned key
/*HMAC_Update(&ctx, <data/>, <length/>);*/
HMAC_Update(&ctx, (unsigned char *)p->data, (unsigned int)p->size); /*packet in wire format*/
- canonic = c_to_canonical_string(keyname);
- HMAC_Update(&ctx, canonic, strlen(canonic) +1); /* key name in canonical wire format */
+ canonic = c_to_canonical_string(keyname); /* key name in canonical wire format (DNS labels) */
+ HMAC_Update(&ctx, canonic, strlen(canonic) +1);
- HMAC_Update(&ctx, uint16_to_canonical_string(AVAHI_DNS_CLASS_ANY), 2); /* class */
-/* HMAC_Update(&ctx,
- HMAC_Update(&ctx, */
+ HMAC_Update(&ctx, uint16_to_canonical_string(AVAHI_DNS_CLASS_ANY), 2); /* class - always ANY for TSIG*/
+
+ HMAC_Update(&ctx, uint32_to_canonical_string(0), 4); /* TTL - always 0 for TSIG */
+
+ canonic = c_to_canonical_string(r->data.tsig.algorithm_name); /* IANA algorithm name in canonical wire format (DNS labels)*/
+ HMAC_Update(&ctx, canonic, strlen(canonic) +1);
+
+ HMAC_Update(&ctx, time_t_to_canonical_string(time_t v), 6); /*uint48 representation of unix time */
+
+ HMAC_Update(&ctx, uint16_to_canonical_string(r->data.tsig.fudge), 2);
+
+ HMAC_Update(&ctx, uint16_to_canonical_string(r->data.tsig.error), 2);
+
+ HMAC_Update(&ctx, uint16_to_canonical_string(r->data.tsig.other_len), 2);
+
+ HMAC_Update(&ctx, r->data.tsig.other_data, other_len); /* should work if other_len =0 can be passed to the HMAC */
HMAC_Final(&ctx, keyed_hash, &hash_length);
HMAC_cleanup(&ctx);