diff options
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 7c8114e..bf9b16c 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)); |