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,
uint32 x_equal = IsZero(h);
// I = (2*H)²
for (int j = 0; j < 8; j++) {
i[j] = h[j] << 1;
for (int k = 0; k < 8; k++) {
i[k] = h[k] << 1;
}
Reduce(&i);
Square(&i, i);
......@@ -495,8 +495,8 @@ void AddJacobian(Point *out,
return;
}
for (int i = 0; i < 8; i++) {
r[i] <<= 1;
for (int k = 0; k < 8; k++) {
r[k] <<= 1;
}
Reduce(&r);
......@@ -513,8 +513,8 @@ void AddJacobian(Point *out,
Mul(&out->z, out->z, h);
// X3 = r²-J-2*V
for (int i = 0; i < 8; i++) {
z1z1[i] = v[i] << 1;
for (int k = 0; k < 8; k++) {
z1z1[k] = v[k] << 1;
}
Add(&z1z1, j, z1z1);
Reduce(&z1z1);
......@@ -523,8 +523,8 @@ void AddJacobian(Point *out,
Reduce(&out->x);
// Y3 = r*(V-X3)-2*S1*J
for (int i = 0; i < 8; i++) {
s1[i] <<= 1;
for (int k = 0; k < 8; k++) {
s1[k] <<= 1;
}
Mul(&s1, s1, j);
Subtract(&z1z1, v, out->x);
......@@ -691,7 +691,7 @@ bool Point::SetFromString(const base::StringPiece& in) {
}
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 (IsZero(this->z)) {
......@@ -701,16 +701,16 @@ std::string Point::ToString() const {
Invert(&zinv, this->z);
Square(&zinv_sq, zinv);
Mul(&x, this->x, zinv_sq);
Mul(&xx, x, zinv_sq);
Mul(&zinv_sq, zinv_sq, zinv);
Mul(&y, this->y, zinv_sq);
Mul(&yy, y, zinv_sq);
Contract(&x);
Contract(&y);
Contract(&xx);
Contract(&yy);
uint32 outwords[14];
Put224Bits(outwords, x);
Put224Bits(outwords + 7, y);
Put224Bits(outwords, xx);
Put224Bits(outwords + 7, yy);
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