Skip to content

Commit 6b8d4cf

Browse files
authored
Merge pull request #752 from tls-attacker/f2mLoopFix
Fix for F2m loop bug
2 parents 77b1516 + e12f8ac commit 6b8d4cf

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

TLS-Core/src/main/java/de/rub/nds/tlsattacker/core/crypto/ec/EllipticCurveOverF2m.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,10 @@ public Point createAPointOnCurve(BigInteger x) {
209209
* @return The result z for the quadratic equation or null if non-existent
210210
*/
211211
public FieldElementF2m solveQuadraticEquation(FieldElement beta) {
212+
if (beta.getData().equals(BigInteger.ZERO)) {
213+
return new FieldElementF2m(BigInteger.ONE, beta.getModulus());
214+
}
215+
212216
FieldElementF2m gamma;
213217
FieldElementF2m z;
214218
Random randNum = new Random(0);

TLS-Core/src/test/java/de/rub/nds/tlsattacker/core/crypto/ec/PointFormatterTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public void compressionFormatTest() {
101101
ArrayConverter.hexStringToByteArray("0300D9B67D192E0367C803F39E1A7E82CA14A651350AAE617E8F");
102102
byte[] sect233r1Base =
103103
ArrayConverter.hexStringToByteArray("0300FAC9DFCBAC8313BB2139F1BB755FEF65BC391F8B36F8F8EB7371FD558B");
104-
byte[] secp571k1Base = ArrayConverter.hexStringToByteArray(
104+
byte[] sect571k1Base = ArrayConverter.hexStringToByteArray(
105105
"02026EB7A859923FBC82189631F8103FE4AC9CA2970012D5D46024804801841CA44370958493B205E647DA304DB4CEB08CBBD1BA39494776FB988B47174DCA88C7E2945283A01C8972");
106106

107107
byte[] compressed = PointFormatter.formatToByteArray(NamedGroup.SECP160R1,
@@ -126,6 +126,6 @@ public void compressionFormatTest() {
126126

127127
compressed = PointFormatter.formatToByteArray(NamedGroup.SECT571K1,
128128
CurveFactory.getCurve(NamedGroup.SECT571K1).getBasePoint(), ECPointFormat.ANSIX962_COMPRESSED_CHAR2);
129-
assertArrayEquals(secp571k1Base, compressed);
129+
assertArrayEquals(sect571k1Base, compressed);
130130
}
131131
}

0 commit comments

Comments
 (0)