From 47df83d8e885562571eefe8f12316a1096567ba9 Mon Sep 17 00:00:00 2001 From: Federico Lucifredi Date: Thu, 27 Dec 2007 09:30:38 +0000 Subject: uint32_to_canonical_string()added git-svn-id: file:///home/lennart/svn/public/avahi/branches/federico@1659 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe --- avahi-core/domain-util.c | 14 +++++++++++++- avahi-core/wide-area.c | 5 +++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/avahi-core/domain-util.c b/avahi-core/domain-util.c index 2bbf127..fc2877b 100644 --- a/avahi-core/domain-util.c +++ b/avahi-core/domain-util.c @@ -230,4 +230,16 @@ char * uint16_to_canonical_string(uint16_t v) { c[0] = (uint8_t) (v >> 8); c[1] = (uint8_t) v; return c; -} \ No newline at end of file +} + +char * uint32_to_canonical_string(uint32_t v) { + uint8_t *c = avahi_malloc(4); + + c[0] = (uint8_t) (v >> 24); + c[1] = (uint8_t) (v >> 16); + c[2] = (uint8_t) (v >> 8); + c[3] = (uint8_t) v; + + return c; +} + diff --git a/avahi-core/wide-area.c b/avahi-core/wide-area.c index b884dca..2373333 100644 --- a/avahi-core/wide-area.c +++ b/avahi-core/wide-area.c @@ -34,6 +34,7 @@ #include #include #include +#include #include @@ -805,10 +806,10 @@ AvahiRecord* tsig_sign_packet(const char* keyname, const char* key, unsigned key /*feed all the data to be hashed in */ /*HMAC_Update(&ctx, , );*/ - HMAC_Update(&ctx, p->data, p->size); /*packet in wire format*/ + 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 */ + HMAC_Update(&ctx, &canonic, strlen(canonic) +1); /* key name in canonical wire format */ HMAC_Update(&ctx, uint16_to_canonical_string(AVAHI_DNS_CLASS_ANY), 2); /* class */ /* HMAC_Update(&ctx, -- cgit