Coverage Report

Created: 2025-07-18 07:03

/src/bind9/lib/dns/rdata/generic/rkey_57.c
Line
Count
Source (jump to first uncovered line)
1
/*
2
 * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
3
 *
4
 * SPDX-License-Identifier: MPL-2.0
5
 *
6
 * This Source Code Form is subject to the terms of the Mozilla Public
7
 * License, v. 2.0. If a copy of the MPL was not distributed with this
8
 * file, you can obtain one at https://mozilla.org/MPL/2.0/.
9
 *
10
 * See the COPYRIGHT file distributed with this work for additional
11
 * information regarding copyright ownership.
12
 */
13
14
#ifndef RDATA_GENERIC_RKEY_57_C
15
#define RDATA_GENERIC_RKEY_57_C
16
17
9.59k
#define RRTYPE_RKEY_ATTRIBUTES 0
18
19
static isc_result_t
20
56
fromtext_rkey(ARGS_FROMTEXT) {
21
56
  REQUIRE(type == dns_rdatatype_rkey);
22
23
56
  return generic_fromtext_key(CALL_FROMTEXT);
24
56
}
25
26
static isc_result_t
27
1.06k
totext_rkey(ARGS_TOTEXT) {
28
1.06k
  REQUIRE(rdata != NULL);
29
1.06k
  REQUIRE(rdata->type == dns_rdatatype_rkey);
30
31
1.06k
  return generic_totext_key(CALL_TOTEXT);
32
1.06k
}
33
34
static isc_result_t
35
1.12k
fromwire_rkey(ARGS_FROMWIRE) {
36
1.12k
  REQUIRE(type == dns_rdatatype_rkey);
37
38
1.12k
  return generic_fromwire_key(CALL_FROMWIRE);
39
1.12k
}
40
41
static isc_result_t
42
542
towire_rkey(ARGS_TOWIRE) {
43
542
  isc_region_t sr;
44
45
542
  REQUIRE(rdata != NULL);
46
542
  REQUIRE(rdata->type == dns_rdatatype_rkey);
47
542
  REQUIRE(rdata->length != 0);
48
49
542
  UNUSED(cctx);
50
51
542
  dns_rdata_toregion(rdata, &sr);
52
542
  return mem_tobuffer(target, sr.base, sr.length);
53
542
}
54
55
static int
56
0
compare_rkey(ARGS_COMPARE) {
57
0
  isc_region_t r1;
58
0
  isc_region_t r2;
59
60
0
  REQUIRE(rdata1 != NULL);
61
0
  REQUIRE(rdata2 != NULL);
62
0
  REQUIRE(rdata1->type == rdata2->type);
63
0
  REQUIRE(rdata1->rdclass == rdata2->rdclass);
64
0
  REQUIRE(rdata1->type == dns_rdatatype_rkey);
65
0
  REQUIRE(rdata1->length != 0);
66
0
  REQUIRE(rdata2->length != 0);
67
68
0
  dns_rdata_toregion(rdata1, &r1);
69
0
  dns_rdata_toregion(rdata2, &r2);
70
0
  return isc_region_compare(&r1, &r2);
71
0
}
72
73
static isc_result_t
74
0
fromstruct_rkey(ARGS_FROMSTRUCT) {
75
0
  REQUIRE(type == dns_rdatatype_rkey);
76
77
0
  return generic_fromstruct_key(CALL_FROMSTRUCT);
78
0
}
79
80
static isc_result_t
81
0
tostruct_rkey(ARGS_TOSTRUCT) {
82
0
  dns_rdata_rkey_t *rkey = target;
83
84
0
  REQUIRE(rkey != NULL);
85
0
  REQUIRE(rdata != NULL);
86
0
  REQUIRE(rdata->type == dns_rdatatype_rkey);
87
88
0
  rkey->common.rdclass = rdata->rdclass;
89
0
  rkey->common.rdtype = rdata->type;
90
91
0
  return generic_tostruct_key(CALL_TOSTRUCT);
92
0
}
93
94
static void
95
0
freestruct_rkey(ARGS_FREESTRUCT) {
96
0
  dns_rdata_rkey_t *rkey = (dns_rdata_rkey_t *)source;
97
98
0
  REQUIRE(rkey != NULL);
99
0
  REQUIRE(rkey->common.rdtype == dns_rdatatype_rkey);
100
101
0
  generic_freestruct_key(source);
102
0
}
103
104
static isc_result_t
105
0
additionaldata_rkey(ARGS_ADDLDATA) {
106
0
  REQUIRE(rdata->type == dns_rdatatype_rkey);
107
108
0
  UNUSED(rdata);
109
0
  UNUSED(owner);
110
0
  UNUSED(add);
111
0
  UNUSED(arg);
112
113
0
  return ISC_R_SUCCESS;
114
0
}
115
116
static isc_result_t
117
0
digest_rkey(ARGS_DIGEST) {
118
0
  isc_region_t r;
119
120
0
  REQUIRE(rdata != NULL);
121
0
  REQUIRE(rdata->type == dns_rdatatype_rkey);
122
123
0
  dns_rdata_toregion(rdata, &r);
124
125
0
  return (digest)(arg, &r);
126
0
}
127
128
static bool
129
0
checkowner_rkey(ARGS_CHECKOWNER) {
130
0
  REQUIRE(type == dns_rdatatype_rkey);
131
132
0
  UNUSED(name);
133
0
  UNUSED(type);
134
0
  UNUSED(rdclass);
135
0
  UNUSED(wildcard);
136
137
0
  return true;
138
0
}
139
140
static bool
141
0
checknames_rkey(ARGS_CHECKNAMES) {
142
0
  REQUIRE(rdata != NULL);
143
0
  REQUIRE(rdata->type == dns_rdatatype_rkey);
144
145
0
  UNUSED(rdata);
146
0
  UNUSED(owner);
147
0
  UNUSED(bad);
148
149
0
  return true;
150
0
}
151
152
static int
153
0
casecompare_rkey(ARGS_COMPARE) {
154
  /*
155
   * Treat ALG 253 (private DNS) subtype name case sensitively.
156
   */
157
0
  return compare_rkey(rdata1, rdata2);
158
0
}
159
160
#endif /* RDATA_GENERIC_RKEY_57_C */