Commit cb6a123e authored by scottmg's avatar scottmg Committed by Commit bot

win vs2015: avoid some variable shadowing warnings in crypto/p224

e.g.

d:\src\cr2\src\crypto\p224.cc(478): error C2220: warning treated as error - no 'object' file generated
d:\src\cr2\src\crypto\p224.cc(478): warning C4456: declaration of 'j' hides previous local declaration
d:\src\cr2\src\crypto\p224.cc(447): note: see declaration of 'j'
d:\src\cr2\src\crypto\p224.cc(498): warning C4456: declaration of 'i' hides previous local declaration
d:\src\cr2\src\crypto\p224.cc(447): note: see declaration of 'i'
d:\src\cr2\src\crypto\p224.cc(516): warning C4456: declaration of 'i' hides previous local declaration
d:\src\cr2\src\crypto\p224.cc(447): note: see declaration of 'i'
d:\src\cr2\src\crypto\p224.cc(526): warning C4456: declaration of 'i' hides previous local declaration
d:\src\cr2\src\crypto\p224.cc(447): note: see declaration of 'i'
d:\src\cr2\src\crypto\p224.cc(694): warning C4458: declaration of 'x' hides class member
d:\src\cr2\src\crypto\p224.h(35): note: see declaration of 'crypto::p224::Point::x'
d:\src\cr2\src\crypto\p224.cc(694): warning C4458: declaration of 'y' hides class member
d:\src\cr2\src\crypto\p224.h(35): note: see declaration of 'crypto::p224::Point::y'

R=rsleevi@chromium.org
BUG=440500

Review URL: https://codereview.chromium.org/945633003

Cr-Commit-Position: refs/heads/master@{#317398}
parent ab87bce6
...@@ -475,8 +475,8 @@ void AddJacobian(Point *out, ...@@ -475,8 +475,8 @@ void AddJacobian(Point *out,
uint32 x_equal = IsZero(h); uint32 x_equal = IsZero(h);
// I = (2*H)² // I = (2*H)²
for (int j = 0; j < 8; j++) { for (int k = 0; k < 8; k++) {
i[j] = h[j] << 1; i[k] = h[k] << 1;
} }
Reduce(&i); Reduce(&i);
Square(&i, i); Square(&i, i);
...@@ -495,8 +495,8 @@ void AddJacobian(Point *out, ...@@ -495,8 +495,8 @@ void AddJacobian(Point *out,
return; return;
} }
for (int i = 0; i < 8; i++) { for (int k = 0; k < 8; k++) {
r[i] <<= 1; r[k] <<= 1;
} }
Reduce(&r); Reduce(&r);
...@@ -513,8 +513,8 @@ void AddJacobian(Point *out, ...@@ -513,8 +513,8 @@ void AddJacobian(Point *out,
Mul(&out->z, out->z, h); Mul(&out->z, out->z, h);
// X3 = r²-J-2*V // X3 = r²-J-2*V
for (int i = 0; i < 8; i++) { for (int k = 0; k < 8; k++) {
z1z1[i] = v[i] << 1; z1z1[k] = v[k] << 1;
} }
Add(&z1z1, j, z1z1); Add(&z1z1, j, z1z1);
Reduce(&z1z1); Reduce(&z1z1);
...@@ -523,8 +523,8 @@ void AddJacobian(Point *out, ...@@ -523,8 +523,8 @@ void AddJacobian(Point *out,
Reduce(&out->x); Reduce(&out->x);
// Y3 = r*(V-X3)-2*S1*J // Y3 = r*(V-X3)-2*S1*J
for (int i = 0; i < 8; i++) { for (int k = 0; k < 8; k++) {
s1[i] <<= 1; s1[k] <<= 1;
} }
Mul(&s1, s1, j); Mul(&s1, s1, j);
Subtract(&z1z1, v, out->x); Subtract(&z1z1, v, out->x);
...@@ -691,7 +691,7 @@ bool Point::SetFromString(const base::StringPiece& in) { ...@@ -691,7 +691,7 @@ bool Point::SetFromString(const base::StringPiece& in) {
} }
std::string Point::ToString() const { std::string Point::ToString() const {
FieldElement zinv, zinv_sq, x, y; FieldElement zinv, zinv_sq, xx, yy;
// If this is the point at infinity we return a string of all zeros. // If this is the point at infinity we return a string of all zeros.
if (IsZero(this->z)) { if (IsZero(this->z)) {
...@@ -701,16 +701,16 @@ std::string Point::ToString() const { ...@@ -701,16 +701,16 @@ std::string Point::ToString() const {
Invert(&zinv, this->z); Invert(&zinv, this->z);
Square(&zinv_sq, zinv); Square(&zinv_sq, zinv);
Mul(&x, this->x, zinv_sq); Mul(&xx, x, zinv_sq);
Mul(&zinv_sq, zinv_sq, zinv); Mul(&zinv_sq, zinv_sq, zinv);
Mul(&y, this->y, zinv_sq); Mul(&yy, y, zinv_sq);
Contract(&x); Contract(&xx);
Contract(&y); Contract(&yy);
uint32 outwords[14]; uint32 outwords[14];
Put224Bits(outwords, x); Put224Bits(outwords, xx);
Put224Bits(outwords + 7, y); Put224Bits(outwords + 7, yy);
return std::string(reinterpret_cast<const char*>(outwords), sizeof(outwords)); return std::string(reinterpret_cast<const char*>(outwords), sizeof(outwords));
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment