chiark / gitweb /
math/f25519.c: Implementation for arithmetic in GF(2^255 - 19).
There's both a fast implementation for platforms with 64-bit arithmetic,
and a slow baseline for minimal C89 platforms. The code works better on
two's complement systems with arithmetic right shifts, but it works
portably.
* Arithmetic shifts are implemented with hairy masking and exact
division, but GCC notices and optimizes accordingly.
* Two's complement is used in the conditional-swap machinery, but
there's a fallback using multiplication if the `configure' script
can't detect it.