+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]
* List of digest types used by ds_from_cdnskey(), filled in by add_dtype()
* from -a arguments. The size of the array is an arbitrary limit.
*/
-static uint8_t dtype[8];
+static dns_dsdigest_t dtype[8];
static const char *startstr = NULL; /* from which we derive notbefore */
static isc_stdtime_t notbefore = 0; /* restrict sig inception times */
typedef struct keyinfo {
dns_rdata_t rdata;
dst_key_t *dst;
- uint8_t algo;
+ dns_secalg_t algo;
dns_keytag_t tag;
} keyinfo_t;
* otherwise the key algorithm. This is used by the signature coverage
* check functions below.
*/
-static uint8_t *
+static dns_secalg_t *
matching_sigs(keyinfo_t *keytbl, dns_rdataset_t *rdataset,
dns_rdataset_t *sigset)
{
isc_result_t result;
- uint8_t *algo;
+ dns_secalg_t *algo;
int i;
algo = isc_mem_get(mctx, nkey);
* fetched from the child zone, any working signature is enough.
*/
static bool
-signed_loose(uint8_t *algo) {
+signed_loose(dns_secalg_t *algo) {
bool ok = false;
int i;
for (i = 0; i < nkey; i++) {
* RRset.
*/
static bool
-signed_strict(dns_rdataset_t *dsset, uint8_t *algo) {
+signed_strict(dns_rdataset_t *dsset, dns_secalg_t *algo) {
isc_result_t result;
bool all_ok = true;
*/
static int
cmp_dtype(const void *ap, const void *bp) {
- int a = *(const uint8_t *)ap;
- int b = *(const uint8_t *)bp;
+ int a = *(const dns_dsdigest_t *)ap;
+ int b = *(const dns_dsdigest_t *)bp;
return (a - b);
}
static void
add_dtype(const char *dn) {
- uint8_t dt;
+ dns_dsdigest_t dt;
unsigned i, n;
dt = strtodsdigest(dn);
dns_rdata_t *arrdata;
dns_rdata_ds_t *ds;
dns_keytag_t key_tag;
- uint8_t algorithm;
+ dns_secalg_t algorithm;
bool match;
int i, j, n, d;
}
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;
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;
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;
return (ISC_R_NOTIMPLEMENTED);
}
- name = dns_fixedname_initname(&fname);
- (void)dns_name_downcase(owner, name, NULL);
-
- memset(buffer, 0, DNS_DS_BUFFERSIZE);
- isc_buffer_init(&b, buffer, DNS_DS_BUFFERSIZE);
-
- md = isc_md_new();
- if (md == NULL) {
- return (ISC_R_NOMEMORY);
- }
-
switch (digest_type) {
case DNS_DSDIGEST_SHA1:
md_type = ISC_MD_SHA1;
break;
case DNS_DSDIGEST_SHA256:
- default:
md_type = ISC_MD_SHA256;
break;
+
+ default:
+ INSIST(0);
+ ISC_UNREACHABLE();
+ }
+
+ name = dns_fixedname_initname(&fname);
+ (void)dns_name_downcase(owner, name, NULL);
+
+ memset(buffer, 0, DNS_DS_BUFFERSIZE);
+ isc_buffer_init(&b, buffer, DNS_DS_BUFFERSIZE);
+
+ md = isc_md_new();
+ if (md == NULL) {
+ return (ISC_R_NOMEMORY);
}
ret = isc_md_init(md, md_type);
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.
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;
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;
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;
*/
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;