diff options
author | Florian Weimer <fweimer@redhat.com> | 2016-09-21 16:08:31 +0200 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2016-09-21 16:08:32 +0200 |
commit | 3a2a1d2cc2e3c9fad9d93eaecf5874f04a679606 (patch) | |
tree | a5d700bf65bcd3af1430ec6dac11a1f605ef3ac0 /resolv/ns_print.c | |
parent | f4a36548d86453792e3db05898f6f2b732c32581 (diff) | |
download | glibc-3a2a1d2cc2e3c9fad9d93eaecf5874f04a679606.zip glibc-3a2a1d2cc2e3c9fad9d93eaecf5874f04a679606.tar.gz glibc-3a2a1d2cc2e3c9fad9d93eaecf5874f04a679606.tar.bz2 |
Remove obsolete DNSSEC support [BZ #20591]
The removed function declaration have never been implemented in libresolv.
Diffstat (limited to 'resolv/ns_print.c')
-rw-r--r-- | resolv/ns_print.c | 198 |
1 files changed, 0 insertions, 198 deletions
diff --git a/resolv/ns_print.c b/resolv/ns_print.c index 7a0e7d5..f55680c 100644 --- a/resolv/ns_print.c +++ b/resolv/ns_print.c @@ -47,8 +47,6 @@ static int addstr(const char *src, size_t len, static int addtab(size_t len, size_t target, int spaced, char **buf, size_t *buflen); -static u_int16_t dst_s_dns_key_id(const u_char *, const int); - /* Macros. */ #define T(x) \ @@ -436,124 +434,6 @@ ns_sprintrrf(const u_char *msg, size_t msglen, break; } - case ns_t_key: { - char base64_key[NS_MD5RSA_MAX_BASE64]; - u_int keyflags, protocol, algorithm, key_id; - const char *leader; - int n; - - if (rdlen < 0U + NS_INT16SZ + NS_INT8SZ + NS_INT8SZ) - goto formerr; - - /* Key flags, Protocol, Algorithm. */ - key_id = dst_s_dns_key_id(rdata, edata-rdata); - keyflags = ns_get16(rdata); rdata += NS_INT16SZ; - protocol = *rdata++; - algorithm = *rdata++; - len = SPRINTF((tmp, "0x%04x %u %u", - keyflags, protocol, algorithm)); - T(addstr(tmp, len, &buf, &buflen)); - - /* Public key data. */ - len = b64_ntop(rdata, edata - rdata, - base64_key, sizeof base64_key); - if (len < 0) - goto formerr; - if (len > 15) { - T(addstr(" (", 2, &buf, &buflen)); - leader = "\n\t\t"; - spaced = 0; - } else - leader = " "; - for (n = 0; n < len; n += 48) { - T(addstr(leader, strlen(leader), &buf, &buflen)); - T(addstr(base64_key + n, MIN(len - n, 48), - &buf, &buflen)); - } - if (len > 15) - T(addstr(" )", 2, &buf, &buflen)); - n = SPRINTF((tmp, " ; key_tag= %u", key_id)); - T(addstr(tmp, n, &buf, &buflen)); - - break; - } - - case ns_t_sig: { - char base64_key[NS_MD5RSA_MAX_BASE64]; - u_int type, algorithm, labels, footprint; - const char *leader; - u_long t; - int n; - - if (rdlen < 22U) - goto formerr; - - /* Type covered, Algorithm, Label count, Original TTL. */ - type = ns_get16(rdata); rdata += NS_INT16SZ; - algorithm = *rdata++; - labels = *rdata++; - t = ns_get32(rdata); rdata += NS_INT32SZ; - len = SPRINTF((tmp, "%s %d %d %lu ", - p_type(type), algorithm, labels, t)); - T(addstr(tmp, len, &buf, &buflen)); - if (labels > (u_int)dn_count_labels(name)) - goto formerr; - - /* Signature expiry. */ - t = ns_get32(rdata); rdata += NS_INT32SZ; - len = SPRINTF((tmp, "%s ", p_secstodate(t))); - T(addstr(tmp, len, &buf, &buflen)); - - /* Time signed. */ - t = ns_get32(rdata); rdata += NS_INT32SZ; - len = SPRINTF((tmp, "%s ", p_secstodate(t))); - T(addstr(tmp, len, &buf, &buflen)); - - /* Signature Footprint. */ - footprint = ns_get16(rdata); rdata += NS_INT16SZ; - len = SPRINTF((tmp, "%u ", footprint)); - T(addstr(tmp, len, &buf, &buflen)); - - /* Signer's name. */ - T(addname(msg, msglen, &rdata, origin, &buf, &buflen)); - - /* Signature. */ - len = b64_ntop(rdata, edata - rdata, - base64_key, sizeof base64_key); - if (len > 15) { - T(addstr(" (", 2, &buf, &buflen)); - leader = "\n\t\t"; - spaced = 0; - } else - leader = " "; - if (len < 0) - goto formerr; - for (n = 0; n < len; n += 48) { - T(addstr(leader, strlen(leader), &buf, &buflen)); - T(addstr(base64_key + n, MIN(len - n, 48), - &buf, &buflen)); - } - if (len > 15) - T(addstr(" )", 2, &buf, &buflen)); - break; - } - - case ns_t_nxt: { - int n, c; - - /* Next domain name. */ - T(addname(msg, msglen, &rdata, origin, &buf, &buflen)); - - /* Type bit map. */ - n = edata - rdata; - for (c = 0; c < n*8; c++) - if (NS_NXT_BIT_ISSET(c, rdata)) { - len = SPRINTF((tmp, " %s", p_type(c))); - T(addstr(tmp, len, &buf, &buflen)); - } - break; - } - case ns_t_cert: { u_int c_type, key_tag, alg; int n; @@ -887,81 +767,3 @@ addtab(size_t len, size_t target, int spaced, char **buf, size_t *buflen) { } return (spaced); } - -/* DST algorithm codes */ -#define KEY_RSA 1 -#define KEY_HMAC_MD5 157 - -/*% - * calculates a checksum used in dst for an id. - * takes an array of bytes and a length. - * returns a 16 bit checksum. - */ -static u_int16_t -dst_s_id_calc(const u_char *key, const int keysize) -{ - u_int32_t ac; - const u_char *kp = key; - int size = keysize; - - if (!key || (keysize <= 0)) - return (0xffffU); - - 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 (ac & 0xffff); -} - -/*% - * dst_s_get_int16 - * This routine extracts a 16 bit integer from a two byte character - * string. The character string is assumed to be in network byte - * order and may be unaligned. The number returned is in host order. - * Parameter - * buf A two byte character string. - * Return - * The converted integer value. - */ - -static u_int16_t -dst_s_get_int16(const u_char *buf) -{ - u_int16_t a = 0; - a = ((u_int16_t)(buf[0] << 8)) | ((u_int16_t)(buf[1])); - return (a); -} - -/*% - * dst_s_dns_key_id() Function to calculate DNSSEC footprint from KEY record - * rdata - * Input: - * dns_key_rdata: the raw data in wire format - * rdata_len: the size of the input data - * Output: - * the key footprint/id calculated from the key data - */ -static u_int16_t -dst_s_dns_key_id(const u_char *dns_key_rdata, const int rdata_len) -{ - if (!dns_key_rdata) - return 0; - - /* compute id */ - if (dns_key_rdata[3] == KEY_RSA) /*%< Algorithm RSA */ - return dst_s_get_int16((const u_char *) - &dns_key_rdata[rdata_len - 3]); - else if (dns_key_rdata[3] == KEY_HMAC_MD5) - /* compatibility */ - return 0; - else - /* compute a checksum on the key part of the key rr */ - return dst_s_id_calc(dns_key_rdata, rdata_len); -} - - -/*! \file */ |