krb5 commit: Update edwards25519 code from BoringSSL
Greg Hudson
ghudson at mit.edu
Thu Jul 11 13:06:23 EDT 2019
https://github.com/krb5/krb5/commit/881b5312f85216f27a2a2f2560edc4e81a0d939a
commit 881b5312f85216f27a2a2f2560edc4e81a0d939a
Author: Greg Hudson <ghudson at mit.edu>
Date: Fri Jun 7 12:51:36 2019 -0400
Update edwards25519 code from BoringSSL
Bring the SPAKE edwards25519.c code up to date with BoringSSL, adding
edwards25519_fiat.h to contain the Fiat-generated code which BoringSSL
has split out. The relevant BoringSSL commits are:
302bb3964ad8cc4fb8540ee4783a936c5515605d
5590c715e26790d9b60384e1ac092529a19208af
32e59d2d3264e4e104b355ef73663b8b79ac4093
899835fad40f50f4c29bf7042b415eb72ad0e7d7
9847cdd785abae6313412fc5a824b938bef6ba98
The updated code avoids undefined signed left-shift behavior (not a
problem in practice, so far) and compiles to faster code with gcc on
platforms where the 64-bit code cannot be used.
src/plugins/preauth/spake/deps | 3 +-
src/plugins/preauth/spake/edwards25519.c | 1251 ++++--------------------
src/plugins/preauth/spake/edwards25519_fiat.h | 1289 +++++++++++++++++++++++++
3 files changed, 1470 insertions(+), 1073 deletions(-)
diff --git a/src/plugins/preauth/spake/deps b/src/plugins/preauth/spake/deps
index ce636af..695ad97 100644
--- a/src/plugins/preauth/spake/deps
+++ b/src/plugins/preauth/spake/deps
@@ -45,7 +45,8 @@ edwards25519.so edwards25519.po $(OUTPRE)edwards25519.$(OBJEXT): \
$(top_srcdir)/include/k5-trace.h $(top_srcdir)/include/krb5.h \
$(top_srcdir)/include/krb5/authdata_plugin.h $(top_srcdir)/include/krb5/plugin.h \
$(top_srcdir)/include/port-sockets.h $(top_srcdir)/include/socket-utils.h \
- edwards25519.c edwards25519_tables.h groups.h iana.h
+ edwards25519.c edwards25519_fiat.h edwards25519_tables.h \
+ groups.h iana.h
spake_client.so spake_client.po $(OUTPRE)spake_client.$(OBJEXT): \
$(BUILDTOP)/include/autoconf.h $(BUILDTOP)/include/krb5/krb5.h \
$(BUILDTOP)/include/osconf.h $(BUILDTOP)/include/profile.h \
diff --git a/src/plugins/preauth/spake/edwards25519.c b/src/plugins/preauth/spake/edwards25519.c
index f75a3c2..cbc26e5 100644
--- a/src/plugins/preauth/spake/edwards25519.c
+++ b/src/plugins/preauth/spake/edwards25519.c
@@ -61,8 +61,17 @@
* the generator point table, which is still in a separate header), so all of
* the functions are declared static.
*
- * - BORINGSSL_CURVE25519_64BIT is defined here using preprocessor conditionals
- * derived from the BoringSSL headers.
+ * - BORINGSSL_CURVE25519_64BIT is defined here using autoconf tests.
+ *
+ * - curve25519_32.h and curve25519_64.h are combined into edwards25519_fiat.h
+ * (conditionalized on BORINGSSL_CURVE25519_64BIT) for predictable dependency
+ * generation. The fiat_25519_selectznz and fiat_25519_carry_scmul_121666
+ * functions were removed from both branches as they are not used here (the
+ * former because it is not used by the BoringSSL code and the latter because
+ * it is only used by the X25519 code).
+ *
+ * - fe_cmov() has the initial "Silence an unused function warning" part
+ * removed, as we removed fiat_25519_selectznz instead.
*
* - The field element bounds assertion checks are disabled by default, as they
* slow the code down by roughly a factor of two. The
@@ -107,12 +116,6 @@ typedef __int128_t int128_t;
typedef __uint128_t uint128_t;
#endif
-#ifndef EDWARDS25519_ASSERTS
-#define assert_fe(f)
-#define assert_fe_loose(f)
-#define assert_fe_frozen(f)
-#endif
-
/* From BoringSSL third-party/fiat/internal.h */
#if defined(BORINGSSL_CURVE25519_64BIT)
@@ -185,6 +188,7 @@ typedef struct {
} ge_cached;
#include "edwards25519_tables.h"
+#include "edwards25519_fiat.h"
/* From BoringSSL third-party/fiat/curve25519.c */
@@ -205,644 +209,115 @@ static uint64_t load_4(const uint8_t *in) {
return result;
}
-#if defined(BORINGSSL_CURVE25519_64BIT)
-static uint64_t load_8(const uint8_t *in) {
- uint64_t result;
- result = (uint64_t)in[0];
- result |= ((uint64_t)in[1]) << 8;
- result |= ((uint64_t)in[2]) << 16;
- result |= ((uint64_t)in[3]) << 24;
- result |= ((uint64_t)in[4]) << 32;
- result |= ((uint64_t)in[5]) << 40;
- result |= ((uint64_t)in[6]) << 48;
- result |= ((uint64_t)in[7]) << 56;
- return result;
-}
-
-static uint8_t /*bool*/ addcarryx_u51(uint8_t /*bool*/ c, uint64_t a,
- uint64_t b, uint64_t *low) {
- // This function extracts 51 bits of result and 1 bit of carry (52 total), so
- // a 64-bit intermediate is sufficient.
- uint64_t x = a + b + c;
- *low = x & ((UINT64_C(1) << 51) - 1);
- return (x >> 51) & 1;
-}
-
-static uint8_t /*bool*/ subborrow_u51(uint8_t /*bool*/ c, uint64_t a,
- uint64_t b, uint64_t *low) {
- // This function extracts 51 bits of result and 1 bit of borrow (52 total), so
- // a 64-bit intermediate is sufficient.
- uint64_t x = a - b - c;
- *low = x & ((UINT64_C(1) << 51) - 1);
- return x >> 63;
-}
-
-static uint64_t cmovznz64(uint64_t t, uint64_t z, uint64_t nz) {
- t = -!!t; // all set if nonzero, 0 if 0
- return (t&nz) | ((~t)&z);
-}
-
-#else
-
-static uint8_t /*bool*/ addcarryx_u25(uint8_t /*bool*/ c, uint32_t a,
- uint32_t b, uint32_t *low) {
- // This function extracts 25 bits of result and 1 bit of carry (26 total), so
- // a 32-bit intermediate is sufficient.
- uint32_t x = a + b + c;
- *low = x & ((1 << 25) - 1);
- return (x >> 25) & 1;
-}
-
-static uint8_t /*bool*/ addcarryx_u26(uint8_t /*bool*/ c, uint32_t a,
- uint32_t b, uint32_t *low) {
- // This function extracts 26 bits of result and 1 bit of carry (27 total), so
- // a 32-bit intermediate is sufficient.
- uint32_t x = a + b + c;
- *low = x & ((1 << 26) - 1);
- return (x >> 26) & 1;
-}
-
-static uint8_t /*bool*/ subborrow_u25(uint8_t /*bool*/ c, uint32_t a,
- uint32_t b, uint32_t *low) {
- // This function extracts 25 bits of result and 1 bit of borrow (26 total), so
- // a 32-bit intermediate is sufficient.
- uint32_t x = a - b - c;
- *low = x & ((1 << 25) - 1);
- return x >> 31;
-}
-
-static uint8_t /*bool*/ subborrow_u26(uint8_t /*bool*/ c, uint32_t a,
- uint32_t b, uint32_t *low) {
- // This function extracts 26 bits of result and 1 bit of borrow (27 total), so
- // a 32-bit intermediate is sufficient.
- uint32_t x = a - b - c;
- *low = x & ((1 << 26) - 1);
- return x >> 31;
-}
-
-static uint32_t cmovznz32(uint32_t t, uint32_t z, uint32_t nz) {
- t = -!!t; // all set if nonzero, 0 if 0
- return (t&nz) | ((~t)&z);
-}
-
-#endif
-
// Field operations.
#if defined(BORINGSSL_CURVE25519_64BIT)
-#ifdef EDWARDS25519_ASSERTS
-#define assert_fe(f) do { \
- unsigned _assert_fe_i; \
- for (_assert_fe_i = 0; _assert_fe_i< 5; _assert_fe_i++) { \
- assert(f[_assert_fe_i] < 1.125*(UINT64_C(1)<<51)); \
- } \
-} while (0)
-
-#define assert_fe_loose(f) do { \
- unsigned _assert_fe_i; \
- for (_assert_fe_i = 0; _assert_fe_i< 5; _assert_fe_i++) { \
- assert(f[_assert_fe_i] < 3.375*(UINT64_C(1)<<51)); \
- } \
-} while (0)
-
-#define assert_fe_frozen(f) do { \
- unsigned _assert_fe_i; \
- for (_assert_fe_i = 0; _assert_fe_i< 5; _assert_fe_i++) { \
- assert(f[_assert_fe_i] < (UINT64_C(1)<<51)); \
- } \
-} while (0)
-#endif /* EDWARDS25519_ASSERTS */
-
-static void fe_frombytes_impl(uint64_t h[5], const uint8_t *s) {
- // Ignores top bit of s.
- uint64_t a0 = load_8(s);
- uint64_t a1 = load_8(s+8);
- uint64_t a2 = load_8(s+16);
- uint64_t a3 = load_8(s+24);
- // Use 51 bits, 64-51 = 13 left.
- h[0] = a0 & ((UINT64_C(1) << 51) - 1);
- // (64-51) + 38 = 13 + 38 = 51
- h[1] = (a0 >> 51) | ((a1 & ((UINT64_C(1) << 38) - 1)) << 13);
- // (64-38) + 25 = 26 + 25 = 51
- h[2] = (a1 >> 38) | ((a2 & ((UINT64_C(1) << 25) - 1)) << 26);
- // (64-25) + 12 = 39 + 12 = 51
- h[3] = (a2 >> 25) | ((a3 & ((UINT64_C(1) << 12) - 1)) << 39);
- // (64-12) = 52, ignore top bit
- h[4] = (a3 >> 12) & ((UINT64_C(1) << 51) - 1);
- assert_fe(h);
-}
-
-static void fe_frombytes(fe *h, const uint8_t *s) {
- fe_frombytes_impl(h->v, s);
-}
-
-static void fe_freeze(uint64_t out[5], const uint64_t in1[5]) {
- { const uint64_t x7 = in1[4];
- { const uint64_t x8 = in1[3];
- { const uint64_t x6 = in1[2];
- { const uint64_t x4 = in1[1];
- { const uint64_t x2 = in1[0];
- { uint64_t x10; uint8_t/*bool*/ x11 = subborrow_u51(0x0, x2, 0x7ffffffffffed, &x10);
- { uint64_t x13; uint8_t/*bool*/ x14 = subborrow_u51(x11, x4, 0x7ffffffffffff, &x13);
- { uint64_t x16; uint8_t/*bool*/ x17 = subborrow_u51(x14, x6, 0x7ffffffffffff, &x16);
- { uint64_t x19; uint8_t/*bool*/ x20 = subborrow_u51(x17, x8, 0x7ffffffffffff, &x19);
- { uint64_t x22; uint8_t/*bool*/ x23 = subborrow_u51(x20, x7, 0x7ffffffffffff, &x22);
- { uint64_t x24 = cmovznz64(x23, 0x0, 0xffffffffffffffffL);
- { uint64_t x25 = (x24 & 0x7ffffffffffed);
- { uint64_t x27; uint8_t/*bool*/ x28 = addcarryx_u51(0x0, x10, x25, &x27);
- { uint64_t x29 = (x24 & 0x7ffffffffffff);
- { uint64_t x31; uint8_t/*bool*/ x32 = addcarryx_u51(x28, x13, x29, &x31);
- { uint64_t x33 = (x24 & 0x7ffffffffffff);
- { uint64_t x35; uint8_t/*bool*/ x36 = addcarryx_u51(x32, x16, x33, &x35);
- { uint64_t x37 = (x24 & 0x7ffffffffffff);
- { uint64_t x39; uint8_t/*bool*/ x40 = addcarryx_u51(x36, x19, x37, &x39);
- { uint64_t x41 = (x24 & 0x7ffffffffffff);
- { uint64_t x43; addcarryx_u51(x40, x22, x41, &x43);
- out[0] = x27;
- out[1] = x31;
- out[2] = x35;
- out[3] = x39;
- out[4] = x43;
- }}}}}}}}}}}}}}}}}}}}}
-}
-
-static void fe_tobytes(uint8_t s[32], const fe *f) {
- assert_fe(f->v);
- uint64_t h[5];
- fe_freeze(h, f->v);
- assert_fe_frozen(h);
-
- s[0] = h[0] >> 0;
- s[1] = h[0] >> 8;
- s[2] = h[0] >> 16;
- s[3] = h[0] >> 24;
- s[4] = h[0] >> 32;
- s[5] = h[0] >> 40;
- s[6] = (h[0] >> 48) | (h[1] << 3);
- s[7] = h[1] >> 5;
- s[8] = h[1] >> 13;
- s[9] = h[1] >> 21;
- s[10] = h[1] >> 29;
- s[11] = h[1] >> 37;
- s[12] = (h[1] >> 45) | (h[2] << 6);
- s[13] = h[2] >> 2;
- s[14] = h[2] >> 10;
- s[15] = h[2] >> 18;
- s[16] = h[2] >> 26;
- s[17] = h[2] >> 34;
- s[18] = h[2] >> 42;
- s[19] = (h[2] >> 50) | (h[3] << 1);
- s[20] = h[3] >> 7;
- s[21] = h[3] >> 15;
- s[22] = h[3] >> 23;
- s[23] = h[3] >> 31;
- s[24] = h[3] >> 39;
- s[25] = (h[3] >> 47) | (h[4] << 4);
- s[26] = h[4] >> 4;
- s[27] = h[4] >> 12;
- s[28] = h[4] >> 20;
- s[29] = h[4] >> 28;
- s[30] = h[4] >> 36;
- s[31] = h[4] >> 44;
-}
-
-// h = 0
-static void fe_0(fe *h) {
- memset(h, 0, sizeof(fe));
-}
-
-static void fe_loose_0(fe_loose *h) {
- memset(h, 0, sizeof(fe_loose));
-}
-
-// h = 1
-static void fe_1(fe *h) {
- memset(h, 0, sizeof(fe));
- h->v[0] = 1;
-}
-
-static void fe_loose_1(fe_loose *h) {
- memset(h, 0, sizeof(fe_loose));
- h->v[0] = 1;
-}
-
-static void fe_add_impl(uint64_t out[5], const uint64_t in1[5], const uint64_t in2[5]) {
- { const uint64_t x10 = in1[4];
- { const uint64_t x11 = in1[3];
- { const uint64_t x9 = in1[2];
- { const uint64_t x7 = in1[1];
- { const uint64_t x5 = in1[0];
- { const uint64_t x18 = in2[4];
- { const uint64_t x19 = in2[3];
- { const uint64_t x17 = in2[2];
- { const uint64_t x15 = in2[1];
- { const uint64_t x13 = in2[0];
- out[0] = (x5 + x13);
- out[1] = (x7 + x15);
- out[2] = (x9 + x17);
- out[3] = (x11 + x19);
- out[4] = (x10 + x18);
- }}}}}}}}}}
-}
-
-// h = f + g
-// Can overlap h with f or g.
-static void fe_add(fe_loose *h, const fe *f, const fe *g) {
- assert_fe(f->v);
- assert_fe(g->v);
- fe_add_impl(h->v, f->v, g->v);
- assert_fe_loose(h->v);
-}
-
-static void fe_sub_impl(uint64_t out[5], const uint64_t in1[5], const uint64_t in2[5]) {
- { const uint64_t x10 = in1[4];
- { const uint64_t x11 = in1[3];
- { const uint64_t x9 = in1[2];
- { const uint64_t x7 = in1[1];
- { const uint64_t x5 = in1[0];
- { const uint64_t x18 = in2[4];
- { const uint64_t x19 = in2[3];
- { const uint64_t x17 = in2[2];
- { const uint64_t x15 = in2[1];
- { const uint64_t x13 = in2[0];
- out[0] = ((0xfffffffffffda + x5) - x13);
- out[1] = ((0xffffffffffffe + x7) - x15);
- out[2] = ((0xffffffffffffe + x9) - x17);
- out[3] = ((0xffffffffffffe + x11) - x19);
- out[4] = ((0xffffffffffffe + x10) - x18);
- }}}}}}}}}}
-}
-
-// h = f - g
-// Can overlap h with f or g.
-static void fe_sub(fe_loose *h, const fe *f, const fe *g) {
- assert_fe(f->v);
- assert_fe(g->v);
- fe_sub_impl(h->v, f->v, g->v);
- assert_fe_loose(h->v);
-}
-
-static void fe_carry_impl(uint64_t out[5], const uint64_t in1[5]) {
- { const uint64_t x7 = in1[4];
- { const uint64_t x8 = in1[3];
- { const uint64_t x6 = in1[2];
- { const uint64_t x4 = in1[1];
- { const uint64_t x2 = in1[0];
- { uint64_t x9 = (x2 >> 0x33);
- { uint64_t x10 = (x2 & 0x7ffffffffffff);
- { uint64_t x11 = (x9 + x4);
- { uint64_t x12 = (x11 >> 0x33);
- { uint64_t x13 = (x11 & 0x7ffffffffffff);
- { uint64_t x14 = (x12 + x6);
- { uint64_t x15 = (x14 >> 0x33);
- { uint64_t x16 = (x14 & 0x7ffffffffffff);
- { uint64_t x17 = (x15 + x8);
- { uint64_t x18 = (x17 >> 0x33);
- { uint64_t x19 = (x17 & 0x7ffffffffffff);
- { uint64_t x20 = (x18 + x7);
- { uint64_t x21 = (x20 >> 0x33);
- { uint64_t x22 = (x20 & 0x7ffffffffffff);
- { uint64_t x23 = (x10 + (0x13 * x21));
- { uint64_t x24 = (x23 >> 0x33);
- { uint64_t x25 = (x23 & 0x7ffffffffffff);
- { uint64_t x26 = (x24 + x13);
- { uint64_t x27 = (x26 >> 0x33);
- { uint64_t x28 = (x26 & 0x7ffffffffffff);
- out[0] = x25;
- out[1] = x28;
- out[2] = (x27 + x16);
- out[3] = x19;
- out[4] = x22;
- }}}}}}}}}}}}}}}}}}}}}}}}}
-}
-
-static void fe_carry(fe *h, const fe_loose* f) {
- assert_fe_loose(f->v);
- fe_carry_impl(h->v, f->v);
- assert_fe(h->v);
-}
-
-static void fe_mul_impl(uint64_t out[5], const uint64_t in1[5], const uint64_t in2[5]) {
- assert_fe_loose(in1);
- assert_fe_loose(in2);
- { const uint64_t x10 = in1[4];
- { const uint64_t x11 = in1[3];
- { const uint64_t x9 = in1[2];
- { const uint64_t x7 = in1[1];
- { const uint64_t x5 = in1[0];
- { const uint64_t x18 = in2[4];
- { const uint64_t x19 = in2[3];
- { const uint64_t x17 = in2[2];
- { const uint64_t x15 = in2[1];
- { const uint64_t x13 = in2[0];
- { uint128_t x20 = ((uint128_t)x5 * x13);
- { uint128_t x21 = (((uint128_t)x5 * x15) + ((uint128_t)x7 * x13));
- { uint128_t x22 = ((((uint128_t)x5 * x17) + ((uint128_t)x9 * x13)) + ((uint128_t)x7 * x15));
- { uint128_t x23 = (((((uint128_t)x5 * x19) + ((uint128_t)x11 * x13)) + ((uint128_t)x7 * x17)) + ((uint128_t)x9 * x15));
- { uint128_t x24 = ((((((uint128_t)x5 * x18) + ((uint128_t)x10 * x13)) + ((uint128_t)x11 * x15)) + ((uint128_t)x7 * x19)) + ((uint128_t)x9 * x17));
- { uint64_t x25 = (x10 * 0x13);
- { uint64_t x26 = (x7 * 0x13);
- { uint64_t x27 = (x9 * 0x13);
- { uint64_t x28 = (x11 * 0x13);
- { uint128_t x29 = ((((x20 + ((uint128_t)x25 * x15)) + ((uint128_t)x26 * x18)) + ((uint128_t)x27 * x19)) + ((uint128_t)x28 * x17));
- { uint128_t x30 = (((x21 + ((uint128_t)x25 * x17)) + ((uint128_t)x27 * x18)) + ((uint128_t)x28 * x19));
- { uint128_t x31 = ((x22 + ((uint128_t)x25 * x19)) + ((uint128_t)x28 * x18));
- { uint128_t x32 = (x23 + ((uint128_t)x25 * x18));
- { uint64_t x33 = (uint64_t) (x29 >> 0x33);
- { uint64_t x34 = ((uint64_t)x29 & 0x7ffffffffffff);
- { uint128_t x35 = (x33 + x30);
- { uint64_t x36 = (uint64_t) (x35 >> 0x33);
- { uint64_t x37 = ((uint64_t)x35 & 0x7ffffffffffff);
- { uint128_t x38 = (x36 + x31);
- { uint64_t x39 = (uint64_t) (x38 >> 0x33);
- { uint64_t x40 = ((uint64_t)x38 & 0x7ffffffffffff);
- { uint128_t x41 = (x39 + x32);
- { uint64_t x42 = (uint64_t) (x41 >> 0x33);
- { uint64_t x43 = ((uint64_t)x41 & 0x7ffffffffffff);
- { uint128_t x44 = (x42 + x24);
- { uint64_t x45 = (uint64_t) (x44 >> 0x33);
- { uint64_t x46 = ((uint64_t)x44 & 0x7ffffffffffff);
- { uint64_t x47 = (x34 + (0x13 * x45));
- { uint64_t x48 = (x47 >> 0x33);
- { uint64_t x49 = (x47 & 0x7ffffffffffff);
- { uint64_t x50 = (x48 + x37);
- { uint64_t x51 = (x50 >> 0x33);
- { uint64_t x52 = (x50 & 0x7ffffffffffff);
- out[0] = x49;
- out[1] = x52;
- out[2] = (x51 + x40);
- out[3] = x43;
- out[4] = x46;
- }}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
- assert_fe(out);
-}
-
-static void fe_mul_ltt(fe_loose *h, const fe *f, const fe *g) {
- fe_mul_impl(h->v, f->v, g->v);
-}
-
-static void fe_mul_llt(fe_loose *h, const fe_loose *f, const fe *g) {
- fe_mul_impl(h->v, f->v, g->v);
-}
-
-static void fe_mul_ttt(fe *h, const fe *f, const fe *g) {
- fe_mul_impl(h->v, f->v, g->v);
-}
-
-static void fe_mul_tlt(fe *h, const fe_loose *f, const fe *g) {
- fe_mul_impl(h->v, f->v, g->v);
-}
-
-static void fe_mul_ttl(fe *h, const fe *f, const fe_loose *g) {
- fe_mul_impl(h->v, f->v, g->v);
-}
-
-static void fe_mul_tll(fe *h, const fe_loose *f, const fe_loose *g) {
- fe_mul_impl(h->v, f->v, g->v);
-}
-
-static void fe_sqr_impl(uint64_t out[5], const uint64_t in1[5]) {
- assert_fe_loose(in1);
- { const uint64_t x7 = in1[4];
- { const uint64_t x8 = in1[3];
- { const uint64_t x6 = in1[2];
- { const uint64_t x4 = in1[1];
- { const uint64_t x2 = in1[0];
- { uint64_t x9 = (x2 * 0x2);
- { uint64_t x10 = (x4 * 0x2);
- { uint64_t x11 = ((x6 * 0x2) * 0x13);
- { uint64_t x12 = (x7 * 0x13);
- { uint64_t x13 = (x12 * 0x2);
- { uint128_t x14 = ((((uint128_t)x2 * x2) + ((uint128_t)x13 * x4)) + ((uint128_t)x11 * x8));
- { uint128_t x15 = ((((uint128_t)x9 * x4) + ((uint128_t)x13 * x6)) + ((uint128_t)x8 * (x8 * 0x13)));
- { uint128_t x16 = ((((uint128_t)x9 * x6) + ((uint128_t)x4 * x4)) + ((uint128_t)x13 * x8));
- { uint128_t x17 = ((((uint128_t)x9 * x8) + ((uint128_t)x10 * x6)) + ((uint128_t)x7 * x12));
- { uint128_t x18 = ((((uint128_t)x9 * x7) + ((uint128_t)x10 * x8)) + ((uint128_t)x6 * x6));
- { uint64_t x19 = (uint64_t) (x14 >> 0x33);
- { uint64_t x20 = ((uint64_t)x14 & 0x7ffffffffffff);
- { uint128_t x21 = (x19 + x15);
- { uint64_t x22 = (uint64_t) (x21 >> 0x33);
- { uint64_t x23 = ((uint64_t)x21 & 0x7ffffffffffff);
- { uint128_t x24 = (x22 + x16);
- { uint64_t x25 = (uint64_t) (x24 >> 0x33);
- { uint64_t x26 = ((uint64_t)x24 & 0x7ffffffffffff);
- { uint128_t x27 = (x25 + x17);
- { uint64_t x28 = (uint64_t) (x27 >> 0x33);
- { uint64_t x29 = ((uint64_t)x27 & 0x7ffffffffffff);
- { uint128_t x30 = (x28 + x18);
- { uint64_t x31 = (uint64_t) (x30 >> 0x33);
- { uint64_t x32 = ((uint64_t)x30 & 0x7ffffffffffff);
- { uint64_t x33 = (x20 + (0x13 * x31));
- { uint64_t x34 = (x33 >> 0x33);
- { uint64_t x35 = (x33 & 0x7ffffffffffff);
- { uint64_t x36 = (x34 + x23);
- { uint64_t x37 = (x36 >> 0x33);
- { uint64_t x38 = (x36 & 0x7ffffffffffff);
- out[0] = x35;
- out[1] = x38;
- out[2] = (x37 + x26);
- out[3] = x29;
- out[4] = x32;
- }}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
- assert_fe(out);
-}
+typedef uint64_t fe_limb_t;
+#define FE_NUM_LIMBS 5
-static void fe_sq_tl(fe *h, const fe_loose *f) {
- fe_sqr_impl(h->v, f->v);
-}
-
-static void fe_sq_tt(fe *h, const fe *f) {
- fe_sqr_impl(h->v, f->v);
-}
+// assert_fe asserts that |f| satisfies bounds:
+//
+// [[0x0 ~> 0x8cccccccccccc],
+// [0x0 ~> 0x8cccccccccccc],
+// [0x0 ~> 0x8cccccccccccc],
+// [0x0 ~> 0x8cccccccccccc],
+// [0x0 ~> 0x8cccccccccccc]]
+//
+// See comments in edwards25519_fiat.h for which functions use these bounds for
+// inputs or outputs.
+#define assert_fe(f) \
+ do { \
+ for (unsigned _assert_fe_i = 0; _assert_fe_i < 5; _assert_fe_i++) { \
+ assert(f[_assert_fe_i] <= UINT64_C(0x8cccccccccccc)); \
+ } \
+ } while (0)
+
+// assert_fe_loose asserts that |f| satisfies bounds:
+//
+// [[0x0 ~> 0x1a666666666664],
+// [0x0 ~> 0x1a666666666664],
+// [0x0 ~> 0x1a666666666664],
+// [0x0 ~> 0x1a666666666664],
+// [0x0 ~> 0x1a666666666664]]
+//
+// See comments in edwards25519_fiat.h for which functions use these bounds for
+// inputs or outputs.
+#define assert_fe_loose(f) \
+ do { \
+ for (unsigned _assert_fe_i = 0; _assert_fe_i < 5; _assert_fe_i++) { \
+ assert(f[_assert_fe_i] <= UINT64_C(0x1a666666666664)); \
+ } \
+ } while (0)
-// Adapted from Fiat-synthesized |fe_sub_impl| with |out| = 0.
-static void fe_neg_impl(uint64_t out[5], const uint64_t in2[5]) {
- { const uint64_t x10 = 0;
- { const uint64_t x11 = 0;
- { const uint64_t x9 = 0;
- { const uint64_t x7 = 0;
- { const uint64_t x5 = 0;
- { const uint64_t x18 = in2[4];
- { const uint64_t x19 = in2[3];
- { const uint64_t x17 = in2[2];
- { const uint64_t x15 = in2[1];
- { const uint64_t x13 = in2[0];
- out[0] = ((0xfffffffffffda + x5) - x13);
- out[1] = ((0xffffffffffffe + x7) - x15);
- out[2] = ((0xffffffffffffe + x9) - x17);
- out[3] = ((0xffffffffffffe + x11) - x19);
- out[4] = ((0xffffffffffffe + x10) - x18);
- }}}}}}}}}}
-}
+#else
-// h = -f
-static void fe_neg(fe_loose *h, const fe *f) {
- assert_fe(f->v);
- fe_neg_impl(h->v, f->v);
- assert_fe_loose(h->v);
-}
+typedef uint32_t fe_limb_t;
+#define FE_NUM_LIMBS 10
-// Replace (f,g) with (g,g) if b == 1;
-// replace (f,g) with (f,g) if b == 0.
+// assert_fe asserts that |f| satisfies bounds:
//
-// Preconditions: b in {0,1}.
-static void fe_cmov(fe_loose *f, const fe_loose *g, uint64_t b) {
- unsigned i;
- b = 0-b;
- for (i = 0; i < 5; i++) {
- uint64_t x = f->v[i] ^ g->v[i];
- x &= b;
- f->v[i] ^= x;
- }
-}
+// [[0x0 ~> 0x4666666], [0x0 ~> 0x2333333],
+// [0x0 ~> 0x4666666], [0x0 ~> 0x2333333],
+// [0x0 ~> 0x4666666], [0x0 ~> 0x2333333],
+// [0x0 ~> 0x4666666], [0x0 ~> 0x2333333],
+// [0x0 ~> 0x4666666], [0x0 ~> 0x2333333]]
+//
+// See comments in edwards25519_fiat.h for which functions use these bounds for
+// inputs or outputs.
+#define assert_fe(f) \
+ do { \
+ for (unsigned _assert_fe_i = 0; _assert_fe_i < 10; _assert_fe_i++) { \
+ assert(f[_assert_fe_i] <= \
+ ((_assert_fe_i & 1) ? 0x2333333u : 0x4666666u)); \
+ } \
+ } while (0)
+
+// assert_fe_loose asserts that |f| satisfies bounds:
+//
+// [[0x0 ~> 0xd333332], [0x0 ~> 0x6999999],
+// [0x0 ~> 0xd333332], [0x0 ~> 0x6999999],
+// [0x0 ~> 0xd333332], [0x0 ~> 0x6999999],
+// [0x0 ~> 0xd333332], [0x0 ~> 0x6999999],
+// [0x0 ~> 0xd333332], [0x0 ~> 0x6999999]]
+//
+// See comments in edwards25519_fiat.h for which functions use these bounds for
+// inputs or outputs.
+#define assert_fe_loose(f) \
+ do { \
+ for (unsigned _assert_fe_i = 0; _assert_fe_i < 10; _assert_fe_i++) { \
+ assert(f[_assert_fe_i] <= \
+ ((_assert_fe_i & 1) ? 0x6999999u : 0xd333332u)); \
+ } \
+ } while (0)
-#else
+#endif // BORINGSSL_CURVE25519_64BIT
-#ifdef EDWARDS25519_ASSERTS
-#define assert_fe(f) do { \
- unsigned _assert_fe_i; \
- for (_assert_fe_i = 0; _assert_fe_i< 10; _assert_fe_i++) { \
- assert(f[_assert_fe_i] < 1.125*(1<<(26-(_assert_fe_i&1)))); \
- } \
-} while (0)
-
-#define assert_fe_loose(f) do { \
- unsigned _assert_fe_i; \
- for (_assert_fe_i = 0; _assert_fe_i< 10; _assert_fe_i++) { \
- assert(f[_assert_fe_i] < 3.375*(1<<(26-(_assert_fe_i&1)))); \
- } \
-} while (0)
-
-#define assert_fe_frozen(f) do { \
- unsigned _assert_fe_i; \
- for (_assert_fe_i = 0; _assert_fe_i< 10; _assert_fe_i++) { \
- assert(f[_assert_fe_i] < (1u<<(26-(_assert_fe_i&1)))); \
- } \
-} while (0)
-#endif /* EDWARDS25519_ASSERTS */
-
-static void fe_frombytes_impl(uint32_t h[10], const uint8_t *s) {
- // Ignores top bit of s.
- uint32_t a0 = load_4(s);
- uint32_t a1 = load_4(s+4);
- uint32_t a2 = load_4(s+8);
- uint32_t a3 = load_4(s+12);
- uint32_t a4 = load_4(s+16);
- uint32_t a5 = load_4(s+20);
- uint32_t a6 = load_4(s+24);
- uint32_t a7 = load_4(s+28);
- h[0] = a0&((1<<26)-1); // 26 used, 32-26 left. 26
- h[1] = (a0>>26) | ((a1&((1<<19)-1))<< 6); // (32-26) + 19 = 6+19 = 25
- h[2] = (a1>>19) | ((a2&((1<<13)-1))<<13); // (32-19) + 13 = 13+13 = 26
- h[3] = (a2>>13) | ((a3&((1<< 6)-1))<<19); // (32-13) + 6 = 19+ 6 = 25
- h[4] = (a3>> 6); // (32- 6) = 26
- h[5] = a4&((1<<25)-1); // 25
- h[6] = (a4>>25) | ((a5&((1<<19)-1))<< 7); // (32-25) + 19 = 7+19 = 26
- h[7] = (a5>>19) | ((a6&((1<<12)-1))<<13); // (32-19) + 12 = 13+12 = 25
- h[8] = (a6>>12) | ((a7&((1<< 6)-1))<<20); // (32-12) + 6 = 20+ 6 = 26
- h[9] = (a7>> 6)&((1<<25)-1); // 25
- assert_fe(h);
-}
+#ifndef EDWARDS25519_ASSERTS
+#undef assert_fe
+#undef assert_fe_loose
+#define assert_fe(f)
+#define assert_fe_loose(f)
+#endif
-static void fe_frombytes(fe *h, const uint8_t *s) {
- fe_frombytes_impl(h->v, s);
+static void fe_frombytes_strict(fe *h, const uint8_t s[32]) {
+ // |fiat_25519_from_bytes| requires the top-most bit be clear.
+ assert((s[31] & 0x80) == 0);
+ fiat_25519_from_bytes(h->v, s);
+ assert_fe(h->v);
}
-static void fe_freeze(uint32_t out[10], const uint32_t in1[10]) {
- { const uint32_t x17 = in1[9];
- { const uint32_t x18 = in1[8];
- { const uint32_t x16 = in1[7];
- { const uint32_t x14 = in1[6];
- { const uint32_t x12 = in1[5];
- { const uint32_t x10 = in1[4];
- { const uint32_t x8 = in1[3];
- { const uint32_t x6 = in1[2];
- { const uint32_t x4 = in1[1];
- { const uint32_t x2 = in1[0];
- { uint32_t x20; uint8_t/*bool*/ x21 = subborrow_u26(0x0, x2, 0x3ffffed, &x20);
- { uint32_t x23; uint8_t/*bool*/ x24 = subborrow_u25(x21, x4, 0x1ffffff, &x23);
- { uint32_t x26; uint8_t/*bool*/ x27 = subborrow_u26(x24, x6, 0x3ffffff, &x26);
- { uint32_t x29; uint8_t/*bool*/ x30 = subborrow_u25(x27, x8, 0x1ffffff, &x29);
- { uint32_t x32; uint8_t/*bool*/ x33 = subborrow_u26(x30, x10, 0x3ffffff, &x32);
- { uint32_t x35; uint8_t/*bool*/ x36 = subborrow_u25(x33, x12, 0x1ffffff, &x35);
- { uint32_t x38; uint8_t/*bool*/ x39 = subborrow_u26(x36, x14, 0x3ffffff, &x38);
- { uint32_t x41; uint8_t/*bool*/ x42 = subborrow_u25(x39, x16, 0x1ffffff, &x41);
- { uint32_t x44; uint8_t/*bool*/ x45 = subborrow_u26(x42, x18, 0x3ffffff, &x44);
- { uint32_t x47; uint8_t/*bool*/ x48 = subborrow_u25(x45, x17, 0x1ffffff, &x47);
- { uint32_t x49 = cmovznz32(x48, 0x0, 0xffffffff);
- { uint32_t x50 = (x49 & 0x3ffffed);
- { uint32_t x52; uint8_t/*bool*/ x53 = addcarryx_u26(0x0, x20, x50, &x52);
- { uint32_t x54 = (x49 & 0x1ffffff);
- { uint32_t x56; uint8_t/*bool*/ x57 = addcarryx_u25(x53, x23, x54, &x56);
- { uint32_t x58 = (x49 & 0x3ffffff);
- { uint32_t x60; uint8_t/*bool*/ x61 = addcarryx_u26(x57, x26, x58, &x60);
- { uint32_t x62 = (x49 & 0x1ffffff);
- { uint32_t x64; uint8_t/*bool*/ x65 = addcarryx_u25(x61, x29, x62, &x64);
- { uint32_t x66 = (x49 & 0x3ffffff);
- { uint32_t x68; uint8_t/*bool*/ x69 = addcarryx_u26(x65, x32, x66, &x68);
- { uint32_t x70 = (x49 & 0x1ffffff);
- { uint32_t x72; uint8_t/*bool*/ x73 = addcarryx_u25(x69, x35, x70, &x72);
- { uint32_t x74 = (x49 & 0x3ffffff);
- { uint32_t x76; uint8_t/*bool*/ x77 = addcarryx_u26(x73, x38, x74, &x76);
- { uint32_t x78 = (x49 & 0x1ffffff);
- { uint32_t x80; uint8_t/*bool*/ x81 = addcarryx_u25(x77, x41, x78, &x80);
- { uint32_t x82 = (x49 & 0x3ffffff);
- { uint32_t x84; uint8_t/*bool*/ x85 = addcarryx_u26(x81, x44, x82, &x84);
- { uint32_t x86 = (x49 & 0x1ffffff);
- { uint32_t x88; addcarryx_u25(x85, x47, x86, &x88);
- out[0] = x52;
- out[1] = x56;
- out[2] = x60;
- out[3] = x64;
- out[4] = x68;
- out[5] = x72;
- out[6] = x76;
- out[7] = x80;
- out[8] = x84;
- out[9] = x88;
- }}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
+static void fe_frombytes(fe *h, const uint8_t s[32]) {
+ uint8_t s_copy[32];
+ memcpy(s_copy, s, 32);
+ s_copy[31] &= 0x7f;
+ fe_frombytes_strict(h, s_copy);
}
static void fe_tobytes(uint8_t s[32], const fe *f) {
assert_fe(f->v);
- uint32_t h[10];
- fe_freeze(h, f->v);
- assert_fe_frozen(h);
-
- s[0] = h[0] >> 0;
- s[1] = h[0] >> 8;
- s[2] = h[0] >> 16;
- s[3] = (h[0] >> 24) | (h[1] << 2);
- s[4] = h[1] >> 6;
- s[5] = h[1] >> 14;
- s[6] = (h[1] >> 22) | (h[2] << 3);
- s[7] = h[2] >> 5;
- s[8] = h[2] >> 13;
- s[9] = (h[2] >> 21) | (h[3] << 5);
- s[10] = h[3] >> 3;
- s[11] = h[3] >> 11;
- s[12] = (h[3] >> 19) | (h[4] << 6);
- s[13] = h[4] >> 2;
- s[14] = h[4] >> 10;
- s[15] = h[4] >> 18;
- s[16] = h[5] >> 0;
- s[17] = h[5] >> 8;
- s[18] = h[5] >> 16;
- s[19] = (h[5] >> 24) | (h[6] << 1);
- s[20] = h[6] >> 7;
- s[21] = h[6] >> 15;
- s[22] = (h[6] >> 23) | (h[7] << 3);
- s[23] = h[7] >> 5;
- s[24] = h[7] >> 13;
- s[25] = (h[7] >> 21) | (h[8] << 4);
- s[26] = h[8] >> 4;
- s[27] = h[8] >> 12;
- s[28] = (h[8] >> 20) | (h[9] << 6);
- s[29] = h[9] >> 2;
- s[30] = h[9] >> 10;
- s[31] = h[9] >> 18;
+ fiat_25519_to_bytes(s, f->v);
}
// h = 0
@@ -865,272 +340,36 @@ static void fe_loose_1(fe_loose *h) {
h->v[0] = 1;
}
-static void fe_add_impl(uint32_t out[10], const uint32_t in1[10], const uint32_t in2[10]) {
- { const uint32_t x20 = in1[9];
- { const uint32_t x21 = in1[8];
- { const uint32_t x19 = in1[7];
- { const uint32_t x17 = in1[6];
- { const uint32_t x15 = in1[5];
- { const uint32_t x13 = in1[4];
- { const uint32_t x11 = in1[3];
- { const uint32_t x9 = in1[2];
- { const uint32_t x7 = in1[1];
- { const uint32_t x5 = in1[0];
- { const uint32_t x38 = in2[9];
- { const uint32_t x39 = in2[8];
- { const uint32_t x37 = in2[7];
- { const uint32_t x35 = in2[6];
- { const uint32_t x33 = in2[5];
- { const uint32_t x31 = in2[4];
- { const uint32_t x29 = in2[3];
- { const uint32_t x27 = in2[2];
- { const uint32_t x25 = in2[1];
- { const uint32_t x23 = in2[0];
- out[0] = (x5 + x23);
- out[1] = (x7 + x25);
- out[2] = (x9 + x27);
- out[3] = (x11 + x29);
- out[4] = (x13 + x31);
- out[5] = (x15 + x33);
- out[6] = (x17 + x35);
- out[7] = (x19 + x37);
- out[8] = (x21 + x39);
- out[9] = (x20 + x38);
- }}}}}}}}}}}}}}}}}}}}
-}
-
// h = f + g
// Can overlap h with f or g.
static void fe_add(fe_loose *h, const fe *f, const fe *g) {
assert_fe(f->v);
assert_fe(g->v);
- fe_add_impl(h->v, f->v, g->v);
+ fiat_25519_add(h->v, f->v, g->v);
assert_fe_loose(h->v);
}
-static void fe_sub_impl(uint32_t out[10], const uint32_t in1[10], const uint32_t in2[10]) {
- { const uint32_t x20 = in1[9];
- { const uint32_t x21 = in1[8];
- { const uint32_t x19 = in1[7];
- { const uint32_t x17 = in1[6];
- { const uint32_t x15 = in1[5];
- { const uint32_t x13 = in1[4];
- { const uint32_t x11 = in1[3];
- { const uint32_t x9 = in1[2];
- { const uint32_t x7 = in1[1];
- { const uint32_t x5 = in1[0];
- { const uint32_t x38 = in2[9];
- { const uint32_t x39 = in2[8];
- { const uint32_t x37 = in2[7];
- { const uint32_t x35 = in2[6];
- { const uint32_t x33 = in2[5];
- { const uint32_t x31 = in2[4];
- { const uint32_t x29 = in2[3];
- { const uint32_t x27 = in2[2];
- { const uint32_t x25 = in2[1];
- { const uint32_t x23 = in2[0];
- out[0] = ((0x7ffffda + x5) - x23);
- out[1] = ((0x3fffffe + x7) - x25);
- out[2] = ((0x7fffffe + x9) - x27);
- out[3] = ((0x3fffffe + x11) - x29);
- out[4] = ((0x7fffffe + x13) - x31);
- out[5] = ((0x3fffffe + x15) - x33);
- out[6] = ((0x7fffffe + x17) - x35);
- out[7] = ((0x3fffffe + x19) - x37);
- out[8] = ((0x7fffffe + x21) - x39);
- out[9] = ((0x3fffffe + x20) - x38);
- }}}}}}}}}}}}}}}}}}}}
-}
-
// h = f - g
// Can overlap h with f or g.
static void fe_sub(fe_loose *h, const fe *f, const fe *g) {
assert_fe(f->v);
assert_fe(g->v);
- fe_sub_impl(h->v, f->v, g->v);
+ fiat_25519_sub(h->v, f->v, g->v);
assert_fe_loose(h->v);
}
-static void fe_carry_impl(uint32_t out[10], const uint32_t in1[10]) {
- { const uint32_t x17 = in1[9];
- { const uint32_t x18 = in1[8];
- { const uint32_t x16 = in1[7];
- { const uint32_t x14 = in1[6];
- { const uint32_t x12 = in1[5];
- { const uint32_t x10 = in1[4];
- { const uint32_t x8 = in1[3];
- { const uint32_t x6 = in1[2];
- { const uint32_t x4 = in1[1];
- { const uint32_t x2 = in1[0];
- { uint32_t x19 = (x2 >> 0x1a);
- { uint32_t x20 = (x2 & 0x3ffffff);
- { uint32_t x21 = (x19 + x4);
- { uint32_t x22 = (x21 >> 0x19);
- { uint32_t x23 = (x21 & 0x1ffffff);
- { uint32_t x24 = (x22 + x6);
- { uint32_t x25 = (x24 >> 0x1a);
- { uint32_t x26 = (x24 & 0x3ffffff);
- { uint32_t x27 = (x25 + x8);
- { uint32_t x28 = (x27 >> 0x19);
- { uint32_t x29 = (x27 & 0x1ffffff);
- { uint32_t x30 = (x28 + x10);
- { uint32_t x31 = (x30 >> 0x1a);
- { uint32_t x32 = (x30 & 0x3ffffff);
- { uint32_t x33 = (x31 + x12);
- { uint32_t x34 = (x33 >> 0x19);
- { uint32_t x35 = (x33 & 0x1ffffff);
- { uint32_t x36 = (x34 + x14);
- { uint32_t x37 = (x36 >> 0x1a);
- { uint32_t x38 = (x36 & 0x3ffffff);
- { uint32_t x39 = (x37 + x16);
- { uint32_t x40 = (x39 >> 0x19);
- { uint32_t x41 = (x39 & 0x1ffffff);
- { uint32_t x42 = (x40 + x18);
- { uint32_t x43 = (x42 >> 0x1a);
- { uint32_t x44 = (x42 & 0x3ffffff);
- { uint32_t x45 = (x43 + x17);
- { uint32_t x46 = (x45 >> 0x19);
- { uint32_t x47 = (x45 & 0x1ffffff);
- { uint32_t x48 = (x20 + (0x13 * x46));
- { uint32_t x49 = (x48 >> 0x1a);
- { uint32_t x50 = (x48 & 0x3ffffff);
- { uint32_t x51 = (x49 + x23);
- { uint32_t x52 = (x51 >> 0x19);
- { uint32_t x53 = (x51 & 0x1ffffff);
- out[0] = x50;
- out[1] = x53;
- out[2] = (x52 + x26);
- out[3] = x29;
- out[4] = x32;
- out[5] = x35;
- out[6] = x38;
- out[7] = x41;
- out[8] = x44;
- out[9] = x47;
- }}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
-}
-
static void fe_carry(fe *h, const fe_loose* f) {
assert_fe_loose(f->v);
- fe_carry_impl(h->v, f->v);
+ fiat_25519_carry(h->v, f->v);
assert_fe(h->v);
}
-static void fe_mul_impl(uint32_t out[10], const uint32_t in1[10], const uint32_t in2[10]) {
+static void fe_mul_impl(fe_limb_t out[FE_NUM_LIMBS],
+ const fe_limb_t in1[FE_NUM_LIMBS],
+ const fe_limb_t in2[FE_NUM_LIMBS]) {
assert_fe_loose(in1);
assert_fe_loose(in2);
- { const uint32_t x20 = in1[9];
- { const uint32_t x21 = in1[8];
- { const uint32_t x19 = in1[7];
- { const uint32_t x17 = in1[6];
- { const uint32_t x15 = in1[5];
- { const uint32_t x13 = in1[4];
- { const uint32_t x11 = in1[3];
- { const uint32_t x9 = in1[2];
- { const uint32_t x7 = in1[1];
- { const uint32_t x5 = in1[0];
- { const uint32_t x38 = in2[9];
- { const uint32_t x39 = in2[8];
- { const uint32_t x37 = in2[7];
- { const uint32_t x35 = in2[6];
- { const uint32_t x33 = in2[5];
- { const uint32_t x31 = in2[4];
- { const uint32_t x29 = in2[3];
- { const uint32_t x27 = in2[2];
- { const uint32_t x25 = in2[1];
- { const uint32_t x23 = in2[0];
- { uint64_t x40 = ((uint64_t)x23 * x5);
- { uint64_t x41 = (((uint64_t)x23 * x7) + ((uint64_t)x25 * x5));
- { uint64_t x42 = ((((uint64_t)(0x2 * x25) * x7) + ((uint64_t)x23 * x9)) + ((uint64_t)x27 * x5));
- { uint64_t x43 = (((((uint64_t)x25 * x9) + ((uint64_t)x27 * x7)) + ((uint64_t)x23 * x11)) + ((uint64_t)x29 * x5));
- { uint64_t x44 = (((((uint64_t)x27 * x9) + (0x2 * (((uint64_t)x25 * x11) + ((uint64_t)x29 * x7)))) + ((uint64_t)x23 * x13)) + ((uint64_t)x31 * x5));
- { uint64_t x45 = (((((((uint64_t)x27 * x11) + ((uint64_t)x29 * x9)) + ((uint64_t)x25 * x13)) + ((uint64_t)x31 * x7)) + ((uint64_t)x23 * x15)) + ((uint64_t)x33 * x5));
- { uint64_t x46 = (((((0x2 * ((((uint64_t)x29 * x11) + ((uint64_t)x25 * x15)) + ((uint64_t)x33 * x7))) + ((uint64_t)x27 * x13)) + ((uint64_t)x31 * x9)) + ((uint64_t)x23 * x17)) + ((uint64_t)x35 * x5));
- { uint64_t x47 = (((((((((uint64_t)x29 * x13) + ((uint64_t)x31 * x11)) + ((uint64_t)x27 * x15)) + ((uint64_t)x33 * x9)) + ((uint64_t)x25 * x17)) + ((uint64_t)x35 * x7)) + ((uint64_t)x23 * x19)) + ((uint64_t)x37 * x5));
- { uint64_t x48 = (((((((uint64_t)x31 * x13) + (0x2 * (((((uint64_t)x29 * x15) + ((uint64_t)x33 * x11)) + ((uint64_t)x25 * x19)) + ((uint64_t)x37 * x7)))) + ((uint64_t)x27 * x17)) + ((uint64_t)x35 * x9)) + ((uint64_t)x23 * x21)) + ((uint64_t)x39 * x5));
- { uint64_t x49 = (((((((((((uint64_t)x31 * x15) + ((uint64_t)x33 * x13)) + ((uint64_t)x29 * x17)) + ((uint64_t)x35 * x11)) + ((uint64_t)x27 * x19)) + ((uint64_t)x37 * x9)) + ((uint64_t)x25 * x21)) + ((uint64_t)x39 * x7)) + ((uint64_t)x23 * x20)) + ((uint64_t)x38 * x5));
- { uint64_t x50 = (((((0x2 * ((((((uint64_t)x33 * x15) + ((uint64_t)x29 * x19)) + ((uint64_t)x37 * x11)) + ((uint64_t)x25 * x20)) + ((uint64_t)x38 * x7))) + ((uint64_t)x31 * x17)) + ((uint64_t)x35 * x13)) + ((uint64_t)x27 * x21)) + ((uint64_t)x39 * x9));
- { uint64_t x51 = (((((((((uint64_t)x33 * x17) + ((uint64_t)x35 * x15)) + ((uint64_t)x31 * x19)) + ((uint64_t)x37 * x13)) + ((uint64_t)x29 * x21)) + ((uint64_t)x39 * x11)) + ((uint64_t)x27 * x20)) + ((uint64_t)x38 * x9));
- { uint64_t x52 = (((((uint64_t)x35 * x17) + (0x2 * (((((uint64_t)x33 * x19) + ((uint64_t)x37 * x15)) + ((uint64_t)x29 * x20)) + ((uint64_t)x38 * x11)))) + ((uint64_t)x31 * x21)) + ((uint64_t)x39 * x13));
- { uint64_t x53 = (((((((uint64_t)x35 * x19) + ((uint64_t)x37 * x17)) + ((uint64_t)x33 * x21)) + ((uint64_t)x39 * x15)) + ((uint64_t)x31 * x20)) + ((uint64_t)x38 * x13));
- { uint64_t x54 = (((0x2 * ((((uint64_t)x37 * x19) + ((uint64_t)x33 * x20)) + ((uint64_t)x38 * x15))) + ((uint64_t)x35 * x21)) + ((uint64_t)x39 * x17));
- { uint64_t x55 = (((((uint64_t)x37 * x21) + ((uint64_t)x39 * x19)) + ((uint64_t)x35 * x20)) + ((uint64_t)x38 * x17));
- { uint64_t x56 = (((uint64_t)x39 * x21) + (0x2 * (((uint64_t)x37 * x20) + ((uint64_t)x38 * x19))));
- { uint64_t x57 = (((uint64_t)x39 * x20) + ((uint64_t)x38 * x21));
- { uint64_t x58 = ((uint64_t)(0x2 * x38) * x20);
- { uint64_t x59 = (x48 + (x58 << 0x4));
- { uint64_t x60 = (x59 + (x58 << 0x1));
- { uint64_t x61 = (x60 + x58);
- { uint64_t x62 = (x47 + (x57 << 0x4));
- { uint64_t x63 = (x62 + (x57 << 0x1));
- { uint64_t x64 = (x63 + x57);
- { uint64_t x65 = (x46 + (x56 << 0x4));
- { uint64_t x66 = (x65 + (x56 << 0x1));
- { uint64_t x67 = (x66 + x56);
- { uint64_t x68 = (x45 + (x55 << 0x4));
- { uint64_t x69 = (x68 + (x55 << 0x1));
- { uint64_t x70 = (x69 + x55);
- { uint64_t x71 = (x44 + (x54 << 0x4));
- { uint64_t x72 = (x71 + (x54 << 0x1));
- { uint64_t x73 = (x72 + x54);
- { uint64_t x74 = (x43 + (x53 << 0x4));
- { uint64_t x75 = (x74 + (x53 << 0x1));
- { uint64_t x76 = (x75 + x53);
- { uint64_t x77 = (x42 + (x52 << 0x4));
- { uint64_t x78 = (x77 + (x52 << 0x1));
- { uint64_t x79 = (x78 + x52);
- { uint64_t x80 = (x41 + (x51 << 0x4));
- { uint64_t x81 = (x80 + (x51 << 0x1));
- { uint64_t x82 = (x81 + x51);
- { uint64_t x83 = (x40 + (x50 << 0x4));
- { uint64_t x84 = (x83 + (x50 << 0x1));
- { uint64_t x85 = (x84 + x50);
- { uint64_t x86 = (x85 >> 0x1a);
- { uint32_t x87 = ((uint32_t)x85 & 0x3ffffff);
- { uint64_t x88 = (x86 + x82);
- { uint64_t x89 = (x88 >> 0x19);
- { uint32_t x90 = ((uint32_t)x88 & 0x1ffffff);
- { uint64_t x91 = (x89 + x79);
- { uint64_t x92 = (x91 >> 0x1a);
- { uint32_t x93 = ((uint32_t)x91 & 0x3ffffff);
- { uint64_t x94 = (x92 + x76);
- { uint64_t x95 = (x94 >> 0x19);
- { uint32_t x96 = ((uint32_t)x94 & 0x1ffffff);
- { uint64_t x97 = (x95 + x73);
- { uint64_t x98 = (x97 >> 0x1a);
- { uint32_t x99 = ((uint32_t)x97 & 0x3ffffff);
- { uint64_t x100 = (x98 + x70);
- { uint64_t x101 = (x100 >> 0x19);
- { uint32_t x102 = ((uint32_t)x100 & 0x1ffffff);
- { uint64_t x103 = (x101 + x67);
- { uint64_t x104 = (x103 >> 0x1a);
- { uint32_t x105 = ((uint32_t)x103 & 0x3ffffff);
- { uint64_t x106 = (x104 + x64);
- { uint64_t x107 = (x106 >> 0x19);
- { uint32_t x108 = ((uint32_t)x106 & 0x1ffffff);
- { uint64_t x109 = (x107 + x61);
- { uint64_t x110 = (x109 >> 0x1a);
- { uint32_t x111 = ((uint32_t)x109 & 0x3ffffff);
- { uint64_t x112 = (x110 + x49);
- { uint64_t x113 = (x112 >> 0x19);
- { uint32_t x114 = ((uint32_t)x112 & 0x1ffffff);
- { uint64_t x115 = (x87 + (0x13 * x113));
- { uint32_t x116 = (uint32_t) (x115 >> 0x1a);
- { uint32_t x117 = ((uint32_t)x115 & 0x3ffffff);
- { uint32_t x118 = (x116 + x90);
- { uint32_t x119 = (x118 >> 0x19);
- { uint32_t x120 = (x118 & 0x1ffffff);
- out[0] = x117;
- out[1] = x120;
- out[2] = (x119 + x93);
- out[3] = x96;
- out[4] = x99;
- out[5] = x102;
- out[6] = x105;
- out[7] = x108;
- out[8] = x111;
- out[9] = x114;
- }}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
+ fiat_25519_carry_mul(out, in1, in2);
assert_fe(out);
}
@@ -1158,160 +397,22 @@ static void fe_mul_tll(fe *h, const fe_loose *f, const fe_loose *g) {
fe_mul_impl(h->v, f->v, g->v);
}
-static void fe_sqr_impl(uint32_t out[10], const uint32_t in1[10]) {
- assert_fe_loose(in1);
- { const uint32_t x17 = in1[9];
- { const uint32_t x18 = in1[8];
- { const uint32_t x16 = in1[7];
- { const uint32_t x14 = in1[6];
- { const uint32_t x12 = in1[5];
- { const uint32_t x10 = in1[4];
- { const uint32_t x8 = in1[3];
- { const uint32_t x6 = in1[2];
- { const uint32_t x4 = in1[1];
- { const uint32_t x2 = in1[0];
- { uint64_t x19 = ((uint64_t)x2 * x2);
- { uint64_t x20 = ((uint64_t)(0x2 * x2) * x4);
- { uint64_t x21 = (0x2 * (((uint64_t)x4 * x4) + ((uint64_t)x2 * x6)));
- { uint64_t x22 = (0x2 * (((uint64_t)x4 * x6) + ((uint64_t)x2 * x8)));
- { uint64_t x23 = ((((uint64_t)x6 * x6) + ((uint64_t)(0x4 * x4) * x8)) + ((uint64_t)(0x2 * x2) * x10));
- { uint64_t x24 = (0x2 * ((((uint64_t)x6 * x8) + ((uint64_t)x4 * x10)) + ((uint64_t)x2 * x12)));
- { uint64_t x25 = (0x2 * (((((uint64_t)x8 * x8) + ((uint64_t)x6 * x10)) + ((uint64_t)x2 * x14)) + ((uint64_t)(0x2 * x4) * x12)));
- { uint64_t x26 = (0x2 * (((((uint64_t)x8 * x10) + ((uint64_t)x6 * x12)) + ((uint64_t)x4 * x14)) + ((uint64_t)x2 * x16)));
- { uint64_t x27 = (((uint64_t)x10 * x10) + (0x2 * ((((uint64_t)x6 * x14) + ((uint64_t)x2 * x18)) + (0x2 * (((uint64_t)x4 * x16) + ((uint64_t)x8 * x12))))));
- { uint64_t x28 = (0x2 * ((((((uint64_t)x10 * x12) + ((uint64_t)x8 * x14)) + ((uint64_t)x6 * x16)) + ((uint64_t)x4 * x18)) + ((uint64_t)x2 * x17)));
- { uint64_t x29 = (0x2 * (((((uint64_t)x12 * x12) + ((uint64_t)x10 * x14)) + ((uint64_t)x6 * x18)) + (0x2 * (((uint64_t)x8 * x16) + ((uint64_t)x4 * x17)))));
- { uint64_t x30 = (0x2 * (((((uint64_t)x12 * x14) + ((uint64_t)x10 * x16)) + ((uint64_t)x8 * x18)) + ((uint64_t)x6 * x17)));
- { uint64_t x31 = (((uint64_t)x14 * x14) + (0x2 * (((uint64_t)x10 * x18) + (0x2 * (((uint64_t)x12 * x16) + ((uint64_t)x8 * x17))))));
- { uint64_t x32 = (0x2 * ((((uint64_t)x14 * x16) + ((uint64_t)x12 * x18)) + ((uint64_t)x10 * x17)));
- { uint64_t x33 = (0x2 * ((((uint64_t)x16 * x16) + ((uint64_t)x14 * x18)) + ((uint64_t)(0x2 * x12) * x17)));
- { uint64_t x34 = (0x2 * (((uint64_t)x16 * x18) + ((uint64_t)x14 * x17)));
- { uint64_t x35 = (((uint64_t)x18 * x18) + ((uint64_t)(0x4 * x16) * x17));
- { uint64_t x36 = ((uint64_t)(0x2 * x18) * x17);
- { uint64_t x37 = ((uint64_t)(0x2 * x17) * x17);
- { uint64_t x38 = (x27 + (x37 << 0x4));
- { uint64_t x39 = (x38 + (x37 << 0x1));
- { uint64_t x40 = (x39 + x37);
- { uint64_t x41 = (x26 + (x36 << 0x4));
- { uint64_t x42 = (x41 + (x36 << 0x1));
- { uint64_t x43 = (x42 + x36);
- { uint64_t x44 = (x25 + (x35 << 0x4));
- { uint64_t x45 = (x44 + (x35 << 0x1));
- { uint64_t x46 = (x45 + x35);
- { uint64_t x47 = (x24 + (x34 << 0x4));
- { uint64_t x48 = (x47 + (x34 << 0x1));
- { uint64_t x49 = (x48 + x34);
- { uint64_t x50 = (x23 + (x33 << 0x4));
- { uint64_t x51 = (x50 + (x33 << 0x1));
- { uint64_t x52 = (x51 + x33);
- { uint64_t x53 = (x22 + (x32 << 0x4));
- { uint64_t x54 = (x53 + (x32 << 0x1));
- { uint64_t x55 = (x54 + x32);
- { uint64_t x56 = (x21 + (x31 << 0x4));
- { uint64_t x57 = (x56 + (x31 << 0x1));
- { uint64_t x58 = (x57 + x31);
- { uint64_t x59 = (x20 + (x30 << 0x4));
- { uint64_t x60 = (x59 + (x30 << 0x1));
- { uint64_t x61 = (x60 + x30);
- { uint64_t x62 = (x19 + (x29 << 0x4));
- { uint64_t x63 = (x62 + (x29 << 0x1));
- { uint64_t x64 = (x63 + x29);
- { uint64_t x65 = (x64 >> 0x1a);
- { uint32_t x66 = ((uint32_t)x64 & 0x3ffffff);
- { uint64_t x67 = (x65 + x61);
- { uint64_t x68 = (x67 >> 0x19);
- { uint32_t x69 = ((uint32_t)x67 & 0x1ffffff);
- { uint64_t x70 = (x68 + x58);
- { uint64_t x71 = (x70 >> 0x1a);
- { uint32_t x72 = ((uint32_t)x70 & 0x3ffffff);
- { uint64_t x73 = (x71 + x55);
- { uint64_t x74 = (x73 >> 0x19);
- { uint32_t x75 = ((uint32_t)x73 & 0x1ffffff);
- { uint64_t x76 = (x74 + x52);
- { uint64_t x77 = (x76 >> 0x1a);
- { uint32_t x78 = ((uint32_t)x76 & 0x3ffffff);
- { uint64_t x79 = (x77 + x49);
- { uint64_t x80 = (x79 >> 0x19);
- { uint32_t x81 = ((uint32_t)x79 & 0x1ffffff);
- { uint64_t x82 = (x80 + x46);
- { uint64_t x83 = (x82 >> 0x1a);
- { uint32_t x84 = ((uint32_t)x82 & 0x3ffffff);
- { uint64_t x85 = (x83 + x43);
- { uint64_t x86 = (x85 >> 0x19);
- { uint32_t x87 = ((uint32_t)x85 & 0x1ffffff);
- { uint64_t x88 = (x86 + x40);
- { uint64_t x89 = (x88 >> 0x1a);
- { uint32_t x90 = ((uint32_t)x88 & 0x3ffffff);
- { uint64_t x91 = (x89 + x28);
- { uint64_t x92 = (x91 >> 0x19);
- { uint32_t x93 = ((uint32_t)x91 & 0x1ffffff);
- { uint64_t x94 = (x66 + (0x13 * x92));
- { uint32_t x95 = (uint32_t) (x94 >> 0x1a);
- { uint32_t x96 = ((uint32_t)x94 & 0x3ffffff);
- { uint32_t x97 = (x95 + x69);
- { uint32_t x98 = (x97 >> 0x19);
- { uint32_t x99 = (x97 & 0x1ffffff);
- out[0] = x96;
- out[1] = x99;
- out[2] = (x98 + x72);
- out[3] = x75;
- out[4] = x78;
- out[5] = x81;
- out[6] = x84;
- out[7] = x87;
- out[8] = x90;
- out[9] = x93;
- }}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
- assert_fe(out);
-}
-
static void fe_sq_tl(fe *h, const fe_loose *f) {
- fe_sqr_impl(h->v, f->v);
+ assert_fe_loose(f->v);
+ fiat_25519_carry_square(h->v, f->v);
+ assert_fe(h->v);
}
static void fe_sq_tt(fe *h, const fe *f) {
- fe_sqr_impl(h->v, f->v);
-}
-
-// Adapted from Fiat-synthesized |fe_sub_impl| with |out| = 0.
-static void fe_neg_impl(uint32_t out[10], const uint32_t in2[10]) {
- { const uint32_t x20 = 0;
- { const uint32_t x21 = 0;
- { const uint32_t x19 = 0;
- { const uint32_t x17 = 0;
- { const uint32_t x15 = 0;
- { const uint32_t x13 = 0;
- { const uint32_t x11 = 0;
- { const uint32_t x9 = 0;
- { const uint32_t x7 = 0;
- { const uint32_t x5 = 0;
- { const uint32_t x38 = in2[9];
- { const uint32_t x39 = in2[8];
- { const uint32_t x37 = in2[7];
- { const uint32_t x35 = in2[6];
- { const uint32_t x33 = in2[5];
- { const uint32_t x31 = in2[4];
- { const uint32_t x29 = in2[3];
- { const uint32_t x27 = in2[2];
- { const uint32_t x25 = in2[1];
- { const uint32_t x23 = in2[0];
- out[0] = ((0x7ffffda + x5) - x23);
- out[1] = ((0x3fffffe + x7) - x25);
- out[2] = ((0x7fffffe + x9) - x27);
- out[3] = ((0x3fffffe + x11) - x29);
- out[4] = ((0x7fffffe + x13) - x31);
- out[5] = ((0x3fffffe + x15) - x33);
- out[6] = ((0x7fffffe + x17) - x35);
- out[7] = ((0x3fffffe + x19) - x37);
- out[8] = ((0x7fffffe + x21) - x39);
- out[9] = ((0x3fffffe + x20) - x38);
- }}}}}}}}}}}}}}}}}}}}
+ assert_fe_loose(f->v);
+ fiat_25519_carry_square(h->v, f->v);
+ assert_fe(h->v);
}
// h = -f
static void fe_neg(fe_loose *h, const fe *f) {
assert_fe(f->v);
- fe_neg_impl(h->v, f->v);
+ fiat_25519_opp(h->v, f->v);
assert_fe_loose(h->v);
}
@@ -1319,18 +420,16 @@ static void fe_neg(fe_loose *h, const fe *f) {
// replace (f,g) with (f,g) if b == 0.
//
// Preconditions: b in {0,1}.
-static void fe_cmov(fe_loose *f, const fe_loose *g, unsigned b) {
+static void fe_cmov(fe_loose *f, const fe_loose *g, fe_limb_t b) {
b = 0-b;
unsigned i;
- for (i = 0; i < 10; i++) {
- uint32_t x = f->v[i] ^ g->v[i];
+ for (i = 0; i < FE_NUM_LIMBS; i++) {
+ fe_limb_t x = f->v[i] ^ g->v[i];
x &= b;
f->v[i] ^= x;
}
}
-#endif // BORINGSSL_CURVE25519_64BIT
-
// h = f
static void fe_copy(fe *h, const fe *f) {
memmove(h, f, sizeof(fe));
@@ -1514,7 +613,7 @@ static void x25519_ge_tobytes(uint8_t s[32], const ge_p2 *h) {
s[31] ^= fe_isnegative(&x) << 7;
}
-static int x25519_ge_frombytes_vartime(ge_p3 *h, const uint8_t *s) {
+static int x25519_ge_frombytes_vartime(ge_p3 *h, const uint8_t s[32]) {
fe u;
fe_loose v;
fe v3;
@@ -1545,7 +644,7 @@ static int x25519_ge_frombytes_vartime(ge_p3 *h, const uint8_t *s) {
if (fe_isnonzero(&check)) {
fe_add(&check, &vxx, &u);
if (fe_isnonzero(&check)) {
- return -1;
+ return 0;
}
fe_mul_ttt(&h->X, &h->X, &sqrtm1);
}
@@ -1557,7 +656,7 @@ static int x25519_ge_frombytes_vartime(ge_p3 *h, const uint8_t *s) {
}
fe_mul_ttt(&h->T, &h->X, &h->Y);
- return 0;
+ return 1;
}
static void ge_p2_0(ge_p2 *h) {
@@ -1728,10 +827,12 @@ static void x25519_ge_scalarmult_small_precomp(
unsigned i;
for (i = 0; i < 15; i++) {
+ // The precomputed table is assumed to already clear the top bit, so
+ // |fe_frombytes_strict| may be used directly.
const uint8_t *bytes = &precomp_table[i*(2 * 32)];
fe x, y;
- fe_frombytes(&x, bytes);
- fe_frombytes(&y, bytes + 32);
+ fe_frombytes_strict(&x, bytes);
+ fe_frombytes_strict(&y, bytes + 32);
ge_precomp *out = &multiples[i];
fe_add(&out->yplusx, &y, &x);
@@ -1929,6 +1030,12 @@ static void x25519_ge_scalarmult(ge_p2 *r, const uint8_t *scalar,
}
}
+// int64_lshift21 returns |a << 21| but is defined when shifting bits into the
+// sign bit. This works around a language flaw in C.
+static inline int64_t int64_lshift21(int64_t a) {
+ return (int64_t)((uint64_t)a << 21);
+}
+
// The set of scalars is \Z/l
// where l = 2^252 + 27742317777372353535851937790883648493.
@@ -2032,38 +1139,38 @@ static void x25519_sc_reduce(uint8_t s[64]) {
carry6 = (s6 + (1 << 20)) >> 21;
s7 += carry6;
- s6 -= carry6 << 21;
+ s6 -= int64_lshift21(carry6);
carry8 = (s8 + (1 << 20)) >> 21;
s9 += carry8;
- s8 -= carry8 << 21;
+ s8 -= int64_lshift21(carry8);
carry10 = (s10 + (1 << 20)) >> 21;
s11 += carry10;
- s10 -= carry10 << 21;
+ s10 -= int64_lshift21(carry10);
carry12 = (s12 + (1 << 20)) >> 21;
s13 += carry12;
- s12 -= carry12 << 21;
+ s12 -= int64_lshift21(carry12);
carry14 = (s14 + (1 << 20)) >> 21;
s15 += carry14;
- s14 -= carry14 << 21;
+ s14 -= int64_lshift21(carry14);
carry16 = (s16 + (1 << 20)) >> 21;
s17 += carry16;
- s16 -= carry16 << 21;
+ s16 -= int64_lshift21(carry16);
carry7 = (s7 + (1 << 20)) >> 21;
s8 += carry7;
- s7 -= carry7 << 21;
+ s7 -= int64_lshift21(carry7);
carry9 = (s9 + (1 << 20)) >> 21;
s10 += carry9;
- s9 -= carry9 << 21;
+ s9 -= int64_lshift21(carry9);
carry11 = (s11 + (1 << 20)) >> 21;
s12 += carry11;
- s11 -= carry11 << 21;
+ s11 -= int64_lshift21(carry11);
carry13 = (s13 + (1 << 20)) >> 21;
s14 += carry13;
- s13 -= carry13 << 21;
+ s13 -= int64_lshift21(carry13);
carry15 = (s15 + (1 << 20)) >> 21;
s16 += carry15;
- s15 -= carry15 << 21;
+ s15 -= int64_lshift21(carry15);
s5 += s17 * 666643;
s6 += s17 * 470296;
@@ -2115,41 +1222,41 @@ static void x25519_sc_reduce(uint8_t s[64]) {
carry0 = (s0 + (1 << 20)) >> 21;
s1 += carry0;
- s0 -= carry0 << 21;
+ s0 -= int64_lshift21(carry0);
carry2 = (s2 + (1 << 20)) >> 21;
s3 += carry2;
- s2 -= carry2 << 21;
+ s2 -= int64_lshift21(carry2);
carry4 = (s4 + (1 << 20)) >> 21;
s5 += carry4;
- s4 -= carry4 << 21;
+ s4 -= int64_lshift21(carry4);
carry6 = (s6 + (1 << 20)) >> 21;
s7 += carry6;
- s6 -= carry6 << 21;
+ s6 -= int64_lshift21(carry6);
carry8 = (s8 + (1 << 20)) >> 21;
s9 += carry8;
- s8 -= carry8 << 21;
+ s8 -= int64_lshift21(carry8);
carry10 = (s10 + (1 << 20)) >> 21;
s11 += carry10;
- s10 -= carry10 << 21;
+ s10 -= int64_lshift21(carry10);
carry1 = (s1 + (1 << 20)) >> 21;
s2 += carry1;
- s1 -= carry1 << 21;
+ s1 -= int64_lshift21(carry1);
carry3 = (s3 + (1 << 20)) >> 21;
s4 += carry3;
- s3 -= carry3 << 21;
+ s3 -= int64_lshift21(carry3);
carry5 = (s5 + (1 << 20)) >> 21;
s6 += carry5;
- s5 -= carry5 << 21;
+ s5 -= int64_lshift21(carry5);
carry7 = (s7 + (1 << 20)) >> 21;
s8 += carry7;
- s7 -= carry7 << 21;
+ s7 -= int64_lshift21(carry7);
carry9 = (s9 + (1 << 20)) >> 21;
s10 += carry9;
- s9 -= carry9 << 21;
+ s9 -= int64_lshift21(carry9);
carry11 = (s11 + (1 << 20)) >> 21;
s12 += carry11;
- s11 -= carry11 << 21;
+ s11 -= int64_lshift21(carry11);
s0 += s12 * 666643;
s1 += s12 * 470296;
@@ -2161,40 +1268,40 @@ static void x25519_sc_reduce(uint8_t s[64]) {
carry0 = s0 >> 21;
s1 += carry0;
- s0 -= carry0 << 21;
+ s0 -= int64_lshift21(carry0);
carry1 = s1 >> 21;
s2 += carry1;
- s1 -= carry1 << 21;
+ s1 -= int64_lshift21(carry1);
carry2 = s2 >> 21;
s3 += carry2;
- s2 -= carry2 << 21;
+ s2 -= int64_lshift21(carry2);
carry3 = s3 >> 21;
s4 += carry3;
- s3 -= carry3 << 21;
+ s3 -= int64_lshift21(carry3);
carry4 = s4 >> 21;
s5 += carry4;
- s4 -= carry4 << 21;
+ s4 -= int64_lshift21(carry4);
carry5 = s5 >> 21;
s6 += carry5;
- s5 -= carry5 << 21;
+ s5 -= int64_lshift21(carry5);
carry6 = s6 >> 21;
s7 += carry6;
- s6 -= carry6 << 21;
+ s6 -= int64_lshift21(carry6);
carry7 = s7 >> 21;
s8 += carry7;
- s7 -= carry7 << 21;
+ s7 -= int64_lshift21(carry7);
carry8 = s8 >> 21;
s9 += carry8;
- s8 -= carry8 << 21;
+ s8 -= int64_lshift21(carry8);
carry9 = s9 >> 21;
s10 += carry9;
- s9 -= carry9 << 21;
+ s9 -= int64_lshift21(carry9);
carry10 = s10 >> 21;
s11 += carry10;
- s10 -= carry10 << 21;
+ s10 -= int64_lshift21(carry10);
carry11 = s11 >> 21;
s12 += carry11;
- s11 -= carry11 << 21;
+ s11 -= int64_lshift21(carry11);
s0 += s12 * 666643;
s1 += s12 * 470296;
@@ -2206,37 +1313,37 @@ static void x25519_sc_reduce(uint8_t s[64]) {
carry0 = s0 >> 21;
s1 += carry0;
- s0 -= carry0 << 21;
+ s0 -= int64_lshift21(carry0);
carry1 = s1 >> 21;
s2 += carry1;
- s1 -= carry1 << 21;
+ s1 -= int64_lshift21(carry1);
carry2 = s2 >> 21;
s3 += carry2;
- s2 -= carry2 << 21;
+ s2 -= int64_lshift21(carry2);
carry3 = s3 >> 21;
s4 += carry3;
- s3 -= carry3 << 21;
+ s3 -= int64_lshift21(carry3);
carry4 = s4 >> 21;
s5 += carry4;
- s4 -= carry4 << 21;
+ s4 -= int64_lshift21(carry4);
carry5 = s5 >> 21;
s6 += carry5;
- s5 -= carry5 << 21;
+ s5 -= int64_lshift21(carry5);
carry6 = s6 >> 21;
s7 += carry6;
- s6 -= carry6 << 21;
+ s6 -= int64_lshift21(carry6);
carry7 = s7 >> 21;
s8 += carry7;
- s7 -= carry7 << 21;
+ s7 -= int64_lshift21(carry7);
carry8 = s8 >> 21;
s9 += carry8;
- s8 -= carry8 << 21;
+ s8 -= int64_lshift21(carry8);
carry9 = s9 >> 21;
s10 += carry9;
- s9 -= carry9 << 21;
+ s9 -= int64_lshift21(carry9);
carry10 = s10 >> 21;
s11 += carry10;
- s10 -= carry10 << 21;
+ s10 -= int64_lshift21(carry10);
s[0] = s0 >> 0;
s[1] = s0 >> 8;
@@ -2596,7 +1703,7 @@ builtin_edwards25519_result(krb5_context context, groupdata *gdata,
* subgroup even if a rogue peer sends a point which is not.
*/
ge_p3 Qmasked;
- if (x25519_ge_frombytes_vartime(&Qmasked, theirpub) != 0)
+ if (!x25519_ge_frombytes_vartime(&Qmasked, theirpub))
return EINVAL;
/* Compute w mod p. */
diff --git a/src/plugins/preauth/spake/edwards25519_fiat.h b/src/plugins/preauth/spake/edwards25519_fiat.h
new file mode 100644
index 0000000..b61cb49
--- /dev/null
+++ b/src/plugins/preauth/spake/edwards25519_fiat.h
@@ -0,0 +1,1289 @@
+#if defined(BORINGSSL_CURVE25519_64BIT)
+
+/* Autogenerated */
+/* curve description: 25519 */
+/* requested operations: carry_mul, carry_square, carry_scmul121666, carry, add, sub, opp, selectznz, to_bytes, from_bytes */
+/* n = 5 (from "5") */
+/* s = 0x8000000000000000000000000000000000000000000000000000000000000000 (from "2^255") */
+/* c = [(1, 19)] (from "1,19") */
+/* machine_wordsize = 64 (from "64") */
+
+#include <stdint.h>
+typedef unsigned char fiat_25519_uint1;
+typedef signed char fiat_25519_int1;
+typedef signed __int128 fiat_25519_int128;
+typedef unsigned __int128 fiat_25519_uint128;
+
+
+/*
+ * Input Bounds:
+ * arg1: [0x0 ~> 0x1]
+ * arg2: [0x0 ~> 0x7ffffffffffff]
+ * arg3: [0x0 ~> 0x7ffffffffffff]
+ * Output Bounds:
+ * out1: [0x0 ~> 0x7ffffffffffff]
+ * out2: [0x0 ~> 0x1]
+ */
+static void fiat_25519_addcarryx_u51(uint64_t* out1, fiat_25519_uint1* out2, fiat_25519_uint1 arg1, uint64_t arg2, uint64_t arg3) {
+ uint64_t x1 = ((arg1 + arg2) + arg3);
+ uint64_t x2 = (x1 & UINT64_C(0x7ffffffffffff));
+ fiat_25519_uint1 x3 = (fiat_25519_uint1)(x1 >> 51);
+ *out1 = x2;
+ *out2 = x3;
+}
+
+/*
+ * Input Bounds:
+ * arg1: [0x0 ~> 0x1]
+ * arg2: [0x0 ~> 0x7ffffffffffff]
+ * arg3: [0x0 ~> 0x7ffffffffffff]
+ * Output Bounds:
+ * out1: [0x0 ~> 0x7ffffffffffff]
+ * out2: [0x0 ~> 0x1]
+ */
+static void fiat_25519_subborrowx_u51(uint64_t* out1, fiat_25519_uint1* out2, fiat_25519_uint1 arg1, uint64_t arg2, uint64_t arg3) {
+ int64_t x1 = ((int64_t)(arg2 - (int64_t)arg1) - (int64_t)arg3);
+ fiat_25519_int1 x2 = (fiat_25519_int1)(x1 >> 51);
+ uint64_t x3 = (x1 & UINT64_C(0x7ffffffffffff));
+ *out1 = x3;
+ *out2 = (fiat_25519_uint1)(0x0 - x2);
+}
+
+/*
+ * Input Bounds:
+ * arg1: [0x0 ~> 0x1]
+ * arg2: [0x0 ~> 0xffffffffffffffff]
+ * arg3: [0x0 ~> 0xffffffffffffffff]
+ * Output Bounds:
+ * out1: [0x0 ~> 0xffffffffffffffff]
+ */
+static void fiat_25519_cmovznz_u64(uint64_t* out1, fiat_25519_uint1 arg1, uint64_t arg2, uint64_t arg3) {
+ fiat_25519_uint1 x1 = (!(!arg1));
+ uint64_t x2 = ((fiat_25519_int1)(0x0 - x1) & UINT64_C(0xffffffffffffffff));
+ uint64_t x3 = ((x2 & arg3) | ((~x2) & arg2));
+ *out1 = x3;
+}
+
+/*
+ * Input Bounds:
+ * arg1: [[0x0 ~> 0x1a666666666664], [0x0 ~> 0x1a666666666664], [0x0 ~> 0x1a666666666664], [0x0 ~> 0x1a666666666664], [0x0 ~> 0x1a666666666664]]
+ * arg2: [[0x0 ~> 0x1a666666666664], [0x0 ~> 0x1a666666666664], [0x0 ~> 0x1a666666666664], [0x0 ~> 0x1a666666666664], [0x0 ~> 0x1a666666666664]]
+ * Output Bounds:
+ * out1: [[0x0 ~> 0x8cccccccccccc], [0x0 ~> 0x8cccccccccccc], [0x0 ~> 0x8cccccccccccc], [0x0 ~> 0x8cccccccccccc], [0x0 ~> 0x8cccccccccccc]]
+ */
+static void fiat_25519_carry_mul(uint64_t out1[5], const uint64_t arg1[5], const uint64_t arg2[5]) {
+ fiat_25519_uint128 x1 = ((fiat_25519_uint128)(arg1[4]) * ((arg2[4]) * (uint64_t)UINT8_C(0x13)));
+ fiat_25519_uint128 x2 = ((fiat_25519_uint128)(arg1[4]) * ((arg2[3]) * (uint64_t)UINT8_C(0x13)));
+ fiat_25519_uint128 x3 = ((fiat_25519_uint128)(arg1[4]) * ((arg2[2]) * (uint64_t)UINT8_C(0x13)));
+ fiat_25519_uint128 x4 = ((fiat_25519_uint128)(arg1[4]) * ((arg2[1]) * (uint64_t)UINT8_C(0x13)));
+ fiat_25519_uint128 x5 = ((fiat_25519_uint128)(arg1[3]) * ((arg2[4]) * (uint64_t)UINT8_C(0x13)));
+ fiat_25519_uint128 x6 = ((fiat_25519_uint128)(arg1[3]) * ((arg2[3]) * (uint64_t)UINT8_C(0x13)));
+ fiat_25519_uint128 x7 = ((fiat_25519_uint128)(arg1[3]) * ((arg2[2]) * (uint64_t)UINT8_C(0x13)));
+ fiat_25519_uint128 x8 = ((fiat_25519_uint128)(arg1[2]) * ((arg2[4]) * (uint64_t)UINT8_C(0x13)));
+ fiat_25519_uint128 x9 = ((fiat_25519_uint128)(arg1[2]) * ((arg2[3]) * (uint64_t)UINT8_C(0x13)));
+ fiat_25519_uint128 x10 = ((fiat_25519_uint128)(arg1[1]) * ((arg2[4]) * (uint64_t)UINT8_C(0x13)));
+ fiat_25519_uint128 x11 = ((fiat_25519_uint128)(arg1[4]) * (arg2[0]));
+ fiat_25519_uint128 x12 = ((fiat_25519_uint128)(arg1[3]) * (arg2[1]));
+ fiat_25519_uint128 x13 = ((fiat_25519_uint128)(arg1[3]) * (arg2[0]));
+ fiat_25519_uint128 x14 = ((fiat_25519_uint128)(arg1[2]) * (arg2[2]));
+ fiat_25519_uint128 x15 = ((fiat_25519_uint128)(arg1[2]) * (arg2[1]));
+ fiat_25519_uint128 x16 = ((fiat_25519_uint128)(arg1[2]) * (arg2[0]));
+ fiat_25519_uint128 x17 = ((fiat_25519_uint128)(arg1[1]) * (arg2[3]));
+ fiat_25519_uint128 x18 = ((fiat_25519_uint128)(arg1[1]) * (arg2[2]));
+ fiat_25519_uint128 x19 = ((fiat_25519_uint128)(arg1[1]) * (arg2[1]));
+ fiat_25519_uint128 x20 = ((fiat_25519_uint128)(arg1[1]) * (arg2[0]));
+ fiat_25519_uint128 x21 = ((fiat_25519_uint128)(arg1[0]) * (arg2[4]));
+ fiat_25519_uint128 x22 = ((fiat_25519_uint128)(arg1[0]) * (arg2[3]));
+ fiat_25519_uint128 x23 = ((fiat_25519_uint128)(arg1[0]) * (arg2[2]));
+ fiat_25519_uint128 x24 = ((fiat_25519_uint128)(arg1[0]) * (arg2[1]));
+ fiat_25519_uint128 x25 = ((fiat_25519_uint128)(arg1[0]) * (arg2[0]));
+ fiat_25519_uint128 x26 = (x25 + (x10 + (x9 + (x7 + x4))));
+ uint64_t x27 = (uint64_t)(x26 >> 51);
+ uint64_t x28 = (uint64_t)(x26 & UINT64_C(0x7ffffffffffff));
+ fiat_25519_uint128 x29 = (x21 + (x17 + (x14 + (x12 + x11))));
+ fiat_25519_uint128 x30 = (x22 + (x18 + (x15 + (x13 + x1))));
+ fiat_25519_uint128 x31 = (x23 + (x19 + (x16 + (x5 + x2))));
+ fiat_25519_uint128 x32 = (x24 + (x20 + (x8 + (x6 + x3))));
+ fiat_25519_uint128 x33 = (x27 + x32);
+ uint64_t x34 = (uint64_t)(x33 >> 51);
+ uint64_t x35 = (uint64_t)(x33 & UINT64_C(0x7ffffffffffff));
+ fiat_25519_uint128 x36 = (x34 + x31);
+ uint64_t x37 = (uint64_t)(x36 >> 51);
+ uint64_t x38 = (uint64_t)(x36 & UINT64_C(0x7ffffffffffff));
+ fiat_25519_uint128 x39 = (x37 + x30);
+ uint64_t x40 = (uint64_t)(x39 >> 51);
+ uint64_t x41 = (uint64_t)(x39 & UINT64_C(0x7ffffffffffff));
+ fiat_25519_uint128 x42 = (x40 + x29);
+ uint64_t x43 = (uint64_t)(x42 >> 51);
+ uint64_t x44 = (uint64_t)(x42 & UINT64_C(0x7ffffffffffff));
+ uint64_t x45 = (x43 * (uint64_t)UINT8_C(0x13));
+ uint64_t x46 = (x28 + x45);
+ uint64_t x47 = (x46 >> 51);
+ uint64_t x48 = (x46 & UINT64_C(0x7ffffffffffff));
+ uint64_t x49 = (x47 + x35);
+ uint64_t x50 = (x49 >> 51);
+ uint64_t x51 = (x49 & UINT64_C(0x7ffffffffffff));
+ uint64_t x52 = (x50 + x38);
+ out1[0] = x48;
+ out1[1] = x51;
+ out1[2] = x52;
+ out1[3] = x41;
+ out1[4] = x44;
+}
+
+/*
+ * Input Bounds:
+ * arg1: [[0x0 ~> 0x1a666666666664], [0x0 ~> 0x1a666666666664], [0x0 ~> 0x1a666666666664], [0x0 ~> 0x1a666666666664], [0x0 ~> 0x1a666666666664]]
+ * Output Bounds:
+ * out1: [[0x0 ~> 0x8cccccccccccc], [0x0 ~> 0x8cccccccccccc], [0x0 ~> 0x8cccccccccccc], [0x0 ~> 0x8cccccccccccc], [0x0 ~> 0x8cccccccccccc]]
+ */
+static void fiat_25519_carry_square(uint64_t out1[5], const uint64_t arg1[5]) {
+ uint64_t x1 = ((arg1[4]) * (uint64_t)UINT8_C(0x13));
+ uint64_t x2 = (x1 * (uint64_t)0x2);
+ uint64_t x3 = ((arg1[4]) * (uint64_t)0x2);
+ uint64_t x4 = ((arg1[3]) * (uint64_t)UINT8_C(0x13));
+ uint64_t x5 = (x4 * (uint64_t)0x2);
+ uint64_t x6 = ((arg1[3]) * (uint64_t)0x2);
+ uint64_t x7 = ((arg1[2]) * (uint64_t)0x2);
+ uint64_t x8 = ((arg1[1]) * (uint64_t)0x2);
+ fiat_25519_uint128 x9 = ((fiat_25519_uint128)(arg1[4]) * x1);
+ fiat_25519_uint128 x10 = ((fiat_25519_uint128)(arg1[3]) * x2);
+ fiat_25519_uint128 x11 = ((fiat_25519_uint128)(arg1[3]) * x4);
+ fiat_25519_uint128 x12 = ((fiat_25519_uint128)(arg1[2]) * x2);
+ fiat_25519_uint128 x13 = ((fiat_25519_uint128)(arg1[2]) * x5);
+ fiat_25519_uint128 x14 = ((fiat_25519_uint128)(arg1[2]) * (arg1[2]));
+ fiat_25519_uint128 x15 = ((fiat_25519_uint128)(arg1[1]) * x2);
+ fiat_25519_uint128 x16 = ((fiat_25519_uint128)(arg1[1]) * x6);
+ fiat_25519_uint128 x17 = ((fiat_25519_uint128)(arg1[1]) * x7);
+ fiat_25519_uint128 x18 = ((fiat_25519_uint128)(arg1[1]) * (arg1[1]));
+ fiat_25519_uint128 x19 = ((fiat_25519_uint128)(arg1[0]) * x3);
+ fiat_25519_uint128 x20 = ((fiat_25519_uint128)(arg1[0]) * x6);
+ fiat_25519_uint128 x21 = ((fiat_25519_uint128)(arg1[0]) * x7);
+ fiat_25519_uint128 x22 = ((fiat_25519_uint128)(arg1[0]) * x8);
+ fiat_25519_uint128 x23 = ((fiat_25519_uint128)(arg1[0]) * (arg1[0]));
+ fiat_25519_uint128 x24 = (x23 + (x15 + x13));
+ uint64_t x25 = (uint64_t)(x24 >> 51);
+ uint64_t x26 = (uint64_t)(x24 & UINT64_C(0x7ffffffffffff));
+ fiat_25519_uint128 x27 = (x19 + (x16 + x14));
+ fiat_25519_uint128 x28 = (x20 + (x17 + x9));
+ fiat_25519_uint128 x29 = (x21 + (x18 + x10));
+ fiat_25519_uint128 x30 = (x22 + (x12 + x11));
+ fiat_25519_uint128 x31 = (x25 + x30);
+ uint64_t x32 = (uint64_t)(x31 >> 51);
+ uint64_t x33 = (uint64_t)(x31 & UINT64_C(0x7ffffffffffff));
+ fiat_25519_uint128 x34 = (x32 + x29);
+ uint64_t x35 = (uint64_t)(x34 >> 51);
+ uint64_t x36 = (uint64_t)(x34 & UINT64_C(0x7ffffffffffff));
+ fiat_25519_uint128 x37 = (x35 + x28);
+ uint64_t x38 = (uint64_t)(x37 >> 51);
+ uint64_t x39 = (uint64_t)(x37 & UINT64_C(0x7ffffffffffff));
+ fiat_25519_uint128 x40 = (x38 + x27);
+ uint64_t x41 = (uint64_t)(x40 >> 51);
+ uint64_t x42 = (uint64_t)(x40 & UINT64_C(0x7ffffffffffff));
+ uint64_t x43 = (x41 * (uint64_t)UINT8_C(0x13));
+ uint64_t x44 = (x26 + x43);
+ uint64_t x45 = (x44 >> 51);
+ uint64_t x46 = (x44 & UINT64_C(0x7ffffffffffff));
+ uint64_t x47 = (x45 + x33);
+ uint64_t x48 = (x47 >> 51);
+ uint64_t x49 = (x47 & UINT64_C(0x7ffffffffffff));
+ uint64_t x50 = (x48 + x36);
+ out1[0] = x46;
+ out1[1] = x49;
+ out1[2] = x50;
+ out1[3] = x39;
+ out1[4] = x42;
+}
+
+/*
+ * Input Bounds:
+ * arg1: [[0x0 ~> 0x1a666666666664], [0x0 ~> 0x1a666666666664], [0x0 ~> 0x1a666666666664], [0x0 ~> 0x1a666666666664], [0x0 ~> 0x1a666666666664]]
+ * Output Bounds:
+ * out1: [[0x0 ~> 0x8cccccccccccc], [0x0 ~> 0x8cccccccccccc], [0x0 ~> 0x8cccccccccccc], [0x0 ~> 0x8cccccccccccc], [0x0 ~> 0x8cccccccccccc]]
+ */
+static void fiat_25519_carry(uint64_t out1[5], const uint64_t arg1[5]) {
+ uint64_t x1 = (arg1[0]);
+ uint64_t x2 = ((x1 >> 51) + (arg1[1]));
+ uint64_t x3 = ((x2 >> 51) + (arg1[2]));
+ uint64_t x4 = ((x3 >> 51) + (arg1[3]));
+ uint64_t x5 = ((x4 >> 51) + (arg1[4]));
+ uint64_t x6 = ((x1 & UINT64_C(0x7ffffffffffff)) + ((x5 >> 51) * (uint64_t)UINT8_C(0x13)));
+ uint64_t x7 = ((x6 >> 51) + (x2 & UINT64_C(0x7ffffffffffff)));
+ uint64_t x8 = (x6 & UINT64_C(0x7ffffffffffff));
+ uint64_t x9 = (x7 & UINT64_C(0x7ffffffffffff));
+ uint64_t x10 = ((x7 >> 51) + (x3 & UINT64_C(0x7ffffffffffff)));
+ uint64_t x11 = (x4 & UINT64_C(0x7ffffffffffff));
+ uint64_t x12 = (x5 & UINT64_C(0x7ffffffffffff));
+ out1[0] = x8;
+ out1[1] = x9;
+ out1[2] = x10;
+ out1[3] = x11;
+ out1[4] = x12;
+}
+
+/*
+ * Input Bounds:
+ * arg1: [[0x0 ~> 0x8cccccccccccc], [0x0 ~> 0x8cccccccccccc], [0x0 ~> 0x8cccccccccccc], [0x0 ~> 0x8cccccccccccc], [0x0 ~> 0x8cccccccccccc]]
+ * arg2: [[0x0 ~> 0x8cccccccccccc], [0x0 ~> 0x8cccccccccccc], [0x0 ~> 0x8cccccccccccc], [0x0 ~> 0x8cccccccccccc], [0x0 ~> 0x8cccccccccccc]]
+ * Output Bounds:
+ * out1: [[0x0 ~> 0x1a666666666664], [0x0 ~> 0x1a666666666664], [0x0 ~> 0x1a666666666664], [0x0 ~> 0x1a666666666664], [0x0 ~> 0x1a666666666664]]
+ */
+static void fiat_25519_add(uint64_t out1[5], const uint64_t arg1[5], const uint64_t arg2[5]) {
+ uint64_t x1 = ((arg1[0]) + (arg2[0]));
+ uint64_t x2 = ((arg1[1]) + (arg2[1]));
+ uint64_t x3 = ((arg1[2]) + (arg2[2]));
+ uint64_t x4 = ((arg1[3]) + (arg2[3]));
+ uint64_t x5 = ((arg1[4]) + (arg2[4]));
+ out1[0] = x1;
+ out1[1] = x2;
+ out1[2] = x3;
+ out1[3] = x4;
+ out1[4] = x5;
+}
+
+/*
+ * Input Bounds:
+ * arg1: [[0x0 ~> 0x8cccccccccccc], [0x0 ~> 0x8cccccccccccc], [0x0 ~> 0x8cccccccccccc], [0x0 ~> 0x8cccccccccccc], [0x0 ~> 0x8cccccccccccc]]
+ * arg2: [[0x0 ~> 0x8cccccccccccc], [0x0 ~> 0x8cccccccccccc], [0x0 ~> 0x8cccccccccccc], [0x0 ~> 0x8cccccccccccc], [0x0 ~> 0x8cccccccccccc]]
+ * Output Bounds:
+ * out1: [[0x0 ~> 0x1a666666666664], [0x0 ~> 0x1a666666666664], [0x0 ~> 0x1a666666666664], [0x0 ~> 0x1a666666666664], [0x0 ~> 0x1a666666666664]]
+ */
+static void fiat_25519_sub(uint64_t out1[5], const uint64_t arg1[5], const uint64_t arg2[5]) {
+ uint64_t x1 = ((UINT64_C(0xfffffffffffda) + (arg1[0])) - (arg2[0]));
+ uint64_t x2 = ((UINT64_C(0xffffffffffffe) + (arg1[1])) - (arg2[1]));
+ uint64_t x3 = ((UINT64_C(0xffffffffffffe) + (arg1[2])) - (arg2[2]));
+ uint64_t x4 = ((UINT64_C(0xffffffffffffe) + (arg1[3])) - (arg2[3]));
+ uint64_t x5 = ((UINT64_C(0xffffffffffffe) + (arg1[4])) - (arg2[4]));
+ out1[0] = x1;
+ out1[1] = x2;
+ out1[2] = x3;
+ out1[3] = x4;
+ out1[4] = x5;
+}
+
+/*
+ * Input Bounds:
+ * arg1: [[0x0 ~> 0x8cccccccccccc], [0x0 ~> 0x8cccccccccccc], [0x0 ~> 0x8cccccccccccc], [0x0 ~> 0x8cccccccccccc], [0x0 ~> 0x8cccccccccccc]]
+ * Output Bounds:
+ * out1: [[0x0 ~> 0x1a666666666664], [0x0 ~> 0x1a666666666664], [0x0 ~> 0x1a666666666664], [0x0 ~> 0x1a666666666664], [0x0 ~> 0x1a666666666664]]
+ */
+static void fiat_25519_opp(uint64_t out1[5], const uint64_t arg1[5]) {
+ uint64_t x1 = (UINT64_C(0xfffffffffffda) - (arg1[0]));
+ uint64_t x2 = (UINT64_C(0xffffffffffffe) - (arg1[1]));
+ uint64_t x3 = (UINT64_C(0xffffffffffffe) - (arg1[2]));
+ uint64_t x4 = (UINT64_C(0xffffffffffffe) - (arg1[3]));
+ uint64_t x5 = (UINT64_C(0xffffffffffffe) - (arg1[4]));
+ out1[0] = x1;
+ out1[1] = x2;
+ out1[2] = x3;
+ out1[3] = x4;
+ out1[4] = x5;
+}
+
+/*
+ * Input Bounds:
+ * arg1: [[0x0 ~> 0x8cccccccccccc], [0x0 ~> 0x8cccccccccccc], [0x0 ~> 0x8cccccccccccc], [0x0 ~> 0x8cccccccccccc], [0x0 ~> 0x8cccccccccccc]]
+ * Output Bounds:
+ * out1: [[0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0x7f]]
+ */
+static void fiat_25519_to_bytes(uint8_t out1[32], const uint64_t arg1[5]) {
+ uint64_t x1;
+ fiat_25519_uint1 x2;
+ fiat_25519_subborrowx_u51(&x1, &x2, 0x0, (arg1[0]), UINT64_C(0x7ffffffffffed));
+ uint64_t x3;
+ fiat_25519_uint1 x4;
+ fiat_25519_subborrowx_u51(&x3, &x4, x2, (arg1[1]), UINT64_C(0x7ffffffffffff));
+ uint64_t x5;
+ fiat_25519_uint1 x6;
+ fiat_25519_subborrowx_u51(&x5, &x6, x4, (arg1[2]), UINT64_C(0x7ffffffffffff));
+ uint64_t x7;
+ fiat_25519_uint1 x8;
+ fiat_25519_subborrowx_u51(&x7, &x8, x6, (arg1[3]), UINT64_C(0x7ffffffffffff));
+ uint64_t x9;
+ fiat_25519_uint1 x10;
+ fiat_25519_subborrowx_u51(&x9, &x10, x8, (arg1[4]), UINT64_C(0x7ffffffffffff));
+ uint64_t x11;
+ fiat_25519_cmovznz_u64(&x11, x10, 0x0, UINT64_C(0xffffffffffffffff));
+ uint64_t x12;
+ fiat_25519_uint1 x13;
+ fiat_25519_addcarryx_u51(&x12, &x13, 0x0, (x11 & UINT64_C(0x7ffffffffffed)), x1);
+ uint64_t x14;
+ fiat_25519_uint1 x15;
+ fiat_25519_addcarryx_u51(&x14, &x15, x13, (x11 & UINT64_C(0x7ffffffffffff)), x3);
+ uint64_t x16;
+ fiat_25519_uint1 x17;
+ fiat_25519_addcarryx_u51(&x16, &x17, x15, (x11 & UINT64_C(0x7ffffffffffff)), x5);
+ uint64_t x18;
+ fiat_25519_uint1 x19;
+ fiat_25519_addcarryx_u51(&x18, &x19, x17, (x11 & UINT64_C(0x7ffffffffffff)), x7);
+ uint64_t x20;
+ fiat_25519_uint1 x21;
+ fiat_25519_addcarryx_u51(&x20, &x21, x19, (x11 & UINT64_C(0x7ffffffffffff)), x9);
+ uint64_t x22 = (x20 << 4);
+ uint64_t x23 = (x18 * (uint64_t)0x2);
+ uint64_t x24 = (x16 << 6);
+ uint64_t x25 = (x14 << 3);
+ uint64_t x26 = (x12 >> 8);
+ uint8_t x27 = (uint8_t)(x12 & UINT8_C(0xff));
+ uint64_t x28 = (x26 >> 8);
+ uint8_t x29 = (uint8_t)(x26 & UINT8_C(0xff));
+ uint64_t x30 = (x28 >> 8);
+ uint8_t x31 = (uint8_t)(x28 & UINT8_C(0xff));
+ uint64_t x32 = (x30 >> 8);
+ uint8_t x33 = (uint8_t)(x30 & UINT8_C(0xff));
+ uint64_t x34 = (x32 >> 8);
+ uint8_t x35 = (uint8_t)(x32 & UINT8_C(0xff));
+ uint8_t x36 = (uint8_t)(x34 >> 8);
+ uint8_t x37 = (uint8_t)(x34 & UINT8_C(0xff));
+ uint64_t x38 = (x36 + x25);
+ uint64_t x39 = (x38 >> 8);
+ uint8_t x40 = (uint8_t)(x38 & UINT8_C(0xff));
+ uint64_t x41 = (x39 >> 8);
+ uint8_t x42 = (uint8_t)(x39 & UINT8_C(0xff));
+ uint64_t x43 = (x41 >> 8);
+ uint8_t x44 = (uint8_t)(x41 & UINT8_C(0xff));
+ uint64_t x45 = (x43 >> 8);
+ uint8_t x46 = (uint8_t)(x43 & UINT8_C(0xff));
+ uint64_t x47 = (x45 >> 8);
+ uint8_t x48 = (uint8_t)(x45 & UINT8_C(0xff));
+ uint8_t x49 = (uint8_t)(x47 >> 8);
+ uint8_t x50 = (uint8_t)(x47 & UINT8_C(0xff));
+ uint64_t x51 = (x49 + x24);
+ uint64_t x52 = (x51 >> 8);
+ uint8_t x53 = (uint8_t)(x51 & UINT8_C(0xff));
+ uint64_t x54 = (x52 >> 8);
+ uint8_t x55 = (uint8_t)(x52 & UINT8_C(0xff));
+ uint64_t x56 = (x54 >> 8);
+ uint8_t x57 = (uint8_t)(x54 & UINT8_C(0xff));
+ uint64_t x58 = (x56 >> 8);
+ uint8_t x59 = (uint8_t)(x56 & UINT8_C(0xff));
+ uint64_t x60 = (x58 >> 8);
+ uint8_t x61 = (uint8_t)(x58 & UINT8_C(0xff));
+ uint64_t x62 = (x60 >> 8);
+ uint8_t x63 = (uint8_t)(x60 & UINT8_C(0xff));
+ fiat_25519_uint1 x64 = (fiat_25519_uint1)(x62 >> 8);
+ uint8_t x65 = (uint8_t)(x62 & UINT8_C(0xff));
+ uint64_t x66 = (x64 + x23);
+ uint64_t x67 = (x66 >> 8);
+ uint8_t x68 = (uint8_t)(x66 & UINT8_C(0xff));
+ uint64_t x69 = (x67 >> 8);
+ uint8_t x70 = (uint8_t)(x67 & UINT8_C(0xff));
+ uint64_t x71 = (x69 >> 8);
+ uint8_t x72 = (uint8_t)(x69 & UINT8_C(0xff));
+ uint64_t x73 = (x71 >> 8);
+ uint8_t x74 = (uint8_t)(x71 & UINT8_C(0xff));
+ uint64_t x75 = (x73 >> 8);
+ uint8_t x76 = (uint8_t)(x73 & UINT8_C(0xff));
+ uint8_t x77 = (uint8_t)(x75 >> 8);
+ uint8_t x78 = (uint8_t)(x75 & UINT8_C(0xff));
+ uint64_t x79 = (x77 + x22);
+ uint64_t x80 = (x79 >> 8);
+ uint8_t x81 = (uint8_t)(x79 & UINT8_C(0xff));
+ uint64_t x82 = (x80 >> 8);
+ uint8_t x83 = (uint8_t)(x80 & UINT8_C(0xff));
+ uint64_t x84 = (x82 >> 8);
+ uint8_t x85 = (uint8_t)(x82 & UINT8_C(0xff));
+ uint64_t x86 = (x84 >> 8);
+ uint8_t x87 = (uint8_t)(x84 & UINT8_C(0xff));
+ uint64_t x88 = (x86 >> 8);
+ uint8_t x89 = (uint8_t)(x86 & UINT8_C(0xff));
+ uint8_t x90 = (uint8_t)(x88 >> 8);
+ uint8_t x91 = (uint8_t)(x88 & UINT8_C(0xff));
+ out1[0] = x27;
+ out1[1] = x29;
+ out1[2] = x31;
+ out1[3] = x33;
+ out1[4] = x35;
+ out1[5] = x37;
+ out1[6] = x40;
+ out1[7] = x42;
+ out1[8] = x44;
+ out1[9] = x46;
+ out1[10] = x48;
+ out1[11] = x50;
+ out1[12] = x53;
+ out1[13] = x55;
+ out1[14] = x57;
+ out1[15] = x59;
+ out1[16] = x61;
+ out1[17] = x63;
+ out1[18] = x65;
+ out1[19] = x68;
+ out1[20] = x70;
+ out1[21] = x72;
+ out1[22] = x74;
+ out1[23] = x76;
+ out1[24] = x78;
+ out1[25] = x81;
+ out1[26] = x83;
+ out1[27] = x85;
+ out1[28] = x87;
+ out1[29] = x89;
+ out1[30] = x91;
+ out1[31] = x90;
+}
+
+/*
+ * Input Bounds:
+ * arg1: [[0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0x7f]]
+ * Output Bounds:
+ * out1: [[0x0 ~> 0x8cccccccccccc], [0x0 ~> 0x8cccccccccccc], [0x0 ~> 0x8cccccccccccc], [0x0 ~> 0x8cccccccccccc], [0x0 ~> 0x8cccccccccccc]]
+ */
+static void fiat_25519_from_bytes(uint64_t out1[5], const uint8_t arg1[32]) {
+ uint64_t x1 = ((uint64_t)(arg1[31]) << 44);
+ uint64_t x2 = ((uint64_t)(arg1[30]) << 36);
+ uint64_t x3 = ((uint64_t)(arg1[29]) << 28);
+ uint64_t x4 = ((uint64_t)(arg1[28]) << 20);
+ uint64_t x5 = ((uint64_t)(arg1[27]) << 12);
+ uint64_t x6 = ((uint64_t)(arg1[26]) << 4);
+ uint64_t x7 = ((uint64_t)(arg1[25]) << 47);
+ uint64_t x8 = ((uint64_t)(arg1[24]) << 39);
+ uint64_t x9 = ((uint64_t)(arg1[23]) << 31);
+ uint64_t x10 = ((uint64_t)(arg1[22]) << 23);
+ uint64_t x11 = ((uint64_t)(arg1[21]) << 15);
+ uint64_t x12 = ((uint64_t)(arg1[20]) << 7);
+ uint64_t x13 = ((uint64_t)(arg1[19]) << 50);
+ uint64_t x14 = ((uint64_t)(arg1[18]) << 42);
+ uint64_t x15 = ((uint64_t)(arg1[17]) << 34);
+ uint64_t x16 = ((uint64_t)(arg1[16]) << 26);
+ uint64_t x17 = ((uint64_t)(arg1[15]) << 18);
+ uint64_t x18 = ((uint64_t)(arg1[14]) << 10);
+ uint64_t x19 = ((uint64_t)(arg1[13]) << 2);
+ uint64_t x20 = ((uint64_t)(arg1[12]) << 45);
+ uint64_t x21 = ((uint64_t)(arg1[11]) << 37);
+ uint64_t x22 = ((uint64_t)(arg1[10]) << 29);
+ uint64_t x23 = ((uint64_t)(arg1[9]) << 21);
+ uint64_t x24 = ((uint64_t)(arg1[8]) << 13);
+ uint64_t x25 = ((uint64_t)(arg1[7]) << 5);
+ uint64_t x26 = ((uint64_t)(arg1[6]) << 48);
+ uint64_t x27 = ((uint64_t)(arg1[5]) << 40);
+ uint64_t x28 = ((uint64_t)(arg1[4]) << 32);
+ uint64_t x29 = ((uint64_t)(arg1[3]) << 24);
+ uint64_t x30 = ((uint64_t)(arg1[2]) << 16);
+ uint64_t x31 = ((uint64_t)(arg1[1]) << 8);
+ uint8_t x32 = (arg1[0]);
+ uint64_t x33 = (x32 + (x31 + (x30 + (x29 + (x28 + (x27 + x26))))));
+ uint8_t x34 = (uint8_t)(x33 >> 51);
+ uint64_t x35 = (x33 & UINT64_C(0x7ffffffffffff));
+ uint64_t x36 = (x6 + (x5 + (x4 + (x3 + (x2 + x1)))));
+ uint64_t x37 = (x12 + (x11 + (x10 + (x9 + (x8 + x7)))));
+ uint64_t x38 = (x19 + (x18 + (x17 + (x16 + (x15 + (x14 + x13))))));
+ uint64_t x39 = (x25 + (x24 + (x23 + (x22 + (x21 + x20)))));
+ uint64_t x40 = (x34 + x39);
+ uint8_t x41 = (uint8_t)(x40 >> 51);
+ uint64_t x42 = (x40 & UINT64_C(0x7ffffffffffff));
+ uint64_t x43 = (x41 + x38);
+ uint8_t x44 = (uint8_t)(x43 >> 51);
+ uint64_t x45 = (x43 & UINT64_C(0x7ffffffffffff));
+ uint64_t x46 = (x44 + x37);
+ uint8_t x47 = (uint8_t)(x46 >> 51);
+ uint64_t x48 = (x46 & UINT64_C(0x7ffffffffffff));
+ uint64_t x49 = (x47 + x36);
+ out1[0] = x35;
+ out1[1] = x42;
+ out1[2] = x45;
+ out1[3] = x48;
+ out1[4] = x49;
+}
+
+#else /* defined(BORINGSSL_CURVE25519_64BIT) */
+
+/* Autogenerated */
+/* curve description: 25519 */
+/* requested operations: carry_mul, carry_square, carry_scmul121666, carry, add, sub, opp, selectznz, to_bytes, from_bytes */
+/* n = 10 (from "10") */
+/* s = 0x8000000000000000000000000000000000000000000000000000000000000000 (from "2^255") */
+/* c = [(1, 19)] (from "1,19") */
+/* machine_wordsize = 32 (from "32") */
+
+#include <stdint.h>
+typedef unsigned char fiat_25519_uint1;
+typedef signed char fiat_25519_int1;
+
+
+/*
+ * Input Bounds:
+ * arg1: [0x0 ~> 0x1]
+ * arg2: [0x0 ~> 0x3ffffff]
+ * arg3: [0x0 ~> 0x3ffffff]
+ * Output Bounds:
+ * out1: [0x0 ~> 0x3ffffff]
+ * out2: [0x0 ~> 0x1]
+ */
+static void fiat_25519_addcarryx_u26(uint32_t* out1, fiat_25519_uint1* out2, fiat_25519_uint1 arg1, uint32_t arg2, uint32_t arg3) {
+ uint32_t x1 = ((arg1 + arg2) + arg3);
+ uint32_t x2 = (x1 & UINT32_C(0x3ffffff));
+ fiat_25519_uint1 x3 = (fiat_25519_uint1)(x1 >> 26);
+ *out1 = x2;
+ *out2 = x3;
+}
+
+/*
+ * Input Bounds:
+ * arg1: [0x0 ~> 0x1]
+ * arg2: [0x0 ~> 0x3ffffff]
+ * arg3: [0x0 ~> 0x3ffffff]
+ * Output Bounds:
+ * out1: [0x0 ~> 0x3ffffff]
+ * out2: [0x0 ~> 0x1]
+ */
+static void fiat_25519_subborrowx_u26(uint32_t* out1, fiat_25519_uint1* out2, fiat_25519_uint1 arg1, uint32_t arg2, uint32_t arg3) {
+ int32_t x1 = ((int32_t)(arg2 - arg1) - (int32_t)arg3);
+ fiat_25519_int1 x2 = (fiat_25519_int1)(x1 >> 26);
+ uint32_t x3 = (x1 & UINT32_C(0x3ffffff));
+ *out1 = x3;
+ *out2 = (fiat_25519_uint1)(0x0 - x2);
+}
+
+/*
+ * Input Bounds:
+ * arg1: [0x0 ~> 0x1]
+ * arg2: [0x0 ~> 0x1ffffff]
+ * arg3: [0x0 ~> 0x1ffffff]
+ * Output Bounds:
+ * out1: [0x0 ~> 0x1ffffff]
+ * out2: [0x0 ~> 0x1]
+ */
+static void fiat_25519_addcarryx_u25(uint32_t* out1, fiat_25519_uint1* out2, fiat_25519_uint1 arg1, uint32_t arg2, uint32_t arg3) {
+ uint32_t x1 = ((arg1 + arg2) + arg3);
+ uint32_t x2 = (x1 & UINT32_C(0x1ffffff));
+ fiat_25519_uint1 x3 = (fiat_25519_uint1)(x1 >> 25);
+ *out1 = x2;
+ *out2 = x3;
+}
+
+/*
+ * Input Bounds:
+ * arg1: [0x0 ~> 0x1]
+ * arg2: [0x0 ~> 0x1ffffff]
+ * arg3: [0x0 ~> 0x1ffffff]
+ * Output Bounds:
+ * out1: [0x0 ~> 0x1ffffff]
+ * out2: [0x0 ~> 0x1]
+ */
+static void fiat_25519_subborrowx_u25(uint32_t* out1, fiat_25519_uint1* out2, fiat_25519_uint1 arg1, uint32_t arg2, uint32_t arg3) {
+ int32_t x1 = ((int32_t)(arg2 - arg1) - (int32_t)arg3);
+ fiat_25519_int1 x2 = (fiat_25519_int1)(x1 >> 25);
+ uint32_t x3 = (x1 & UINT32_C(0x1ffffff));
+ *out1 = x3;
+ *out2 = (fiat_25519_uint1)(0x0 - x2);
+}
+
+/*
+ * Input Bounds:
+ * arg1: [0x0 ~> 0x1]
+ * arg2: [0x0 ~> 0xffffffff]
+ * arg3: [0x0 ~> 0xffffffff]
+ * Output Bounds:
+ * out1: [0x0 ~> 0xffffffff]
+ */
+static void fiat_25519_cmovznz_u32(uint32_t* out1, fiat_25519_uint1 arg1, uint32_t arg2, uint32_t arg3) {
+ fiat_25519_uint1 x1 = (!(!arg1));
+ uint32_t x2 = ((fiat_25519_int1)(0x0 - x1) & UINT32_C(0xffffffff));
+ uint32_t x3 = ((x2 & arg3) | ((~x2) & arg2));
+ *out1 = x3;
+}
+
+/*
+ * Input Bounds:
+ * arg1: [[0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999]]
+ * arg2: [[0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999]]
+ * Output Bounds:
+ * out1: [[0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333]]
+ */
+static void fiat_25519_carry_mul(uint32_t out1[10], const uint32_t arg1[10], const uint32_t arg2[10]) {
+ uint64_t x1 = ((uint64_t)(arg1[9]) * ((arg2[9]) * ((uint32_t)0x2 * UINT8_C(0x13))));
+ uint64_t x2 = ((uint64_t)(arg1[9]) * ((arg2[8]) * (uint32_t)UINT8_C(0x13)));
+ uint64_t x3 = ((uint64_t)(arg1[9]) * ((arg2[7]) * ((uint32_t)0x2 * UINT8_C(0x13))));
+ uint64_t x4 = ((uint64_t)(arg1[9]) * ((arg2[6]) * (uint32_t)UINT8_C(0x13)));
+ uint64_t x5 = ((uint64_t)(arg1[9]) * ((arg2[5]) * ((uint32_t)0x2 * UINT8_C(0x13))));
+ uint64_t x6 = ((uint64_t)(arg1[9]) * ((arg2[4]) * (uint32_t)UINT8_C(0x13)));
+ uint64_t x7 = ((uint64_t)(arg1[9]) * ((arg2[3]) * ((uint32_t)0x2 * UINT8_C(0x13))));
+ uint64_t x8 = ((uint64_t)(arg1[9]) * ((arg2[2]) * (uint32_t)UINT8_C(0x13)));
+ uint64_t x9 = ((uint64_t)(arg1[9]) * ((arg2[1]) * ((uint32_t)0x2 * UINT8_C(0x13))));
+ uint64_t x10 = ((uint64_t)(arg1[8]) * ((arg2[9]) * (uint32_t)UINT8_C(0x13)));
+ uint64_t x11 = ((uint64_t)(arg1[8]) * ((arg2[8]) * (uint32_t)UINT8_C(0x13)));
+ uint64_t x12 = ((uint64_t)(arg1[8]) * ((arg2[7]) * (uint32_t)UINT8_C(0x13)));
+ uint64_t x13 = ((uint64_t)(arg1[8]) * ((arg2[6]) * (uint32_t)UINT8_C(0x13)));
+ uint64_t x14 = ((uint64_t)(arg1[8]) * ((arg2[5]) * (uint32_t)UINT8_C(0x13)));
+ uint64_t x15 = ((uint64_t)(arg1[8]) * ((arg2[4]) * (uint32_t)UINT8_C(0x13)));
+ uint64_t x16 = ((uint64_t)(arg1[8]) * ((arg2[3]) * (uint32_t)UINT8_C(0x13)));
+ uint64_t x17 = ((uint64_t)(arg1[8]) * ((arg2[2]) * (uint32_t)UINT8_C(0x13)));
+ uint64_t x18 = ((uint64_t)(arg1[7]) * ((arg2[9]) * ((uint32_t)0x2 * UINT8_C(0x13))));
+ uint64_t x19 = ((uint64_t)(arg1[7]) * ((arg2[8]) * (uint32_t)UINT8_C(0x13)));
+ uint64_t x20 = ((uint64_t)(arg1[7]) * ((arg2[7]) * ((uint32_t)0x2 * UINT8_C(0x13))));
+ uint64_t x21 = ((uint64_t)(arg1[7]) * ((arg2[6]) * (uint32_t)UINT8_C(0x13)));
+ uint64_t x22 = ((uint64_t)(arg1[7]) * ((arg2[5]) * ((uint32_t)0x2 * UINT8_C(0x13))));
+ uint64_t x23 = ((uint64_t)(arg1[7]) * ((arg2[4]) * (uint32_t)UINT8_C(0x13)));
+ uint64_t x24 = ((uint64_t)(arg1[7]) * ((arg2[3]) * ((uint32_t)0x2 * UINT8_C(0x13))));
+ uint64_t x25 = ((uint64_t)(arg1[6]) * ((arg2[9]) * (uint32_t)UINT8_C(0x13)));
+ uint64_t x26 = ((uint64_t)(arg1[6]) * ((arg2[8]) * (uint32_t)UINT8_C(0x13)));
+ uint64_t x27 = ((uint64_t)(arg1[6]) * ((arg2[7]) * (uint32_t)UINT8_C(0x13)));
+ uint64_t x28 = ((uint64_t)(arg1[6]) * ((arg2[6]) * (uint32_t)UINT8_C(0x13)));
+ uint64_t x29 = ((uint64_t)(arg1[6]) * ((arg2[5]) * (uint32_t)UINT8_C(0x13)));
+ uint64_t x30 = ((uint64_t)(arg1[6]) * ((arg2[4]) * (uint32_t)UINT8_C(0x13)));
+ uint64_t x31 = ((uint64_t)(arg1[5]) * ((arg2[9]) * ((uint32_t)0x2 * UINT8_C(0x13))));
+ uint64_t x32 = ((uint64_t)(arg1[5]) * ((arg2[8]) * (uint32_t)UINT8_C(0x13)));
+ uint64_t x33 = ((uint64_t)(arg1[5]) * ((arg2[7]) * ((uint32_t)0x2 * UINT8_C(0x13))));
+ uint64_t x34 = ((uint64_t)(arg1[5]) * ((arg2[6]) * (uint32_t)UINT8_C(0x13)));
+ uint64_t x35 = ((uint64_t)(arg1[5]) * ((arg2[5]) * ((uint32_t)0x2 * UINT8_C(0x13))));
+ uint64_t x36 = ((uint64_t)(arg1[4]) * ((arg2[9]) * (uint32_t)UINT8_C(0x13)));
+ uint64_t x37 = ((uint64_t)(arg1[4]) * ((arg2[8]) * (uint32_t)UINT8_C(0x13)));
+ uint64_t x38 = ((uint64_t)(arg1[4]) * ((arg2[7]) * (uint32_t)UINT8_C(0x13)));
+ uint64_t x39 = ((uint64_t)(arg1[4]) * ((arg2[6]) * (uint32_t)UINT8_C(0x13)));
+ uint64_t x40 = ((uint64_t)(arg1[3]) * ((arg2[9]) * ((uint32_t)0x2 * UINT8_C(0x13))));
+ uint64_t x41 = ((uint64_t)(arg1[3]) * ((arg2[8]) * (uint32_t)UINT8_C(0x13)));
+ uint64_t x42 = ((uint64_t)(arg1[3]) * ((arg2[7]) * ((uint32_t)0x2 * UINT8_C(0x13))));
+ uint64_t x43 = ((uint64_t)(arg1[2]) * ((arg2[9]) * (uint32_t)UINT8_C(0x13)));
+ uint64_t x44 = ((uint64_t)(arg1[2]) * ((arg2[8]) * (uint32_t)UINT8_C(0x13)));
+ uint64_t x45 = ((uint64_t)(arg1[1]) * ((arg2[9]) * ((uint32_t)0x2 * UINT8_C(0x13))));
+ uint64_t x46 = ((uint64_t)(arg1[9]) * (arg2[0]));
+ uint64_t x47 = ((uint64_t)(arg1[8]) * (arg2[1]));
+ uint64_t x48 = ((uint64_t)(arg1[8]) * (arg2[0]));
+ uint64_t x49 = ((uint64_t)(arg1[7]) * (arg2[2]));
+ uint64_t x50 = ((uint64_t)(arg1[7]) * ((arg2[1]) * (uint32_t)0x2));
+ uint64_t x51 = ((uint64_t)(arg1[7]) * (arg2[0]));
+ uint64_t x52 = ((uint64_t)(arg1[6]) * (arg2[3]));
+ uint64_t x53 = ((uint64_t)(arg1[6]) * (arg2[2]));
+ uint64_t x54 = ((uint64_t)(arg1[6]) * (arg2[1]));
+ uint64_t x55 = ((uint64_t)(arg1[6]) * (arg2[0]));
+ uint64_t x56 = ((uint64_t)(arg1[5]) * (arg2[4]));
+ uint64_t x57 = ((uint64_t)(arg1[5]) * ((arg2[3]) * (uint32_t)0x2));
+ uint64_t x58 = ((uint64_t)(arg1[5]) * (arg2[2]));
+ uint64_t x59 = ((uint64_t)(arg1[5]) * ((arg2[1]) * (uint32_t)0x2));
+ uint64_t x60 = ((uint64_t)(arg1[5]) * (arg2[0]));
+ uint64_t x61 = ((uint64_t)(arg1[4]) * (arg2[5]));
+ uint64_t x62 = ((uint64_t)(arg1[4]) * (arg2[4]));
+ uint64_t x63 = ((uint64_t)(arg1[4]) * (arg2[3]));
+ uint64_t x64 = ((uint64_t)(arg1[4]) * (arg2[2]));
+ uint64_t x65 = ((uint64_t)(arg1[4]) * (arg2[1]));
+ uint64_t x66 = ((uint64_t)(arg1[4]) * (arg2[0]));
+ uint64_t x67 = ((uint64_t)(arg1[3]) * (arg2[6]));
+ uint64_t x68 = ((uint64_t)(arg1[3]) * ((arg2[5]) * (uint32_t)0x2));
+ uint64_t x69 = ((uint64_t)(arg1[3]) * (arg2[4]));
+ uint64_t x70 = ((uint64_t)(arg1[3]) * ((arg2[3]) * (uint32_t)0x2));
+ uint64_t x71 = ((uint64_t)(arg1[3]) * (arg2[2]));
+ uint64_t x72 = ((uint64_t)(arg1[3]) * ((arg2[1]) * (uint32_t)0x2));
+ uint64_t x73 = ((uint64_t)(arg1[3]) * (arg2[0]));
+ uint64_t x74 = ((uint64_t)(arg1[2]) * (arg2[7]));
+ uint64_t x75 = ((uint64_t)(arg1[2]) * (arg2[6]));
+ uint64_t x76 = ((uint64_t)(arg1[2]) * (arg2[5]));
+ uint64_t x77 = ((uint64_t)(arg1[2]) * (arg2[4]));
+ uint64_t x78 = ((uint64_t)(arg1[2]) * (arg2[3]));
+ uint64_t x79 = ((uint64_t)(arg1[2]) * (arg2[2]));
+ uint64_t x80 = ((uint64_t)(arg1[2]) * (arg2[1]));
+ uint64_t x81 = ((uint64_t)(arg1[2]) * (arg2[0]));
+ uint64_t x82 = ((uint64_t)(arg1[1]) * (arg2[8]));
+ uint64_t x83 = ((uint64_t)(arg1[1]) * ((arg2[7]) * (uint32_t)0x2));
+ uint64_t x84 = ((uint64_t)(arg1[1]) * (arg2[6]));
+ uint64_t x85 = ((uint64_t)(arg1[1]) * ((arg2[5]) * (uint32_t)0x2));
+ uint64_t x86 = ((uint64_t)(arg1[1]) * (arg2[4]));
+ uint64_t x87 = ((uint64_t)(arg1[1]) * ((arg2[3]) * (uint32_t)0x2));
+ uint64_t x88 = ((uint64_t)(arg1[1]) * (arg2[2]));
+ uint64_t x89 = ((uint64_t)(arg1[1]) * ((arg2[1]) * (uint32_t)0x2));
+ uint64_t x90 = ((uint64_t)(arg1[1]) * (arg2[0]));
+ uint64_t x91 = ((uint64_t)(arg1[0]) * (arg2[9]));
+ uint64_t x92 = ((uint64_t)(arg1[0]) * (arg2[8]));
+ uint64_t x93 = ((uint64_t)(arg1[0]) * (arg2[7]));
+ uint64_t x94 = ((uint64_t)(arg1[0]) * (arg2[6]));
+ uint64_t x95 = ((uint64_t)(arg1[0]) * (arg2[5]));
+ uint64_t x96 = ((uint64_t)(arg1[0]) * (arg2[4]));
+ uint64_t x97 = ((uint64_t)(arg1[0]) * (arg2[3]));
+ uint64_t x98 = ((uint64_t)(arg1[0]) * (arg2[2]));
+ uint64_t x99 = ((uint64_t)(arg1[0]) * (arg2[1]));
+ uint64_t x100 = ((uint64_t)(arg1[0]) * (arg2[0]));
+ uint64_t x101 = (x100 + (x45 + (x44 + (x42 + (x39 + (x35 + (x30 + (x24 + (x17 + x9)))))))));
+ uint64_t x102 = (x101 >> 26);
+ uint32_t x103 = (uint32_t)(x101 & UINT32_C(0x3ffffff));
+ uint64_t x104 = (x91 + (x82 + (x74 + (x67 + (x61 + (x56 + (x52 + (x49 + (x47 + x46)))))))));
+ uint64_t x105 = (x92 + (x83 + (x75 + (x68 + (x62 + (x57 + (x53 + (x50 + (x48 + x1)))))))));
+ uint64_t x106 = (x93 + (x84 + (x76 + (x69 + (x63 + (x58 + (x54 + (x51 + (x10 + x2)))))))));
+ uint64_t x107 = (x94 + (x85 + (x77 + (x70 + (x64 + (x59 + (x55 + (x18 + (x11 + x3)))))))));
+ uint64_t x108 = (x95 + (x86 + (x78 + (x71 + (x65 + (x60 + (x25 + (x19 + (x12 + x4)))))))));
+ uint64_t x109 = (x96 + (x87 + (x79 + (x72 + (x66 + (x31 + (x26 + (x20 + (x13 + x5)))))))));
+ uint64_t x110 = (x97 + (x88 + (x80 + (x73 + (x36 + (x32 + (x27 + (x21 + (x14 + x6)))))))));
+ uint64_t x111 = (x98 + (x89 + (x81 + (x40 + (x37 + (x33 + (x28 + (x22 + (x15 + x7)))))))));
+ uint64_t x112 = (x99 + (x90 + (x43 + (x41 + (x38 + (x34 + (x29 + (x23 + (x16 + x8)))))))));
+ uint64_t x113 = (x102 + x112);
+ uint64_t x114 = (x113 >> 25);
+ uint32_t x115 = (uint32_t)(x113 & UINT32_C(0x1ffffff));
+ uint64_t x116 = (x114 + x111);
+ uint64_t x117 = (x116 >> 26);
+ uint32_t x118 = (uint32_t)(x116 & UINT32_C(0x3ffffff));
+ uint64_t x119 = (x117 + x110);
+ uint64_t x120 = (x119 >> 25);
+ uint32_t x121 = (uint32_t)(x119 & UINT32_C(0x1ffffff));
+ uint64_t x122 = (x120 + x109);
+ uint64_t x123 = (x122 >> 26);
+ uint32_t x124 = (uint32_t)(x122 & UINT32_C(0x3ffffff));
+ uint64_t x125 = (x123 + x108);
+ uint64_t x126 = (x125 >> 25);
+ uint32_t x127 = (uint32_t)(x125 & UINT32_C(0x1ffffff));
+ uint64_t x128 = (x126 + x107);
+ uint64_t x129 = (x128 >> 26);
+ uint32_t x130 = (uint32_t)(x128 & UINT32_C(0x3ffffff));
+ uint64_t x131 = (x129 + x106);
+ uint64_t x132 = (x131 >> 25);
+ uint32_t x133 = (uint32_t)(x131 & UINT32_C(0x1ffffff));
+ uint64_t x134 = (x132 + x105);
+ uint64_t x135 = (x134 >> 26);
+ uint32_t x136 = (uint32_t)(x134 & UINT32_C(0x3ffffff));
+ uint64_t x137 = (x135 + x104);
+ uint64_t x138 = (x137 >> 25);
+ uint32_t x139 = (uint32_t)(x137 & UINT32_C(0x1ffffff));
+ uint64_t x140 = (x138 * (uint64_t)UINT8_C(0x13));
+ uint64_t x141 = (x103 + x140);
+ uint32_t x142 = (uint32_t)(x141 >> 26);
+ uint32_t x143 = (uint32_t)(x141 & UINT32_C(0x3ffffff));
+ uint32_t x144 = (x142 + x115);
+ uint32_t x145 = (x144 >> 25);
+ uint32_t x146 = (x144 & UINT32_C(0x1ffffff));
+ uint32_t x147 = (x145 + x118);
+ out1[0] = x143;
+ out1[1] = x146;
+ out1[2] = x147;
+ out1[3] = x121;
+ out1[4] = x124;
+ out1[5] = x127;
+ out1[6] = x130;
+ out1[7] = x133;
+ out1[8] = x136;
+ out1[9] = x139;
+}
+
+/*
+ * Input Bounds:
+ * arg1: [[0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999]]
+ * Output Bounds:
+ * out1: [[0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333]]
+ */
+static void fiat_25519_carry_square(uint32_t out1[10], const uint32_t arg1[10]) {
+ uint32_t x1 = ((arg1[9]) * (uint32_t)UINT8_C(0x13));
+ uint32_t x2 = (x1 * (uint32_t)0x2);
+ uint32_t x3 = ((arg1[9]) * (uint32_t)0x2);
+ uint32_t x4 = ((arg1[8]) * (uint32_t)UINT8_C(0x13));
+ uint64_t x5 = (x4 * (uint64_t)0x2);
+ uint32_t x6 = ((arg1[8]) * (uint32_t)0x2);
+ uint32_t x7 = ((arg1[7]) * (uint32_t)UINT8_C(0x13));
+ uint32_t x8 = (x7 * (uint32_t)0x2);
+ uint32_t x9 = ((arg1[7]) * (uint32_t)0x2);
+ uint32_t x10 = ((arg1[6]) * (uint32_t)UINT8_C(0x13));
+ uint64_t x11 = (x10 * (uint64_t)0x2);
+ uint32_t x12 = ((arg1[6]) * (uint32_t)0x2);
+ uint32_t x13 = ((arg1[5]) * (uint32_t)UINT8_C(0x13));
+ uint32_t x14 = ((arg1[5]) * (uint32_t)0x2);
+ uint32_t x15 = ((arg1[4]) * (uint32_t)0x2);
+ uint32_t x16 = ((arg1[3]) * (uint32_t)0x2);
+ uint32_t x17 = ((arg1[2]) * (uint32_t)0x2);
+ uint32_t x18 = ((arg1[1]) * (uint32_t)0x2);
+ uint64_t x19 = ((uint64_t)(arg1[9]) * (x1 * (uint32_t)0x2));
+ uint64_t x20 = ((uint64_t)(arg1[8]) * x2);
+ uint64_t x21 = ((uint64_t)(arg1[8]) * x4);
+ uint64_t x22 = ((arg1[7]) * (x2 * (uint64_t)0x2));
+ uint64_t x23 = ((arg1[7]) * x5);
+ uint64_t x24 = ((uint64_t)(arg1[7]) * (x7 * (uint32_t)0x2));
+ uint64_t x25 = ((uint64_t)(arg1[6]) * x2);
+ uint64_t x26 = ((arg1[6]) * x5);
+ uint64_t x27 = ((uint64_t)(arg1[6]) * x8);
+ uint64_t x28 = ((uint64_t)(arg1[6]) * x10);
+ uint64_t x29 = ((arg1[5]) * (x2 * (uint64_t)0x2));
+ uint64_t x30 = ((arg1[5]) * x5);
+ uint64_t x31 = ((arg1[5]) * (x8 * (uint64_t)0x2));
+ uint64_t x32 = ((arg1[5]) * x11);
+ uint64_t x33 = ((uint64_t)(arg1[5]) * (x13 * (uint32_t)0x2));
+ uint64_t x34 = ((uint64_t)(arg1[4]) * x2);
+ uint64_t x35 = ((arg1[4]) * x5);
+ uint64_t x36 = ((uint64_t)(arg1[4]) * x8);
+ uint64_t x37 = ((arg1[4]) * x11);
+ uint64_t x38 = ((uint64_t)(arg1[4]) * x14);
+ uint64_t x39 = ((uint64_t)(arg1[4]) * (arg1[4]));
+ uint64_t x40 = ((arg1[3]) * (x2 * (uint64_t)0x2));
+ uint64_t x41 = ((arg1[3]) * x5);
+ uint64_t x42 = ((arg1[3]) * (x8 * (uint64_t)0x2));
+ uint64_t x43 = ((uint64_t)(arg1[3]) * x12);
+ uint64_t x44 = ((uint64_t)(arg1[3]) * (x14 * (uint32_t)0x2));
+ uint64_t x45 = ((uint64_t)(arg1[3]) * x15);
+ uint64_t x46 = ((uint64_t)(arg1[3]) * ((arg1[3]) * (uint32_t)0x2));
+ uint64_t x47 = ((uint64_t)(arg1[2]) * x2);
+ uint64_t x48 = ((arg1[2]) * x5);
+ uint64_t x49 = ((uint64_t)(arg1[2]) * x9);
+ uint64_t x50 = ((uint64_t)(arg1[2]) * x12);
+ uint64_t x51 = ((uint64_t)(arg1[2]) * x14);
+ uint64_t x52 = ((uint64_t)(arg1[2]) * x15);
+ uint64_t x53 = ((uint64_t)(arg1[2]) * x16);
+ uint64_t x54 = ((uint64_t)(arg1[2]) * (arg1[2]));
+ uint64_t x55 = ((arg1[1]) * (x2 * (uint64_t)0x2));
+ uint64_t x56 = ((uint64_t)(arg1[1]) * x6);
+ uint64_t x57 = ((uint64_t)(arg1[1]) * (x9 * (uint32_t)0x2));
+ uint64_t x58 = ((uint64_t)(arg1[1]) * x12);
+ uint64_t x59 = ((uint64_t)(arg1[1]) * (x14 * (uint32_t)0x2));
+ uint64_t x60 = ((uint64_t)(arg1[1]) * x15);
+ uint64_t x61 = ((uint64_t)(arg1[1]) * (x16 * (uint32_t)0x2));
+ uint64_t x62 = ((uint64_t)(arg1[1]) * x17);
+ uint64_t x63 = ((uint64_t)(arg1[1]) * ((arg1[1]) * (uint32_t)0x2));
+ uint64_t x64 = ((uint64_t)(arg1[0]) * x3);
+ uint64_t x65 = ((uint64_t)(arg1[0]) * x6);
+ uint64_t x66 = ((uint64_t)(arg1[0]) * x9);
+ uint64_t x67 = ((uint64_t)(arg1[0]) * x12);
+ uint64_t x68 = ((uint64_t)(arg1[0]) * x14);
+ uint64_t x69 = ((uint64_t)(arg1[0]) * x15);
+ uint64_t x70 = ((uint64_t)(arg1[0]) * x16);
+ uint64_t x71 = ((uint64_t)(arg1[0]) * x17);
+ uint64_t x72 = ((uint64_t)(arg1[0]) * x18);
+ uint64_t x73 = ((uint64_t)(arg1[0]) * (arg1[0]));
+ uint64_t x74 = (x73 + (x55 + (x48 + (x42 + (x37 + x33)))));
+ uint64_t x75 = (x74 >> 26);
+ uint32_t x76 = (uint32_t)(x74 & UINT32_C(0x3ffffff));
+ uint64_t x77 = (x64 + (x56 + (x49 + (x43 + x38))));
+ uint64_t x78 = (x65 + (x57 + (x50 + (x44 + (x39 + x19)))));
+ uint64_t x79 = (x66 + (x58 + (x51 + (x45 + x20))));
+ uint64_t x80 = (x67 + (x59 + (x52 + (x46 + (x22 + x21)))));
+ uint64_t x81 = (x68 + (x60 + (x53 + (x25 + x23))));
+ uint64_t x82 = (x69 + (x61 + (x54 + (x29 + (x26 + x24)))));
+ uint64_t x83 = (x70 + (x62 + (x34 + (x30 + x27))));
+ uint64_t x84 = (x71 + (x63 + (x40 + (x35 + (x31 + x28)))));
+ uint64_t x85 = (x72 + (x47 + (x41 + (x36 + x32))));
+ uint64_t x86 = (x75 + x85);
+ uint64_t x87 = (x86 >> 25);
+ uint32_t x88 = (uint32_t)(x86 & UINT32_C(0x1ffffff));
+ uint64_t x89 = (x87 + x84);
+ uint64_t x90 = (x89 >> 26);
+ uint32_t x91 = (uint32_t)(x89 & UINT32_C(0x3ffffff));
+ uint64_t x92 = (x90 + x83);
+ uint64_t x93 = (x92 >> 25);
+ uint32_t x94 = (uint32_t)(x92 & UINT32_C(0x1ffffff));
+ uint64_t x95 = (x93 + x82);
+ uint64_t x96 = (x95 >> 26);
+ uint32_t x97 = (uint32_t)(x95 & UINT32_C(0x3ffffff));
+ uint64_t x98 = (x96 + x81);
+ uint64_t x99 = (x98 >> 25);
+ uint32_t x100 = (uint32_t)(x98 & UINT32_C(0x1ffffff));
+ uint64_t x101 = (x99 + x80);
+ uint64_t x102 = (x101 >> 26);
+ uint32_t x103 = (uint32_t)(x101 & UINT32_C(0x3ffffff));
+ uint64_t x104 = (x102 + x79);
+ uint64_t x105 = (x104 >> 25);
+ uint32_t x106 = (uint32_t)(x104 & UINT32_C(0x1ffffff));
+ uint64_t x107 = (x105 + x78);
+ uint64_t x108 = (x107 >> 26);
+ uint32_t x109 = (uint32_t)(x107 & UINT32_C(0x3ffffff));
+ uint64_t x110 = (x108 + x77);
+ uint64_t x111 = (x110 >> 25);
+ uint32_t x112 = (uint32_t)(x110 & UINT32_C(0x1ffffff));
+ uint64_t x113 = (x111 * (uint64_t)UINT8_C(0x13));
+ uint64_t x114 = (x76 + x113);
+ uint32_t x115 = (uint32_t)(x114 >> 26);
+ uint32_t x116 = (uint32_t)(x114 & UINT32_C(0x3ffffff));
+ uint32_t x117 = (x115 + x88);
+ uint32_t x118 = (x117 >> 25);
+ uint32_t x119 = (x117 & UINT32_C(0x1ffffff));
+ uint32_t x120 = (x118 + x91);
+ out1[0] = x116;
+ out1[1] = x119;
+ out1[2] = x120;
+ out1[3] = x94;
+ out1[4] = x97;
+ out1[5] = x100;
+ out1[6] = x103;
+ out1[7] = x106;
+ out1[8] = x109;
+ out1[9] = x112;
+}
+
+/*
+ * Input Bounds:
+ * arg1: [[0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999]]
+ * Output Bounds:
+ * out1: [[0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333]]
+ */
+static void fiat_25519_carry(uint32_t out1[10], const uint32_t arg1[10]) {
+ uint32_t x1 = (arg1[0]);
+ uint32_t x2 = ((x1 >> 26) + (arg1[1]));
+ uint32_t x3 = ((x2 >> 25) + (arg1[2]));
+ uint32_t x4 = ((x3 >> 26) + (arg1[3]));
+ uint32_t x5 = ((x4 >> 25) + (arg1[4]));
+ uint32_t x6 = ((x5 >> 26) + (arg1[5]));
+ uint32_t x7 = ((x6 >> 25) + (arg1[6]));
+ uint32_t x8 = ((x7 >> 26) + (arg1[7]));
+ uint32_t x9 = ((x8 >> 25) + (arg1[8]));
+ uint32_t x10 = ((x9 >> 26) + (arg1[9]));
+ uint32_t x11 = ((x1 & UINT32_C(0x3ffffff)) + ((x10 >> 25) * (uint32_t)UINT8_C(0x13)));
+ uint32_t x12 = ((x11 >> 26) + (x2 & UINT32_C(0x1ffffff)));
+ uint32_t x13 = (x11 & UINT32_C(0x3ffffff));
+ uint32_t x14 = (x12 & UINT32_C(0x1ffffff));
+ uint32_t x15 = ((x12 >> 25) + (x3 & UINT32_C(0x3ffffff)));
+ uint32_t x16 = (x4 & UINT32_C(0x1ffffff));
+ uint32_t x17 = (x5 & UINT32_C(0x3ffffff));
+ uint32_t x18 = (x6 & UINT32_C(0x1ffffff));
+ uint32_t x19 = (x7 & UINT32_C(0x3ffffff));
+ uint32_t x20 = (x8 & UINT32_C(0x1ffffff));
+ uint32_t x21 = (x9 & UINT32_C(0x3ffffff));
+ uint32_t x22 = (x10 & UINT32_C(0x1ffffff));
+ out1[0] = x13;
+ out1[1] = x14;
+ out1[2] = x15;
+ out1[3] = x16;
+ out1[4] = x17;
+ out1[5] = x18;
+ out1[6] = x19;
+ out1[7] = x20;
+ out1[8] = x21;
+ out1[9] = x22;
+}
+
+/*
+ * Input Bounds:
+ * arg1: [[0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333]]
+ * arg2: [[0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333]]
+ * Output Bounds:
+ * out1: [[0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999]]
+ */
+static void fiat_25519_add(uint32_t out1[10], const uint32_t arg1[10], const uint32_t arg2[10]) {
+ uint32_t x1 = ((arg1[0]) + (arg2[0]));
+ uint32_t x2 = ((arg1[1]) + (arg2[1]));
+ uint32_t x3 = ((arg1[2]) + (arg2[2]));
+ uint32_t x4 = ((arg1[3]) + (arg2[3]));
+ uint32_t x5 = ((arg1[4]) + (arg2[4]));
+ uint32_t x6 = ((arg1[5]) + (arg2[5]));
+ uint32_t x7 = ((arg1[6]) + (arg2[6]));
+ uint32_t x8 = ((arg1[7]) + (arg2[7]));
+ uint32_t x9 = ((arg1[8]) + (arg2[8]));
+ uint32_t x10 = ((arg1[9]) + (arg2[9]));
+ out1[0] = x1;
+ out1[1] = x2;
+ out1[2] = x3;
+ out1[3] = x4;
+ out1[4] = x5;
+ out1[5] = x6;
+ out1[6] = x7;
+ out1[7] = x8;
+ out1[8] = x9;
+ out1[9] = x10;
+}
+
+/*
+ * Input Bounds:
+ * arg1: [[0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333]]
+ * arg2: [[0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333]]
+ * Output Bounds:
+ * out1: [[0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999]]
+ */
+static void fiat_25519_sub(uint32_t out1[10], const uint32_t arg1[10], const uint32_t arg2[10]) {
+ uint32_t x1 = ((UINT32_C(0x7ffffda) + (arg1[0])) - (arg2[0]));
+ uint32_t x2 = ((UINT32_C(0x3fffffe) + (arg1[1])) - (arg2[1]));
+ uint32_t x3 = ((UINT32_C(0x7fffffe) + (arg1[2])) - (arg2[2]));
+ uint32_t x4 = ((UINT32_C(0x3fffffe) + (arg1[3])) - (arg2[3]));
+ uint32_t x5 = ((UINT32_C(0x7fffffe) + (arg1[4])) - (arg2[4]));
+ uint32_t x6 = ((UINT32_C(0x3fffffe) + (arg1[5])) - (arg2[5]));
+ uint32_t x7 = ((UINT32_C(0x7fffffe) + (arg1[6])) - (arg2[6]));
+ uint32_t x8 = ((UINT32_C(0x3fffffe) + (arg1[7])) - (arg2[7]));
+ uint32_t x9 = ((UINT32_C(0x7fffffe) + (arg1[8])) - (arg2[8]));
+ uint32_t x10 = ((UINT32_C(0x3fffffe) + (arg1[9])) - (arg2[9]));
+ out1[0] = x1;
+ out1[1] = x2;
+ out1[2] = x3;
+ out1[3] = x4;
+ out1[4] = x5;
+ out1[5] = x6;
+ out1[6] = x7;
+ out1[7] = x8;
+ out1[8] = x9;
+ out1[9] = x10;
+}
+
+/*
+ * Input Bounds:
+ * arg1: [[0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333]]
+ * Output Bounds:
+ * out1: [[0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999]]
+ */
+static void fiat_25519_opp(uint32_t out1[10], const uint32_t arg1[10]) {
+ uint32_t x1 = (UINT32_C(0x7ffffda) - (arg1[0]));
+ uint32_t x2 = (UINT32_C(0x3fffffe) - (arg1[1]));
+ uint32_t x3 = (UINT32_C(0x7fffffe) - (arg1[2]));
+ uint32_t x4 = (UINT32_C(0x3fffffe) - (arg1[3]));
+ uint32_t x5 = (UINT32_C(0x7fffffe) - (arg1[4]));
+ uint32_t x6 = (UINT32_C(0x3fffffe) - (arg1[5]));
+ uint32_t x7 = (UINT32_C(0x7fffffe) - (arg1[6]));
+ uint32_t x8 = (UINT32_C(0x3fffffe) - (arg1[7]));
+ uint32_t x9 = (UINT32_C(0x7fffffe) - (arg1[8]));
+ uint32_t x10 = (UINT32_C(0x3fffffe) - (arg1[9]));
+ out1[0] = x1;
+ out1[1] = x2;
+ out1[2] = x3;
+ out1[3] = x4;
+ out1[4] = x5;
+ out1[5] = x6;
+ out1[6] = x7;
+ out1[7] = x8;
+ out1[8] = x9;
+ out1[9] = x10;
+}
+
+/*
+ * Input Bounds:
+ * arg1: [[0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333]]
+ * Output Bounds:
+ * out1: [[0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0x7f]]
+ */
+static void fiat_25519_to_bytes(uint8_t out1[32], const uint32_t arg1[10]) {
+ uint32_t x1;
+ fiat_25519_uint1 x2;
+ fiat_25519_subborrowx_u26(&x1, &x2, 0x0, (arg1[0]), UINT32_C(0x3ffffed));
+ uint32_t x3;
+ fiat_25519_uint1 x4;
+ fiat_25519_subborrowx_u25(&x3, &x4, x2, (arg1[1]), UINT32_C(0x1ffffff));
+ uint32_t x5;
+ fiat_25519_uint1 x6;
+ fiat_25519_subborrowx_u26(&x5, &x6, x4, (arg1[2]), UINT32_C(0x3ffffff));
+ uint32_t x7;
+ fiat_25519_uint1 x8;
+ fiat_25519_subborrowx_u25(&x7, &x8, x6, (arg1[3]), UINT32_C(0x1ffffff));
+ uint32_t x9;
+ fiat_25519_uint1 x10;
+ fiat_25519_subborrowx_u26(&x9, &x10, x8, (arg1[4]), UINT32_C(0x3ffffff));
+ uint32_t x11;
+ fiat_25519_uint1 x12;
+ fiat_25519_subborrowx_u25(&x11, &x12, x10, (arg1[5]), UINT32_C(0x1ffffff));
+ uint32_t x13;
+ fiat_25519_uint1 x14;
+ fiat_25519_subborrowx_u26(&x13, &x14, x12, (arg1[6]), UINT32_C(0x3ffffff));
+ uint32_t x15;
+ fiat_25519_uint1 x16;
+ fiat_25519_subborrowx_u25(&x15, &x16, x14, (arg1[7]), UINT32_C(0x1ffffff));
+ uint32_t x17;
+ fiat_25519_uint1 x18;
+ fiat_25519_subborrowx_u26(&x17, &x18, x16, (arg1[8]), UINT32_C(0x3ffffff));
+ uint32_t x19;
+ fiat_25519_uint1 x20;
+ fiat_25519_subborrowx_u25(&x19, &x20, x18, (arg1[9]), UINT32_C(0x1ffffff));
+ uint32_t x21;
+ fiat_25519_cmovznz_u32(&x21, x20, 0x0, UINT32_C(0xffffffff));
+ uint32_t x22;
+ fiat_25519_uint1 x23;
+ fiat_25519_addcarryx_u26(&x22, &x23, 0x0, (x21 & UINT32_C(0x3ffffed)), x1);
+ uint32_t x24;
+ fiat_25519_uint1 x25;
+ fiat_25519_addcarryx_u25(&x24, &x25, x23, (x21 & UINT32_C(0x1ffffff)), x3);
+ uint32_t x26;
+ fiat_25519_uint1 x27;
+ fiat_25519_addcarryx_u26(&x26, &x27, x25, (x21 & UINT32_C(0x3ffffff)), x5);
+ uint32_t x28;
+ fiat_25519_uint1 x29;
+ fiat_25519_addcarryx_u25(&x28, &x29, x27, (x21 & UINT32_C(0x1ffffff)), x7);
+ uint32_t x30;
+ fiat_25519_uint1 x31;
+ fiat_25519_addcarryx_u26(&x30, &x31, x29, (x21 & UINT32_C(0x3ffffff)), x9);
+ uint32_t x32;
+ fiat_25519_uint1 x33;
+ fiat_25519_addcarryx_u25(&x32, &x33, x31, (x21 & UINT32_C(0x1ffffff)), x11);
+ uint32_t x34;
+ fiat_25519_uint1 x35;
+ fiat_25519_addcarryx_u26(&x34, &x35, x33, (x21 & UINT32_C(0x3ffffff)), x13);
+ uint32_t x36;
+ fiat_25519_uint1 x37;
+ fiat_25519_addcarryx_u25(&x36, &x37, x35, (x21 & UINT32_C(0x1ffffff)), x15);
+ uint32_t x38;
+ fiat_25519_uint1 x39;
+ fiat_25519_addcarryx_u26(&x38, &x39, x37, (x21 & UINT32_C(0x3ffffff)), x17);
+ uint32_t x40;
+ fiat_25519_uint1 x41;
+ fiat_25519_addcarryx_u25(&x40, &x41, x39, (x21 & UINT32_C(0x1ffffff)), x19);
+ uint32_t x42 = (x40 << 6);
+ uint32_t x43 = (x38 << 4);
+ uint32_t x44 = (x36 << 3);
+ uint32_t x45 = (x34 * (uint32_t)0x2);
+ uint32_t x46 = (x30 << 6);
+ uint32_t x47 = (x28 << 5);
+ uint32_t x48 = (x26 << 3);
+ uint32_t x49 = (x24 << 2);
+ uint32_t x50 = (x22 >> 8);
+ uint8_t x51 = (uint8_t)(x22 & UINT8_C(0xff));
+ uint32_t x52 = (x50 >> 8);
+ uint8_t x53 = (uint8_t)(x50 & UINT8_C(0xff));
+ uint8_t x54 = (uint8_t)(x52 >> 8);
+ uint8_t x55 = (uint8_t)(x52 & UINT8_C(0xff));
+ uint32_t x56 = (x54 + x49);
+ uint32_t x57 = (x56 >> 8);
+ uint8_t x58 = (uint8_t)(x56 & UINT8_C(0xff));
+ uint32_t x59 = (x57 >> 8);
+ uint8_t x60 = (uint8_t)(x57 & UINT8_C(0xff));
+ uint8_t x61 = (uint8_t)(x59 >> 8);
+ uint8_t x62 = (uint8_t)(x59 & UINT8_C(0xff));
+ uint32_t x63 = (x61 + x48);
+ uint32_t x64 = (x63 >> 8);
+ uint8_t x65 = (uint8_t)(x63 & UINT8_C(0xff));
+ uint32_t x66 = (x64 >> 8);
+ uint8_t x67 = (uint8_t)(x64 & UINT8_C(0xff));
+ uint8_t x68 = (uint8_t)(x66 >> 8);
+ uint8_t x69 = (uint8_t)(x66 & UINT8_C(0xff));
+ uint32_t x70 = (x68 + x47);
+ uint32_t x71 = (x70 >> 8);
+ uint8_t x72 = (uint8_t)(x70 & UINT8_C(0xff));
+ uint32_t x73 = (x71 >> 8);
+ uint8_t x74 = (uint8_t)(x71 & UINT8_C(0xff));
+ uint8_t x75 = (uint8_t)(x73 >> 8);
+ uint8_t x76 = (uint8_t)(x73 & UINT8_C(0xff));
+ uint32_t x77 = (x75 + x46);
+ uint32_t x78 = (x77 >> 8);
+ uint8_t x79 = (uint8_t)(x77 & UINT8_C(0xff));
+ uint32_t x80 = (x78 >> 8);
+ uint8_t x81 = (uint8_t)(x78 & UINT8_C(0xff));
+ uint8_t x82 = (uint8_t)(x80 >> 8);
+ uint8_t x83 = (uint8_t)(x80 & UINT8_C(0xff));
+ uint8_t x84 = (uint8_t)(x82 & UINT8_C(0xff));
+ uint32_t x85 = (x32 >> 8);
+ uint8_t x86 = (uint8_t)(x32 & UINT8_C(0xff));
+ uint32_t x87 = (x85 >> 8);
+ uint8_t x88 = (uint8_t)(x85 & UINT8_C(0xff));
+ fiat_25519_uint1 x89 = (fiat_25519_uint1)(x87 >> 8);
+ uint8_t x90 = (uint8_t)(x87 & UINT8_C(0xff));
+ uint32_t x91 = (x89 + x45);
+ uint32_t x92 = (x91 >> 8);
+ uint8_t x93 = (uint8_t)(x91 & UINT8_C(0xff));
+ uint32_t x94 = (x92 >> 8);
+ uint8_t x95 = (uint8_t)(x92 & UINT8_C(0xff));
+ uint8_t x96 = (uint8_t)(x94 >> 8);
+ uint8_t x97 = (uint8_t)(x94 & UINT8_C(0xff));
+ uint32_t x98 = (x96 + x44);
+ uint32_t x99 = (x98 >> 8);
+ uint8_t x100 = (uint8_t)(x98 & UINT8_C(0xff));
+ uint32_t x101 = (x99 >> 8);
+ uint8_t x102 = (uint8_t)(x99 & UINT8_C(0xff));
+ uint8_t x103 = (uint8_t)(x101 >> 8);
+ uint8_t x104 = (uint8_t)(x101 & UINT8_C(0xff));
+ uint32_t x105 = (x103 + x43);
+ uint32_t x106 = (x105 >> 8);
+ uint8_t x107 = (uint8_t)(x105 & UINT8_C(0xff));
+ uint32_t x108 = (x106 >> 8);
+ uint8_t x109 = (uint8_t)(x106 & UINT8_C(0xff));
+ uint8_t x110 = (uint8_t)(x108 >> 8);
+ uint8_t x111 = (uint8_t)(x108 & UINT8_C(0xff));
+ uint32_t x112 = (x110 + x42);
+ uint32_t x113 = (x112 >> 8);
+ uint8_t x114 = (uint8_t)(x112 & UINT8_C(0xff));
+ uint32_t x115 = (x113 >> 8);
+ uint8_t x116 = (uint8_t)(x113 & UINT8_C(0xff));
+ uint8_t x117 = (uint8_t)(x115 >> 8);
+ uint8_t x118 = (uint8_t)(x115 & UINT8_C(0xff));
+ out1[0] = x51;
+ out1[1] = x53;
+ out1[2] = x55;
+ out1[3] = x58;
+ out1[4] = x60;
+ out1[5] = x62;
+ out1[6] = x65;
+ out1[7] = x67;
+ out1[8] = x69;
+ out1[9] = x72;
+ out1[10] = x74;
+ out1[11] = x76;
+ out1[12] = x79;
+ out1[13] = x81;
+ out1[14] = x83;
+ out1[15] = x84;
+ out1[16] = x86;
+ out1[17] = x88;
+ out1[18] = x90;
+ out1[19] = x93;
+ out1[20] = x95;
+ out1[21] = x97;
+ out1[22] = x100;
+ out1[23] = x102;
+ out1[24] = x104;
+ out1[25] = x107;
+ out1[26] = x109;
+ out1[27] = x111;
+ out1[28] = x114;
+ out1[29] = x116;
+ out1[30] = x118;
+ out1[31] = x117;
+}
+
+/*
+ * Input Bounds:
+ * arg1: [[0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0x7f]]
+ * Output Bounds:
+ * out1: [[0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333]]
+ */
+static void fiat_25519_from_bytes(uint32_t out1[10], const uint8_t arg1[32]) {
+ uint32_t x1 = ((uint32_t)(arg1[31]) << 18);
+ uint32_t x2 = ((uint32_t)(arg1[30]) << 10);
+ uint32_t x3 = ((uint32_t)(arg1[29]) << 2);
+ uint32_t x4 = ((uint32_t)(arg1[28]) << 20);
+ uint32_t x5 = ((uint32_t)(arg1[27]) << 12);
+ uint32_t x6 = ((uint32_t)(arg1[26]) << 4);
+ uint32_t x7 = ((uint32_t)(arg1[25]) << 21);
+ uint32_t x8 = ((uint32_t)(arg1[24]) << 13);
+ uint32_t x9 = ((uint32_t)(arg1[23]) << 5);
+ uint32_t x10 = ((uint32_t)(arg1[22]) << 23);
+ uint32_t x11 = ((uint32_t)(arg1[21]) << 15);
+ uint32_t x12 = ((uint32_t)(arg1[20]) << 7);
+ uint32_t x13 = ((uint32_t)(arg1[19]) << 24);
+ uint32_t x14 = ((uint32_t)(arg1[18]) << 16);
+ uint32_t x15 = ((uint32_t)(arg1[17]) << 8);
+ uint8_t x16 = (arg1[16]);
+ uint32_t x17 = ((uint32_t)(arg1[15]) << 18);
+ uint32_t x18 = ((uint32_t)(arg1[14]) << 10);
+ uint32_t x19 = ((uint32_t)(arg1[13]) << 2);
+ uint32_t x20 = ((uint32_t)(arg1[12]) << 19);
+ uint32_t x21 = ((uint32_t)(arg1[11]) << 11);
+ uint32_t x22 = ((uint32_t)(arg1[10]) << 3);
+ uint32_t x23 = ((uint32_t)(arg1[9]) << 21);
+ uint32_t x24 = ((uint32_t)(arg1[8]) << 13);
+ uint32_t x25 = ((uint32_t)(arg1[7]) << 5);
+ uint32_t x26 = ((uint32_t)(arg1[6]) << 22);
+ uint32_t x27 = ((uint32_t)(arg1[5]) << 14);
+ uint32_t x28 = ((uint32_t)(arg1[4]) << 6);
+ uint32_t x29 = ((uint32_t)(arg1[3]) << 24);
+ uint32_t x30 = ((uint32_t)(arg1[2]) << 16);
+ uint32_t x31 = ((uint32_t)(arg1[1]) << 8);
+ uint8_t x32 = (arg1[0]);
+ uint32_t x33 = (x32 + (x31 + (x30 + x29)));
+ uint8_t x34 = (uint8_t)(x33 >> 26);
+ uint32_t x35 = (x33 & UINT32_C(0x3ffffff));
+ uint32_t x36 = (x3 + (x2 + x1));
+ uint32_t x37 = (x6 + (x5 + x4));
+ uint32_t x38 = (x9 + (x8 + x7));
+ uint32_t x39 = (x12 + (x11 + x10));
+ uint32_t x40 = (x16 + (x15 + (x14 + x13)));
+ uint32_t x41 = (x19 + (x18 + x17));
+ uint32_t x42 = (x22 + (x21 + x20));
+ uint32_t x43 = (x25 + (x24 + x23));
+ uint32_t x44 = (x28 + (x27 + x26));
+ uint32_t x45 = (x34 + x44);
+ uint8_t x46 = (uint8_t)(x45 >> 25);
+ uint32_t x47 = (x45 & UINT32_C(0x1ffffff));
+ uint32_t x48 = (x46 + x43);
+ uint8_t x49 = (uint8_t)(x48 >> 26);
+ uint32_t x50 = (x48 & UINT32_C(0x3ffffff));
+ uint32_t x51 = (x49 + x42);
+ uint8_t x52 = (uint8_t)(x51 >> 25);
+ uint32_t x53 = (x51 & UINT32_C(0x1ffffff));
+ uint32_t x54 = (x52 + x41);
+ uint32_t x55 = (x54 & UINT32_C(0x3ffffff));
+ uint8_t x56 = (uint8_t)(x40 >> 25);
+ uint32_t x57 = (x40 & UINT32_C(0x1ffffff));
+ uint32_t x58 = (x56 + x39);
+ uint8_t x59 = (uint8_t)(x58 >> 26);
+ uint32_t x60 = (x58 & UINT32_C(0x3ffffff));
+ uint32_t x61 = (x59 + x38);
+ uint8_t x62 = (uint8_t)(x61 >> 25);
+ uint32_t x63 = (x61 & UINT32_C(0x1ffffff));
+ uint32_t x64 = (x62 + x37);
+ uint8_t x65 = (uint8_t)(x64 >> 26);
+ uint32_t x66 = (x64 & UINT32_C(0x3ffffff));
+ uint32_t x67 = (x65 + x36);
+ out1[0] = x35;
+ out1[1] = x47;
+ out1[2] = x50;
+ out1[3] = x53;
+ out1[4] = x55;
+ out1[5] = x57;
+ out1[6] = x60;
+ out1[7] = x63;
+ out1[8] = x66;
+ out1[9] = x67;
+}
+
+#endif /* not defined(BORINGSSL_CURVE25519_64BIT) */
More information about the cvs-krb5
mailing list