Merging upstream version 0.7.1 (Closes: #991419).

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-09 07:39:31 +01:00
parent 05c588e9d7
commit 9e09e0ef69
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
99 changed files with 6727 additions and 943 deletions

View file

@ -0,0 +1,41 @@
#include <assert.h>
#include "../../../src/ck_ec_timeutil.h"
#include "fuzz_harness.h"
struct example {
uint32_t nsec;
uint32_t multiplier;
unsigned int shift;
};
static const struct example examples[] = {
{
UINT32_MAX,
UINT32_MAX,
1
},
{
10,
20,
0
}
};
static inline int test_wait_time_scale(const struct example *example)
{
const uint32_t nsec = example->nsec;
const uint32_t multiplier = example->multiplier;
const unsigned int shift = example->shift % 32;
uint32_t actual = wait_time_scale(nsec, multiplier, shift);
uint64_t expected = ((uint64_t)nsec * multiplier) >> shift;
if (expected > UINT32_MAX) {
expected = UINT32_MAX;
}
assert(actual == expected);
return 0;
}
TEST(test_wait_time_scale, examples)