diff options
-rw-r--r-- | curve25519_32.c | 992 | ||||
-rw-r--r-- | curve25519_64.c | 569 |
2 files changed, 164 insertions, 1397 deletions
diff --git a/curve25519_32.c b/curve25519_32.c index d03f03133..4d31b5110 100644 --- a/curve25519_32.c +++ b/curve25519_32.c @@ -1,3 +1,4 @@ +check_args /* Autogenerated */ /* curve description: 25519 */ /* requested operations: carry_mul, carry_square, carry_scmul121666, carry, add, sub, opp, selectznz, to_bytes, from_bytes */ @@ -11,890 +12,127 @@ 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) | (uint32_t)((uint64_t)(~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[8]) * (uint32_t)0x2); - uint32_t x2 = ((arg1[7]) * (uint32_t)0x2); - uint32_t x3 = ((arg1[6]) * (uint32_t)0x2); - uint32_t x4 = ((arg1[5]) * (uint32_t)0x2); - uint32_t x5 = ((arg1[4]) * (uint32_t)0x2); - uint32_t x6 = ((arg1[3]) * (uint32_t)0x2); - uint32_t x7 = ((arg1[2]) * (uint32_t)0x2); - uint32_t x8 = ((arg1[1]) * (uint32_t)0x2); - uint32_t x9 = ((arg1[0]) * (uint32_t)0x2); - uint64_t x10 = ((uint64_t)(arg1[9]) * ((arg1[9]) * ((uint32_t)0x2 * UINT8_C(0x13)))); - uint64_t x11 = ((uint64_t)x1 * ((arg1[9]) * (uint32_t)UINT8_C(0x13))); - uint64_t x12 = ((uint64_t)(arg1[8]) * ((arg1[8]) * (uint32_t)UINT8_C(0x13))); - uint64_t x13 = ((uint64_t)x2 * ((arg1[9]) * ((uint32_t)0x2 * UINT8_C(0x13)))); - uint64_t x14 = ((uint64_t)x2 * ((arg1[8]) * (uint32_t)UINT8_C(0x13))); - uint64_t x15 = ((uint64_t)(arg1[7]) * ((arg1[7]) * ((uint32_t)0x2 * UINT8_C(0x13)))); - uint64_t x16 = ((uint64_t)x3 * ((arg1[9]) * (uint32_t)UINT8_C(0x13))); - uint64_t x17 = ((uint64_t)x3 * ((arg1[8]) * (uint32_t)UINT8_C(0x13))); - uint64_t x18 = ((uint64_t)x3 * ((arg1[7]) * (uint32_t)UINT8_C(0x13))); - uint64_t x19 = ((uint64_t)(arg1[6]) * ((arg1[6]) * (uint32_t)UINT8_C(0x13))); - uint64_t x20 = ((uint64_t)x4 * ((arg1[9]) * ((uint32_t)0x2 * UINT8_C(0x13)))); - uint64_t x21 = ((uint64_t)x4 * ((arg1[8]) * (uint32_t)UINT8_C(0x13))); - uint64_t x22 = ((uint64_t)x4 * ((arg1[7]) * ((uint32_t)0x2 * UINT8_C(0x13)))); - uint64_t x23 = ((uint64_t)x4 * ((arg1[6]) * (uint32_t)UINT8_C(0x13))); - uint64_t x24 = ((uint64_t)(arg1[5]) * ((arg1[5]) * ((uint32_t)0x2 * UINT8_C(0x13)))); - uint64_t x25 = ((uint64_t)x5 * ((arg1[9]) * (uint32_t)UINT8_C(0x13))); - uint64_t x26 = ((uint64_t)x5 * ((arg1[8]) * (uint32_t)UINT8_C(0x13))); - uint64_t x27 = ((uint64_t)x5 * ((arg1[7]) * (uint32_t)UINT8_C(0x13))); - uint64_t x28 = ((uint64_t)x5 * ((arg1[6]) * (uint32_t)UINT8_C(0x13))); - uint64_t x29 = ((uint64_t)x6 * ((arg1[9]) * ((uint32_t)0x2 * UINT8_C(0x13)))); - uint64_t x30 = ((uint64_t)x6 * ((arg1[8]) * (uint32_t)UINT8_C(0x13))); - uint64_t x31 = ((uint64_t)x6 * ((arg1[7]) * ((uint32_t)0x2 * UINT8_C(0x13)))); - uint64_t x32 = ((uint64_t)x7 * ((arg1[9]) * (uint32_t)UINT8_C(0x13))); - uint64_t x33 = ((uint64_t)x7 * ((arg1[8]) * (uint32_t)UINT8_C(0x13))); - uint64_t x34 = ((uint64_t)x8 * ((arg1[9]) * ((uint32_t)0x2 * UINT8_C(0x13)))); - uint64_t x35 = ((uint64_t)x5 * (arg1[5])); - uint64_t x36 = ((uint64_t)(arg1[4]) * (arg1[4])); - uint64_t x37 = ((uint64_t)x6 * (arg1[6])); - uint64_t x38 = ((uint64_t)x6 * ((arg1[5]) * (uint32_t)0x2)); - uint64_t x39 = ((uint64_t)x6 * (arg1[4])); - uint64_t x40 = ((uint64_t)(arg1[3]) * ((arg1[3]) * (uint32_t)0x2)); - uint64_t x41 = ((uint64_t)x7 * (arg1[7])); - uint64_t x42 = ((uint64_t)x7 * (arg1[6])); - uint64_t x43 = ((uint64_t)x7 * (arg1[5])); - uint64_t x44 = ((uint64_t)x7 * (arg1[4])); - uint64_t x45 = ((uint64_t)x7 * (arg1[3])); - uint64_t x46 = ((uint64_t)(arg1[2]) * (arg1[2])); - uint64_t x47 = ((uint64_t)x8 * (arg1[8])); - uint64_t x48 = ((uint64_t)x8 * ((arg1[7]) * (uint32_t)0x2)); - uint64_t x49 = ((uint64_t)x8 * (arg1[6])); - uint64_t x50 = ((uint64_t)x8 * ((arg1[5]) * (uint32_t)0x2)); - uint64_t x51 = ((uint64_t)x8 * (arg1[4])); - uint64_t x52 = ((uint64_t)x8 * ((arg1[3]) * (uint32_t)0x2)); - uint64_t x53 = ((uint64_t)x8 * (arg1[2])); - uint64_t x54 = ((uint64_t)(arg1[1]) * ((arg1[1]) * (uint32_t)0x2)); - uint64_t x55 = ((uint64_t)x9 * (arg1[9])); - uint64_t x56 = ((uint64_t)x9 * (arg1[8])); - uint64_t x57 = ((uint64_t)x9 * (arg1[7])); - uint64_t x58 = ((uint64_t)x9 * (arg1[6])); - uint64_t x59 = ((uint64_t)x9 * (arg1[5])); - uint64_t x60 = ((uint64_t)x9 * (arg1[4])); - uint64_t x61 = ((uint64_t)x9 * (arg1[3])); - uint64_t x62 = ((uint64_t)x9 * (arg1[2])); - uint64_t x63 = ((uint64_t)x9 * (arg1[1])); - uint64_t x64 = ((uint64_t)(arg1[0]) * (arg1[0])); - uint64_t x65 = (x64 + (x34 + (x33 + (x31 + (x28 + x24))))); - uint64_t x66 = (x65 >> 26); - uint32_t x67 = (uint32_t)(x65 & UINT32_C(0x3ffffff)); - uint64_t x68 = (x55 + (x47 + (x41 + (x37 + x35)))); - uint64_t x69 = (x56 + (x48 + (x42 + (x38 + (x36 + x10))))); - uint64_t x70 = (x57 + (x49 + (x43 + (x39 + x11)))); - uint64_t x71 = (x58 + (x50 + (x44 + (x40 + (x13 + x12))))); - uint64_t x72 = (x59 + (x51 + (x45 + (x16 + x14)))); - uint64_t x73 = (x60 + (x52 + (x46 + (x20 + (x17 + x15))))); - uint64_t x74 = (x61 + (x53 + (x25 + (x21 + x18)))); - uint64_t x75 = (x62 + (x54 + (x29 + (x26 + (x22 + x19))))); - uint64_t x76 = (x63 + (x32 + (x30 + (x27 + x23)))); - uint64_t x77 = (x66 + x76); - uint64_t x78 = (x77 >> 25); - uint32_t x79 = (uint32_t)(x77 & UINT32_C(0x1ffffff)); - uint64_t x80 = (x78 + x75); - uint64_t x81 = (x80 >> 26); - uint32_t x82 = (uint32_t)(x80 & UINT32_C(0x3ffffff)); - uint64_t x83 = (x81 + x74); - uint64_t x84 = (x83 >> 25); - uint32_t x85 = (uint32_t)(x83 & UINT32_C(0x1ffffff)); - uint64_t x86 = (x84 + x73); - uint64_t x87 = (x86 >> 26); - uint32_t x88 = (uint32_t)(x86 & UINT32_C(0x3ffffff)); - uint64_t x89 = (x87 + x72); - uint64_t x90 = (x89 >> 25); - uint32_t x91 = (uint32_t)(x89 & UINT32_C(0x1ffffff)); - uint64_t x92 = (x90 + x71); - uint64_t x93 = (x92 >> 26); - uint32_t x94 = (uint32_t)(x92 & UINT32_C(0x3ffffff)); - uint64_t x95 = (x93 + x70); - uint64_t x96 = (x95 >> 25); - uint32_t x97 = (uint32_t)(x95 & UINT32_C(0x1ffffff)); - uint64_t x98 = (x96 + x69); - uint64_t x99 = (x98 >> 26); - uint32_t x100 = (uint32_t)(x98 & UINT32_C(0x3ffffff)); - uint64_t x101 = (x99 + x68); - uint64_t x102 = (x101 >> 25); - uint32_t x103 = (uint32_t)(x101 & UINT32_C(0x1ffffff)); - uint64_t x104 = (x102 * (uint64_t)UINT8_C(0x13)); - uint64_t x105 = (x67 + x104); - uint32_t x106 = (uint32_t)(x105 >> 26); - uint32_t x107 = (uint32_t)(x105 & UINT32_C(0x3ffffff)); - uint32_t x108 = (x106 + x79); - uint32_t x109 = (x108 >> 25); - uint32_t x110 = (x108 & UINT32_C(0x1ffffff)); - uint32_t x111 = (x109 + x82); - out1[0] = x107; - out1[1] = x110; - out1[2] = x111; - out1[3] = x85; - out1[4] = x88; - out1[5] = x91; - out1[6] = x94; - out1[7] = x97; - out1[8] = x100; - out1[9] = x103; -} +In fiat_25519_carry_square: +Computed bounds (Some [Some [0x0 ~> 0x3ffffff], Some [0x0 ~> 0x1ffffff], Some [0x0 ~> 0xcee8f59cf0a40c7a3d673c28f96ba3d673c29031e8f59d30a3e5a], Some [0x0 ~> 0x1ffffff], Some [0x0 ~> 0x3ffffff], Some [0x0 ~> 0x1ffffff], Some [0x0 ~> 0x3ffffff], Some [0x0 ~> 0x1ffffff], Some [0x0 ~> 0x3ffffff], Some [0x0 ~> 0x1ffffff]]) are not tight enough (expected bounds not looser than (Some [Some [0x0 ~> 0x4666666], Some [0x0 ~> 0x2333333], Some [0x0 ~> 0x4666666], Some [0x0 ~> 0x2333333], Some [0x0 ~> 0x4666666], Some [0x0 ~> 0x2333333], Some [0x0 ~> 0x4666666], Some [0x0 ~> 0x2333333], Some [0x0 ~> 0x4666666], Some [0x0 ~> 0x2333333]])). +The bounds [0x0 ~> 0xcee8f59cf0a40c7a3d673c28f96ba3d673c29031e8f59d30a3e5a] are looser than the expected bounds [0x0 ~> 0x4666666] +When doing bounds analysis on the syntax tree: /* * 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_scmul_121666(uint32_t out1[10], const uint32_t arg1[10]) { - uint64_t x1 = ((uint64_t)UINT32_C(0x1db42) * (arg1[9])); - uint64_t x2 = ((uint64_t)UINT32_C(0x1db42) * (arg1[8])); - uint64_t x3 = ((uint64_t)UINT32_C(0x1db42) * (arg1[7])); - uint64_t x4 = ((uint64_t)UINT32_C(0x1db42) * (arg1[6])); - uint64_t x5 = ((uint64_t)UINT32_C(0x1db42) * (arg1[5])); - uint64_t x6 = ((uint64_t)UINT32_C(0x1db42) * (arg1[4])); - uint64_t x7 = ((uint64_t)UINT32_C(0x1db42) * (arg1[3])); - uint64_t x8 = ((uint64_t)UINT32_C(0x1db42) * (arg1[2])); - uint64_t x9 = ((uint64_t)UINT32_C(0x1db42) * (arg1[1])); - uint64_t x10 = ((uint64_t)UINT32_C(0x1db42) * (arg1[0])); - uint32_t x11 = (uint32_t)(x10 >> 26); - uint32_t x12 = (uint32_t)(x10 & UINT32_C(0x3ffffff)); - uint64_t x13 = (x11 + x9); - uint32_t x14 = (uint32_t)(x13 >> 25); - uint32_t x15 = (uint32_t)(x13 & UINT32_C(0x1ffffff)); - uint64_t x16 = (x14 + x8); - uint32_t x17 = (uint32_t)(x16 >> 26); - uint32_t x18 = (uint32_t)(x16 & UINT32_C(0x3ffffff)); - uint64_t x19 = (x17 + x7); - uint32_t x20 = (uint32_t)(x19 >> 25); - uint32_t x21 = (uint32_t)(x19 & UINT32_C(0x1ffffff)); - uint64_t x22 = (x20 + x6); - uint32_t x23 = (uint32_t)(x22 >> 26); - uint32_t x24 = (uint32_t)(x22 & UINT32_C(0x3ffffff)); - uint64_t x25 = (x23 + x5); - uint32_t x26 = (uint32_t)(x25 >> 25); - uint32_t x27 = (uint32_t)(x25 & UINT32_C(0x1ffffff)); - uint64_t x28 = (x26 + x4); - uint32_t x29 = (uint32_t)(x28 >> 26); - uint32_t x30 = (uint32_t)(x28 & UINT32_C(0x3ffffff)); - uint64_t x31 = (x29 + x3); - uint32_t x32 = (uint32_t)(x31 >> 25); - uint32_t x33 = (uint32_t)(x31 & UINT32_C(0x1ffffff)); - uint64_t x34 = (x32 + x2); - uint32_t x35 = (uint32_t)(x34 >> 26); - uint32_t x36 = (uint32_t)(x34 & UINT32_C(0x3ffffff)); - uint64_t x37 = (x35 + x1); - uint32_t x38 = (uint32_t)(x37 >> 25); - uint32_t x39 = (uint32_t)(x37 & UINT32_C(0x1ffffff)); - uint32_t x40 = (x38 * (uint32_t)UINT8_C(0x13)); - uint32_t x41 = (x12 + x40); - uint32_t x42 = (x41 >> 26); - uint32_t x43 = (x41 & UINT32_C(0x3ffffff)); - uint32_t x44 = (x42 + x15); - uint32_t x45 = (x44 >> 25); - uint32_t x46 = (x44 & UINT32_C(0x1ffffff)); - uint32_t x47 = (x45 + x18); - out1[0] = x43; - out1[1] = x46; - out1[2] = x47; - out1[3] = x21; - out1[4] = x24; - out1[5] = x27; - out1[6] = x30; - out1[7] = x33; - out1[8] = x36; - out1[9] = x39; -} - -/* - * 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]] + * out1: None */ -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; +void f(uint256 out1[10], const uint32_t arg1[10]) { + uint32_t x1 = ((arg1[8]) * (uint32_t)UINT8_C(0x13)); + uint64_t x2 = (x1 * (uint64_t)0x2); + uint32_t x3 = ((arg1[7]) * (uint32_t)UINT8_C(0x13)); + uint32_t x4 = (x3 * (uint32_t)0x2); + uint32_t x5 = ((arg1[6]) * (uint32_t)UINT8_C(0x13)); + uint64_t x6 = (x5 * (uint64_t)0x2); + uint32_t x7 = ((arg1[5]) * (uint32_t)UINT8_C(0x13)); + uint32_t x8 = (x7 * (uint32_t)0x2); + uint32_t x9 = ((arg1[4]) * (uint32_t)0x2); + uint32_t x10 = ((arg1[3]) * (uint32_t)0x2); + uint32_t x11 = ((arg1[2]) * (uint32_t)0x2); + uint32_t x12 = ((arg1[1]) * (uint32_t)0x2); + uint32_t x13 = ((arg1[0]) * (uint32_t)0x2); + uint512 x14 = ((uint512)((uint64_t)(arg1[9]) * (arg1[9])) << 230); + uint64_t x15 = ((arg1[8]) * x2); + uint256 x16 = ((uint256)((uint64_t)(arg1[8]) * (arg1[8])) << 178); + uint64_t x17 = ((arg1[7]) * (x4 * (uint64_t)0x2)); + uint64_t x18 = ((arg1[7]) * (x4 * (uint64_t)0x2)); + uint256 x19 = ((uint256)((uint64_t)(arg1[7]) * (arg1[7])) << 128); + uint64_t x20 = ((arg1[6]) * x6); + uint64_t x21 = ((arg1[6]) * x6); + uint64_t x22 = ((arg1[6]) * x6); + uint256 x23 = ((uint256)((uint64_t)(arg1[6]) * (arg1[6])) << 76); + uint64_t x24 = ((arg1[5]) * (x8 * (uint64_t)0x2)); + uint64_t x25 = ((arg1[5]) * (x8 * (uint64_t)0x2)); + uint64_t x26 = ((arg1[5]) * (x8 * (uint64_t)0x2)); + uint64_t x27 = ((arg1[5]) * (x8 * (uint64_t)0x2)); + uint128 x28 = ((uint128)((uint64_t)(arg1[5]) * (arg1[5])) << 26); + uint64_t x29 = ((uint64_t)(arg1[4]) * x9); + uint64_t x30 = ((uint64_t)(arg1[4]) * (arg1[4])); + uint64_t x31 = ((uint64_t)(arg1[3]) * (x10 * (uint32_t)0x2)); + uint64_t x32 = ((uint64_t)(arg1[3]) * (x10 * (uint32_t)0x2)); + uint64_t x33 = ((uint64_t)(arg1[3]) * (x10 * (uint32_t)0x2)); + uint64_t x34 = ((uint64_t)(arg1[3]) * ((arg1[3]) * (uint32_t)0x2)); + uint64_t x35 = ((uint64_t)(arg1[2]) * x11); + uint64_t x36 = ((uint64_t)(arg1[2]) * x11); + uint64_t x37 = ((uint64_t)(arg1[2]) * x11); + uint64_t x38 = ((uint64_t)(arg1[2]) * x11); + uint64_t x39 = ((uint64_t)(arg1[2]) * x11); + uint64_t x40 = ((uint64_t)(arg1[2]) * (arg1[2])); + uint64_t x41 = ((uint64_t)(arg1[1]) * (x12 * (uint32_t)0x2)); + uint64_t x42 = ((uint64_t)(arg1[1]) * (x12 * (uint32_t)0x2)); + uint64_t x43 = ((uint64_t)(arg1[1]) * (x12 * (uint32_t)0x2)); + uint64_t x44 = ((uint64_t)(arg1[1]) * (x12 * (uint32_t)0x2)); + uint64_t x45 = ((uint64_t)(arg1[1]) * (x12 * (uint32_t)0x2)); + uint64_t x46 = ((uint64_t)(arg1[1]) * (x12 * (uint32_t)0x2)); + uint64_t x47 = ((uint64_t)(arg1[1]) * (x12 * (uint32_t)0x2)); + uint64_t x48 = ((uint64_t)(arg1[1]) * ((arg1[1]) * (uint32_t)0x2)); + uint64_t x49 = ((uint64_t)(arg1[0]) * x13); + uint64_t x50 = ((uint64_t)(arg1[0]) * x13); + uint64_t x51 = ((uint64_t)(arg1[0]) * x13); + uint64_t x52 = ((uint64_t)(arg1[0]) * x13); + uint64_t x53 = ((uint64_t)(arg1[0]) * x13); + uint64_t x54 = ((uint64_t)(arg1[0]) * x13); + uint64_t x55 = ((uint64_t)(arg1[0]) * x13); + uint64_t x56 = ((uint64_t)(arg1[0]) * x13); + uint64_t x57 = ((uint64_t)(arg1[0]) * x13); + uint64_t x58 = ((uint64_t)(arg1[0]) * (arg1[0])); + uint64_t x59 = (x58 + (x57 + (x56 + (x55 + (x54 + (x53 + (x52 + (x51 + (x50 + (x49 + (x27 + (x26 + (x25 + x24))))))))))))); + uint64_t x60 = (x59 >> 26); + uint32_t x61 = (uint32_t)(x59 & UINT32_C(0x3ffffff)); + uint512 x62 = (x28 + (x23 + (x19 + (x16 + x14)))); + uint64_t x63 = (x30 + x29); + uint64_t x64 = (x34 + (x33 + (x32 + (x31 + x15)))); + uint64_t x65 = (x40 + (x39 + (x38 + (x37 + (x36 + (x35 + (x18 + x17))))))); + uint64_t x66 = (x48 + (x47 + (x46 + (x45 + (x44 + (x43 + (x42 + (x41 + (x22 + (x21 + x20)))))))))); + uint16_t x67 = (uint16_t)(x60 >> 25); + uint32_t x68 = (uint32_t)(x60 & UINT32_C(0x1ffffff)); + uint64_t x69 = (x67 + x66); + uint64_t x70 = (x69 >> 26); + uint32_t x71 = (uint32_t)(x69 & UINT32_C(0x3ffffff)); + uint16_t x72 = (uint16_t)(x70 >> 25); + uint32_t x73 = (uint32_t)(x70 & UINT32_C(0x1ffffff)); + uint64_t x74 = (x72 + x65); + uint64_t x75 = (x74 >> 26); + uint32_t x76 = (uint32_t)(x74 & UINT32_C(0x3ffffff)); + uint16_t x77 = (uint16_t)(x75 >> 25); + uint32_t x78 = (uint32_t)(x75 & UINT32_C(0x1ffffff)); + uint64_t x79 = (x77 + x64); + uint64_t x80 = (x79 >> 26); + uint32_t x81 = (uint32_t)(x79 & UINT32_C(0x3ffffff)); + uint16_t x82 = (uint16_t)(x80 >> 25); + uint32_t x83 = (uint32_t)(x80 & UINT32_C(0x1ffffff)); + uint64_t x84 = (x82 + x63); + uint32_t x85 = (uint32_t)(x84 >> 26); + uint32_t x86 = (uint32_t)(x84 & UINT32_C(0x3ffffff)); + uint512 x87 = (x85 + x62); + uint512 x88 = (x87 >> 25); + uint32_t x89 = (uint32_t)(x87 & UINT32_C(0x1ffffff)); + uint512 x90 = (x88 * (uint512)UINT8_C(0x13)); + uint512 x91 = (x61 + x90); + uint256 x92 = (uint256)(x91 >> 26); + uint32_t x93 = (uint32_t)(x91 & UINT32_C(0x3ffffff)); + uint256 x94 = (x92 + x68); + uint256 x95 = (x94 >> 25); + uint32_t x96 = (uint32_t)(x94 & UINT32_C(0x1ffffff)); + uint256 x97 = (x95 + x71); + out1[0] = x93; + out1[1] = x96; + out1[2] = x97; + out1[3] = x73; + out1[4] = x76; + out1[5] = x78; + out1[6] = x81; + out1[7] = x83; + out1[8] = x86; + out1[9] = x89; } -/* - * Input Bounds: - * arg1: [0x0 ~> 0x1] - * arg2: [[0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff]] - * arg3: [[0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff]] - * Output Bounds: - * out1: [[0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff]] - */ -static void fiat_25519_selectznz(uint32_t out1[10], fiat_25519_uint1 arg1, const uint32_t arg2[10], const uint32_t arg3[10]) { - uint32_t x1; - fiat_25519_cmovznz_u32(&x1, arg1, (arg2[0]), (arg3[0])); - uint32_t x2; - fiat_25519_cmovznz_u32(&x2, arg1, (arg2[1]), (arg3[1])); - uint32_t x3; - fiat_25519_cmovznz_u32(&x3, arg1, (arg2[2]), (arg3[2])); - uint32_t x4; - fiat_25519_cmovznz_u32(&x4, arg1, (arg2[3]), (arg3[3])); - uint32_t x5; - fiat_25519_cmovznz_u32(&x5, arg1, (arg2[4]), (arg3[4])); - uint32_t x6; - fiat_25519_cmovznz_u32(&x6, arg1, (arg2[5]), (arg3[5])); - uint32_t x7; - fiat_25519_cmovznz_u32(&x7, arg1, (arg2[6]), (arg3[6])); - uint32_t x8; - fiat_25519_cmovznz_u32(&x8, arg1, (arg2[7]), (arg3[7])); - uint32_t x9; - fiat_25519_cmovznz_u32(&x9, arg1, (arg2[8]), (arg3[8])); - uint32_t x10; - fiat_25519_cmovznz_u32(&x10, arg1, (arg2[9]), (arg3[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; -} +with input bounds (Some [Some [0x0 ~> 0xd333332], Some [0x0 ~> 0x6999999], Some [0x0 ~> 0xd333332], Some [0x0 ~> 0x6999999], Some [0x0 ~> 0xd333332], Some [0x0 ~> 0x6999999], Some [0x0 ~> 0xd333332], Some [0x0 ~> 0x6999999], Some [0x0 ~> 0xd333332], Some [0x0 ~> 0x6999999]], tt). -/* - * 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)); - fiat_25519_uint1 x84 = (fiat_25519_uint1)(x82 >> 8); - uint8_t x85 = (uint8_t)(x82 & UINT8_C(0xff)); - uint32_t x86 = (x84 + x32); - uint32_t x87 = (x86 >> 8); - uint8_t x88 = (uint8_t)(x86 & UINT8_C(0xff)); - uint32_t x89 = (x87 >> 8); - uint8_t x90 = (uint8_t)(x87 & UINT8_C(0xff)); - fiat_25519_uint1 x91 = (fiat_25519_uint1)(x89 >> 8); - uint8_t x92 = (uint8_t)(x89 & UINT8_C(0xff)); - uint32_t x93 = (x91 + x45); - uint32_t x94 = (x93 >> 8); - uint8_t x95 = (uint8_t)(x93 & UINT8_C(0xff)); - uint32_t x96 = (x94 >> 8); - uint8_t x97 = (uint8_t)(x94 & UINT8_C(0xff)); - uint8_t x98 = (uint8_t)(x96 >> 8); - uint8_t x99 = (uint8_t)(x96 & UINT8_C(0xff)); - uint32_t x100 = (x98 + x44); - uint32_t x101 = (x100 >> 8); - uint8_t x102 = (uint8_t)(x100 & UINT8_C(0xff)); - uint32_t x103 = (x101 >> 8); - uint8_t x104 = (uint8_t)(x101 & UINT8_C(0xff)); - uint8_t x105 = (uint8_t)(x103 >> 8); - uint8_t x106 = (uint8_t)(x103 & UINT8_C(0xff)); - uint32_t x107 = (x105 + x43); - uint32_t x108 = (x107 >> 8); - uint8_t x109 = (uint8_t)(x107 & UINT8_C(0xff)); - uint32_t x110 = (x108 >> 8); - uint8_t x111 = (uint8_t)(x108 & UINT8_C(0xff)); - uint8_t x112 = (uint8_t)(x110 >> 8); - uint8_t x113 = (uint8_t)(x110 & UINT8_C(0xff)); - uint32_t x114 = (x112 + x42); - uint32_t x115 = (x114 >> 8); - uint8_t x116 = (uint8_t)(x114 & UINT8_C(0xff)); - uint32_t x117 = (x115 >> 8); - uint8_t x118 = (uint8_t)(x115 & UINT8_C(0xff)); - uint8_t x119 = (uint8_t)(x117 >> 8); - uint8_t x120 = (uint8_t)(x117 & 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] = x85; - out1[16] = x88; - out1[17] = x90; - out1[18] = x92; - out1[19] = x95; - out1[20] = x97; - out1[21] = x99; - out1[22] = x102; - out1[23] = x104; - out1[24] = x106; - out1[25] = x109; - out1[26] = x111; - out1[27] = x113; - out1[28] = x116; - out1[29] = x118; - out1[30] = x120; - out1[31] = x119; -} - -/* - * 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); - fiat_25519_uint1 x55 = (fiat_25519_uint1)(x54 >> 26); - uint32_t x56 = (x54 & UINT32_C(0x3ffffff)); - uint32_t x57 = (x55 + x40); - uint8_t x58 = (uint8_t)(x57 >> 25); - uint32_t x59 = (x57 & UINT32_C(0x1ffffff)); - uint32_t x60 = (x58 + x39); - uint8_t x61 = (uint8_t)(x60 >> 26); - uint32_t x62 = (x60 & UINT32_C(0x3ffffff)); - uint32_t x63 = (x61 + x38); - uint8_t x64 = (uint8_t)(x63 >> 25); - uint32_t x65 = (x63 & UINT32_C(0x1ffffff)); - uint32_t x66 = (x64 + x37); - uint8_t x67 = (uint8_t)(x66 >> 26); - uint32_t x68 = (x66 & UINT32_C(0x3ffffff)); - uint32_t x69 = (x67 + x36); - out1[0] = x35; - out1[1] = x47; - out1[2] = x50; - out1[3] = x53; - out1[4] = x56; - out1[5] = x59; - out1[6] = x62; - out1[7] = x65; - out1[8] = x68; - out1[9] = x69; -} diff --git a/curve25519_64.c b/curve25519_64.c index d511cd0c9..799b4e93b 100644 --- a/curve25519_64.c +++ b/curve25519_64.c @@ -1,3 +1,4 @@ +check_args /* Autogenerated */ /* curve description: 25519 */ /* requested operations: carry_mul, carry_square, carry_scmul121666, carry, add, sub, opp, selectznz, to_bytes, from_bytes */ @@ -13,537 +14,65 @@ 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) | (uint64_t)((fiat_25519_uint128)(~x2) & arg2)); - *out1 = x3; -} +In fiat_25519_carry_square: +Computed bounds (Some [Some [0x0 ~> 0x7ffffffffffff], Some [0x0 ~> 0x7ffffffffffff], Some [0x0 ~> 0x19dd1eb851eb806ae147ae147b7ff47ae147ae01a], Some [0x0 ~> 0x7ffffffffffff], Some [0x0 ~> 0x7ffffffffffff]]) are not tight enough (expected bounds not looser than (Some [Some [0x0 ~> 0x8cccccccccccc], Some [0x0 ~> 0x8cccccccccccc], Some [0x0 ~> 0x8cccccccccccc], Some [0x0 ~> 0x8cccccccccccc], Some [0x0 ~> 0x8cccccccccccc]])). +The bounds [0x0 ~> 0x19dd1eb851eb806ae147ae147b7ff47ae147ae01a] are looser than the expected bounds [0x0 ~> 0x8cccccccccccc] +When doing bounds analysis on the syntax tree: /* * 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]] + * out1: None */ -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[3]) * (uint64_t)0x2); - uint64_t x2 = ((arg1[2]) * (uint64_t)0x2); +void f(uint256 out1[5], const uint64_t arg1[5]) { + uint64_t x1 = ((arg1[3]) * (uint64_t)UINT8_C(0x13)); + uint64_t x2 = (x1 * (uint64_t)0x2); uint64_t x3 = ((arg1[1]) * (uint64_t)0x2); uint64_t x4 = ((arg1[0]) * (uint64_t)0x2); - fiat_25519_uint128 x5 = ((fiat_25519_uint128)(arg1[4]) * ((arg1[4]) * (uint64_t)UINT8_C(0x13))); - fiat_25519_uint128 x6 = ((fiat_25519_uint128)x1 * ((arg1[4]) * (uint64_t)UINT8_C(0x13))); - fiat_25519_uint128 x7 = ((fiat_25519_uint128)(arg1[3]) * ((arg1[3]) * (uint64_t)UINT8_C(0x13))); - fiat_25519_uint128 x8 = ((fiat_25519_uint128)x2 * ((arg1[4]) * (uint64_t)UINT8_C(0x13))); - fiat_25519_uint128 x9 = ((fiat_25519_uint128)x2 * ((arg1[3]) * (uint64_t)UINT8_C(0x13))); - fiat_25519_uint128 x10 = ((fiat_25519_uint128)x3 * ((arg1[4]) * (uint64_t)UINT8_C(0x13))); - fiat_25519_uint128 x11 = ((fiat_25519_uint128)(arg1[2]) * (arg1[2])); - fiat_25519_uint128 x12 = ((fiat_25519_uint128)x3 * (arg1[3])); - fiat_25519_uint128 x13 = ((fiat_25519_uint128)x3 * (arg1[2])); - fiat_25519_uint128 x14 = ((fiat_25519_uint128)(arg1[1]) * (arg1[1])); - fiat_25519_uint128 x15 = ((fiat_25519_uint128)x4 * (arg1[4])); - fiat_25519_uint128 x16 = ((fiat_25519_uint128)x4 * (arg1[3])); - fiat_25519_uint128 x17 = ((fiat_25519_uint128)x4 * (arg1[2])); - fiat_25519_uint128 x18 = ((fiat_25519_uint128)x4 * (arg1[1])); - fiat_25519_uint128 x19 = ((fiat_25519_uint128)(arg1[0]) * (arg1[0])); - fiat_25519_uint128 x20 = (x19 + (x10 + x9)); - uint64_t x21 = (uint64_t)(x20 >> 51); - uint64_t x22 = (uint64_t)(x20 & UINT64_C(0x7ffffffffffff)); - fiat_25519_uint128 x23 = (x15 + (x12 + x11)); - fiat_25519_uint128 x24 = (x16 + (x13 + x5)); - fiat_25519_uint128 x25 = (x17 + (x14 + x6)); - fiat_25519_uint128 x26 = (x18 + (x8 + x7)); - fiat_25519_uint128 x27 = (x21 + x26); - uint64_t x28 = (uint64_t)(x27 >> 51); - uint64_t x29 = (uint64_t)(x27 & UINT64_C(0x7ffffffffffff)); - fiat_25519_uint128 x30 = (x28 + x25); - uint64_t x31 = (uint64_t)(x30 >> 51); - uint64_t x32 = (uint64_t)(x30 & UINT64_C(0x7ffffffffffff)); - fiat_25519_uint128 x33 = (x31 + x24); - uint64_t x34 = (uint64_t)(x33 >> 51); - uint64_t x35 = (uint64_t)(x33 & UINT64_C(0x7ffffffffffff)); - fiat_25519_uint128 x36 = (x34 + x23); - uint64_t x37 = (uint64_t)(x36 >> 51); - uint64_t x38 = (uint64_t)(x36 & UINT64_C(0x7ffffffffffff)); - uint64_t x39 = (x37 * (uint64_t)UINT8_C(0x13)); - uint64_t x40 = (x22 + x39); - uint64_t x41 = (x40 >> 51); - uint64_t x42 = (x40 & UINT64_C(0x7ffffffffffff)); - uint64_t x43 = (x41 + x29); - uint64_t x44 = (x43 >> 51); - uint64_t x45 = (x43 & UINT64_C(0x7ffffffffffff)); - uint64_t x46 = (x44 + x32); - out1[0] = x42; - out1[1] = x45; - out1[2] = x46; - out1[3] = x35; - out1[4] = x38; -} - -/* - * 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_scmul_121666(uint64_t out1[5], const uint64_t arg1[5]) { - fiat_25519_uint128 x1 = (UINT32_C(0x1db42) * (fiat_25519_uint128)(arg1[4])); - fiat_25519_uint128 x2 = (UINT32_C(0x1db42) * (fiat_25519_uint128)(arg1[3])); - fiat_25519_uint128 x3 = (UINT32_C(0x1db42) * (fiat_25519_uint128)(arg1[2])); - fiat_25519_uint128 x4 = (UINT32_C(0x1db42) * (fiat_25519_uint128)(arg1[1])); - fiat_25519_uint128 x5 = (UINT32_C(0x1db42) * (fiat_25519_uint128)(arg1[0])); - uint64_t x6 = (uint64_t)(x5 >> 51); - uint64_t x7 = (uint64_t)(x5 & UINT64_C(0x7ffffffffffff)); - fiat_25519_uint128 x8 = (x6 + x4); - uint64_t x9 = (uint64_t)(x8 >> 51); - uint64_t x10 = (uint64_t)(x8 & UINT64_C(0x7ffffffffffff)); - fiat_25519_uint128 x11 = (x9 + x3); - uint64_t x12 = (uint64_t)(x11 >> 51); - uint64_t x13 = (uint64_t)(x11 & UINT64_C(0x7ffffffffffff)); - fiat_25519_uint128 x14 = (x12 + x2); - uint64_t x15 = (uint64_t)(x14 >> 51); - uint64_t x16 = (uint64_t)(x14 & UINT64_C(0x7ffffffffffff)); - fiat_25519_uint128 x17 = (x15 + x1); + uint512 x5 = ((uint512)((uint128)(arg1[4]) * (arg1[4])) << 204); + uint128 x6 = ((uint128)(arg1[3]) * x2); + uint256 x7 = ((uint256)((uint128)(arg1[3]) * (arg1[3])) << 102); + uint128 x8 = ((uint128)(arg1[2]) * (arg1[2])); + uint128 x9 = ((uint128)(arg1[1]) * x3); + uint128 x10 = ((uint128)(arg1[1]) * x3); + uint128 x11 = ((uint128)(arg1[1]) * (arg1[1])); + uint128 x12 = ((uint128)(arg1[0]) * x4); + uint128 x13 = ((uint128)(arg1[0]) * x4); + uint128 x14 = ((uint128)(arg1[0]) * x4); + uint128 x15 = ((uint128)(arg1[0]) * x4); + uint128 x16 = ((uint128)(arg1[0]) * (arg1[0])); + uint128 x17 = (x16 + (x15 + (x14 + (x13 + x12)))); uint64_t x18 = (uint64_t)(x17 >> 51); uint64_t x19 = (uint64_t)(x17 & UINT64_C(0x7ffffffffffff)); - uint64_t x20 = (x18 * (uint64_t)UINT8_C(0x13)); - uint64_t x21 = (x7 + x20); - uint64_t x22 = (x21 >> 51); - uint64_t x23 = (x21 & UINT64_C(0x7ffffffffffff)); - uint64_t x24 = (x22 + x10); - uint64_t x25 = (x24 >> 51); - uint64_t x26 = (x24 & UINT64_C(0x7ffffffffffff)); - uint64_t x27 = (x25 + x13); - out1[0] = x23; - out1[1] = x26; - out1[2] = x27; - out1[3] = x16; - out1[4] = x19; -} - -/* - * 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 ~> 0x1] - * arg2: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] - * arg3: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] - * Output Bounds: - * out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] - */ -static void fiat_25519_selectznz(uint64_t out1[5], fiat_25519_uint1 arg1, const uint64_t arg2[5], const uint64_t arg3[5]) { - uint64_t x1; - fiat_25519_cmovznz_u64(&x1, arg1, (arg2[0]), (arg3[0])); - uint64_t x2; - fiat_25519_cmovznz_u64(&x2, arg1, (arg2[1]), (arg3[1])); - uint64_t x3; - fiat_25519_cmovznz_u64(&x3, arg1, (arg2[2]), (arg3[2])); - uint64_t x4; - fiat_25519_cmovznz_u64(&x4, arg1, (arg2[3]), (arg3[3])); - uint64_t x5; - fiat_25519_cmovznz_u64(&x5, arg1, (arg2[4]), (arg3[4])); - out1[0] = x1; - out1[1] = x2; - out1[2] = x3; - out1[3] = x4; - out1[4] = x5; + uint512 x20 = (x8 + (x7 + x5)); + uint128 x21 = (x11 + (x10 + x9)); + uint128 x22 = (x18 + x6); + uint64_t x23 = (uint64_t)(x22 >> 51); + uint64_t x24 = (uint64_t)(x22 & UINT64_C(0x7ffffffffffff)); + uint128 x25 = (x23 + x21); + uint64_t x26 = (uint64_t)(x25 >> 51); + uint64_t x27 = (uint64_t)(x25 & UINT64_C(0x7ffffffffffff)); + uint8_t x28 = (uint8_t)(x26 >> 51); + uint64_t x29 = (x26 & UINT64_C(0x7ffffffffffff)); + uint512 x30 = (x28 + x20); + uint512 x31 = (x30 >> 51); + uint64_t x32 = (uint64_t)(x30 & UINT64_C(0x7ffffffffffff)); + uint512 x33 = (x31 * (uint512)UINT8_C(0x13)); + uint512 x34 = (x19 + x33); + uint256 x35 = (uint256)(x34 >> 51); + uint64_t x36 = (uint64_t)(x34 & UINT64_C(0x7ffffffffffff)); + uint256 x37 = (x35 + x24); + uint256 x38 = (x37 >> 51); + uint64_t x39 = (uint64_t)(x37 & UINT64_C(0x7ffffffffffff)); + uint256 x40 = (x38 + x27); + out1[0] = x36; + out1[1] = x39; + out1[2] = x40; + out1[3] = x29; + out1[4] = x32; } -/* - * 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; -} +with input bounds (Some [Some [0x0 ~> 0x1a666666666664], Some [0x0 ~> 0x1a666666666664], Some [0x0 ~> 0x1a666666666664], Some [0x0 ~> 0x1a666666666664], Some [0x0 ~> 0x1a666666666664]], tt). -/* - * 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; -} |