Move dst_region_computeid into a new file dst/keyid.c, so that all of the
dnssec code doesn't need to be linked in by using rdata routines.
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
|
||||
# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
# $Id: Makefile.in,v 1.118 2001/01/09 21:50:34 bwelling Exp $
|
||||
# $Id: Makefile.in,v 1.119 2001/01/17 00:33:33 bwelling Exp $
|
||||
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
@@ -51,8 +51,8 @@ CONFOBJS = config/confacl.@O@ config/confcache.@O@ config/confcommon.@O@ \
|
||||
DSTOBJS = sec/dst/dst_api.@O@ \
|
||||
sec/dst/dst_lib.@O@ sec/dst/dst_parse.@O@ \
|
||||
sec/dst/dst_result.@O@ sec/dst/gssapi_link.@O@ \
|
||||
sec/dst/hmac_link.@O@ sec/dst/openssl_link.@O@ \
|
||||
sec/dst/gssapictx.@O@ \
|
||||
sec/dst/gssapictx.@O@ sec/dst/hmac_link.@O@ \
|
||||
sec/dst/keyid.@O@ sec/dst/openssl_link.@O@ \
|
||||
sec/dst/openssldh_link.@O@ sec/dst/opensslrsa_link.@O@
|
||||
|
||||
OPENSSLOBJS = sec/openssl/a_bitstr.@O@ sec/openssl/a_bytes.@O@ \
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
|
||||
# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
# $Id: Makefile.in,v 1.20 2001/01/09 21:55:26 bwelling Exp $
|
||||
# $Id: Makefile.in,v 1.21 2001/01/17 00:33:34 bwelling Exp $
|
||||
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
@@ -33,11 +33,13 @@ LIBS = @LIBS@
|
||||
|
||||
# Alphabetically
|
||||
OBJS = dst_api.@O@ dst_lib.@O@ dst_parse.@O@ \
|
||||
dst_result.@O@ gssapi_link.@O@ gssapictx.@O@ hmac_link.@O@ \
|
||||
dst_result.@O@ gssapi_link.@O@ gssapictx.@O@ \
|
||||
hmac_link.@O@ keyid.@O@ \
|
||||
openssl_link.@O@ openssldh_link.@O@ opensslrsa_link.@O@
|
||||
|
||||
SRCS = dst_api.c dst_lib.c dst_parse.c \
|
||||
dst_result.c gssapi_link.c gssapictx.c hmac_link.c \
|
||||
dst_result.c gssapi_link.c gssapictx.c \
|
||||
hmac_link.c keyid.c \
|
||||
openssl_link.c openssldh_link.c opensslrsa_link.c
|
||||
|
||||
SUBDIRS = include
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
/*
|
||||
* Principal Author: Brian Wellington
|
||||
* $Id: dst_api.c,v 1.69 2001/01/09 21:55:27 bwelling Exp $
|
||||
* $Id: dst_api.c,v 1.70 2001/01/17 00:33:36 bwelling Exp $
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
@@ -762,33 +762,6 @@ dst_key_secretsize(const dst_key_t *key, unsigned int *n) {
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
isc_uint16_t
|
||||
dst_region_computeid(const isc_region_t *source, const unsigned int alg) {
|
||||
isc_uint32_t ac;
|
||||
const unsigned char *p;
|
||||
int size;
|
||||
|
||||
REQUIRE(source != NULL);
|
||||
|
||||
if (source->length < 4)
|
||||
return (0);
|
||||
|
||||
p = source->base;
|
||||
size = source->length;
|
||||
|
||||
if (alg == DST_ALG_RSAMD5)
|
||||
return ((p[size - 3] << 8) + p[size - 2]);
|
||||
|
||||
for (ac = 0; 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));
|
||||
}
|
||||
|
||||
/***
|
||||
*** Static methods
|
||||
***/
|
||||
|
||||
33
lib/dns/sec/dst/keyid.c
Normal file
33
lib/dns/sec/dst/keyid.c
Normal file
@@ -0,0 +1,33 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <isc/region.h>
|
||||
#include <isc/util.h>
|
||||
|
||||
#include <dst/dst.h>
|
||||
|
||||
isc_uint16_t
|
||||
dst_region_computeid(const isc_region_t *source, const unsigned int alg) {
|
||||
isc_uint32_t ac;
|
||||
const unsigned char *p;
|
||||
int size;
|
||||
|
||||
REQUIRE(source != NULL);
|
||||
|
||||
if (source->length < 4)
|
||||
return (0);
|
||||
|
||||
p = source->base;
|
||||
size = source->length;
|
||||
|
||||
if (alg == DST_ALG_RSAMD5)
|
||||
return ((p[size - 3] << 8) + p[size - 2]);
|
||||
|
||||
for (ac = 0; 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));
|
||||
}
|
||||
Reference in New Issue
Block a user