Permalink
Browse files

Fixed some naming of variables

  • Loading branch information...
Messjer committed Aug 6, 2018
1 parent 4bf3f19 commit d127db964eb719e2736d02d44cfdef67b55682e8
Showing with 10 additions and 10 deletions.
  1. +1 −0 .gitignore
  2. +5 −5 src/basic/field/field_p.rs
  3. +4 −4 src/basic/group/ecc_group.rs
  4. +0 −1 src/sm2/mod.rs
@@ -1,3 +1,4 @@
.DS_Store
.idea/
target/
Cargo.lock
@@ -152,17 +152,17 @@ fn raw_mul(x: U64x4, y: U64x4) -> [u64; 8] {
let mut carry: u128 = 0;

// for each result block
for (blocki, cell) in result.iter_mut().enumerate().take(7) {
for (block_i, cell) in result.iter_mut().enumerate().take(7) {
// temporary value
let mut cur: u128 = carry;
carry = 0;

// enumerate each block of y
let low = if blocki > 3 { blocki - 3 } else { 0 };
let high = if blocki > 3 { 3 } else { blocki };
let low = if block_i > 3 { block_i - 3 } else { 0 };
let high = if block_i > 3 { 3 } else { block_i };

for yi in low..=high {
let (rst, c) = helper_mul(x.value[blocki - yi], y.value[yi]);
for y_i in low..=high {
let (rst, c) = helper_mul(x.value[block_i - y_i], y.value[y_i]);
carry += c;
cur += rst;
}
@@ -55,7 +55,7 @@ pub const ZERO_JACOBI: JacobiPoint = JacobiPoint {
};

lazy_static! {
static ref lowTable: Vec<Point> = {
static ref low_table: Vec<Point> = {
// save G, 2G, 4G, ... for later use
let g_jacobi = affine_to_jacobi(ECC_G);
let mut pow_g: Vec<JacobiPoint> = vec![g_jacobi];
@@ -89,7 +89,7 @@ lazy_static! {
table
};

static ref highTable: Vec<Point> = {
static ref high_table: Vec<Point> = {
// save G, 2G, 4G, ... for later use
let g_jacobi = affine_to_jacobi(ECC_G);
let mut pow_g: Vec<JacobiPoint> = vec![g_jacobi];
@@ -420,8 +420,8 @@ pub fn times_base_point(times: U64x4) -> JacobiPoint {
t = add_jacobi_point(t, t);
let index_low = to_index(times, i);
let index_high = to_index(times, i + 16);
t = add_jacobi_affine(t, lowTable[index_low]);
t = add_jacobi_affine(t, highTable[index_high]);
t = add_jacobi_affine(t, low_table[index_low]);
t = add_jacobi_affine(t, high_table[index_high]);
}
t
}
@@ -212,7 +212,6 @@ mod tests {
for _ in 0..10000 {
let mut m = sm2_gen_sign(&msg, d_a, q, 4);
let t = sm2_ver_sign(&msg, q, 4, m.0, m.1);
println!("{}", t);
assert!(t);
}
}

0 comments on commit d127db9

Please sign in to comment.