When fuzzing it is useful for all signing operations to happen
at a specific time for reproducability. Add two variables to
the message structure (fuzzing and fuzztime) to specify if a
fixed time should be used and the value of that time.
(cherry picked from commit
3e85d8c3d69d62ee585a5544c1454b452cab917e)
sig.labels = 0; /* the root name */
sig.originalttl = 0;
- isc_stdtime_get(&now);
+ if (msg->fuzzing) {
+ now = msg->fuzztime;
+ } else {
+ isc_stdtime_get(&now);
+ }
sig.timesigned = now - DNS_TSIG_FUDGE;
sig.timeexpire = now + DNS_TSIG_FUDGE;
goto failure;
}
- isc_stdtime_get(&now);
+ if (msg->fuzzing) {
+ now = msg->fuzztime;
+ } else {
+ isc_stdtime_get(&now);
+ }
+
if (isc_serial_lt((uint32_t)now, sig.timesigned)) {
result = DNS_R_SIGFUTURE;
msg->sig0status = dns_tsigerror_badtime;
unsigned int cc_bad : 1;
unsigned int tkey : 1;
unsigned int rdclass_set : 1;
+ unsigned int fuzzing : 1;
unsigned int opt_reserved;
unsigned int sig_reserved;
isc_region_t query;
isc_region_t saved;
+ /*
+ * Time to be used when fuzzing.
+ */
+ isc_stdtime_t fuzztime;
+
dns_rdatasetorderfunc_t order;
dns_sortlist_arg_t order_arg;
dns_name_init(&tsig.algorithm, NULL);
dns_name_clone(key->algorithm, &tsig.algorithm);
- isc_stdtime_get(&now);
+ if (msg->fuzzing) {
+ now = msg->fuzztime;
+ } else {
+ isc_stdtime_get(&now);
+ }
+
tsig.timesigned = now + msg->timeadjust;
tsig.fudge = DNS_TSIG_FUDGE;
/*
* Get the current time.
*/
- isc_stdtime_get(&now);
+ if (msg->fuzzing) {
+ now = msg->fuzztime;
+ } else {
+ isc_stdtime_get(&now);
+ }
/*
* Find dns_tsigkey_t based on keyname.
/*
* Is the time ok?
*/
- isc_stdtime_get(&now);
+ if (msg->fuzzing) {
+ now = msg->fuzztime;
+ } else {
+ isc_stdtime_get(&now);
+ }
if (now + msg->timeadjust > tsig.timesigned + tsig.fudge) {
msg->tsigstatus = dns_tsigerror_badtime;