It seems simpler, now that we have kr_rnd_buffered().
int kr_pkt_clear_payload(knot_pkt_t *);
uint16_t kr_pkt_qclass(const knot_pkt_t *);
uint16_t kr_pkt_qtype(const knot_pkt_t *);
-uint64_t kr_rand_bytes_nonstatic(int);
+void kr_rnd_buffered(void *, unsigned int);
uint32_t kr_rrsig_sig_inception(const knot_rdata_t *);
uint32_t kr_rrsig_sig_expiration(const knot_rdata_t *);
uint16_t kr_rrsig_type_covered(const knot_rdata_t *);
kr_pkt_clear_payload
kr_pkt_qclass
kr_pkt_qtype
- kr_rand_bytes_nonstatic
+ kr_rnd_buffered
kr_rrsig_sig_inception
kr_rrsig_sig_expiration
kr_rrsig_type_covered
error(string.format('failed to allocate a packet of size %d', size))
end
if wire == nil then
- pkt:id(tonumber(C.kr_rand_bytes_nonstatic(2)))
+ C.kr_rnd_buffered(pkt.wire, 2) -- randomize the query ID
else
assert(size <= #wire)
ffi.copy(pkt.wire, wire, size)
{
return knot_rrsig_type_covered(rdata);
}
-uint64_t kr_rand_bytes_nonstatic(int size)
-{
- return kr_rand_bytes(size);
-}
}
return result;
}
-/** non-static variant of kr_rand_bytes() */
-KR_EXPORT uint64_t kr_rand_bytes_nonstatic(int size);
/** Throw a pseudo-random coin, succeeding approximately with probability nomin/denomin.
* - low precision, only one byte of randomness