@@ -1673,16 +1673,12 @@ FIO_IFUNC void fio_u2buf24_be(void *buf, uint32_t i) {
16731673/** Converts an unaligned byte stream to a 24 bit number - local endieness. */
16741674FIO_IFUNC uint32_t fio_buf2u24u(const void *c) { return fio_buf2u24_be(c); }
16751675/** Writes a 24 bit number to an unaligned buffer - in local endieness. */
1676- FIO_IFUNC void fio_u2buf24u(void *buf, uint32_t i) {
1677- return fio_u2buf24_be(buf, i);
1678- }
1676+ FIO_IFUNC void fio_u2buf24u(void *buf, uint32_t i) { fio_u2buf24_be(buf, i); }
16791677#elif __LITTLE_ENDIAN__
16801678/** Converts an unaligned byte stream to a 24 bit number - local endieness. */
16811679FIO_IFUNC uint32_t fio_buf2u24u(const void *c) { return fio_buf2u24_le(c); }
16821680/** Writes a 24 bit number to an unaligned buffer - in local endieness. */
1683- FIO_IFUNC void fio_u2buf24u(void *buf, uint32_t i) {
1684- return fio_u2buf24_le(buf, i);
1685- }
1681+ FIO_IFUNC void fio_u2buf24u(void *buf, uint32_t i) { fio_u2buf24_le(buf, i); }
16861682#else
16871683#warning "Couldn't calculate local version for fio_buf2u24u and fio_u2buf24u"
16881684#endif
@@ -16645,7 +16641,7 @@ SFUNC int fio_poll_review(fio_poll_s *p, size_t timeout) {
1664516641 int active_count = epoll_wait(p->fds[0].fd, events, FIO_POLL_MAX_EVENTS, 0);
1664616642 if (active_count > 0) {
1664716643 /* TODO! fix error handling*/
16648- for (size_t i = 0; i < active_count; i++) {
16644+ for (unsigned i = 0; i < (unsigned) active_count; i++) {
1664916645 // errors are handled as disconnections (on_close) in the EPOLLIN queue
1665016646 // if no error, try an active event(s)
1665116647 if (events[i].events & EPOLLOUT)
@@ -16655,7 +16651,7 @@ SFUNC int fio_poll_review(fio_poll_s *p, size_t timeout) {
1665516651 }
1665616652 active_count = epoll_wait(p->fds[1].fd, events, FIO_POLL_MAX_EVENTS, 0);
1665716653 if (active_count > 0) {
16658- for (size_t i = 0; i < active_count; i++) {
16654+ for (unsigned i = 0; i < (unsigned) active_count; i++) {
1665916655 // holds an active event(s)
1666016656 if (events[i].events & EPOLLIN)
1666116657 p->settings.on_data(events[i].data.ptr);
@@ -16813,7 +16809,7 @@ SFUNC int fio_poll_review(fio_poll_s *p, size_t timeout_) {
1681316809 kevent(p->fd, NULL, 0, events, FIO_POLL_MAX_EVENTS, &timeout);
1681416810
1681516811 if (active_count > 0) {
16816- for (size_t i = 0; i < active_count; i++) {
16812+ for (unsigned i = 0; i < (unsigned) active_count; i++) {
1681716813 // test for event(s) type
1681816814 if ((events[i].filter & EVFILT_WRITE))
1681916815 p->settings.on_ready(events[i].udata);
@@ -24204,7 +24200,7 @@ Cleanup
2420424200
2420524201Copyright and License: see header file (000 copyright.h) or top of file
2420624202***************************************************************************** */
24207- #if 0 && defined(FIO_ED25519) && !defined(H___FIO_ED25519___H)
24203+ #if defined(FIO_ED25519) && !defined(H___FIO_ED25519___H) && 0
2420824204#define H___FIO_ED25519___H
2420924205
2421024206/* *****************************************************************************
@@ -24222,7 +24218,7 @@ ED25519 API
2422224218***************************************************************************** */
2422324219
2422424220/** ED25519 Key Pair */
24225- typedef struct {
24221+ typedef struct { /* TODO: FIXME: do we need all the bits? */
2422624222 fio_u512 private_key; /* Private key (with extra internal storage?) */
2422724223 fio_u256 public_key; /* Public key */
2422824224} fio_ed25519_s;
@@ -24260,10 +24256,18 @@ FIO_IFUNC void fio___ed25519_clamp_on_key(uint8_t *k) {
2426024256 k[31] |= 0x40U; /* set the 255th bit (making sure the value is big) */
2426124257}
2426224258
24263- static fio_u256 FIO___ED25519_PRIME = fio_u256_init64(0x7FFFFFFFFFFFFFFF,
24264- 0xFFFFFFFFFFFFFFFF,
24265- 0xFFFFFFFFFFFFFFFF,
24266- 0xFFFFFFFFFFFFFFED);
24259+ static fio_u256 FIO___ED25519_PRIME = fio_u256_init64(0xFFFFFFFFFFFFFFEDULL,
24260+ 0xFFFFFFFFFFFFFFFFULL,
24261+ 0xFFFFFFFFFFFFFFFFULL,
24262+ 0x7FFFFFFFFFFFFFFFULL);
24263+ /* clang-format off */
24264+ static fio_u1024 FIO___ED25519_PRIME_UNPACKED =
24265+ fio_u1024_init64(0xFFEDULL, 0xFFFFULL, 0xFFFFULL, 0xFFFFULL,
24266+ 0xFFFFULL, 0xFFFFULL, 0xFFFFULL, 0xFFFFULL,
24267+ 0xFFFFULL, 0xFFFFULL, 0xFFFFULL, 0xFFFFULL,
24268+ 0xFFFFULL, 0xFFFFULL, 0xFFFFULL, 0x7FFFULL);
24269+ /* clang-format on */
24270+
2426724271/* Obfuscate or recover ED25519 keys to prevent easy memory scraping */
2426824272FIO_IFUNC void fio___ed25519_flip(fio_ed25519_s *k) {
2426924273 /* Generate a deterministic mask */
@@ -24285,8 +24289,9 @@ FIO_IFUNC fio_u1024 fio___ed25519_unpack(uint8_t *u) {
2428524289 return r;
2428624290}
2428724291
24288- #define fio___ed25519_add fio_u1024_add64
24289- #define fio___ed25519_sub fio_u1024_sub64
24292+ #define fio___ed25519_add fio_u1024_add64
24293+ #define fio___ed25519_sub fio_u1024_sub64
24294+ #define fio___ed25519_swap_if fio_u1024_ct_swap_if
2429024295
2429124296FIO_IFUNC void fio___ed25519_normalize_step(fio_u1024 *u) {
2429224297 uint64_t c;
@@ -50798,23 +50803,23 @@ FIO_SFUNC void FIO_NAME_TEST(stl, core)(void) {
5079850803 }
5079950804 {
5080050805 fprintf(stderr, "* Testing popcount and hemming distance calculation.\n");
50801- for (size_t i = 0; i < 64; ++i) {
50806+ for (int i = 0; i < 64; ++i) {
5080250807 FIO_ASSERT(fio_popcount((uint64_t)1 << i) == 1,
5080350808 "fio_popcount error for 1 bit");
5080450809 }
50805- for (size_t i = 0; i < 63; ++i) {
50810+ for (int i = 0; i < 63; ++i) {
5080650811 FIO_ASSERT(fio_popcount((uint64_t)3 << i) == 2,
5080750812 "fio_popcount error for 2 bits");
5080850813 }
50809- for (size_t i = 0; i < 62; ++i) {
50814+ for (int i = 0; i < 62; ++i) {
5081050815 FIO_ASSERT(fio_popcount((uint64_t)7 << i) == 3,
5081150816 "fio_popcount error for 3 bits");
5081250817 }
50813- for (size_t i = 0; i < 59; ++i) {
50818+ for (int i = 0; i < 59; ++i) {
5081450819 FIO_ASSERT(fio_popcount((uint64_t)21 << i) == 3,
5081550820 "fio_popcount error for 3 alternating bits");
5081650821 }
50817- for (size_t i = 0; i < 64; ++i) {
50822+ for (int i = 0; i < 64; ++i) {
5081850823 FIO_ASSERT(fio_hemming_dist(((uint64_t)1 << i) - 1, 0) == i,
5081950824 "fio_hemming_dist error at %d",
5082050825 i);
@@ -51069,7 +51074,7 @@ FIO_SFUNC void FIO_NAME_TEST(stl, core)(void) {
5106951074 fio_u256_mul(&result, &ua, &ub);
5107051075 FIO_ASSERT(!memcmp(result.u64, expected, sizeof(result.u64)),
5107151076 "Multi-Precision MUL error");
51072- FIO_ASSERT(fio_u256_is_eq (&result, (fio_u256 *)&expected),
51077+ FIO_ASSERT(fio_u512_is_eq (&result, (fio_u512 *)&expected),
5107351078 "Multi-Precision MUL error (is_eq)");
5107451079 {
5107551080 fio_u512 cpy = result;
0 commit comments