diff options
author | Doug Barton <dougb@FreeBSD.org> | 2012-04-05 04:29:35 +0000 |
---|---|---|
committer | Doug Barton <dougb@FreeBSD.org> | 2012-04-05 04:29:35 +0000 |
commit | d0f6280db790de2ad69bd01a1275e350cbd2840d (patch) | |
tree | cf3176c0801c94a4f298353cc450f10cf1aae9c0 /contrib/bind9/lib/dns/key.c | |
parent | 8931e524bfb5c6a10894f704e3eaa05ee5d9fa77 (diff) | |
parent | 42d3eba523963ab015ac451eeea0788b11631c94 (diff) |
Update to version 9.8.2, the latest from ISC, which contains numerous bug fixes.
Notes
Notes:
svn path=/head/; revision=233914
Diffstat (limited to 'contrib/bind9/lib/dns/key.c')
-rw-r--r-- | contrib/bind9/lib/dns/key.c | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/contrib/bind9/lib/dns/key.c b/contrib/bind9/lib/dns/key.c index 7c8114e71bb5..bf9b16c170c4 100644 --- a/contrib/bind9/lib/dns/key.c +++ b/contrib/bind9/lib/dns/key.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2007 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2007, 2011, 2012 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2001 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: key.c,v 1.8 2007-06-19 23:47:16 tbox Exp $ */ +/* $Id$ */ #include <config.h> @@ -56,6 +56,33 @@ dst_region_computeid(const isc_region_t *source, unsigned int alg) { return ((isc_uint16_t)(ac & 0xffff)); } +isc_uint16_t +dst_region_computerid(const isc_region_t *source, unsigned int alg) { + isc_uint32_t ac; + const unsigned char *p; + int size; + + REQUIRE(source != NULL); + REQUIRE(source->length >= 4); + + p = source->base; + size = source->length; + + if (alg == DST_ALG_RSAMD5) + return ((p[size - 3] << 8) + p[size - 2]); + + ac = ((*p) << 8) + *(p + 1); + ac |= DNS_KEYFLAG_REVOKE; + for (size -= 2, p +=2; size > 1; size -= 2, p += 2) + ac += ((*p) << 8) + *(p + 1); + + if (size > 0) + ac += ((*p) << 8); + ac += (ac >> 16) & 0xffff; + + return ((isc_uint16_t)(ac & 0xffff)); +} + dns_name_t * dst_key_name(const dst_key_t *key) { REQUIRE(VALID_KEY(key)); @@ -92,6 +119,12 @@ dst_key_id(const dst_key_t *key) { return (key->key_id); } +dns_keytag_t +dst_key_rid(const dst_key_t *key) { + REQUIRE(VALID_KEY(key)); + return (key->key_rid); +} + dns_rdataclass_t dst_key_class(const dst_key_t *key) { REQUIRE(VALID_KEY(key)); |