Coverage Report

Created: 2026-01-24 06:24

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/bind9/lib/dns/rdata/generic/cdnskey_60.c
Line
Count
Source
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
/* draft-ietf-dnsop-delegation-trust-maintainance-14 */
15
16
#ifndef RDATA_GENERIC_CDNSKEY_60_C
17
#define RDATA_GENERIC_CDNSKEY_60_C
18
19
#include <dst/dst.h>
20
21
14.2k
#define RRTYPE_CDNSKEY_ATTRIBUTES 0
22
23
static isc_result_t
24
647
fromtext_cdnskey(ARGS_FROMTEXT) {
25
647
  REQUIRE(type == dns_rdatatype_cdnskey);
26
27
647
  return generic_fromtext_key(CALL_FROMTEXT);
28
647
}
29
30
static isc_result_t
31
1.00k
totext_cdnskey(ARGS_TOTEXT) {
32
1.00k
  REQUIRE(rdata != NULL);
33
1.00k
  REQUIRE(rdata->type == dns_rdatatype_cdnskey);
34
35
1.00k
  return generic_totext_key(CALL_TOTEXT);
36
1.00k
}
37
38
static isc_result_t
39
3.31k
fromwire_cdnskey(ARGS_FROMWIRE) {
40
3.31k
  REQUIRE(type == dns_rdatatype_cdnskey);
41
42
3.31k
  return generic_fromwire_key(CALL_FROMWIRE);
43
3.31k
}
44
45
static isc_result_t
46
505
towire_cdnskey(ARGS_TOWIRE) {
47
505
  isc_region_t sr;
48
49
505
  REQUIRE(rdata->type == dns_rdatatype_cdnskey);
50
505
  REQUIRE(rdata->length != 0);
51
52
505
  UNUSED(cctx);
53
54
505
  dns_rdata_toregion(rdata, &sr);
55
505
  return mem_tobuffer(target, sr.base, sr.length);
56
505
}
57
58
static int
59
3.45k
compare_cdnskey(ARGS_COMPARE) {
60
3.45k
  isc_region_t r1;
61
3.45k
  isc_region_t r2;
62
63
3.45k
  REQUIRE(rdata1 != NULL);
64
3.45k
  REQUIRE(rdata2 != NULL);
65
3.45k
  REQUIRE(rdata1->type == rdata2->type);
66
3.45k
  REQUIRE(rdata1->rdclass == rdata2->rdclass);
67
3.45k
  REQUIRE(rdata1->type == dns_rdatatype_cdnskey);
68
3.45k
  REQUIRE(rdata1->length != 0);
69
3.45k
  REQUIRE(rdata2->length != 0);
70
71
3.45k
  dns_rdata_toregion(rdata1, &r1);
72
3.45k
  dns_rdata_toregion(rdata2, &r2);
73
3.45k
  return isc_region_compare(&r1, &r2);
74
3.45k
}
75
76
static isc_result_t
77
0
fromstruct_cdnskey(ARGS_FROMSTRUCT) {
78
0
  REQUIRE(type == dns_rdatatype_cdnskey);
79
80
0
  return generic_fromstruct_key(CALL_FROMSTRUCT);
81
0
}
82
83
static isc_result_t
84
0
tostruct_cdnskey(ARGS_TOSTRUCT) {
85
0
  dns_rdata_cdnskey_t *dnskey = target;
86
87
0
  REQUIRE(dnskey != NULL);
88
0
  REQUIRE(rdata != NULL);
89
0
  REQUIRE(rdata->type == dns_rdatatype_cdnskey);
90
91
0
  DNS_RDATACOMMON_INIT(dnskey, rdata->type, rdata->rdclass);
92
93
0
  return generic_tostruct_key(CALL_TOSTRUCT);
94
0
}
95
96
static void
97
0
freestruct_cdnskey(ARGS_FREESTRUCT) {
98
0
  dns_rdata_cdnskey_t *dnskey = (dns_rdata_cdnskey_t *)source;
99
100
0
  REQUIRE(dnskey != NULL);
101
0
  REQUIRE(dnskey->common.rdtype == dns_rdatatype_cdnskey);
102
103
0
  generic_freestruct_key(source);
104
0
}
105
106
static isc_result_t
107
0
additionaldata_cdnskey(ARGS_ADDLDATA) {
108
0
  REQUIRE(rdata->type == dns_rdatatype_cdnskey);
109
110
0
  UNUSED(rdata);
111
0
  UNUSED(owner);
112
0
  UNUSED(add);
113
0
  UNUSED(arg);
114
115
0
  return ISC_R_SUCCESS;
116
0
}
117
118
static isc_result_t
119
0
digest_cdnskey(ARGS_DIGEST) {
120
0
  isc_region_t r;
121
122
0
  REQUIRE(rdata != NULL);
123
0
  REQUIRE(rdata->type == dns_rdatatype_cdnskey);
124
125
0
  dns_rdata_toregion(rdata, &r);
126
127
0
  return (digest)(arg, &r);
128
0
}
129
130
static bool
131
0
checkowner_cdnskey(ARGS_CHECKOWNER) {
132
0
  REQUIRE(type == dns_rdatatype_cdnskey);
133
134
0
  UNUSED(name);
135
0
  UNUSED(type);
136
0
  UNUSED(rdclass);
137
0
  UNUSED(wildcard);
138
139
0
  return true;
140
0
}
141
142
static bool
143
0
checknames_cdnskey(ARGS_CHECKNAMES) {
144
0
  REQUIRE(rdata != NULL);
145
0
  REQUIRE(rdata->type == dns_rdatatype_cdnskey);
146
147
0
  UNUSED(rdata);
148
0
  UNUSED(owner);
149
0
  UNUSED(bad);
150
151
0
  return true;
152
0
}
153
154
static int
155
0
casecompare_cdnskey(ARGS_COMPARE) {
156
  /*
157
   * Treat ALG 253 (private DNS) subtype name case sensitively.
158
   */
159
0
  return compare_cdnskey(rdata1, rdata2);
160
0
}
161
162
#endif /* RDATA_GENERIC_CDNSKEY_60_C */