Fix Byte-order botch: broke DNSSEC on big-endian platforms.

This commit is contained in:
Simon Kelley
2014-02-10 16:42:46 +00:00
parent c8ca33f810
commit 1633e30834

View File

@@ -1374,12 +1374,12 @@ int dnskey_keytag(int alg, int flags, unsigned char *key, int keylen)
}
else
{
unsigned long ac;
unsigned long ac = flags + 0x300 + alg;
int i;
ac = ((htons(flags) >> 8) | ((htons(flags) << 8) & 0xff00)) + 0x300 + alg;
for (i = 0; i < keylen; ++i)
ac += (i & 1) ? key[i] : key[i] << 8;
ac += (ac >> 16) & 0xffff;
return ac & 0xffff;
}