summaryrefslogtreecommitdiffstats
path: root/vendor/fiat-crypto/src/p256_64.rs
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/fiat-crypto/src/p256_64.rs')
-rw-r--r--vendor/fiat-crypto/src/p256_64.rs86
1 files changed, 61 insertions, 25 deletions
diff --git a/vendor/fiat-crypto/src/p256_64.rs b/vendor/fiat-crypto/src/p256_64.rs
index 0a3c6fb84..62272f2a9 100644
--- a/vendor/fiat-crypto/src/p256_64.rs
+++ b/vendor/fiat-crypto/src/p256_64.rs
@@ -20,18 +20,54 @@
#![allow(unused_parens)]
#![allow(non_camel_case_types)]
+/** fiat_p256_u1 represents values of 1 bits, stored in one byte. */
pub type fiat_p256_u1 = u8;
+/** fiat_p256_i1 represents values of 1 bits, stored in one byte. */
pub type fiat_p256_i1 = i8;
+/** fiat_p256_u2 represents values of 2 bits, stored in one byte. */
pub type fiat_p256_u2 = u8;
+/** fiat_p256_i2 represents values of 2 bits, stored in one byte. */
pub type fiat_p256_i2 = i8;
-/* The type fiat_p256_montgomery_domain_field_element is a field element in the Montgomery domain. */
-/* Bounds: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] */
-pub type fiat_p256_montgomery_domain_field_element = [u64; 4];
+/** The type fiat_p256_montgomery_domain_field_element is a field element in the Montgomery domain. */
+/** Bounds: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] */
+#[derive(Clone, Copy)]
+pub struct fiat_p256_montgomery_domain_field_element(pub [u64; 4]);
-/* The type fiat_p256_non_montgomery_domain_field_element is a field element NOT in the Montgomery domain. */
-/* Bounds: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] */
-pub type fiat_p256_non_montgomery_domain_field_element = [u64; 4];
+impl core::ops::Index<usize> for fiat_p256_montgomery_domain_field_element {
+ type Output = u64;
+ #[inline]
+ fn index(&self, index: usize) -> &Self::Output {
+ &self.0[index]
+ }
+}
+
+impl core::ops::IndexMut<usize> for fiat_p256_montgomery_domain_field_element {
+ #[inline]
+ fn index_mut(&mut self, index: usize) -> &mut Self::Output {
+ &mut self.0[index]
+ }
+}
+
+/** The type fiat_p256_non_montgomery_domain_field_element is a field element NOT in the Montgomery domain. */
+/** Bounds: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] */
+#[derive(Clone, Copy)]
+pub struct fiat_p256_non_montgomery_domain_field_element(pub [u64; 4]);
+
+impl core::ops::Index<usize> for fiat_p256_non_montgomery_domain_field_element {
+ type Output = u64;
+ #[inline]
+ fn index(&self, index: usize) -> &Self::Output {
+ &self.0[index]
+ }
+}
+
+impl core::ops::IndexMut<usize> for fiat_p256_non_montgomery_domain_field_element {
+ #[inline]
+ fn index_mut(&mut self, index: usize) -> &mut Self::Output {
+ &mut self.0[index]
+ }
+}
/// The function fiat_p256_addcarryx_u64 is an addition with carry.
@@ -48,7 +84,7 @@ pub type fiat_p256_non_montgomery_domain_field_element = [u64; 4];
/// out1: [0x0 ~> 0xffffffffffffffff]
/// out2: [0x0 ~> 0x1]
#[inline]
-pub fn fiat_p256_addcarryx_u64(out1: &mut u64, out2: &mut fiat_p256_u1, arg1: fiat_p256_u1, arg2: u64, arg3: u64) -> () {
+pub fn fiat_p256_addcarryx_u64(out1: &mut u64, out2: &mut fiat_p256_u1, arg1: fiat_p256_u1, arg2: u64, arg3: u64) {
let x1: u128 = (((arg1 as u128) + (arg2 as u128)) + (arg3 as u128));
let x2: u64 = ((x1 & (0xffffffffffffffff as u128)) as u64);
let x3: fiat_p256_u1 = ((x1 >> 64) as fiat_p256_u1);
@@ -70,7 +106,7 @@ pub fn fiat_p256_addcarryx_u64(out1: &mut u64, out2: &mut fiat_p256_u1, arg1: fi
/// out1: [0x0 ~> 0xffffffffffffffff]
/// out2: [0x0 ~> 0x1]
#[inline]
-pub fn fiat_p256_subborrowx_u64(out1: &mut u64, out2: &mut fiat_p256_u1, arg1: fiat_p256_u1, arg2: u64, arg3: u64) -> () {
+pub fn fiat_p256_subborrowx_u64(out1: &mut u64, out2: &mut fiat_p256_u1, arg1: fiat_p256_u1, arg2: u64, arg3: u64) {
let x1: i128 = (((arg2 as i128) - (arg1 as i128)) - (arg3 as i128));
let x2: fiat_p256_i1 = ((x1 >> 64) as fiat_p256_i1);
let x3: u64 = ((x1 & (0xffffffffffffffff as i128)) as u64);
@@ -91,7 +127,7 @@ pub fn fiat_p256_subborrowx_u64(out1: &mut u64, out2: &mut fiat_p256_u1, arg1: f
/// out1: [0x0 ~> 0xffffffffffffffff]
/// out2: [0x0 ~> 0xffffffffffffffff]
#[inline]
-pub fn fiat_p256_mulx_u64(out1: &mut u64, out2: &mut u64, arg1: u64, arg2: u64) -> () {
+pub fn fiat_p256_mulx_u64(out1: &mut u64, out2: &mut u64, arg1: u64, arg2: u64) {
let x1: u128 = ((arg1 as u128) * (arg2 as u128));
let x2: u64 = ((x1 & (0xffffffffffffffff as u128)) as u64);
let x3: u64 = ((x1 >> 64) as u64);
@@ -111,7 +147,7 @@ pub fn fiat_p256_mulx_u64(out1: &mut u64, out2: &mut u64, arg1: u64, arg2: u64)
/// Output Bounds:
/// out1: [0x0 ~> 0xffffffffffffffff]
#[inline]
-pub fn fiat_p256_cmovznz_u64(out1: &mut u64, arg1: fiat_p256_u1, arg2: u64, arg3: u64) -> () {
+pub fn fiat_p256_cmovznz_u64(out1: &mut u64, arg1: fiat_p256_u1, arg2: u64, arg3: u64) {
let x1: fiat_p256_u1 = (!(!arg1));
let x2: u64 = ((((((0x0 as fiat_p256_i2) - (x1 as fiat_p256_i2)) as fiat_p256_i1) as i128) & (0xffffffffffffffff as i128)) as u64);
let x3: u64 = ((x2 & arg3) | ((!x2) & arg2));
@@ -128,7 +164,7 @@ pub fn fiat_p256_cmovznz_u64(out1: &mut u64, arg1: fiat_p256_u1, arg2: u64, arg3
/// 0 ≤ eval out1 < m
///
#[inline]
-pub fn fiat_p256_mul(out1: &mut fiat_p256_montgomery_domain_field_element, arg1: &fiat_p256_montgomery_domain_field_element, arg2: &fiat_p256_montgomery_domain_field_element) -> () {
+pub fn fiat_p256_mul(out1: &mut fiat_p256_montgomery_domain_field_element, arg1: &fiat_p256_montgomery_domain_field_element, arg2: &fiat_p256_montgomery_domain_field_element) {
let x1: u64 = (arg1[1]);
let x2: u64 = (arg1[2]);
let x3: u64 = (arg1[3]);
@@ -419,7 +455,7 @@ pub fn fiat_p256_mul(out1: &mut fiat_p256_montgomery_domain_field_element, arg1:
/// 0 ≤ eval out1 < m
///
#[inline]
-pub fn fiat_p256_square(out1: &mut fiat_p256_montgomery_domain_field_element, arg1: &fiat_p256_montgomery_domain_field_element) -> () {
+pub fn fiat_p256_square(out1: &mut fiat_p256_montgomery_domain_field_element, arg1: &fiat_p256_montgomery_domain_field_element) {
let x1: u64 = (arg1[1]);
let x2: u64 = (arg1[2]);
let x3: u64 = (arg1[3]);
@@ -711,7 +747,7 @@ pub fn fiat_p256_square(out1: &mut fiat_p256_montgomery_domain_field_element, ar
/// 0 ≤ eval out1 < m
///
#[inline]
-pub fn fiat_p256_add(out1: &mut fiat_p256_montgomery_domain_field_element, arg1: &fiat_p256_montgomery_domain_field_element, arg2: &fiat_p256_montgomery_domain_field_element) -> () {
+pub fn fiat_p256_add(out1: &mut fiat_p256_montgomery_domain_field_element, arg1: &fiat_p256_montgomery_domain_field_element, arg2: &fiat_p256_montgomery_domain_field_element) {
let mut x1: u64 = 0;
let mut x2: fiat_p256_u1 = 0;
fiat_p256_addcarryx_u64(&mut x1, &mut x2, 0x0, (arg1[0]), (arg2[0]));
@@ -763,7 +799,7 @@ pub fn fiat_p256_add(out1: &mut fiat_p256_montgomery_domain_field_element, arg1:
/// 0 ≤ eval out1 < m
///
#[inline]
-pub fn fiat_p256_sub(out1: &mut fiat_p256_montgomery_domain_field_element, arg1: &fiat_p256_montgomery_domain_field_element, arg2: &fiat_p256_montgomery_domain_field_element) -> () {
+pub fn fiat_p256_sub(out1: &mut fiat_p256_montgomery_domain_field_element, arg1: &fiat_p256_montgomery_domain_field_element, arg2: &fiat_p256_montgomery_domain_field_element) {
let mut x1: u64 = 0;
let mut x2: fiat_p256_u1 = 0;
fiat_p256_subborrowx_u64(&mut x1, &mut x2, 0x0, (arg1[0]), (arg2[0]));
@@ -805,7 +841,7 @@ pub fn fiat_p256_sub(out1: &mut fiat_p256_montgomery_domain_field_element, arg1:
/// 0 ≤ eval out1 < m
///
#[inline]
-pub fn fiat_p256_opp(out1: &mut fiat_p256_montgomery_domain_field_element, arg1: &fiat_p256_montgomery_domain_field_element) -> () {
+pub fn fiat_p256_opp(out1: &mut fiat_p256_montgomery_domain_field_element, arg1: &fiat_p256_montgomery_domain_field_element) {
let mut x1: u64 = 0;
let mut x2: fiat_p256_u1 = 0;
fiat_p256_subborrowx_u64(&mut x1, &mut x2, 0x0, (0x0 as u64), (arg1[0]));
@@ -847,7 +883,7 @@ pub fn fiat_p256_opp(out1: &mut fiat_p256_montgomery_domain_field_element, arg1:
/// 0 ≤ eval out1 < m
///
#[inline]
-pub fn fiat_p256_from_montgomery(out1: &mut fiat_p256_non_montgomery_domain_field_element, arg1: &fiat_p256_montgomery_domain_field_element) -> () {
+pub fn fiat_p256_from_montgomery(out1: &mut fiat_p256_non_montgomery_domain_field_element, arg1: &fiat_p256_montgomery_domain_field_element) {
let x1: u64 = (arg1[0]);
let mut x2: u64 = 0;
let mut x3: u64 = 0;
@@ -999,7 +1035,7 @@ pub fn fiat_p256_from_montgomery(out1: &mut fiat_p256_non_montgomery_domain_fiel
/// 0 ≤ eval out1 < m
///
#[inline]
-pub fn fiat_p256_to_montgomery(out1: &mut fiat_p256_montgomery_domain_field_element, arg1: &fiat_p256_non_montgomery_domain_field_element) -> () {
+pub fn fiat_p256_to_montgomery(out1: &mut fiat_p256_montgomery_domain_field_element, arg1: &fiat_p256_non_montgomery_domain_field_element) {
let x1: u64 = (arg1[1]);
let x2: u64 = (arg1[2]);
let x3: u64 = (arg1[3]);
@@ -1273,7 +1309,7 @@ pub fn fiat_p256_to_montgomery(out1: &mut fiat_p256_montgomery_domain_field_elem
/// Output Bounds:
/// out1: [0x0 ~> 0xffffffffffffffff]
#[inline]
-pub fn fiat_p256_nonzero(out1: &mut u64, arg1: &[u64; 4]) -> () {
+pub fn fiat_p256_nonzero(out1: &mut u64, arg1: &[u64; 4]) {
let x1: u64 = ((arg1[0]) | ((arg1[1]) | ((arg1[2]) | (arg1[3]))));
*out1 = x1;
}
@@ -1290,7 +1326,7 @@ pub fn fiat_p256_nonzero(out1: &mut u64, arg1: &[u64; 4]) -> () {
/// Output Bounds:
/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
#[inline]
-pub fn fiat_p256_selectznz(out1: &mut [u64; 4], arg1: fiat_p256_u1, arg2: &[u64; 4], arg3: &[u64; 4]) -> () {
+pub fn fiat_p256_selectznz(out1: &mut [u64; 4], arg1: fiat_p256_u1, arg2: &[u64; 4], arg3: &[u64; 4]) {
let mut x1: u64 = 0;
fiat_p256_cmovznz_u64(&mut x1, arg1, (arg2[0]), (arg3[0]));
let mut x2: u64 = 0;
@@ -1317,7 +1353,7 @@ pub fn fiat_p256_selectznz(out1: &mut [u64; 4], arg1: fiat_p256_u1, arg2: &[u64;
/// 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 ~> 0xff]]
#[inline]
-pub fn fiat_p256_to_bytes(out1: &mut [u8; 32], arg1: &[u64; 4]) -> () {
+pub fn fiat_p256_to_bytes(out1: &mut [u8; 32], arg1: &[u64; 4]) {
let x1: u64 = (arg1[3]);
let x2: u64 = (arg1[2]);
let x3: u64 = (arg1[1]);
@@ -1425,7 +1461,7 @@ pub fn fiat_p256_to_bytes(out1: &mut [u8; 32], arg1: &[u64; 4]) -> () {
/// Output Bounds:
/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
#[inline]
-pub fn fiat_p256_from_bytes(out1: &mut [u64; 4], arg1: &[u8; 32]) -> () {
+pub fn fiat_p256_from_bytes(out1: &mut [u64; 4], arg1: &[u8; 32]) {
let x1: u64 = (((arg1[31]) as u64) << 56);
let x2: u64 = (((arg1[30]) as u64) << 48);
let x3: u64 = (((arg1[29]) as u64) << 40);
@@ -1499,7 +1535,7 @@ pub fn fiat_p256_from_bytes(out1: &mut [u64; 4], arg1: &[u8; 32]) -> () {
/// 0 ≤ eval out1 < m
///
#[inline]
-pub fn fiat_p256_set_one(out1: &mut fiat_p256_montgomery_domain_field_element) -> () {
+pub fn fiat_p256_set_one(out1: &mut fiat_p256_montgomery_domain_field_element) {
out1[0] = (0x1 as u64);
out1[1] = 0xffffffff00000000;
out1[2] = 0xffffffffffffffff;
@@ -1515,7 +1551,7 @@ pub fn fiat_p256_set_one(out1: &mut fiat_p256_montgomery_domain_field_element) -
/// Output Bounds:
/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
#[inline]
-pub fn fiat_p256_msat(out1: &mut [u64; 5]) -> () {
+pub fn fiat_p256_msat(out1: &mut [u64; 5]) {
out1[0] = 0xffffffffffffffff;
out1[1] = 0xffffffff;
out1[2] = (0x0 as u64);
@@ -1552,7 +1588,7 @@ pub fn fiat_p256_msat(out1: &mut [u64; 5]) -> () {
/// out4: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
/// out5: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
#[inline]
-pub fn fiat_p256_divstep(out1: &mut u64, out2: &mut [u64; 5], out3: &mut [u64; 5], out4: &mut [u64; 4], out5: &mut [u64; 4], arg1: u64, arg2: &[u64; 5], arg3: &[u64; 5], arg4: &[u64; 4], arg5: &[u64; 4]) -> () {
+pub fn fiat_p256_divstep(out1: &mut u64, out2: &mut [u64; 5], out3: &mut [u64; 5], out4: &mut [u64; 4], out5: &mut [u64; 4], arg1: u64, arg2: &[u64; 5], arg3: &[u64; 5], arg4: &[u64; 4], arg5: &[u64; 4]) {
let mut x1: u64 = 0;
let mut x2: fiat_p256_u1 = 0;
fiat_p256_addcarryx_u64(&mut x1, &mut x2, 0x0, (!arg1), (0x1 as u64));
@@ -1785,7 +1821,7 @@ pub fn fiat_p256_divstep(out1: &mut u64, out2: &mut [u64; 5], out3: &mut [u64; 5
/// Output Bounds:
/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
#[inline]
-pub fn fiat_p256_divstep_precomp(out1: &mut [u64; 4]) -> () {
+pub fn fiat_p256_divstep_precomp(out1: &mut [u64; 4]) {
out1[0] = 0x67ffffffb8000000;
out1[1] = 0xc000000038000000;
out1[2] = 0xd80000007fffffff;