diff options
| author | 2020-02-17 18:58:39 +0000 | |
|---|---|---|
| committer | 2020-02-17 18:58:39 +0000 | |
| commit | a61b9c11d1cfbd02350b4fbc5b6cf37b75fec5ff (patch) | |
| tree | 0ff52fd4fe2d2913de1df499e5914c7896a21fd9 | |
| parent | vmm: check guest cpl and xsave_mask in xsetbv handler (diff) | |
| download | wireguard-openbsd-a61b9c11d1cfbd02350b4fbc5b6cf37b75fec5ff.tar.xz wireguard-openbsd-a61b9c11d1cfbd02350b4fbc5b6cf37b75fec5ff.zip | |
remove unused code
ok florian
| -rw-r--r-- | usr.bin/dig/dig.c | 9 | ||||
| -rw-r--r-- | usr.bin/dig/lib/isc/app_api.c | 110 | ||||
| -rw-r--r-- | usr.bin/dig/lib/isc/hash.c | 270 | ||||
| -rw-r--r-- | usr.bin/dig/lib/isc/include/isc/app.h | 122 | ||||
| -rw-r--r-- | usr.bin/dig/lib/isc/include/isc/hash.h | 109 | ||||
| -rw-r--r-- | usr.bin/dig/lib/isc/include/isc/log.h | 64 | ||||
| -rw-r--r-- | usr.bin/dig/lib/isc/include/isc/netaddr.h | 25 | ||||
| -rw-r--r-- | usr.bin/dig/lib/isc/include/isc/parseint.h | 5 | ||||
| -rw-r--r-- | usr.bin/dig/lib/isc/include/isc/serial.h | 26 | ||||
| -rw-r--r-- | usr.bin/dig/lib/isc/include/isc/sha1.h | 5 | ||||
| -rw-r--r-- | usr.bin/dig/lib/isc/include/isc/sha2.h | 14 | ||||
| -rw-r--r-- | usr.bin/dig/lib/isc/include/isc/symtab.h | 12 | ||||
| -rw-r--r-- | usr.bin/dig/lib/isc/log.c | 39 | ||||
| -rw-r--r-- | usr.bin/dig/lib/isc/netaddr.c | 87 | ||||
| -rw-r--r-- | usr.bin/dig/lib/isc/parseint.c | 15 | ||||
| -rw-r--r-- | usr.bin/dig/lib/isc/serial.c | 27 | ||||
| -rw-r--r-- | usr.bin/dig/lib/isc/sha1.c | 10 | ||||
| -rw-r--r-- | usr.bin/dig/lib/isc/sha2.c | 172 | ||||
| -rw-r--r-- | usr.bin/dig/lib/isc/symtab.c | 31 | ||||
| -rw-r--r-- | usr.bin/dig/lib/isc/unix/app.c | 5 | ||||
| -rw-r--r-- | usr.bin/dig/lib/isc/unix/socket.c | 2 |
21 files changed, 23 insertions, 1136 deletions
diff --git a/usr.bin/dig/dig.c b/usr.bin/dig/dig.c index 043df0c3a65..41fd7d7485f 100644 --- a/usr.bin/dig/dig.c +++ b/usr.bin/dig/dig.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dig.c,v 1.9 2020/02/15 11:57:11 jsg Exp $ */ +/* $Id: dig.c,v 1.10 2020/02/17 18:58:39 jung Exp $ */ /*! \file */ #include <sys/cdefs.h> @@ -626,13 +626,6 @@ printgreeting(int argc, char **argv, dig_lookup_t *lookup) { } } -/*% - * We're not using isc_commandline_parse() here since the command line - * syntax of dig is quite a bit different from that which can be described - * by that routine. - * XXX doc options - */ - static void plus_option(const char *option, isc_boolean_t is_batchfile, dig_lookup_t *lookup) diff --git a/usr.bin/dig/lib/isc/app_api.c b/usr.bin/dig/lib/isc/app_api.c index fcf7c8e54ba..3a366b25151 100644 --- a/usr.bin/dig/lib/isc/app_api.c +++ b/usr.bin/dig/lib/isc/app_api.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: app_api.c,v 1.1 2020/02/07 09:58:53 florian Exp $ */ +/* $Id: app_api.c,v 1.2 2020/02/17 18:58:39 jung Exp $ */ @@ -30,109 +30,6 @@ static isc_boolean_t is_running = ISC_FALSE; #define ISCAPI_APPMETHODS_VALID(m) ISC_MAGIC_VALID(m, ISCAPI_APPMETHODS_MAGIC) isc_result_t -isc_app_register(isc_appctxcreatefunc_t createfunc) { - isc_result_t result = ISC_R_SUCCESS; - - if (appctx_createfunc == NULL) - appctx_createfunc = createfunc; - else - result = ISC_R_EXISTS; - - return (result); -} - -isc_result_t -isc_appctx_create(isc_appctx_t **ctxp) { - return (isc__appctx_create(ctxp)); -} - -void -isc_appctx_destroy(isc_appctx_t **ctxp) { - REQUIRE(ctxp != NULL && ISCAPI_APPCTX_VALID(*ctxp)); - - isc__appctx_destroy(ctxp); - - ENSURE(*ctxp == NULL); -} - -isc_result_t -isc_app_ctxstart(isc_appctx_t *ctx) { - REQUIRE(ISCAPI_APPCTX_VALID(ctx)); - - return (isc__app_ctxstart(ctx)); -} - -isc_result_t -isc_app_ctxrun(isc_appctx_t *ctx) { - REQUIRE(ISCAPI_APPCTX_VALID(ctx)); - - return (isc__app_ctxrun(ctx)); -} - -isc_result_t -isc_app_ctxonrun(isc_appctx_t *ctx, - isc_task_t *task, isc_taskaction_t action, - void *arg) -{ - REQUIRE(ISCAPI_APPCTX_VALID(ctx)); - - return (isc__app_ctxonrun(ctx, task, action, arg)); -} - -isc_result_t -isc_app_ctxsuspend(isc_appctx_t *ctx) { - REQUIRE(ISCAPI_APPCTX_VALID(ctx)); - - return (isc__app_ctxsuspend(ctx)); -} - -isc_result_t -isc_app_ctxshutdown(isc_appctx_t *ctx) { - REQUIRE(ISCAPI_APPCTX_VALID(ctx)); - - return (isc__app_ctxshutdown(ctx)); -} - -void -isc_app_ctxfinish(isc_appctx_t *ctx) { - REQUIRE(ISCAPI_APPCTX_VALID(ctx)); - - isc__app_ctxfinish(ctx); - - ctx->methods->ctxfinish(ctx); -} - -void -isc_appctx_settaskmgr(isc_appctx_t *ctx, isc_taskmgr_t *taskmgr) { - REQUIRE(ISCAPI_APPCTX_VALID(ctx)); - REQUIRE(taskmgr != NULL); - - isc__appctx_settaskmgr(ctx, taskmgr); - - ctx->methods->settaskmgr(ctx, taskmgr); -} - -void -isc_appctx_setsocketmgr(isc_appctx_t *ctx, isc_socketmgr_t *socketmgr) { - REQUIRE(ISCAPI_APPCTX_VALID(ctx)); - REQUIRE(socketmgr != NULL); - - isc__appctx_setsocketmgr(ctx, socketmgr); - - ctx->methods->setsocketmgr(ctx, socketmgr); -} - -void -isc_appctx_settimermgr(isc_appctx_t *ctx, isc_timermgr_t *timermgr) { - REQUIRE(ISCAPI_APPCTX_VALID(ctx)); - REQUIRE(timermgr != NULL); - - isc__appctx_settimermgr(ctx, timermgr); - - ctx->methods->settimermgr(ctx, timermgr); -} - -isc_result_t isc_app_start(void) { return (isc__app_start()); } @@ -164,11 +61,6 @@ isc_app_shutdown(void) { return (isc__app_shutdown()); } -isc_result_t -isc_app_reload(void) { - return (isc__app_reload()); -} - void isc_app_finish(void) { isc__app_finish(); diff --git a/usr.bin/dig/lib/isc/hash.c b/usr.bin/dig/lib/isc/hash.c index a92ece943fb..8e848f08ca6 100644 --- a/usr.bin/dig/lib/isc/hash.c +++ b/usr.bin/dig/lib/isc/hash.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: hash.c,v 1.1 2020/02/07 09:58:53 florian Exp $ */ +/* $Id: hash.c,v 1.2 2020/02/17 18:58:39 jung Exp $ */ /*! \file * Some portion of this code was derived from universal hash function @@ -91,8 +91,6 @@ struct isc_hash { hash_random_t *rndvector; /*%< random vector for universal hashing */ }; -static isc_hash_t *hash = NULL; - static unsigned char maptolower[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, @@ -128,202 +126,6 @@ static unsigned char maptolower[] = { 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff }; -isc_result_t -isc_hash_ctxcreate(size_t limit, isc_hash_t **hctxp) -{ - isc_result_t result; - isc_hash_t *hctx; - size_t vlen; - hash_random_t *rv; - hash_accum_t overflow_limit; - - REQUIRE(hctxp != NULL && *hctxp == NULL); - - /* - * Overflow check. Since our implementation only does a modulo - * operation at the last stage of hash calculation, the accumulator - * must not overflow. - */ - overflow_limit = - 1 << (((sizeof(hash_accum_t) - sizeof(hash_random_t))) * 8); - if (overflow_limit < (limit + 1) * 0xff) - return (ISC_R_RANGE); - - hctx = malloc(sizeof(isc_hash_t)); - if (hctx == NULL) - return (ISC_R_NOMEMORY); - - vlen = sizeof(hash_random_t) * (limit + 1); - rv = malloc(vlen); - if (rv == NULL) { - result = ISC_R_NOMEMORY; - goto errout; - } - - /* - * From here down, no failures will/can occur. - */ - hctx->magic = HASH_MAGIC; - hctx->initialized = ISC_FALSE; - result = isc_refcount_init(&hctx->refcnt, 1); - if (result != ISC_R_SUCCESS) - goto cleanup_lock; - hctx->limit = limit; - hctx->vectorlen = vlen; - hctx->rndvector = rv; - - *hctxp = hctx; - return (ISC_R_SUCCESS); - - cleanup_lock: - errout: - free(hctx); - if (rv != NULL) - free(rv); - - return (result); -} - -isc_result_t -isc_hash_create(size_t limit) { - isc_result_t result = ISC_R_SUCCESS; - - INSIST(hash == NULL); - - if (hash == NULL) - result = isc_hash_ctxcreate(limit, &hash); - - return (result); -} - -void -isc_hash_ctxinit(isc_hash_t *hctx) { - if (hctx->initialized == ISC_TRUE) - return - - arc4random_buf(hctx->rndvector, hctx->vectorlen); - hctx->initialized = ISC_TRUE; -} - -void -isc_hash_init(void) { - INSIST(hash != NULL && VALID_HASH(hash)); - - isc_hash_ctxinit(hash); -} - -void -isc_hash_ctxattach(isc_hash_t *hctx, isc_hash_t **hctxp) { - REQUIRE(VALID_HASH(hctx)); - REQUIRE(hctxp != NULL && *hctxp == NULL); - - isc_refcount_increment(&hctx->refcnt, NULL); - *hctxp = hctx; -} - -static void -destroy(isc_hash_t **hctxp) { - isc_hash_t *hctx; - - REQUIRE(hctxp != NULL && *hctxp != NULL); - hctx = *hctxp; - *hctxp = NULL; - - isc_refcount_destroy(&hctx->refcnt); - - if (hctx->rndvector != NULL) - free(hctx->rndvector); - - memset(hctx, 0, sizeof(isc_hash_t)); - free(hctx); -} - -void -isc_hash_ctxdetach(isc_hash_t **hctxp) { - isc_hash_t *hctx; - unsigned int refs; - - REQUIRE(hctxp != NULL && VALID_HASH(*hctxp)); - hctx = *hctxp; - - isc_refcount_decrement(&hctx->refcnt, &refs); - if (refs == 0) - destroy(&hctx); - - *hctxp = NULL; -} - -void -isc_hash_destroy(void) { - unsigned int refs; - - INSIST(hash != NULL && VALID_HASH(hash)); - - isc_refcount_decrement(&hash->refcnt, &refs); - INSIST(refs == 0); - - destroy(&hash); -} - -static inline unsigned int -hash_calc(isc_hash_t *hctx, const unsigned char *key, unsigned int keylen, - isc_boolean_t case_sensitive) -{ - hash_accum_t partial_sum = 0; - hash_random_t *p = hctx->rndvector; - unsigned int i = 0; - - /* Make it sure that the hash context is initialized. */ - if (hctx->initialized == ISC_FALSE) - isc_hash_ctxinit(hctx); - - if (case_sensitive) { - for (i = 0; i < keylen; i++) - partial_sum += key[i] * (hash_accum_t)p[i]; - } else { - for (i = 0; i < keylen; i++) - partial_sum += maptolower[key[i]] * (hash_accum_t)p[i]; - } - - partial_sum += p[i]; - - return ((unsigned int)(partial_sum % PRIME32)); -} - -unsigned int -isc_hash_ctxcalc(isc_hash_t *hctx, const unsigned char *key, - unsigned int keylen, isc_boolean_t case_sensitive) -{ - REQUIRE(hctx != NULL && VALID_HASH(hctx)); - REQUIRE(keylen <= hctx->limit); - - return (hash_calc(hctx, key, keylen, case_sensitive)); -} - -unsigned int -isc_hash_calc(const unsigned char *key, unsigned int keylen, - isc_boolean_t case_sensitive) -{ - INSIST(hash != NULL && VALID_HASH(hash)); - REQUIRE(keylen <= hash->limit); - - return (hash_calc(hash, key, keylen, case_sensitive)); -} - -void -isc__hash_setvec(const uint16_t *vec) { - int i; - hash_random_t *p; - - if (hash == NULL) - return; - - p = hash->rndvector; - for (i = 0; i < 256; i++) { - p[i] = vec[i]; - } -} - static uint32_t fnv_offset_basis; static isc_boolean_t fnv_once = ISC_FALSE; @@ -340,76 +142,6 @@ fnv_initialize(void) { } uint32_t -isc_hash_function(const void *data, size_t length, - isc_boolean_t case_sensitive, - const uint32_t *previous_hashp) -{ - uint32_t hval; - const unsigned char *bp; - const unsigned char *be; - - REQUIRE(length == 0 || data != NULL); - if (!fnv_once) { - fnv_once = ISC_TRUE; - fnv_initialize(); - } - - hval = previous_hashp != NULL ? - *previous_hashp : fnv_offset_basis; - - if (length == 0) - return (hval); - - bp = (const unsigned char *) data; - be = bp + length; - - /* - * Fowler-Noll-Vo FNV-1a hash function. - * - * NOTE: A random fnv_offset_basis is used by default to avoid - * collision attacks as the hash function is reversible. This - * makes the mapping non-deterministic, but the distribution in - * the domain is still uniform. - */ - - if (case_sensitive) { - while (bp < be - 4) { - hval ^= (uint32_t) bp[0]; - hval *= 16777619; - hval ^= (uint32_t) bp[1]; - hval *= 16777619; - hval ^= (uint32_t) bp[2]; - hval *= 16777619; - hval ^= (uint32_t) bp[3]; - hval *= 16777619; - bp += 4; - } - while (bp < be) { - hval ^= (uint32_t) *bp++; - hval *= 16777619; - } - } else { - while (bp < be - 4) { - hval ^= (uint32_t) maptolower[bp[0]]; - hval *= 16777619; - hval ^= (uint32_t) maptolower[bp[1]]; - hval *= 16777619; - hval ^= (uint32_t) maptolower[bp[2]]; - hval *= 16777619; - hval ^= (uint32_t) maptolower[bp[3]]; - hval *= 16777619; - bp += 4; - } - while (bp < be) { - hval ^= (uint32_t) maptolower[*bp++]; - hval *= 16777619; - } - } - - return (hval); -} - -uint32_t isc_hash_function_reverse(const void *data, size_t length, isc_boolean_t case_sensitive, const uint32_t *previous_hashp) diff --git a/usr.bin/dig/lib/isc/include/isc/app.h b/usr.bin/dig/lib/isc/include/isc/app.h index a132d6770aa..d82a4854858 100644 --- a/usr.bin/dig/lib/isc/include/isc/app.h +++ b/usr.bin/dig/lib/isc/include/isc/app.h @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: app.h,v 1.2 2020/02/13 13:53:01 jsg Exp $ */ +/* $Id: app.h,v 1.3 2020/02/17 18:58:39 jung Exp $ */ #ifndef ISC_APP_H #define ISC_APP_H 1 @@ -45,11 +45,6 @@ * *\li isc_app_finish(); Call very late in main(). * - * Applications that want to use SIGHUP/isc_app_reload() to trigger reloading - * should check the result of isc_app_run() and call the reload routine if - * the result is ISC_R_RELOAD. They should then call isc_app_run() again - * to resume waiting for reload or termination. - * * Use of this module is not required. In particular, isc_app_start() is * NOT an ISC library initialization routine. * @@ -66,9 +61,7 @@ * called previously). * * The same note applies to isc_app_ctxXXX() functions, but in this case - * it's a per-thread restriction. For example, a thread with an - * application context must ensure that isc_app_ctxstart() with the - * context is called at most once. + * it's a per-thread restriction. * * \li Reliability: * No anticipated impact. @@ -140,9 +133,6 @@ struct isc_appctx { (c)->magic == ISCAPI_APPCTX_MAGIC) isc_result_t -isc_app_ctxstart(isc_appctx_t *ctx); - -isc_result_t isc_app_start(void); /*!< * \brief Start an ISC library application. @@ -156,9 +146,6 @@ isc_app_start(void); */ isc_result_t -isc_app_ctxonrun(isc_appctx_t *ctx, isc_task_t *task, - isc_taskaction_t action, void *arg); -isc_result_t isc_app_onrun(isc_task_t *task, isc_taskaction_t action, void *arg); /*!< @@ -174,9 +161,6 @@ isc_app_onrun(isc_task_t *task, isc_taskaction_t action, */ isc_result_t -isc_app_ctxrun(isc_appctx_t *ctx); - -isc_result_t isc_app_run(void); /*!< * \brief Run an ISC library application. @@ -210,9 +194,6 @@ isc_app_isrunning(void); */ isc_result_t -isc_app_ctxshutdown(isc_appctx_t *ctx); - -isc_result_t isc_app_shutdown(void); /*!< * \brief Request application shutdown. @@ -230,28 +211,6 @@ isc_app_shutdown(void); *\li ISC_R_UNEXPECTED */ -isc_result_t -isc_app_ctxsuspend(isc_appctx_t *ctx); -/*!< - * \brief This has the same behavior as isc_app_ctxsuspend(). - */ - -isc_result_t -isc_app_reload(void); -/*!< - * \brief Request application reload. - * - * Requires: - *\li isc_app_run() has been called. - * - * Returns: - *\li ISC_R_SUCCESS - *\li ISC_R_UNEXPECTED - */ - -void -isc_app_ctxfinish(isc_appctx_t *ctx); - void isc_app_finish(void); /*!< @@ -298,87 +257,10 @@ isc_app_unblock(void); * \li isc_app_block() has been called by the same thread. */ -isc_result_t -isc_appctx_create(isc_appctx_t **ctxp); -/*!< - * \brief Create an application context. - * - * Requires: - *\li 'mctx' is a valid memory context. - *\li 'ctxp' != NULL && *ctxp == NULL. - */ - -void -isc_appctx_destroy(isc_appctx_t **ctxp); -/*!< - * \brief Destroy an application context. - * - * Requires: - *\li '*ctxp' is a valid application context. - * - * Ensures: - *\li *ctxp == NULL. - */ - -void -isc_appctx_settaskmgr(isc_appctx_t *ctx, isc_taskmgr_t *taskmgr); -/*!< - * \brief Associate a task manager with an application context. - * - * This must be done before running tasks within the application context. - * - * Requires: - *\li 'ctx' is a valid application context. - *\li 'taskmgr' is a valid task manager. - */ - -void -isc_appctx_setsocketmgr(isc_appctx_t *ctx, isc_socketmgr_t *socketmgr); -/*!< - * \brief Associate a socket manager with an application context. - * - * This must be done before handling socket events within the application - * context. - * - * Requires: - *\li 'ctx' is a valid application context. - *\li 'socketmgr' is a valid socket manager. - */ - -void -isc_appctx_settimermgr(isc_appctx_t *ctx, isc_timermgr_t *timermgr); -/*!< - * \brief Associate a socket timer with an application context. - * - * This must be done before handling timer events within the application - * context. - * - * Requires: - *\li 'ctx' is a valid application context. - *\li 'timermgr' is a valid timer manager. - */ - /*%< * See isc_appctx_create() above. */ typedef isc_result_t (*isc_appctxcreatefunc_t)(isc_appctx_t **ctxp); -isc_result_t -isc_app_register(isc_appctxcreatefunc_t createfunc); -/*%< - * Register a new application implementation and add it to the list of - * supported implementations. This function must be called when a different - * event library is used than the one contained in the ISC library. - */ - -isc_result_t -isc__app_register(void); -/*%< - * A short cut function that specifies the application module in the ISC - * library for isc_app_register(). An application that uses the ISC library - * usually do not have to care about this function: it would call - * isc_lib_register(), which internally calls this function. - */ - #endif /* ISC_APP_H */ diff --git a/usr.bin/dig/lib/isc/include/isc/hash.h b/usr.bin/dig/lib/isc/include/isc/hash.h index 725557f934c..99cf707c83a 100644 --- a/usr.bin/dig/lib/isc/include/isc/hash.h +++ b/usr.bin/dig/lib/isc/include/isc/hash.h @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: hash.h,v 1.2 2020/02/13 13:53:01 jsg Exp $ */ +/* $Id: hash.h,v 1.3 2020/02/17 18:58:39 jung Exp $ */ #ifndef ISC_HASH_H #define ISC_HASH_H 1 @@ -83,103 +83,6 @@ *** Functions ***/ -isc_result_t -isc_hash_ctxcreate(size_t limit, isc_hash_t **hctx); -isc_result_t -isc_hash_create(size_t limit); -/*!< - * \brief Create a new hash object. - * - * isc_hash_ctxcreate() creates a different object. - * - * isc_hash_create() creates a module-internal object to support the - * single-context mode. It should be called only once. - * - * 'limit' specifies the maximum number of hash keys. If it is too large, - * these functions may fail. - */ - -void -isc_hash_ctxattach(isc_hash_t *hctx, isc_hash_t **hctxp); -/*!< - * \brief Attach to a hash object. - * - * This function is only necessary for the multiple-context mode. - */ - -void -isc_hash_ctxdetach(isc_hash_t **hctxp); -/*!< - * \brief Detach from a hash object. - * - * This function is for the multiple-context mode, and takes a valid - * hash object as an argument. - */ - -void -isc_hash_destroy(void); -/*!< - * \brief This function is for the single-context mode, and is expected to be used - * as a counterpart of isc_hash_create(). - * - * A valid module-internal hash object must have been created, and this - * function should be called only once. - */ - -/*@{*/ -void -isc_hash_ctxinit(isc_hash_t *hctx); -void -isc_hash_init(void); -/*!< - * \brief Initialize a hash object. - * - * It fills in the random vector with a proper - * source of entropy, which is typically from the entropy object specified - * at the creation. Thus, it is desirable to call these functions after - * initializing the entropy object with some good entropy sources. - * - * These functions should be called before the first hash calculation. - * - * isc_hash_ctxinit() is for the multiple-context mode, and takes a valid hash - * object as an argument. - * - * isc_hash_init() is for the single-context mode. A valid module-internal - * hash object must have been created, and this function should be called only - * once. - */ -/*@}*/ - -/*@{*/ -unsigned int -isc_hash_ctxcalc(isc_hash_t *hctx, const unsigned char *key, - unsigned int keylen, isc_boolean_t case_sensitive); -unsigned int -isc_hash_calc(const unsigned char *key, unsigned int keylen, - isc_boolean_t case_sensitive); -/*!< - * \brief Calculate a hash value. - * - * isc_hash_ctxinit() is for the multiple-context mode, and takes a valid hash - * object as an argument. - * - * isc_hash_init() is for the single-context mode. A valid module-internal - * hash object must have been created. - * - * 'key' is the hash key, which is a variable length buffer. - * - * 'keylen' specifies the key length, which must not be larger than the limit - * specified for the corresponding hash object. - * - * 'case_sensitive' specifies whether the hash key should be treated as - * case_sensitive values. It should typically be ISC_FALSE if the hash key - * is a DNS name. - */ -/*@}*/ - -void -isc__hash_setvec(const uint16_t *vec); - /*!< * \brief Set the contents of the random vector used in hashing. * @@ -194,10 +97,6 @@ isc__hash_setvec(const uint16_t *vec); */ uint32_t -isc_hash_function(const void *data, size_t length, - isc_boolean_t case_sensitive, - const uint32_t *previous_hashp); -uint32_t isc_hash_function_reverse(const void *data, size_t length, isc_boolean_t case_sensitive, const uint32_t *previous_hashp); @@ -210,15 +109,11 @@ isc_hash_function_reverse(const void *data, size_t length, * process using this library is run, but will have uniform * distribution. * - * isc_hash_function() calculates the hash from start to end over the - * input data. isc_hash_function_reverse() calculates the hash from the + * isc_hash_function_reverse() calculates the hash from the * end to the start over the input data. The difference in order is * useful in incremental hashing; for example, a previously hashed * value for 'com' can be used as input when hashing 'example.com'. * - * This is a new variant of isc_hash_calc() and will supercede - * isc_hash_calc() eventually. - * * 'data' is the data to be hashed. * * 'length' is the size of the data to be hashed. diff --git a/usr.bin/dig/lib/isc/include/isc/log.h b/usr.bin/dig/lib/isc/include/isc/log.h index b35e4615153..1c266921f05 100644 --- a/usr.bin/dig/lib/isc/include/isc/log.h +++ b/usr.bin/dig/lib/isc/include/isc/log.h @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: log.h,v 1.5 2020/02/13 16:57:55 florian Exp $ */ +/* $Id: log.h,v 1.6 2020/02/17 18:58:39 jung Exp $ */ #ifndef ISC_LOG_H #define ISC_LOG_H 1 @@ -527,68 +527,6 @@ isc_log_write(isc_log_t *lctx, isc_logcategory_t *category, __attribute__((__format__(__printf__, 5, 6))); -/*% - * Write a message to the log channels. - * - * Notes: - *\li lctx can be NULL; this is allowed so that programs which use - * libraries that use the ISC logging system are not required to - * also use it. - * - *\li The format argument is a printf(3) string, with additional arguments - * as necessary. - * - * Requires: - *\li lctx is a valid logging context. - * - *\li The category and module arguments must have ids that are in the - * range of known ids, as established by isc_log_registercategories() - * and isc_log_registermodules(). - * - *\li level != #ISC_LOG_DYNAMIC. ISC_LOG_DYNAMIC is used only to define - * channels, and explicit debugging level must be identified for - * isc_log_write() via ISC_LOG_DEBUG(level). - * - *\li format != NULL. - * - * Ensures: - *\li The log message is written to every channel associated with the - * indicated category/module pair. - * - * Returns: - *\li Nothing. Failure to log a message is not construed as a - * meaningful error. - */ -void -isc_log_vwrite(isc_log_t *lctx, isc_logcategory_t *category, - isc_logmodule_t *module, int level, - const char *format, va_list args) - -__attribute__((__format__(__printf__, 5, 0))); - -/*% - * Write a message to the log channels, pruning duplicates that occur within - * a configurable amount of seconds (see isc_log_[sg]etduplicateinterval). - * This function is otherwise identical to isc_log_write(). - */ -void -isc_log_write1(isc_log_t *lctx, isc_logcategory_t *category, - isc_logmodule_t *module, int level, const char *format, ...) - -__attribute__((__format__(__printf__, 5, 6))); - -/*% - * Write a message to the log channels, pruning duplicates that occur within - * a configurable amount of seconds (see isc_log_[sg]etduplicateinterval). - * This function is otherwise identical to isc_log_vwrite(). - */ -void -isc_log_vwrite1(isc_log_t *lctx, isc_logcategory_t *category, - isc_logmodule_t *module, int level, const char *format, - va_list args) - -__attribute__((__format__(__printf__, 5, 0))); - void isc_log_setdebuglevel(isc_log_t *lctx, unsigned int level); /*%< diff --git a/usr.bin/dig/lib/isc/include/isc/netaddr.h b/usr.bin/dig/lib/isc/include/isc/netaddr.h index e157a8de198..c3be66e2e83 100644 --- a/usr.bin/dig/lib/isc/include/isc/netaddr.h +++ b/usr.bin/dig/lib/isc/include/isc/netaddr.h @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: netaddr.h,v 1.3 2020/02/13 13:53:01 jsg Exp $ */ +/* $Id: netaddr.h,v 1.4 2020/02/17 18:58:39 jung Exp $ */ #ifndef ISC_NETADDR_H #define ISC_NETADDR_H 1 @@ -38,14 +38,6 @@ struct isc_netaddr { }; /*%< - * Compare network addresses 'a' and 'b'. Return #ISC_TRUE if - * they are equal, #ISC_FALSE if not. - */ - -isc_boolean_t -isc_netaddr_eqprefix(const isc_netaddr_t *a, const isc_netaddr_t *b, - unsigned int prefixlen); -/*%< * Compare the 'prefixlen' most significant bits of the network * addresses 'a' and 'b'. If 'b''s scope is zero then 'a''s scope is * ignored. Return #ISC_TRUE if they are equal, #ISC_FALSE if not. @@ -80,9 +72,6 @@ isc_netaddr_format(const isc_netaddr_t *na, char *array, unsigned int size); void isc_netaddr_fromsockaddr(isc_netaddr_t *netaddr, const isc_sockaddr_t *source); -uint32_t -isc_netaddr_getzone(const isc_netaddr_t *netaddr); - isc_boolean_t isc_netaddr_ismulticast(isc_netaddr_t *na); /*%< @@ -90,12 +79,6 @@ isc_netaddr_ismulticast(isc_netaddr_t *na); */ isc_boolean_t -isc_netaddr_isexperimental(isc_netaddr_t *na); -/*%< - * Returns ISC_TRUE if the address is a experimental (CLASS E) address. - */ - -isc_boolean_t isc_netaddr_islinklocal(isc_netaddr_t *na); /*%< * Returns #ISC_TRUE if the address is a link local address. @@ -107,10 +90,4 @@ isc_netaddr_issitelocal(isc_netaddr_t *na); * Returns #ISC_TRUE if the address is a site local address. */ -isc_boolean_t -isc_netaddr_isnetzero(isc_netaddr_t *na); -/*%< - * Returns #ISC_TRUE if the address is in net zero. - */ - #endif /* ISC_NETADDR_H */ diff --git a/usr.bin/dig/lib/isc/include/isc/parseint.h b/usr.bin/dig/lib/isc/include/isc/parseint.h index 4e986fc134e..62b8cfdc684 100644 --- a/usr.bin/dig/lib/isc/include/isc/parseint.h +++ b/usr.bin/dig/lib/isc/include/isc/parseint.h @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: parseint.h,v 1.2 2020/02/13 13:53:01 jsg Exp $ */ +/* $Id: parseint.h,v 1.3 2020/02/17 18:58:39 jung Exp $ */ #ifndef ISC_PARSEINT_H #define ISC_PARSEINT_H 1 @@ -33,9 +33,6 @@ isc_result_t isc_parse_uint32(uint32_t *uip, const char *string, int base); isc_result_t -isc_parse_uint16(uint16_t *uip, const char *string, int base); - -isc_result_t isc_parse_uint8(uint8_t *uip, const char *string, int base); /*%< * Parse the null-terminated string 'string' containing a base 'base' diff --git a/usr.bin/dig/lib/isc/include/isc/serial.h b/usr.bin/dig/lib/isc/include/isc/serial.h index bad4d8ec329..032b6a79937 100644 --- a/usr.bin/dig/lib/isc/include/isc/serial.h +++ b/usr.bin/dig/lib/isc/include/isc/serial.h @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: serial.h,v 1.3 2020/02/13 13:53:01 jsg Exp $ */ +/* $Id: serial.h,v 1.4 2020/02/17 18:58:39 jung Exp $ */ #ifndef ISC_SERIAL_H #define ISC_SERIAL_H 1 @@ -33,39 +33,15 @@ ***/ isc_boolean_t -isc_serial_lt(uint32_t a, uint32_t b); -/*%< - * Return true if 'a' < 'b' otherwise false. - */ - -isc_boolean_t isc_serial_gt(uint32_t a, uint32_t b); /*%< * Return true if 'a' > 'b' otherwise false. */ isc_boolean_t -isc_serial_le(uint32_t a, uint32_t b); -/*%< - * Return true if 'a' <= 'b' otherwise false. - */ - -isc_boolean_t isc_serial_ge(uint32_t a, uint32_t b); /*%< * Return true if 'a' >= 'b' otherwise false. */ -isc_boolean_t -isc_serial_eq(uint32_t a, uint32_t b); -/*%< - * Return true if 'a' == 'b' otherwise false. - */ - -isc_boolean_t -isc_serial_ne(uint32_t a, uint32_t b); -/*%< - * Return true if 'a' != 'b' otherwise false. - */ - #endif /* ISC_SERIAL_H */ diff --git a/usr.bin/dig/lib/isc/include/isc/sha1.h b/usr.bin/dig/lib/isc/include/isc/sha1.h index fb778f2cfb5..ab81aac3bd2 100644 --- a/usr.bin/dig/lib/isc/include/isc/sha1.h +++ b/usr.bin/dig/lib/isc/include/isc/sha1.h @@ -17,7 +17,7 @@ #ifndef ISC_SHA1_H #define ISC_SHA1_H 1 -/* $Id: sha1.h,v 1.4 2020/02/13 13:53:01 jsg Exp $ */ +/* $Id: sha1.h,v 1.5 2020/02/17 18:58:39 jung Exp $ */ /* $NetBSD: sha1.h,v 1.2 1998/05/29 22:55:44 thorpej Exp $ */ @@ -41,9 +41,6 @@ void isc_sha1_init(isc_sha1_t *ctx); void -isc_sha1_invalidate(isc_sha1_t *ctx); - -void isc_sha1_update(isc_sha1_t *ctx, const unsigned char *data, unsigned int len); void diff --git a/usr.bin/dig/lib/isc/include/isc/sha2.h b/usr.bin/dig/lib/isc/include/isc/sha2.h index 907ffc1d069..9692482c501 100644 --- a/usr.bin/dig/lib/isc/include/isc/sha2.h +++ b/usr.bin/dig/lib/isc/include/isc/sha2.h @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: sha2.h,v 1.2 2020/02/13 13:53:01 jsg Exp $ */ +/* $Id: sha2.h,v 1.3 2020/02/17 18:58:39 jung Exp $ */ /* $FreeBSD: src/sys/crypto/sha2/sha2.h,v 1.1.2.1 2001/07/03 11:01:36 ume Exp $ */ /* $KAME: sha2.h,v 1.3 2001/03/12 08:27:48 itojun Exp $ */ @@ -93,31 +93,19 @@ typedef isc_sha512_t isc_sha384_t; /*** SHA-224/256/384/512 Function Prototypes ******************************/ void isc_sha224_init (isc_sha224_t *); -void isc_sha224_invalidate (isc_sha224_t *); void isc_sha224_update (isc_sha224_t *, const uint8_t *, size_t); void isc_sha224_final (uint8_t[ISC_SHA224_DIGESTLENGTH], isc_sha224_t *); -char *isc_sha224_end (isc_sha224_t *, char[ISC_SHA224_DIGESTSTRINGLENGTH]); -char *isc_sha224_data (const uint8_t *, size_t, char[ISC_SHA224_DIGESTSTRINGLENGTH]); void isc_sha256_init (isc_sha256_t *); -void isc_sha256_invalidate (isc_sha256_t *); void isc_sha256_update (isc_sha256_t *, const uint8_t *, size_t); void isc_sha256_final (uint8_t[ISC_SHA256_DIGESTLENGTH], isc_sha256_t *); -char *isc_sha256_end (isc_sha256_t *, char[ISC_SHA256_DIGESTSTRINGLENGTH]); -char *isc_sha256_data (const uint8_t *, size_t, char[ISC_SHA256_DIGESTSTRINGLENGTH]); void isc_sha384_init (isc_sha384_t *); -void isc_sha384_invalidate (isc_sha384_t *); void isc_sha384_update (isc_sha384_t *, const uint8_t *, size_t); void isc_sha384_final (uint8_t[ISC_SHA384_DIGESTLENGTH], isc_sha384_t *); -char *isc_sha384_end (isc_sha384_t *, char[ISC_SHA384_DIGESTSTRINGLENGTH]); -char *isc_sha384_data (const uint8_t *, size_t, char[ISC_SHA384_DIGESTSTRINGLENGTH]); void isc_sha512_init (isc_sha512_t *); -void isc_sha512_invalidate (isc_sha512_t *); void isc_sha512_update (isc_sha512_t *, const uint8_t *, size_t); void isc_sha512_final (uint8_t[ISC_SHA512_DIGESTLENGTH], isc_sha512_t *); -char *isc_sha512_end (isc_sha512_t *, char[ISC_SHA512_DIGESTSTRINGLENGTH]); -char *isc_sha512_data (const uint8_t *, size_t, char[ISC_SHA512_DIGESTSTRINGLENGTH]); #endif /* ISC_SHA2_H */ diff --git a/usr.bin/dig/lib/isc/include/isc/symtab.h b/usr.bin/dig/lib/isc/include/isc/symtab.h index cafaed9ffaa..7d628000424 100644 --- a/usr.bin/dig/lib/isc/include/isc/symtab.h +++ b/usr.bin/dig/lib/isc/include/isc/symtab.h @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: symtab.h,v 1.2 2020/02/13 13:53:01 jsg Exp $ */ +/* $Id: symtab.h,v 1.3 2020/02/17 18:58:39 jung Exp $ */ #ifndef ISC_SYMTAB_H #define ISC_SYMTAB_H 1 @@ -50,7 +50,7 @@ * * The symbol table library does not make a copy the key field, so the * caller must ensure that any key it passes to isc_symtab_define() will not - * change until it calls isc_symtab_undefine() or isc_symtab_destroy(). + * change until it calls isc_symtab_destroy(). * * A user-specified action will be called (if provided) when a symbol is * undefined. It can be used to free memory associated with keys and/or @@ -126,12 +126,4 @@ isc_result_t isc_symtab_define(isc_symtab_t *symtab, const char *key, unsigned int type, isc_symvalue_t value, isc_symexists_t exists_policy); -/*% Undefine a symbol table. */ -isc_result_t -isc_symtab_undefine(isc_symtab_t *symtab, const char *key, unsigned int type); - -/*% Return the number of items in a symbol table. */ -unsigned int -isc_symtab_count(isc_symtab_t *symtab); - #endif /* ISC_SYMTAB_H */ diff --git a/usr.bin/dig/lib/isc/log.c b/usr.bin/dig/lib/isc/log.c index 76a01473640..820a3e9ad3d 100644 --- a/usr.bin/dig/lib/isc/log.c +++ b/usr.bin/dig/lib/isc/log.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: log.c,v 1.13 2020/02/16 21:11:02 florian Exp $ */ +/* $Id: log.c,v 1.14 2020/02/17 18:58:39 jung Exp $ */ /*! \file * \author Principal Authors: DCL */ @@ -680,43 +680,6 @@ isc_log_write(isc_log_t *lctx, isc_logcategory_t *category, } void -isc_log_vwrite(isc_log_t *lctx, isc_logcategory_t *category, - isc_logmodule_t *module, int level, - const char *format, va_list args) -{ - /* - * Contract checking is done in isc_log_doit(). - */ - isc_log_doit(lctx, category, module, level, ISC_FALSE, format, args); -} - -void -isc_log_write1(isc_log_t *lctx, isc_logcategory_t *category, - isc_logmodule_t *module, int level, const char *format, ...) -{ - va_list args; - - /* - * Contract checking is done in isc_log_doit(). - */ - - va_start(args, format); - isc_log_doit(lctx, category, module, level, ISC_TRUE, format, args); - va_end(args); -} - -void -isc_log_vwrite1(isc_log_t *lctx, isc_logcategory_t *category, - isc_logmodule_t *module, int level, - const char *format, va_list args) -{ - /* - * Contract checking is done in isc_log_doit(). - */ - isc_log_doit(lctx, category, module, level, ISC_TRUE, format, args); -} - -void isc_log_setcontext(isc_log_t *lctx) { isc_lctx = lctx; } diff --git a/usr.bin/dig/lib/isc/netaddr.c b/usr.bin/dig/lib/isc/netaddr.c index 40be09aa60b..e51fe224cec 100644 --- a/usr.bin/dig/lib/isc/netaddr.c +++ b/usr.bin/dig/lib/isc/netaddr.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: netaddr.c,v 1.4 2020/02/13 16:55:44 florian Exp $ */ +/* $Id: netaddr.c,v 1.5 2020/02/17 18:58:39 jung Exp $ */ /*! \file */ @@ -30,64 +30,6 @@ #include <string.h> #include <isc/util.h> -isc_boolean_t -isc_netaddr_eqprefix(const isc_netaddr_t *a, const isc_netaddr_t *b, - unsigned int prefixlen) -{ - const unsigned char *pa = NULL, *pb = NULL; - unsigned int ipabytes = 0; /* Length of whole IP address in bytes */ - unsigned int nbytes; /* Number of significant whole bytes */ - unsigned int nbits; /* Number of significant leftover bits */ - - REQUIRE(a != NULL && b != NULL); - - if (a->family != b->family) - return (ISC_FALSE); - - if (a->zone != b->zone && b->zone != 0) - return (ISC_FALSE); - - switch (a->family) { - case AF_INET: - pa = (const unsigned char *) &a->type.in; - pb = (const unsigned char *) &b->type.in; - ipabytes = 4; - break; - case AF_INET6: - pa = (const unsigned char *) &a->type.in6; - pb = (const unsigned char *) &b->type.in6; - ipabytes = 16; - break; - default: - return (ISC_FALSE); - } - - /* - * Don't crash if we get a pattern like 10.0.0.1/9999999. - */ - if (prefixlen > ipabytes * 8) - prefixlen = ipabytes * 8; - - nbytes = prefixlen / 8; - nbits = prefixlen % 8; - - if (nbytes > 0) { - if (memcmp(pa, pb, nbytes) != 0) - return (ISC_FALSE); - } - if (nbits > 0) { - unsigned int bytea, byteb, mask; - INSIST(nbytes < ipabytes); - INSIST(nbits < 8); - bytea = pa[nbytes]; - byteb = pb[nbytes]; - mask = (0xFF << (8-nbits)) & 0xFF; - if ((bytea & mask) != (byteb & mask)) - return (ISC_FALSE); - } - return (ISC_TRUE); -} - isc_result_t isc_netaddr_totext(const isc_netaddr_t *netaddr, isc_buffer_t *target) { char abuf[sizeof("xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:255.255.255.255")]; @@ -161,11 +103,6 @@ isc_netaddr_format(const isc_netaddr_t *na, char *array, unsigned int size) { } } -uint32_t -isc_netaddr_getzone(const isc_netaddr_t *netaddr) { - return (netaddr->zone); -} - void isc_netaddr_fromsockaddr(isc_netaddr_t *t, const isc_sockaddr_t *s) { int family = s->type.sa.sa_family; @@ -197,16 +134,6 @@ isc_netaddr_ismulticast(isc_netaddr_t *na) { } isc_boolean_t -isc_netaddr_isexperimental(isc_netaddr_t *na) { - switch (na->family) { - case AF_INET: - return (ISC_TF(ISC_IPADDR_ISEXPERIMENTAL(na->type.in.s_addr))); - default: - return (ISC_FALSE); /* XXXMLG ? */ - } -} - -isc_boolean_t isc_netaddr_islinklocal(isc_netaddr_t *na) { switch (na->family) { case AF_INET: @@ -233,15 +160,3 @@ isc_netaddr_issitelocal(isc_netaddr_t *na) { #define ISC_IPADDR_ISNETZERO(i) \ (((uint32_t)(i) & ISC__IPADDR(0xff000000)) \ == ISC__IPADDR(0x00000000)) - -isc_boolean_t -isc_netaddr_isnetzero(isc_netaddr_t *na) { - switch (na->family) { - case AF_INET: - return (ISC_TF(ISC_IPADDR_ISNETZERO(na->type.in.s_addr))); - case AF_INET6: - return (ISC_FALSE); - default: - return (ISC_FALSE); - } -} diff --git a/usr.bin/dig/lib/isc/parseint.c b/usr.bin/dig/lib/isc/parseint.c index 88bfe8f15a2..9cec5c2c5b2 100644 --- a/usr.bin/dig/lib/isc/parseint.c +++ b/usr.bin/dig/lib/isc/parseint.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: parseint.c,v 1.1 2020/02/07 09:58:54 florian Exp $ */ +/* $Id: parseint.c,v 1.2 2020/02/17 18:58:39 jung Exp $ */ /*! \file */ @@ -53,19 +53,6 @@ isc_parse_uint32(uint32_t *uip, const char *string, int base) { } isc_result_t -isc_parse_uint16(uint16_t *uip, const char *string, int base) { - uint32_t val; - isc_result_t result; - result = isc_parse_uint32(&val, string, base); - if (result != ISC_R_SUCCESS) - return (result); - if (val > 0xFFFF) - return (ISC_R_RANGE); - *uip = (uint16_t) val; - return (ISC_R_SUCCESS); -} - -isc_result_t isc_parse_uint8(uint8_t *uip, const char *string, int base) { uint32_t val; isc_result_t result; diff --git a/usr.bin/dig/lib/isc/serial.c b/usr.bin/dig/lib/isc/serial.c index 1783952acee..78e73d96c7d 100644 --- a/usr.bin/dig/lib/isc/serial.c +++ b/usr.bin/dig/lib/isc/serial.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: serial.c,v 1.1 2020/02/07 09:58:54 florian Exp $ */ +/* $Id: serial.c,v 1.2 2020/02/17 18:58:39 jung Exp $ */ /*! \file */ @@ -23,36 +23,11 @@ #include <isc/serial.h> isc_boolean_t -isc_serial_lt(uint32_t a, uint32_t b) { - /* - * Undefined => ISC_FALSE - */ - if (a == (b ^ 0x80000000U)) - return (ISC_FALSE); - return (((int32_t)(a - b) < 0) ? ISC_TRUE : ISC_FALSE); -} - -isc_boolean_t isc_serial_gt(uint32_t a, uint32_t b) { return (((int32_t)(a - b) > 0) ? ISC_TRUE : ISC_FALSE); } isc_boolean_t -isc_serial_le(uint32_t a, uint32_t b) { - return ((a == b) ? ISC_TRUE : isc_serial_lt(a, b)); -} - -isc_boolean_t isc_serial_ge(uint32_t a, uint32_t b) { return ((a == b) ? ISC_TRUE : isc_serial_gt(a, b)); } - -isc_boolean_t -isc_serial_eq(uint32_t a, uint32_t b) { - return ((a == b) ? ISC_TRUE : ISC_FALSE); -} - -isc_boolean_t -isc_serial_ne(uint32_t a, uint32_t b) { - return ((a != b) ? ISC_TRUE : ISC_FALSE); -} diff --git a/usr.bin/dig/lib/isc/sha1.c b/usr.bin/dig/lib/isc/sha1.c index d95e2b1150b..4bebea053b6 100644 --- a/usr.bin/dig/lib/isc/sha1.c +++ b/usr.bin/dig/lib/isc/sha1.c @@ -14,10 +14,10 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: sha1.c,v 1.3 2020/02/11 23:26:12 jsg Exp $ */ +/* $Id: sha1.c,v 1.4 2020/02/17 18:58:39 jung Exp $ */ /* $NetBSD: sha1.c,v 1.5 2000/01/22 22:19:14 mycroft Exp $ */ -/* $OpenBSD: sha1.c,v 1.3 2020/02/11 23:26:12 jsg Exp $ */ +/* $OpenBSD: sha1.c,v 1.4 2020/02/17 18:58:39 jung Exp $ */ /*! \file * SHA-1 in C @@ -53,12 +53,6 @@ isc_sha1_init(isc_sha1_t *context) } void -isc_sha1_invalidate(isc_sha1_t *context) { - EVP_MD_CTX_free(context->ctx); - context->ctx = NULL; -} - -void isc_sha1_update(isc_sha1_t *context, const unsigned char *data, unsigned int len) { diff --git a/usr.bin/dig/lib/isc/sha2.c b/usr.bin/dig/lib/isc/sha2.c index 69fa729c0ac..c2daccc619c 100644 --- a/usr.bin/dig/lib/isc/sha2.c +++ b/usr.bin/dig/lib/isc/sha2.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: sha2.c,v 1.2 2020/02/11 23:26:12 jsg Exp $ */ +/* $Id: sha2.c,v 1.3 2020/02/17 18:58:39 jung Exp $ */ /* $FreeBSD: src/sys/crypto/sha2/sha2.c,v 1.2.2.2 2002/03/05 08:36:47 ume Exp $ */ /* $KAME: sha2.c,v 1.8 2001/11/08 01:07:52 itojun Exp $ */ @@ -75,12 +75,6 @@ isc_sha224_init(isc_sha224_t *context) { } void -isc_sha224_invalidate(isc_sha224_t *context) { - EVP_MD_CTX_free(context->ctx); - context->ctx = NULL; -} - -void isc_sha224_update(isc_sha224_t *context, const uint8_t* data, size_t len) { if (len == 0U) { /* Calling with no data is valid - we do nothing */ @@ -123,12 +117,6 @@ isc_sha256_init(isc_sha256_t *context) { } void -isc_sha256_invalidate(isc_sha256_t *context) { - EVP_MD_CTX_free(context->ctx); - context->ctx = NULL; -} - -void isc_sha256_update(isc_sha256_t *context, const uint8_t *data, size_t len) { if (len == 0U) { /* Calling with no data is valid - we do nothing */ @@ -170,12 +158,6 @@ isc_sha512_init(isc_sha512_t *context) { } } -void -isc_sha512_invalidate(isc_sha512_t *context) { - EVP_MD_CTX_free(context->ctx); - context->ctx = NULL; -} - void isc_sha512_update(isc_sha512_t *context, const uint8_t *data, size_t len) { if (len == 0U) { /* Calling with no data is valid - we do nothing */ @@ -217,12 +199,6 @@ isc_sha384_init(isc_sha384_t *context) { } void -isc_sha384_invalidate(isc_sha384_t *context) { - EVP_MD_CTX_free(context->ctx); - context->ctx = NULL; -} - -void isc_sha384_update(isc_sha384_t *context, const uint8_t* data, size_t len) { if (len == 0U) { /* Calling with no data is valid - we do nothing */ @@ -251,149 +227,3 @@ isc_sha384_final(uint8_t digest[], isc_sha384_t *context) { EVP_MD_CTX_free(context->ctx); context->ctx = NULL; } - -/* - * Constant used by SHA256/384/512_End() functions for converting the - * digest to a readable hexadecimal character string: - */ -static const char *sha2_hex_digits = "0123456789abcdef"; - -char * -isc_sha224_end(isc_sha224_t *context, char buffer[]) { - uint8_t digest[ISC_SHA224_DIGESTLENGTH], *d = digest; - unsigned int i; - - /* Sanity check: */ - REQUIRE(context != (isc_sha224_t *)0); - - if (buffer != (char*)0) { - isc_sha224_final(digest, context); - - for (i = 0; i < ISC_SHA224_DIGESTLENGTH; i++) { - *buffer++ = sha2_hex_digits[(*d & 0xf0) >> 4]; - *buffer++ = sha2_hex_digits[*d & 0x0f]; - d++; - } - *buffer = (char)0; - } else { - EVP_MD_CTX_reset(context->ctx); - } - isc_safe_memwipe(digest, sizeof(digest)); - return buffer; -} - -char * -isc_sha224_data(const uint8_t *data, size_t len, - char digest[ISC_SHA224_DIGESTSTRINGLENGTH]) -{ - isc_sha224_t context; - - isc_sha224_init(&context); - isc_sha224_update(&context, data, len); - return (isc_sha224_end(&context, digest)); -} - -char * -isc_sha256_end(isc_sha256_t *context, char buffer[]) { - uint8_t digest[ISC_SHA256_DIGESTLENGTH], *d = digest; - unsigned int i; - - /* Sanity check: */ - REQUIRE(context != (isc_sha256_t *)0); - - if (buffer != (char*)0) { - isc_sha256_final(digest, context); - - for (i = 0; i < ISC_SHA256_DIGESTLENGTH; i++) { - *buffer++ = sha2_hex_digits[(*d & 0xf0) >> 4]; - *buffer++ = sha2_hex_digits[*d & 0x0f]; - d++; - } - *buffer = (char)0; - } else { - EVP_MD_CTX_reset(context->ctx); - } - isc_safe_memwipe(digest, sizeof(digest)); - return buffer; -} - -char * -isc_sha256_data(const uint8_t* data, size_t len, - char digest[ISC_SHA256_DIGESTSTRINGLENGTH]) -{ - isc_sha256_t context; - - isc_sha256_init(&context); - isc_sha256_update(&context, data, len); - return (isc_sha256_end(&context, digest)); -} - -char * -isc_sha512_end(isc_sha512_t *context, char buffer[]) { - uint8_t digest[ISC_SHA512_DIGESTLENGTH], *d = digest; - unsigned int i; - - /* Sanity check: */ - REQUIRE(context != (isc_sha512_t *)0); - - if (buffer != (char*)0) { - isc_sha512_final(digest, context); - - for (i = 0; i < ISC_SHA512_DIGESTLENGTH; i++) { - *buffer++ = sha2_hex_digits[(*d & 0xf0) >> 4]; - *buffer++ = sha2_hex_digits[*d & 0x0f]; - d++; - } - *buffer = (char)0; - } else { - EVP_MD_CTX_reset(context->ctx); - } - isc_safe_memwipe(digest, sizeof(digest)); - return buffer; -} - -char * -isc_sha512_data(const uint8_t *data, size_t len, - char digest[ISC_SHA512_DIGESTSTRINGLENGTH]) -{ - isc_sha512_t context; - - isc_sha512_init(&context); - isc_sha512_update(&context, data, len); - return (isc_sha512_end(&context, digest)); -} - -char * -isc_sha384_end(isc_sha384_t *context, char buffer[]) { - uint8_t digest[ISC_SHA384_DIGESTLENGTH], *d = digest; - unsigned int i; - - /* Sanity check: */ - REQUIRE(context != (isc_sha384_t *)0); - - if (buffer != (char*)0) { - isc_sha384_final(digest, context); - - for (i = 0; i < ISC_SHA384_DIGESTLENGTH; i++) { - *buffer++ = sha2_hex_digits[(*d & 0xf0) >> 4]; - *buffer++ = sha2_hex_digits[*d & 0x0f]; - d++; - } - *buffer = (char)0; - } else { - EVP_MD_CTX_reset(context->ctx); - } - isc_safe_memwipe(digest, sizeof(digest)); - return buffer; -} - -char * -isc_sha384_data(const uint8_t *data, size_t len, - char digest[ISC_SHA384_DIGESTSTRINGLENGTH]) -{ - isc_sha384_t context; - - isc_sha384_init(&context); - isc_sha384_update(&context, data, len); - return (isc_sha384_end(&context, digest)); -} diff --git a/usr.bin/dig/lib/isc/symtab.c b/usr.bin/dig/lib/isc/symtab.c index c97eca8c9c5..e9392002020 100644 --- a/usr.bin/dig/lib/isc/symtab.c +++ b/usr.bin/dig/lib/isc/symtab.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: symtab.c,v 1.1 2020/02/07 09:58:54 florian Exp $ */ +/* $Id: symtab.c,v 1.2 2020/02/17 18:58:39 jung Exp $ */ /*! \file */ @@ -269,32 +269,3 @@ isc_symtab_define(isc_symtab_t *symtab, const char *key, unsigned int type, return (ISC_R_SUCCESS); } - -isc_result_t -isc_symtab_undefine(isc_symtab_t *symtab, const char *key, unsigned int type) { - unsigned int bucket; - elt_t *elt; - - REQUIRE(VALID_SYMTAB(symtab)); - REQUIRE(key != NULL); - - FIND(symtab, key, type, bucket, elt); - - if (elt == NULL) - return (ISC_R_NOTFOUND); - - if (symtab->undefine_action != NULL) - (symtab->undefine_action)(elt->key, elt->type, - elt->value, symtab->undefine_arg); - UNLINK(symtab->table[bucket], elt, link); - free(elt); - symtab->count--; - - return (ISC_R_SUCCESS); -} - -unsigned int -isc_symtab_count(isc_symtab_t *symtab) { - REQUIRE(VALID_SYMTAB(symtab)); - return (symtab->count); -} diff --git a/usr.bin/dig/lib/isc/unix/app.c b/usr.bin/dig/lib/isc/unix/app.c index 6c6d5daf236..012f0e0523d 100644 --- a/usr.bin/dig/lib/isc/unix/app.c +++ b/usr.bin/dig/lib/isc/unix/app.c @@ -567,9 +567,4 @@ isc__appctx_settimermgr(isc_appctx_t *ctx0, isc_timermgr_t *timermgr) { ctx->timermgr = timermgr; } -isc_result_t -isc__app_register(void) { - return (isc_app_register(isc__appctx_create)); -} - #include "../app_api.c" diff --git a/usr.bin/dig/lib/isc/unix/socket.c b/usr.bin/dig/lib/isc/unix/socket.c index 044c3133a56..da2d0b32964 100644 --- a/usr.bin/dig/lib/isc/unix/socket.c +++ b/usr.bin/dig/lib/isc/unix/socket.c @@ -265,8 +265,6 @@ isc__socketmgr_create(isc_socketmgr_t **managerp); isc_result_t isc__socketmgr_create2(isc_socketmgr_t **managerp, unsigned int maxsocks); -isc_result_t -isc_socketmgr_getmaxsockets(isc_socketmgr_t *manager0, unsigned int *nsockp); void isc__socketmgr_destroy(isc_socketmgr_t **managerp); |
