diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2020-02-23 23:40:23 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2020-02-23 23:40:23 +0000 |
commit | d04228a4082bf60aa378cfebb4ef5dfa49cd18c2 (patch) | |
tree | b62943d69d98931969fb0e1027166cdfe099d576 /usr.bin/dig | |
parent | 6294b1dcc8c7653ebe12251b7bcac4a384c388d9 (diff) |
remove some unused functions
ok jung@
Diffstat (limited to 'usr.bin/dig')
-rw-r--r-- | usr.bin/dig/lib/dns/include/dst/dst.h | 4 | ||||
-rw-r--r-- | usr.bin/dig/lib/dns/key.c | 31 | ||||
-rw-r--r-- | usr.bin/dig/lib/isc/base64.c | 32 | ||||
-rw-r--r-- | usr.bin/dig/lib/isc/include/isc/base64.h | 20 | ||||
-rw-r--r-- | usr.bin/dig/lib/isc/include/isc/lex.h | 21 | ||||
-rw-r--r-- | usr.bin/dig/lib/isc/lex.c | 38 |
6 files changed, 6 insertions, 140 deletions
diff --git a/usr.bin/dig/lib/dns/include/dst/dst.h b/usr.bin/dig/lib/dns/include/dst/dst.h index a9ba221dbe5..9d7c9bb985d 100644 --- a/usr.bin/dig/lib/dns/include/dst/dst.h +++ b/usr.bin/dig/lib/dns/include/dst/dst.h @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dst.h,v 1.9 2020/02/23 08:54:01 florian Exp $ */ +/* $Id: dst.h,v 1.10 2020/02/23 23:40:21 jsg Exp $ */ #ifndef DST_DST_H #define DST_DST_H 1 @@ -303,8 +303,6 @@ dst_key_sigsize(const dst_key_t *key, unsigned int *n); uint16_t dst_region_computeid(const isc_region_t *source, unsigned int alg); -uint16_t -dst_region_computerid(const isc_region_t *source, unsigned int alg); /*%< * Computes the (revoked) key id of the key stored in the provided * region with the given algorithm. diff --git a/usr.bin/dig/lib/dns/key.c b/usr.bin/dig/lib/dns/key.c index 485d53da7dd..d3211b01888 100644 --- a/usr.bin/dig/lib/dns/key.c +++ b/usr.bin/dig/lib/dns/key.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: key.c,v 1.6 2020/02/22 19:47:06 jung Exp $ */ +/* $Id: key.c,v 1.7 2020/02/23 23:40:21 jsg Exp $ */ @@ -24,8 +24,6 @@ #include <isc/region.h> #include <isc/util.h> -#include <dns/keyvalues.h> - #include <dst/dst.h> #include "dst_internal.h" @@ -55,33 +53,6 @@ dst_region_computeid(const isc_region_t *source, unsigned int alg) { return ((uint16_t)(ac & 0xffff)); } -uint16_t -dst_region_computerid(const isc_region_t *source, unsigned int alg) { - 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 ((uint16_t)(ac & 0xffff)); -} - unsigned int dst_key_size(const dst_key_t *key) { return (key->key_size); diff --git a/usr.bin/dig/lib/isc/base64.c b/usr.bin/dig/lib/isc/base64.c index c8d1d4c22b2..cb5d8f29fb3 100644 --- a/usr.bin/dig/lib/isc/base64.c +++ b/usr.bin/dig/lib/isc/base64.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: base64.c,v 1.1 2020/02/07 09:58:53 florian Exp $ */ +/* $Id: base64.c,v 1.2 2020/02/23 23:40:22 jsg Exp $ */ /*! \file */ @@ -176,36 +176,6 @@ base64_decode_finish(base64_decode_ctx_t *ctx) { } isc_result_t -isc_base64_tobuffer(isc_lex_t *lexer, isc_buffer_t *target, int length) { - base64_decode_ctx_t ctx; - isc_textregion_t *tr; - isc_token_t token; - isc_boolean_t eol; - - base64_decode_init(&ctx, length, target); - - while (!ctx.seen_end && (ctx.length != 0)) { - unsigned int i; - - if (length > 0) - eol = ISC_FALSE; - else - eol = ISC_TRUE; - RETERR(isc_lex_getmastertoken(lexer, &token, - isc_tokentype_string, eol)); - if (token.type != isc_tokentype_string) - break; - tr = &token.value.as_textregion; - for (i = 0; i < tr->length; i++) - RETERR(base64_decode_char(&ctx, tr->base[i])); - } - if (ctx.length < 0 && !ctx.seen_end) - isc_lex_ungettoken(lexer, &token); - RETERR(base64_decode_finish(&ctx)); - return (ISC_R_SUCCESS); -} - -isc_result_t isc_base64_decodestring(const char *cstr, isc_buffer_t *target) { base64_decode_ctx_t ctx; diff --git a/usr.bin/dig/lib/isc/include/isc/base64.h b/usr.bin/dig/lib/isc/include/isc/base64.h index 956c10b8705..c4413912948 100644 --- a/usr.bin/dig/lib/isc/include/isc/base64.h +++ b/usr.bin/dig/lib/isc/include/isc/base64.h @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: base64.h,v 1.3 2020/02/13 13:53:01 jsg Exp $ */ +/* $Id: base64.h,v 1.4 2020/02/23 23:40:22 jsg Exp $ */ #ifndef ISC_BASE64_H #define ISC_BASE64_H 1 @@ -67,24 +67,6 @@ isc_base64_decodestring(const char *cstr, isc_buffer_t *target); * * Other error returns are any possible error code from: *\li isc_lex_create(), - *\li isc_base64_tobuffer(). - */ - -isc_result_t -isc_base64_tobuffer(isc_lex_t *lexer, isc_buffer_t *target, int length); -/*!< - * \brief Convert base64 encoded text from a lexer context into data. - * - * Requires: - *\li 'lex' is a valid lexer context - *\li 'target' is a buffer containing binary data - *\li 'length' is an integer - * - * Ensures: - *\li target will contain the data represented by the base64 encoded - * string parsed by the lexer. No more than length bytes will be read, - * if length is positive. The 'used' pointer in target will be - * advanced as necessary. */ #endif /* ISC_BASE64_H */ diff --git a/usr.bin/dig/lib/isc/include/isc/lex.h b/usr.bin/dig/lib/isc/include/isc/lex.h index 829e3c19399..6ec56bc0cea 100644 --- a/usr.bin/dig/lib/isc/include/isc/lex.h +++ b/usr.bin/dig/lib/isc/include/isc/lex.h @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: lex.h,v 1.4 2020/02/22 19:47:07 jung Exp $ */ +/* $Id: lex.h,v 1.5 2020/02/23 23:40:22 jsg Exp $ */ #ifndef ISC_LEX_H #define ISC_LEX_H 1 @@ -248,25 +248,6 @@ isc_lex_gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *tokenp); *\li #ISC_R_NOMORE No more input sources */ -isc_result_t -isc_lex_getmastertoken(isc_lex_t *lex, isc_token_t *token, - isc_tokentype_t expect, isc_boolean_t eol); -/*%< - * Get the next token from a DNS master file type stream. This is a - * convenience function that sets appropriate options and handles quoted - * strings and end of line correctly for master files. It also ungets - * unexpected tokens. - * - * Requires: - *\li 'lex' is a valid lexer. - * - *\li 'token' is a valid pointer - * - * Returns: - * - * \li any return code from isc_lex_gettoken(). - */ - void isc_lex_ungettoken(isc_lex_t *lex, isc_token_t *tokenp); /*%< diff --git a/usr.bin/dig/lib/isc/lex.c b/usr.bin/dig/lib/isc/lex.c index 3d4e62bf521..d9d3baa6bc3 100644 --- a/usr.bin/dig/lib/isc/lex.c +++ b/usr.bin/dig/lib/isc/lex.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: lex.c,v 1.6 2020/02/22 19:47:06 jung Exp $ */ +/* $Id: lex.c,v 1.7 2020/02/23 23:40:22 jsg Exp $ */ /*! \file */ @@ -720,42 +720,6 @@ isc_lex_gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *tokenp) { return (result); } -isc_result_t -isc_lex_getmastertoken(isc_lex_t *lex, isc_token_t *token, - isc_tokentype_t expect, isc_boolean_t eol) -{ - unsigned int options = ISC_LEXOPT_EOL | ISC_LEXOPT_EOF | - ISC_LEXOPT_DNSMULTILINE | ISC_LEXOPT_ESCAPE; - isc_result_t result; - - if (expect == isc_tokentype_qstring) - options |= ISC_LEXOPT_QSTRING; - else if (expect == isc_tokentype_number) - options |= ISC_LEXOPT_NUMBER; - result = isc_lex_gettoken(lex, options, token); - if (result == ISC_R_RANGE) - isc_lex_ungettoken(lex, token); - if (result != ISC_R_SUCCESS) - return (result); - - if (eol && ((token->type == isc_tokentype_eol) || - (token->type == isc_tokentype_eof))) - return (ISC_R_SUCCESS); - if (token->type == isc_tokentype_string && - expect == isc_tokentype_qstring) - return (ISC_R_SUCCESS); - if (token->type != expect) { - isc_lex_ungettoken(lex, token); - if (token->type == isc_tokentype_eol || - token->type == isc_tokentype_eof) - return (ISC_R_UNEXPECTEDEND); - if (expect == isc_tokentype_number) - return (ISC_R_BADNUMBER); - return (ISC_R_UNEXPECTEDTOKEN); - } - return (ISC_R_SUCCESS); -} - void isc_lex_ungettoken(isc_lex_t *lex, isc_token_t *tokenp) { inputsource *source; |