cleanup: use dns_secalg_t and dns_dsdigest_t where appropriate
Use them in structs for various rdata types where they are missing.
This doesn't change the structs since we are replacing explicit
uint8_t field types with aliases for uint8_t.
Use dns_dsdigest_t in library function arguments.
(cherry picked from commit 0f219714e1)
This commit is contained in:
4
CHANGES
4
CHANGES
@@ -1,3 +1,7 @@
|
||||
5179. [cleanup] Replace some vague type declarations with the more
|
||||
specific dns_secalg_t and dns_dsdigest_t.
|
||||
Thanks to Tony Finch. [GL !1498]
|
||||
|
||||
5178. [bug] Handle EDQUOT (disk quota) and ENOSPC (disk full)
|
||||
errors when writing files. [GL #902]
|
||||
|
||||
|
||||
@@ -236,7 +236,7 @@ logkey(dns_rdata_t *rdata)
|
||||
}
|
||||
|
||||
static void
|
||||
emit(unsigned int dtype, bool showall, char *lookaside,
|
||||
emit(dns_dsdigest_t dtype, bool showall, char *lookaside,
|
||||
bool cds, dns_rdata_t *rdata)
|
||||
{
|
||||
isc_result_t result;
|
||||
@@ -351,7 +351,7 @@ main(int argc, char **argv) {
|
||||
char *lookaside = NULL;
|
||||
char *endp;
|
||||
int ch;
|
||||
unsigned int dtype = DNS_DSDIGEST_SHA1;
|
||||
dns_dsdigest_t dtype = DNS_DSDIGEST_SHA1;
|
||||
bool cds = false;
|
||||
bool both = true;
|
||||
bool usekeyset = false;
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
|
||||
isc_result_t
|
||||
dns_ds_buildrdata(dns_name_t *owner, dns_rdata_t *key,
|
||||
unsigned int digest_type, unsigned char *buffer,
|
||||
dns_dsdigest_t digest_type, unsigned char *buffer,
|
||||
dns_rdata_t *rdata)
|
||||
{
|
||||
dns_fixedname_t fname;
|
||||
@@ -107,7 +107,6 @@ dns_ds_buildrdata(dns_name_t *owner, dns_rdata_t *key,
|
||||
break;
|
||||
|
||||
case DNS_DSDIGEST_SHA256:
|
||||
default:
|
||||
isc_sha256_init(&sha256);
|
||||
dns_name_toregion(name, &r);
|
||||
isc_sha256_update(&sha256, r.base, r.length);
|
||||
@@ -116,6 +115,10 @@ dns_ds_buildrdata(dns_name_t *owner, dns_rdata_t *key,
|
||||
isc_sha256_update(&sha256, r.base, r.length);
|
||||
isc_sha256_final(digest, &sha256);
|
||||
break;
|
||||
|
||||
default:
|
||||
INSIST(0);
|
||||
ISC_UNREACHABLE();
|
||||
}
|
||||
|
||||
ds.mctx = NULL;
|
||||
|
||||
@@ -31,7 +31,7 @@ ISC_LANG_BEGINDECLS
|
||||
|
||||
isc_result_t
|
||||
dns_ds_buildrdata(dns_name_t *owner, dns_rdata_t *key,
|
||||
unsigned int digest_type, unsigned char *buffer,
|
||||
dns_dsdigest_t digest_type, unsigned char *buffer,
|
||||
dns_rdata_t *rdata);
|
||||
/*%<
|
||||
* Build the rdata of a DS record.
|
||||
|
||||
@@ -19,8 +19,8 @@ typedef struct dns_rdata_ds {
|
||||
dns_rdatacommon_t common;
|
||||
isc_mem_t *mctx;
|
||||
uint16_t key_tag;
|
||||
uint8_t algorithm;
|
||||
uint8_t digest_type;
|
||||
dns_secalg_t algorithm;
|
||||
dns_dsdigest_t digest_type;
|
||||
uint16_t length;
|
||||
unsigned char *digest;
|
||||
} dns_rdata_ds_t;
|
||||
|
||||
@@ -20,8 +20,8 @@ typedef struct dns_rdata_key {
|
||||
dns_rdatacommon_t common;
|
||||
isc_mem_t * mctx;
|
||||
uint16_t flags;
|
||||
uint8_t protocol;
|
||||
uint8_t algorithm;
|
||||
dns_secproto_t protocol;
|
||||
dns_secalg_t algorithm;
|
||||
uint16_t datalen;
|
||||
unsigned char * data;
|
||||
} dns_rdata_key_t;
|
||||
|
||||
@@ -20,8 +20,8 @@ typedef struct dns_rdata_keydata {
|
||||
uint32_t addhd; /* Hold-down timer for adding */
|
||||
uint32_t removehd; /* Hold-down timer for removing */
|
||||
uint16_t flags; /* Copy of DNSKEY_48 */
|
||||
uint8_t protocol;
|
||||
uint8_t algorithm;
|
||||
dns_secproto_t protocol;
|
||||
dns_secalg_t algorithm;
|
||||
uint16_t datalen;
|
||||
unsigned char * data;
|
||||
} dns_rdata_keydata_t;
|
||||
|
||||
@@ -1757,7 +1757,7 @@ checkkey(dns_validator_t *val, dns_rdata_t *keyrdata, uint16_t keyid,
|
||||
*/
|
||||
static isc_result_t
|
||||
keyfromds(dns_validator_t *val, dns_rdataset_t *rdataset, dns_rdata_t *dsrdata,
|
||||
uint8_t digest, uint16_t keyid, dns_secalg_t algorithm,
|
||||
dns_dsdigest_t digest, uint16_t keyid, dns_secalg_t algorithm,
|
||||
dns_rdata_t *keyrdata)
|
||||
{
|
||||
dns_keytag_t keytag;
|
||||
|
||||
Reference in New Issue
Block a user