Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce collision probability for variable names #1804

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
DerivePointerAlignment: false
PointerAlignment: Right
InsertBraces: true
# TODO(davidben): The default for Google style is now Regroup, but the default
# IncludeCategories does not recognize <openssl/header.h>. We should
# reconfigure IncludeCategories to match. For now, keep it at Preserve.
Expand Down
8 changes: 4 additions & 4 deletions crypto/curve25519/curve25519_nohw.c
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ int x25519_ge_frombytes_vartime(ge_p3 *h, const uint8_t s[32]) {
fe_frombytes(&h->Y, s);
fe_1(&h->Z);
fe_sq_tt(&w, &h->Y);
fe_mul_ttt(&vxx, &w, &d);
fe_mul_ttt(&vxx, &w, &k25519d);
fe_sub(&v, &w, &h->Z); // u = y^2-1
fe_carry(&u, &v);
fe_add(&v, &vxx, &h->Z); // v = dy^2+1
Expand All @@ -520,7 +520,7 @@ int x25519_ge_frombytes_vartime(ge_p3 *h, const uint8_t s[32]) {
if (fe_isnonzero(&check)) {
return 0;
}
fe_mul_ttt(&h->X, &h->X, &sqrtm1);
fe_mul_ttt(&h->X, &h->X, &k25519sqrtm1);
}

if (fe_isnegative(&h->X) != (s[31] >> 7)) {
Expand Down Expand Up @@ -571,7 +571,7 @@ void x25519_ge_p3_to_cached(ge_cached *r, const ge_p3 *p) {
fe_add(&r->YplusX, &p->Y, &p->X);
fe_sub(&r->YminusX, &p->Y, &p->X);
fe_copy_lt(&r->Z, &p->Z);
fe_mul_ltt(&r->T2d, &p->T, &d2);
fe_mul_ltt(&r->T2d, &p->T, &k25519d2);
}

// r = p
Expand Down Expand Up @@ -727,7 +727,7 @@ void x25519_ge_scalarmult_small_precomp(
fe_add(&out->yplusx, &y, &x);
fe_sub(&out->yminusx, &y, &x);
fe_mul_ltt(&out->xy2d, &x, &y);
fe_mul_llt(&out->xy2d, &out->xy2d, &d2);
fe_mul_llt(&out->xy2d, &out->xy2d, &k25519d2);
}

// See the comment above |k25519SmallPrecomp| about the structure of the
Expand Down
6 changes: 3 additions & 3 deletions crypto/curve25519/curve25519_tables.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
// ./make_curve25519_tables.py > curve25519_tables.h


static const fe d = {{
static const fe k25519d = {{
#if defined(BORINGSSL_CURVE25519_64BIT)
929955233495203, 466365720129213, 1662059464998953, 2033849074728123,
1442794654840575
Expand All @@ -26,7 +26,7 @@ static const fe d = {{
#endif
}};

static const fe sqrtm1 = {{
static const fe k25519sqrtm1 = {{
#if defined(BORINGSSL_CURVE25519_64BIT)
1718705420411056, 234908883556509, 2233514472574048, 2117202627021982,
765476049583133
Expand All @@ -36,7 +36,7 @@ static const fe sqrtm1 = {{
#endif
}};

static const fe d2 = {{
static const fe k25519d2 = {{
#if defined(BORINGSSL_CURVE25519_64BIT)
1859910466990425, 932731440258426, 1072319116312658, 1815898335770999,
633789495995903
Expand Down
6 changes: 3 additions & 3 deletions crypto/curve25519/make_curve25519_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,15 +159,15 @@ def main():
// ./make_curve25519_tables.py > curve25519_tables.h


static const fe d = """)
static const fe k25519d = """)
buf.write(to_literal(d))
buf.write(""";

static const fe sqrtm1 = """)
static const fe k25519sqrtm1 = """)
buf.write(to_literal(modp_sqrt_m1))
buf.write(""";

static const fe d2 = """)
static const fe k25519d2 = """)
buf.write(to_literal(d2))
buf.write(""";

Expand Down
Loading