# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-# $Id: Makefile.in,v 1.94 2000/07/27 09:45:47 tale Exp $
+# $Id: Makefile.in,v 1.95 2000/07/31 19:44:12 bwelling Exp $
srcdir = @srcdir@
VPATH = @srcdir@
DSTOBJS = sec/dst/bsafe_link.@O@ sec/dst/dst_api.@O@ \
sec/dst/dst_parse.@O@ sec/dst/hmac_link.@O@ \
sec/dst/openssl_link.@O@ sec/dst/openssldh_link.@O@ \
- sec/dst/dst_result.@O@ \
- sec/dst/dst_support.@O@ sec/dst/dst_lib.@O@
+ sec/dst/dst_result.@O@ sec/dst/dst_lib.@O@
OPENSSLOBJS = sec/openssl/bn_add.@O@ sec/openssl/bn_asm.@O@ \
sec/openssl/bn_ctx.@O@ sec/openssl/bn_div.@O@ \
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-# $Id: Makefile.in,v 1.13 2000/07/27 09:50:24 tale Exp $
+# $Id: Makefile.in,v 1.14 2000/07/31 19:44:13 bwelling Exp $
srcdir = @srcdir@
VPATH = @srcdir@
# Alphabetically
OBJS = bsafe_link.@O@ dst_api.@O@ dst_parse.@O@ hmac_link.@O@ \
openssl_link.@O@ openssldh_link.@O@ \
- dst_result.@O@ dst_support.@O@ dst_lib.@O@
+ dst_result.@O@ dst_lib.@O@
SRCS = bsafe_link.c dst_api.c dst_parse.c hmac_link.c \
openssl_link.c openssldh_link.c \
- dst_result.c dst_support.c dst_lib.c
+ dst_result.c dst_lib.c
SUBDIRS = include
TARGETS = ${OBJS}
/*
* Principal Author: Brian Wellington
- * $Id: dst_api.c,v 1.56 2000/06/12 18:05:10 bwelling Exp $
+ * $Id: dst_api.c,v 1.57 2000/07/31 19:44:14 bwelling Exp $
*/
#include <config.h>
return (ISC_R_SUCCESS);
}
+isc_uint16_t
+dst_region_computeid(const isc_region_t *source) {
+ isc_uint32_t ac;
+ const unsigned char *p;
+ int size;
+
+ REQUIRE(source != NULL);
+
+ if (source->length == 0)
+ return (0);
+
+ p = source->base;
+ size = source->length;
+
+ 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
***/
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: dst_internal.h,v 1.25 2000/06/22 21:56:36 tale Exp $ */
+/* $Id: dst_internal.h,v 1.26 2000/07/31 19:44:15 bwelling Exp $ */
#ifndef DST_DST_INTERNAL_H
#define DST_DST_INTERNAL_H 1
void dst__openssldsa_destroy(void);
void dst__openssldh_destroy(void);
-/*
- * Support functions.
- */
-isc_uint16_t
-dst__id_calc(const unsigned char *key, const int keysize);
-
/*
* Memory allocators using the DST memory pool.
*/
+++ /dev/null
-/*
- * Portions Copyright (C) 1999, 2000 Internet Software Consortium.
- * Portions Copyright (C) 1995-2000 by Network Associates, Inc.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM AND
- * NETWORK ASSOCIATES DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
- * SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE CONSORTIUM OR NETWORK
- * ASSOCIATES BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
- * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
- * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
- * Principal Author: Brian Wellington
- * $Id: dst_support.c,v 1.7 2000/06/09 20:58:35 gson Exp $
- */
-
-#include <config.h>
-
-#include <stdlib.h>
-
-#include "dst_internal.h"
-
-/*
- * dst__id_calc
- * Calculates the checksum used by DNS as a key id.
- * Parameters
- * key The key in DNS format
- * length The length of the array
- * Return
- * N the 16 bit checksum.
- */
-isc_uint16_t
-dst__id_calc(const unsigned char *key, const int keysize) {
- isc_uint32_t ac;
- const unsigned char *kp = key;
- int size = keysize;
-
- if (key == NULL || (keysize <= 0))
- return (-1);
-
- for (ac = 0; size > 1; size -= 2, kp += 2)
- ac += ((*kp) << 8) + *(kp + 1);
-
- if (size > 0)
- ac += ((*kp) << 8);
- ac += (ac >> 16) & 0xffff;
-
- return ((isc_uint16_t)(ac & 0xffff));
-}
/*
* Principal Author: Brian Wellington
- * $Id: hmac_link.c,v 1.40 2000/07/18 18:15:27 bwelling Exp $
+ * $Id: hmac_link.c,v 1.41 2000/07/31 19:44:18 bwelling Exp $
*/
#include <config.h>
memcpy(hkey->key, r.base, r.length);
keylen = r.length;
}
-
- key->key_id = dst__id_calc(hkey->key, keylen);
+
+ r.base = hkey->key;
+ r.length = keylen;
+ key->key_id = dst_region_computeid(&r);
key->key_size = keylen * 8;
key->opaque = hkey;
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: dst.h,v 1.32 2000/07/27 09:50:30 tale Exp $ */
+/* $Id: dst.h,v 1.33 2000/07/31 19:44:21 bwelling Exp $ */
#ifndef DST_DST_H
#define DST_DST_H 1
* "n" stores the size of a generated shared secret
*/
+isc_uint16_t
+dst_region_computeid(const isc_region_t *source);
+/*
+ * Computes the key id of the key stored in the provided region.
+ *
+ * Requires:
+ * "source" contains a valid, non-NULL region.
+ *
+ * Returns:
+ * the key id
+ */
+
ISC_LANG_ENDDECLS
#endif /* DST_DST_H */
/*
* Principal Author: Brian Wellington
- * $Id: openssl_link.c,v 1.31 2000/06/12 18:05:13 bwelling Exp $
+ * $Id: openssl_link.c,v 1.32 2000/07/31 19:44:19 bwelling Exp $
*/
#if defined(OPENSSL)
return (result);
}
isc_buffer_usedregion(&dns, &r);
- key->key_id = dst__id_calc(r.base, r.length);
+ key->key_id = dst_region_computeid(&r);
return (ISC_R_SUCCESS);
}
r.base += p_bytes;
isc_buffer_remainingregion(data, &r);
- key->key_id = dst__id_calc(r.base, 1 + ISC_SHA1_DIGESTLENGTH +
- 3 * p_bytes);
+ key->key_id = dst_region_computeid(&r);
key->key_size = p_bytes * 8;
isc_buffer_forward(data, 1 + ISC_SHA1_DIGESTLENGTH + 3 * p_bytes);
if (ret != ISC_R_SUCCESS)
DST_RET(ret);
isc_buffer_usedregion(&dns, &r);
- key->key_id = dst__id_calc(r.base, r.length);
+ key->key_id = dst_region_computeid(&r);
if (key->key_id != id)
DST_RET(DST_R_INVALIDPRIVATEKEY);
/*
* Principal Author: Brian Wellington
- * $Id: openssldh_link.c,v 1.25 2000/06/12 18:05:15 bwelling Exp $
+ * $Id: openssldh_link.c,v 1.26 2000/07/31 19:44:20 bwelling Exp $
*/
#if defined(OPENSSL)
return (result);
}
isc_buffer_usedregion(&dns, &r);
- key->key_id = dst__id_calc(r.base, r.length);
+ key->key_id = dst_region_computeid(&r);
return (ISC_R_SUCCESS);
}
r.base += publen;
isc_buffer_remainingregion(data, &r);
- key->key_id = dst__id_calc(r.base, plen + glen + publen + 6);
+ key->key_id = dst_region_computeid(&r);
key->key_size = BN_num_bits(dh->p);
isc_buffer_forward(data, plen + glen + publen + 6);
if (ret != ISC_R_SUCCESS)
DST_RET(ret);
isc_buffer_usedregion(&dns, &r);
- key->key_id = dst__id_calc(r.base, r.length);
+ key->key_id = dst_region_computeid(&r);
if (key->key_id != id)
DST_RET(DST_R_INVALIDPRIVATEKEY);