Skip to content

Commit e064066

Browse files
committed
Javadoc corrections
1 parent 797afd8 commit e064066

4 files changed

Lines changed: 23 additions & 25 deletions

File tree

core/src/main/java/org/bouncycastle/math/ec/rfc7748/X25519.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,16 @@
1818
* {@code edwards25519} curve via
1919
* {@link Ed25519#scalarMultBaseYZ(Friend, byte[], int, int[], int[])}
2020
* (a signed multi-comb in extended Edwards coordinates), then
21-
* converted to the Curve25519 {@code u} coordinate using the RFC
21+
* converted to the curve25519 {@code u} coordinate using the RFC
2222
* 7748 sec. 4.1 birational map {@code u = (1 + Y) / (1 - Y)}
2323
* where {@code Y = y / z}.</li>
2424
* <li>{@link #scalarMult} (key agreement) &mdash; Montgomery ladder on
2525
* XZ-only projective coordinates per RFC 7748 sec. 5, with
2626
* per-bit constant-time {@code cswap}; the
2727
* {@code A24 = (A + 2) / 4} curve constant is precomputed from
28-
* {@code A = 486662}. The trailing three doublings cancel the
29-
* cofactor introduced by the lowest cleared scalar bits.</li>
28+
* {@code A = 486662}. The final three doublings correspond to the
29+
* always-cleared low bits of the scalar; these clear the cofactor
30+
* to ensure a non-twist result.</li>
3031
* <li>{@link #calculateAgreement} &mdash; {@link #scalarMult} followed
3132
* by the RFC 7748 sec. 6.1 all-zero rejection.</li>
3233
* </ul>
@@ -206,7 +207,7 @@ public static void scalarMultBase(byte[] k, int kOff, byte[] r, int rOff)
206207

207208
Ed25519.scalarMultBaseYZ(Friend.INSTANCE, k, kOff, y, z);
208209

209-
// Birational map edwards25519 -> Curve25519 (RFC 7748 sec. 4.1):
210+
// Birational map edwards25519 -> curve25519 (RFC 7748 sec. 4.1):
210211
// u = (1 + Y) / (1 - Y), where Y = y / z.
211212
// Computed projectively: y' := z + y, z' := z - y, then u = y' / z'.
212213
F.apm(z, y, y, z);

core/src/main/java/org/bouncycastle/math/ec/rfc7748/X448.java

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,18 @@
1414
* {@link #clampPrivateKey} (RFC 7748 sec. 5 clamping: clear bits
1515
* 0..1, set bit 447).</li>
1616
* <li>{@link #generatePublicKey} / {@link #scalarMultBase} &mdash;
17-
* computed as {@code k * B} on the birationally-equivalent
18-
* {@code edwards448} curve via
19-
* {@link Ed448#scalarMultBaseXY(Friend, byte[], int, int[], int[])}
17+
* computed as {@code k * B} on the 4-isogenous {@code edwards448} curve
18+
* via {@link Ed448#scalarMultBaseXY(Friend, byte[], int, int[], int[])}
2019
* (a signed multi-comb in projective Edwards coordinates), then
21-
* converted to the Curve448 {@code u} coordinate using the RFC
22-
* 7748 sec. 4.2 / errata 5568 birational map
23-
* {@code u = (y / x)^2}.</li>
20+
* converted to the curve448 {@code u} coordinate using the RFC
21+
* 7748 sec. 4.2 4-isogeny map {@code u = (y / x)^2}.</li>
2422
* <li>{@link #scalarMult} (key agreement) &mdash; Montgomery ladder on
2523
* XZ-only projective coordinates per RFC 7748 sec. 5, with
2624
* per-bit constant-time {@code cswap}; the
2725
* {@code A24 = (A + 2) / 4} curve constant is precomputed from
28-
* {@code A = 156326}. The trailing two doublings cancel the
29-
* cofactor introduced by the lowest cleared scalar bits.</li>
26+
* {@code A = 156326}. The final two doublings correspond to the
27+
* always-cleared low bits of the scalar; these clear the cofactor
28+
* to ensure a non-twist result.</li>
3029
* <li>{@link #calculateAgreement} &mdash; {@link #scalarMult} followed
3130
* by the RFC 7748 sec. 6.2 all-zero rejection.</li>
3231
* </ul>
@@ -214,9 +213,9 @@ public static void scalarMultBase(byte[] k, int kOff, byte[] r, int rOff)
214213

215214
Ed448.scalarMultBaseXY(Friend.INSTANCE, k, kOff, x, y);
216215

217-
// Birational map edwards448 -> Curve448 (RFC 7748 sec. 4.2 /
218-
// errata 5568): u = (y / x)^2. The Ed448 comb returns the
219-
// affine Edwards (x, y); invert x and square the ratio.
216+
// 4-isogeny map edwards448 -> curve448 (RFC 7748 sec. 4.2): u = (y / x)^2.
217+
// The Ed448 comb returns the X, Y of a result in projective coordinates (with Z elided);
218+
// invert x and square the ratio.
220219
F.inv(x, x);
221220
F.mul(x, y, x);
222221
F.sqr(x, x);

core/src/main/java/org/bouncycastle/math/ec/rfc8032/Ed25519.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,10 @@
3131
* {@code r = SHA-512(prefix || M) mod L}, then {@code S = (r + k * s) mod L} (RFC 8032
3232
* sec. 5.1.6). Reduction modulo {@code L} uses {@code Scalar25519.reduce512} (Barrett-style,
3333
* straight-line). No variable-base scalar multiplication is performed.</li>
34-
* <li>Verification &mdash; {@code verify} runs the small-multiple basis-reduction trick of
35-
* <a href="https://ia.cr/2003/116">Antipa-Brown-Menezes-Struik-Vanstone</a> via
36-
* {@code Scalar25519.reduceBasisVar} then evaluates the combined relation with Strauss-Shamir's
37-
* trick in {@code scalarMultStraus128Var}. Both routines are deliberately variable-time and
38-
* operate only on public material (signature, message, public key).</li>
34+
* <li>Verification &mdash; {@code verify} uses the basis reduction algorithm of
35+
* <a href="https://ia.cr/2020/454">Pornin</a> via {@code Scalar25519.reduceBasisVar} then evaluates the
36+
* combined relation with Strauss-Shamir's trick in {@code scalarMultStraus128Var}. Both routines are
37+
* deliberately variable-time and operate only on public material (signature, message, public key).</li>
3938
* <li>Coordinates &mdash; the precomputed base-point comb table lives in
4039
* <a href="https://ia.cr/2012/309">half-Niels</a> form; signing-side accumulators use extensible
4140
* (twisted Edwards) coordinates so each step needs only one extra point-addition formula.

core/src/main/java/org/bouncycastle/math/ec/rfc8032/Ed448.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,10 @@
2929
* {@code S = (r + k * s) mod L} (RFC 8032 sec. 5.2.6). Reduction modulo {@code L} uses
3030
* {@code Scalar448.reduce912} (Barrett-style, straight-line). No variable-base scalar
3131
* multiplication is performed.</li>
32-
* <li>Verification &mdash; {@code verify} runs the small-multiple basis-reduction trick of
33-
* <a href="https://ia.cr/2003/116">Antipa-Brown-Menezes-Struik-Vanstone</a> via
34-
* {@code Scalar448.reduceBasisVar} then evaluates the combined relation with Strauss-Shamir's
35-
* trick in {@code scalarMultStraus128Var}. Both routines are deliberately variable-time and
36-
* operate only on public material (signature, message, public key).</li>
32+
* <li>Verification &mdash; {@code verify} uses the basis reduction algorithm of
33+
* <a href="https://ia.cr/2020/454">Pornin</a> via {@code Scalar448.reduceBasisVar} then evaluates the
34+
* combined relation with Strauss-Shamir's trick in {@code scalarMultStraus225Var}. Both routines are
35+
* deliberately variable-time and operate only on public material (signature, message, public key).</li>
3736
* <li>Coordinates &mdash; the precomputed base-point comb table lives in
3837
* <a href="https://hyperelliptic.org/EFD/g1p/auto-edwards-projective.html">affine</a> form
3938
* (matching {@code PointAffine} in {@code pointLookup}); the signing-side accumulator is

0 commit comments

Comments
 (0)