aienux
Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.
Brought by drakestapleton
aienux / vendor / fiat-crypto / src / poly1305_64.rs
| 1 | //! Autogenerated: 'src/ExtractionOCaml/unsaturated_solinas' --lang Rust --inline poly1305 64 3 '2^130 - 5' carry_mul carry_square carry add sub opp selectznz to_bytes from_bytes relax |
| 2 | //! curve description: poly1305 |
| 3 | //! machine_wordsize = 64 (from "64") |
| 4 | //! requested operations: carry_mul, carry_square, carry, add, sub, opp, selectznz, to_bytes, from_bytes, relax |
| 5 | //! n = 3 (from "3") |
| 6 | //! s-c = 2^130 - [(1, 5)] (from "2^130 - 5") |
| 7 | //! tight_bounds_multiplier = 1 (from "") |
| 8 | //! |
| 9 | //! Computed values: |
| 10 | //! carry_chain = [0, 1, 2, 0, 1] |
| 11 | //! eval z = z[0] + (z[1] << 44) + (z[2] << 87) |
| 12 | //! bytes_eval z = z[0] + (z[1] << 8) + (z[2] << 16) + (z[3] << 24) + (z[4] << 32) + (z[5] << 40) + (z[6] << 48) + (z[7] << 56) + (z[8] << 64) + (z[9] << 72) + (z[10] << 80) + (z[11] << 88) + (z[12] << 96) + (z[13] << 104) + (z[14] << 112) + (z[15] << 120) + (z[16] << 128) |
| 13 | //! balance = [0x1ffffffffff6, 0xffffffffffe, 0xffffffffffe] |
| 14 | |
| 15 | #![allow(unused_parens)] |
| 16 | #![allow(non_camel_case_types)] |
| 17 | |
| 18 | /** fiat_poly1305_u1 represents values of 1 bits, stored in one byte. */ |
| 19 | pub type fiat_poly1305_u1 = u8; |
| 20 | /** fiat_poly1305_i1 represents values of 1 bits, stored in one byte. */ |
| 21 | pub type fiat_poly1305_i1 = i8; |
| 22 | /** fiat_poly1305_u2 represents values of 2 bits, stored in one byte. */ |
| 23 | pub type fiat_poly1305_u2 = u8; |
| 24 | /** fiat_poly1305_i2 represents values of 2 bits, stored in one byte. */ |
| 25 | pub type fiat_poly1305_i2 = i8; |
| 26 | |
| 27 | /** The type fiat_poly1305_loose_field_element is a field element with loose bounds. */ |
| 28 | /** Bounds: [[0x0 ~> 0x300000000000], [0x0 ~> 0x180000000000], [0x0 ~> 0x180000000000]] */ |
| 29 | #[derive(Clone, Copy)] |
| 30 | pub struct fiat_poly1305_loose_field_element(pub [u64; 3]); |
| 31 | |
| 32 | impl core::ops::Index<usize> for fiat_poly1305_loose_field_element { |
| 33 | type Output = u64; |
| 34 | #[inline] |
| 35 | fn index(&self, index: usize) -> &Self::Output { |
| 36 | &self.0[index] |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | impl core::ops::IndexMut<usize> for fiat_poly1305_loose_field_element { |
| 41 | #[inline] |
| 42 | fn index_mut(&mut self, index: usize) -> &mut Self::Output { |
| 43 | &mut self.0[index] |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | /** The type fiat_poly1305_tight_field_element is a field element with tight bounds. */ |
| 48 | /** Bounds: [[0x0 ~> 0x100000000000], [0x0 ~> 0x80000000000], [0x0 ~> 0x80000000000]] */ |
| 49 | #[derive(Clone, Copy)] |
| 50 | pub struct fiat_poly1305_tight_field_element(pub [u64; 3]); |
| 51 | |
| 52 | impl core::ops::Index<usize> for fiat_poly1305_tight_field_element { |
| 53 | type Output = u64; |
| 54 | #[inline] |
| 55 | fn index(&self, index: usize) -> &Self::Output { |
| 56 | &self.0[index] |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | impl core::ops::IndexMut<usize> for fiat_poly1305_tight_field_element { |
| 61 | #[inline] |
| 62 | fn index_mut(&mut self, index: usize) -> &mut Self::Output { |
| 63 | &mut self.0[index] |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | |
| 68 | /// The function fiat_poly1305_addcarryx_u44 is an addition with carry. |
| 69 | /// |
| 70 | /// Postconditions: |
| 71 | /// out1 = (arg1 + arg2 + arg3) mod 2^44 |
| 72 | /// out2 = ⌊(arg1 + arg2 + arg3) / 2^44⌋ |
| 73 | /// |
| 74 | /// Input Bounds: |
| 75 | /// arg1: [0x0 ~> 0x1] |
| 76 | /// arg2: [0x0 ~> 0xfffffffffff] |
| 77 | /// arg3: [0x0 ~> 0xfffffffffff] |
| 78 | /// Output Bounds: |
| 79 | /// out1: [0x0 ~> 0xfffffffffff] |
| 80 | /// out2: [0x0 ~> 0x1] |
| 81 | #[inline] |
| 82 | pub fn fiat_poly1305_addcarryx_u44(out1: &mut u64, out2: &mut fiat_poly1305_u1, arg1: fiat_poly1305_u1, arg2: u64, arg3: u64) { |
| 83 | let x1: u64 = (((arg1 as u64) + arg2) + arg3); |
| 84 | let x2: u64 = (x1 & 0xfffffffffff); |
| 85 | let x3: fiat_poly1305_u1 = ((x1 >> 44) as fiat_poly1305_u1); |
| 86 | *out1 = x2; |
| 87 | *out2 = x3; |
| 88 | } |
| 89 | |
| 90 | /// The function fiat_poly1305_subborrowx_u44 is a subtraction with borrow. |
| 91 | /// |
| 92 | /// Postconditions: |
| 93 | /// out1 = (-arg1 + arg2 + -arg3) mod 2^44 |
| 94 | /// out2 = -⌊(-arg1 + arg2 + -arg3) / 2^44⌋ |
| 95 | /// |
| 96 | /// Input Bounds: |
| 97 | /// arg1: [0x0 ~> 0x1] |
| 98 | /// arg2: [0x0 ~> 0xfffffffffff] |
| 99 | /// arg3: [0x0 ~> 0xfffffffffff] |
| 100 | /// Output Bounds: |
| 101 | /// out1: [0x0 ~> 0xfffffffffff] |
| 102 | /// out2: [0x0 ~> 0x1] |
| 103 | #[inline] |
| 104 | pub fn fiat_poly1305_subborrowx_u44(out1: &mut u64, out2: &mut fiat_poly1305_u1, arg1: fiat_poly1305_u1, arg2: u64, arg3: u64) { |
| 105 | let x1: i64 = ((((((arg2 as i128) - (arg1 as i128)) as i64) as i128) - (arg3 as i128)) as i64); |
| 106 | let x2: fiat_poly1305_i1 = ((x1 >> 44) as fiat_poly1305_i1); |
| 107 | let x3: u64 = (((x1 as i128) & (0xfffffffffff as i128)) as u64); |
| 108 | *out1 = x3; |
| 109 | *out2 = (((0x0 as fiat_poly1305_i2) - (x2 as fiat_poly1305_i2)) as fiat_poly1305_u1); |
| 110 | } |
| 111 | |
| 112 | /// The function fiat_poly1305_addcarryx_u43 is an addition with carry. |
| 113 | /// |
| 114 | /// Postconditions: |
| 115 | /// out1 = (arg1 + arg2 + arg3) mod 2^43 |
| 116 | /// out2 = ⌊(arg1 + arg2 + arg3) / 2^43⌋ |
| 117 | /// |
| 118 | /// Input Bounds: |
| 119 | /// arg1: [0x0 ~> 0x1] |
| 120 | /// arg2: [0x0 ~> 0x7ffffffffff] |
| 121 | /// arg3: [0x0 ~> 0x7ffffffffff] |
| 122 | /// Output Bounds: |
| 123 | /// out1: [0x0 ~> 0x7ffffffffff] |
| 124 | /// out2: [0x0 ~> 0x1] |
| 125 | #[inline] |
| 126 | pub fn fiat_poly1305_addcarryx_u43(out1: &mut u64, out2: &mut fiat_poly1305_u1, arg1: fiat_poly1305_u1, arg2: u64, arg3: u64) { |
| 127 | let x1: u64 = (((arg1 as u64) + arg2) + arg3); |
| 128 | let x2: u64 = (x1 & 0x7ffffffffff); |
| 129 | let x3: fiat_poly1305_u1 = ((x1 >> 43) as fiat_poly1305_u1); |
| 130 | *out1 = x2; |
| 131 | *out2 = x3; |
| 132 | } |
| 133 | |
| 134 | /// The function fiat_poly1305_subborrowx_u43 is a subtraction with borrow. |
| 135 | /// |
| 136 | /// Postconditions: |
| 137 | /// out1 = (-arg1 + arg2 + -arg3) mod 2^43 |
| 138 | /// out2 = -⌊(-arg1 + arg2 + -arg3) / 2^43⌋ |
| 139 | /// |
| 140 | /// Input Bounds: |
| 141 | /// arg1: [0x0 ~> 0x1] |
| 142 | /// arg2: [0x0 ~> 0x7ffffffffff] |
| 143 | /// arg3: [0x0 ~> 0x7ffffffffff] |
| 144 | /// Output Bounds: |
| 145 | /// out1: [0x0 ~> 0x7ffffffffff] |
| 146 | /// out2: [0x0 ~> 0x1] |
| 147 | #[inline] |
| 148 | pub fn fiat_poly1305_subborrowx_u43(out1: &mut u64, out2: &mut fiat_poly1305_u1, arg1: fiat_poly1305_u1, arg2: u64, arg3: u64) { |
| 149 | let x1: i64 = ((((((arg2 as i128) - (arg1 as i128)) as i64) as i128) - (arg3 as i128)) as i64); |
| 150 | let x2: fiat_poly1305_i1 = ((x1 >> 43) as fiat_poly1305_i1); |
| 151 | let x3: u64 = (((x1 as i128) & (0x7ffffffffff as i128)) as u64); |
| 152 | *out1 = x3; |
| 153 | *out2 = (((0x0 as fiat_poly1305_i2) - (x2 as fiat_poly1305_i2)) as fiat_poly1305_u1); |
| 154 | } |
| 155 | |
| 156 | /// The function fiat_poly1305_cmovznz_u64 is a single-word conditional move. |
| 157 | /// |
| 158 | /// Postconditions: |
| 159 | /// out1 = (if arg1 = 0 then arg2 else arg3) |
| 160 | /// |
| 161 | /// Input Bounds: |
| 162 | /// arg1: [0x0 ~> 0x1] |
| 163 | /// arg2: [0x0 ~> 0xffffffffffffffff] |
| 164 | /// arg3: [0x0 ~> 0xffffffffffffffff] |
| 165 | /// Output Bounds: |
| 166 | /// out1: [0x0 ~> 0xffffffffffffffff] |
| 167 | #[inline] |
| 168 | pub fn fiat_poly1305_cmovznz_u64(out1: &mut u64, arg1: fiat_poly1305_u1, arg2: u64, arg3: u64) { |
| 169 | let x1: fiat_poly1305_u1 = (!(!arg1)); |
| 170 | let x2: u64 = ((((((0x0 as fiat_poly1305_i2) - (x1 as fiat_poly1305_i2)) as fiat_poly1305_i1) as i128) & (0xffffffffffffffff as i128)) as u64); |
| 171 | let x3: u64 = ((x2 & arg3) | ((!x2) & arg2)); |
| 172 | *out1 = x3; |
| 173 | } |
| 174 | |
| 175 | /// The function fiat_poly1305_carry_mul multiplies two field elements and reduces the result. |
| 176 | /// |
| 177 | /// Postconditions: |
| 178 | /// eval out1 mod m = (eval arg1 * eval arg2) mod m |
| 179 | /// |
| 180 | #[inline] |
| 181 | pub fn fiat_poly1305_carry_mul(out1: &mut fiat_poly1305_tight_field_element, arg1: &fiat_poly1305_loose_field_element, arg2: &fiat_poly1305_loose_field_element) { |
| 182 | let x1: u128 = (((arg1[2]) as u128) * (((arg2[2]) * 0x5) as u128)); |
| 183 | let x2: u128 = (((arg1[2]) as u128) * (((arg2[1]) * 0xa) as u128)); |
| 184 | let x3: u128 = (((arg1[1]) as u128) * (((arg2[2]) * 0xa) as u128)); |
| 185 | let x4: u128 = (((arg1[2]) as u128) * ((arg2[0]) as u128)); |
| 186 | let x5: u128 = (((arg1[1]) as u128) * (((arg2[1]) * 0x2) as u128)); |
| 187 | let x6: u128 = (((arg1[1]) as u128) * ((arg2[0]) as u128)); |
| 188 | let x7: u128 = (((arg1[0]) as u128) * ((arg2[2]) as u128)); |
| 189 | let x8: u128 = (((arg1[0]) as u128) * ((arg2[1]) as u128)); |
| 190 | let x9: u128 = (((arg1[0]) as u128) * ((arg2[0]) as u128)); |
| 191 | let x10: u128 = (x9 + (x3 + x2)); |
| 192 | let x11: u64 = ((x10 >> 44) as u64); |
| 193 | let x12: u64 = ((x10 & (0xfffffffffff as u128)) as u64); |
| 194 | let x13: u128 = (x7 + (x5 + x4)); |
| 195 | let x14: u128 = (x8 + (x6 + x1)); |
| 196 | let x15: u128 = ((x11 as u128) + x14); |
| 197 | let x16: u64 = ((x15 >> 43) as u64); |
| 198 | let x17: u64 = ((x15 & (0x7ffffffffff as u128)) as u64); |
| 199 | let x18: u128 = ((x16 as u128) + x13); |
| 200 | let x19: u64 = ((x18 >> 43) as u64); |
| 201 | let x20: u64 = ((x18 & (0x7ffffffffff as u128)) as u64); |
| 202 | let x21: u64 = (x19 * 0x5); |
| 203 | let x22: u64 = (x12 + x21); |
| 204 | let x23: u64 = (x22 >> 44); |
| 205 | let x24: u64 = (x22 & 0xfffffffffff); |
| 206 | let x25: u64 = (x23 + x17); |
| 207 | let x26: fiat_poly1305_u1 = ((x25 >> 43) as fiat_poly1305_u1); |
| 208 | let x27: u64 = (x25 & 0x7ffffffffff); |
| 209 | let x28: u64 = ((x26 as u64) + x20); |
| 210 | out1[0] = x24; |
| 211 | out1[1] = x27; |
| 212 | out1[2] = x28; |
| 213 | } |
| 214 | |
| 215 | /// The function fiat_poly1305_carry_square squares a field element and reduces the result. |
| 216 | /// |
| 217 | /// Postconditions: |
| 218 | /// eval out1 mod m = (eval arg1 * eval arg1) mod m |
| 219 | /// |
| 220 | #[inline] |
| 221 | pub fn fiat_poly1305_carry_square(out1: &mut fiat_poly1305_tight_field_element, arg1: &fiat_poly1305_loose_field_element) { |
| 222 | let x1: u64 = ((arg1[2]) * 0x5); |
| 223 | let x2: u64 = (x1 * 0x2); |
| 224 | let x3: u64 = ((arg1[2]) * 0x2); |
| 225 | let x4: u64 = ((arg1[1]) * 0x2); |
| 226 | let x5: u128 = (((arg1[2]) as u128) * (x1 as u128)); |
| 227 | let x6: u128 = (((arg1[1]) as u128) * ((x2 * 0x2) as u128)); |
| 228 | let x7: u128 = (((arg1[1]) as u128) * (((arg1[1]) * 0x2) as u128)); |
| 229 | let x8: u128 = (((arg1[0]) as u128) * (x3 as u128)); |
| 230 | let x9: u128 = (((arg1[0]) as u128) * (x4 as u128)); |
| 231 | let x10: u128 = (((arg1[0]) as u128) * ((arg1[0]) as u128)); |
| 232 | let x11: u128 = (x10 + x6); |
| 233 | let x12: u64 = ((x11 >> 44) as u64); |
| 234 | let x13: u64 = ((x11 & (0xfffffffffff as u128)) as u64); |
| 235 | let x14: u128 = (x8 + x7); |
| 236 | let x15: u128 = (x9 + x5); |
| 237 | let x16: u128 = ((x12 as u128) + x15); |
| 238 | let x17: u64 = ((x16 >> 43) as u64); |
| 239 | let x18: u64 = ((x16 & (0x7ffffffffff as u128)) as u64); |
| 240 | let x19: u128 = ((x17 as u128) + x14); |
| 241 | let x20: u64 = ((x19 >> 43) as u64); |
| 242 | let x21: u64 = ((x19 & (0x7ffffffffff as u128)) as u64); |
| 243 | let x22: u64 = (x20 * 0x5); |
| 244 | let x23: u64 = (x13 + x22); |
| 245 | let x24: u64 = (x23 >> 44); |
| 246 | let x25: u64 = (x23 & 0xfffffffffff); |
| 247 | let x26: u64 = (x24 + x18); |
| 248 | let x27: fiat_poly1305_u1 = ((x26 >> 43) as fiat_poly1305_u1); |
| 249 | let x28: u64 = (x26 & 0x7ffffffffff); |
| 250 | let x29: u64 = ((x27 as u64) + x21); |
| 251 | out1[0] = x25; |
| 252 | out1[1] = x28; |
| 253 | out1[2] = x29; |
| 254 | } |
| 255 | |
| 256 | /// The function fiat_poly1305_carry reduces a field element. |
| 257 | /// |
| 258 | /// Postconditions: |
| 259 | /// eval out1 mod m = eval arg1 mod m |
| 260 | /// |
| 261 | #[inline] |
| 262 | pub fn fiat_poly1305_carry(out1: &mut fiat_poly1305_tight_field_element, arg1: &fiat_poly1305_loose_field_element) { |
| 263 | let x1: u64 = (arg1[0]); |
| 264 | let x2: u64 = ((x1 >> 44) + (arg1[1])); |
| 265 | let x3: u64 = ((x2 >> 43) + (arg1[2])); |
| 266 | let x4: u64 = ((x1 & 0xfffffffffff) + ((x3 >> 43) * 0x5)); |
| 267 | let x5: u64 = ((((x4 >> 44) as fiat_poly1305_u1) as u64) + (x2 & 0x7ffffffffff)); |
| 268 | let x6: u64 = (x4 & 0xfffffffffff); |
| 269 | let x7: u64 = (x5 & 0x7ffffffffff); |
| 270 | let x8: u64 = ((((x5 >> 43) as fiat_poly1305_u1) as u64) + (x3 & 0x7ffffffffff)); |
| 271 | out1[0] = x6; |
| 272 | out1[1] = x7; |
| 273 | out1[2] = x8; |
| 274 | } |
| 275 | |
| 276 | /// The function fiat_poly1305_add adds two field elements. |
| 277 | /// |
| 278 | /// Postconditions: |
| 279 | /// eval out1 mod m = (eval arg1 + eval arg2) mod m |
| 280 | /// |
| 281 | #[inline] |
| 282 | pub fn fiat_poly1305_add(out1: &mut fiat_poly1305_loose_field_element, arg1: &fiat_poly1305_tight_field_element, arg2: &fiat_poly1305_tight_field_element) { |
| 283 | let x1: u64 = ((arg1[0]) + (arg2[0])); |
| 284 | let x2: u64 = ((arg1[1]) + (arg2[1])); |
| 285 | let x3: u64 = ((arg1[2]) + (arg2[2])); |
| 286 | out1[0] = x1; |
| 287 | out1[1] = x2; |
| 288 | out1[2] = x3; |
| 289 | } |
| 290 | |
| 291 | /// The function fiat_poly1305_sub subtracts two field elements. |
| 292 | /// |
| 293 | /// Postconditions: |
| 294 | /// eval out1 mod m = (eval arg1 - eval arg2) mod m |
| 295 | /// |
| 296 | #[inline] |
| 297 | pub fn fiat_poly1305_sub(out1: &mut fiat_poly1305_loose_field_element, arg1: &fiat_poly1305_tight_field_element, arg2: &fiat_poly1305_tight_field_element) { |
| 298 | let x1: u64 = ((0x1ffffffffff6 + (arg1[0])) - (arg2[0])); |
| 299 | let x2: u64 = ((0xffffffffffe + (arg1[1])) - (arg2[1])); |
| 300 | let x3: u64 = ((0xffffffffffe + (arg1[2])) - (arg2[2])); |
| 301 | out1[0] = x1; |
| 302 | out1[1] = x2; |
| 303 | out1[2] = x3; |
| 304 | } |
| 305 | |
| 306 | /// The function fiat_poly1305_opp negates a field element. |
| 307 | /// |
| 308 | /// Postconditions: |
| 309 | /// eval out1 mod m = -eval arg1 mod m |
| 310 | /// |
| 311 | #[inline] |
| 312 | pub fn fiat_poly1305_opp(out1: &mut fiat_poly1305_loose_field_element, arg1: &fiat_poly1305_tight_field_element) { |
| 313 | let x1: u64 = (0x1ffffffffff6 - (arg1[0])); |
| 314 | let x2: u64 = (0xffffffffffe - (arg1[1])); |
| 315 | let x3: u64 = (0xffffffffffe - (arg1[2])); |
| 316 | out1[0] = x1; |
| 317 | out1[1] = x2; |
| 318 | out1[2] = x3; |
| 319 | } |
| 320 | |
| 321 | /// The function fiat_poly1305_selectznz is a multi-limb conditional select. |
| 322 | /// |
| 323 | /// Postconditions: |
| 324 | /// out1 = (if arg1 = 0 then arg2 else arg3) |
| 325 | /// |
| 326 | /// Input Bounds: |
| 327 | /// arg1: [0x0 ~> 0x1] |
| 328 | /// arg2: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] |
| 329 | /// arg3: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] |
| 330 | /// Output Bounds: |
| 331 | /// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] |
| 332 | #[inline] |
| 333 | pub fn fiat_poly1305_selectznz(out1: &mut [u64; 3], arg1: fiat_poly1305_u1, arg2: &[u64; 3], arg3: &[u64; 3]) { |
| 334 | let mut x1: u64 = 0; |
| 335 | fiat_poly1305_cmovznz_u64(&mut x1, arg1, (arg2[0]), (arg3[0])); |
| 336 | let mut x2: u64 = 0; |
| 337 | fiat_poly1305_cmovznz_u64(&mut x2, arg1, (arg2[1]), (arg3[1])); |
| 338 | let mut x3: u64 = 0; |
| 339 | fiat_poly1305_cmovznz_u64(&mut x3, arg1, (arg2[2]), (arg3[2])); |
| 340 | out1[0] = x1; |
| 341 | out1[1] = x2; |
| 342 | out1[2] = x3; |
| 343 | } |
| 344 | |
| 345 | /// The function fiat_poly1305_to_bytes serializes a field element to bytes in little-endian order. |
| 346 | /// |
| 347 | /// Postconditions: |
| 348 | /// out1 = map (λ x, ⌊((eval arg1 mod m) mod 2^(8 * (x + 1))) / 2^(8 * x)⌋) [0..16] |
| 349 | /// |
| 350 | /// Output Bounds: |
| 351 | /// 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 ~> 0x3]] |
| 352 | #[inline] |
| 353 | pub fn fiat_poly1305_to_bytes(out1: &mut [u8; 17], arg1: &fiat_poly1305_tight_field_element) { |
| 354 | let mut x1: u64 = 0; |
| 355 | let mut x2: fiat_poly1305_u1 = 0; |
| 356 | fiat_poly1305_subborrowx_u44(&mut x1, &mut x2, 0x0, (arg1[0]), 0xffffffffffb); |
| 357 | let mut x3: u64 = 0; |
| 358 | let mut x4: fiat_poly1305_u1 = 0; |
| 359 | fiat_poly1305_subborrowx_u43(&mut x3, &mut x4, x2, (arg1[1]), 0x7ffffffffff); |
| 360 | let mut x5: u64 = 0; |
| 361 | let mut x6: fiat_poly1305_u1 = 0; |
| 362 | fiat_poly1305_subborrowx_u43(&mut x5, &mut x6, x4, (arg1[2]), 0x7ffffffffff); |
| 363 | let mut x7: u64 = 0; |
| 364 | fiat_poly1305_cmovznz_u64(&mut x7, x6, (0x0 as u64), 0xffffffffffffffff); |
| 365 | let mut x8: u64 = 0; |
| 366 | let mut x9: fiat_poly1305_u1 = 0; |
| 367 | fiat_poly1305_addcarryx_u44(&mut x8, &mut x9, 0x0, x1, (x7 & 0xffffffffffb)); |
| 368 | let mut x10: u64 = 0; |
| 369 | let mut x11: fiat_poly1305_u1 = 0; |
| 370 | fiat_poly1305_addcarryx_u43(&mut x10, &mut x11, x9, x3, (x7 & 0x7ffffffffff)); |
| 371 | let mut x12: u64 = 0; |
| 372 | let mut x13: fiat_poly1305_u1 = 0; |
| 373 | fiat_poly1305_addcarryx_u43(&mut x12, &mut x13, x11, x5, (x7 & 0x7ffffffffff)); |
| 374 | let x14: u64 = (x12 << 7); |
| 375 | let x15: u64 = (x10 << 4); |
| 376 | let x16: u8 = ((x8 & (0xff as u64)) as u8); |
| 377 | let x17: u64 = (x8 >> 8); |
| 378 | let x18: u8 = ((x17 & (0xff as u64)) as u8); |
| 379 | let x19: u64 = (x17 >> 8); |
| 380 | let x20: u8 = ((x19 & (0xff as u64)) as u8); |
| 381 | let x21: u64 = (x19 >> 8); |
| 382 | let x22: u8 = ((x21 & (0xff as u64)) as u8); |
| 383 | let x23: u64 = (x21 >> 8); |
| 384 | let x24: u8 = ((x23 & (0xff as u64)) as u8); |
| 385 | let x25: u8 = ((x23 >> 8) as u8); |
| 386 | let x26: u64 = (x15 + (x25 as u64)); |
| 387 | let x27: u8 = ((x26 & (0xff as u64)) as u8); |
| 388 | let x28: u64 = (x26 >> 8); |
| 389 | let x29: u8 = ((x28 & (0xff as u64)) as u8); |
| 390 | let x30: u64 = (x28 >> 8); |
| 391 | let x31: u8 = ((x30 & (0xff as u64)) as u8); |
| 392 | let x32: u64 = (x30 >> 8); |
| 393 | let x33: u8 = ((x32 & (0xff as u64)) as u8); |
| 394 | let x34: u64 = (x32 >> 8); |
| 395 | let x35: u8 = ((x34 & (0xff as u64)) as u8); |
| 396 | let x36: u8 = ((x34 >> 8) as u8); |
| 397 | let x37: u64 = (x14 + (x36 as u64)); |
| 398 | let x38: u8 = ((x37 & (0xff as u64)) as u8); |
| 399 | let x39: u64 = (x37 >> 8); |
| 400 | let x40: u8 = ((x39 & (0xff as u64)) as u8); |
| 401 | let x41: u64 = (x39 >> 8); |
| 402 | let x42: u8 = ((x41 & (0xff as u64)) as u8); |
| 403 | let x43: u64 = (x41 >> 8); |
| 404 | let x44: u8 = ((x43 & (0xff as u64)) as u8); |
| 405 | let x45: u64 = (x43 >> 8); |
| 406 | let x46: u8 = ((x45 & (0xff as u64)) as u8); |
| 407 | let x47: u64 = (x45 >> 8); |
| 408 | let x48: u8 = ((x47 & (0xff as u64)) as u8); |
| 409 | let x49: u8 = ((x47 >> 8) as u8); |
| 410 | out1[0] = x16; |
| 411 | out1[1] = x18; |
| 412 | out1[2] = x20; |
| 413 | out1[3] = x22; |
| 414 | out1[4] = x24; |
| 415 | out1[5] = x27; |
| 416 | out1[6] = x29; |
| 417 | out1[7] = x31; |
| 418 | out1[8] = x33; |
| 419 | out1[9] = x35; |
| 420 | out1[10] = x38; |
| 421 | out1[11] = x40; |
| 422 | out1[12] = x42; |
| 423 | out1[13] = x44; |
| 424 | out1[14] = x46; |
| 425 | out1[15] = x48; |
| 426 | out1[16] = x49; |
| 427 | } |
| 428 | |
| 429 | /// The function fiat_poly1305_from_bytes deserializes a field element from bytes in little-endian order. |
| 430 | /// |
| 431 | /// Postconditions: |
| 432 | /// eval out1 mod m = bytes_eval arg1 mod m |
| 433 | /// |
| 434 | /// Input Bounds: |
| 435 | /// 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 ~> 0x3]] |
| 436 | #[inline] |
| 437 | pub fn fiat_poly1305_from_bytes(out1: &mut fiat_poly1305_tight_field_element, arg1: &[u8; 17]) { |
| 438 | let x1: u64 = (((arg1[16]) as u64) << 41); |
| 439 | let x2: u64 = (((arg1[15]) as u64) << 33); |
| 440 | let x3: u64 = (((arg1[14]) as u64) << 25); |
| 441 | let x4: u64 = (((arg1[13]) as u64) << 17); |
| 442 | let x5: u64 = (((arg1[12]) as u64) << 9); |
| 443 | let x6: u64 = (((arg1[11]) as u64) * (0x2 as u64)); |
| 444 | let x7: u64 = (((arg1[10]) as u64) << 36); |
| 445 | let x8: u64 = (((arg1[9]) as u64) << 28); |
| 446 | let x9: u64 = (((arg1[8]) as u64) << 20); |
| 447 | let x10: u64 = (((arg1[7]) as u64) << 12); |
| 448 | let x11: u64 = (((arg1[6]) as u64) << 4); |
| 449 | let x12: u64 = (((arg1[5]) as u64) << 40); |
| 450 | let x13: u64 = (((arg1[4]) as u64) << 32); |
| 451 | let x14: u64 = (((arg1[3]) as u64) << 24); |
| 452 | let x15: u64 = (((arg1[2]) as u64) << 16); |
| 453 | let x16: u64 = (((arg1[1]) as u64) << 8); |
| 454 | let x17: u8 = (arg1[0]); |
| 455 | let x18: u64 = (x16 + (x17 as u64)); |
| 456 | let x19: u64 = (x15 + x18); |
| 457 | let x20: u64 = (x14 + x19); |
| 458 | let x21: u64 = (x13 + x20); |
| 459 | let x22: u64 = (x12 + x21); |
| 460 | let x23: u64 = (x22 & 0xfffffffffff); |
| 461 | let x24: u8 = ((x22 >> 44) as u8); |
| 462 | let x25: u64 = (x11 + (x24 as u64)); |
| 463 | let x26: u64 = (x10 + x25); |
| 464 | let x27: u64 = (x9 + x26); |
| 465 | let x28: u64 = (x8 + x27); |
| 466 | let x29: u64 = (x7 + x28); |
| 467 | let x30: u64 = (x29 & 0x7ffffffffff); |
| 468 | let x31: fiat_poly1305_u1 = ((x29 >> 43) as fiat_poly1305_u1); |
| 469 | let x32: u64 = (x6 + (x31 as u64)); |
| 470 | let x33: u64 = (x5 + x32); |
| 471 | let x34: u64 = (x4 + x33); |
| 472 | let x35: u64 = (x3 + x34); |
| 473 | let x36: u64 = (x2 + x35); |
| 474 | let x37: u64 = (x1 + x36); |
| 475 | out1[0] = x23; |
| 476 | out1[1] = x30; |
| 477 | out1[2] = x37; |
| 478 | } |
| 479 | |
| 480 | /// The function fiat_poly1305_relax is the identity function converting from tight field elements to loose field elements. |
| 481 | /// |
| 482 | /// Postconditions: |
| 483 | /// out1 = arg1 |
| 484 | /// |
| 485 | #[inline] |
| 486 | pub fn fiat_poly1305_relax(out1: &mut fiat_poly1305_loose_field_element, arg1: &fiat_poly1305_tight_field_element) { |
| 487 | let x1: u64 = (arg1[0]); |
| 488 | let x2: u64 = (arg1[1]); |
| 489 | let x3: u64 = (arg1[2]); |
| 490 | out1[0] = x1; |
| 491 | out1[1] = x2; |
| 492 | out1[2] = x3; |
| 493 | } |