}
}
-template<typename T> bool rfc1982LessThan(T a, T b)
+template<typename T> bool rfc1982LessThan(T lhs, T rhs)
{
static_assert(std::is_unsigned_v<T>, "rfc1982LessThan only works for unsigned types");
- return std::make_signed_t<T>(a - b) < 0;
+ return static_cast<std::make_signed_t<T>>(lhs - rhs) < 0;
+}
+
+template<typename T> bool rfc1982LessThanOrEqual(T lhs, T rhs)
+{
+ static_assert(std::is_unsigned_v<T>, "rfc1982LessThanOrEqual only works for unsigned types");
+ return static_cast<std::make_signed_t<T>>(lhs - rhs) <= 0;
}
// fills container with ranges, so {posbegin,posend}
bool isRRSIGNotExpired(const time_t now, const RRSIGRecordContent& sig)
{
- return rfc1982LessThan<uint32_t>(now, sig.d_sigexpire);
+ return rfc1982LessThanOrEqual<uint32_t>(now, sig.d_sigexpire);
}
bool isRRSIGIncepted(const time_t now, const RRSIGRecordContent& sig)
{
- return rfc1982LessThan<uint32_t>(sig.d_siginception - g_signatureInceptionSkew, now);
+ return rfc1982LessThanOrEqual<uint32_t>(sig.d_siginception - g_signatureInceptionSkew, now);
}
namespace {