|
Bouncy Castle Cryptography Library 1.86 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjunit.framework.Assert
junit.framework.TestCase
org.bouncycastle.pqc.crypto.hqc.GFTest
Regression tests for HQC's GF(2^8) arithmetic.
GF used to be implemented with log/exp/inv/sqr lookup tables indexed by field
elements, which leaked secret-derived values through the cache; it is now table-free and
branch-free. These tests pin the arithmetic to the values the tables produced, so a future
change cannot alter a result while the HQC known-answer tests happen to keep passing on the
subset of inputs they exercise.
The expected values come from an independent construction: log and exp tables built here by iterating the generator X over GF(2)[X]/(X^8 + X^4 + X^3 + X^2 + 1), so the oracle takes a different computational route (discrete logs) from the implementation (carryless multiply and reduce). Field laws are checked as well, in case both sides were to be wrong the same way.
| Constructor Summary | |
GFTest()
|
|
| Method Summary | |
void |
setUp()
|
void |
testDivAgainstOracle()
|
void |
testFieldLaws()
|
void |
testInvAgainstOracle()
|
void |
testMul3AgainstOracle()
mul3 is exercised on a stride rather than all 16777216 triples, to keep the legacy Ant builds (which run this on a real JRE 1.3/1.4) quick; mul itself is covered exhaustively above and mul3 is defined in terms of it. |
void |
testMulAgainstOracle()
|
void |
testOracleIsTheExpectedField()
Guard the oracle itself: these are the opening entries of the classic GF(256) exp table for this field polynomial, and the cycle must close back on 1. |
void |
testSqrAgainstOracle()
|
| Methods inherited from class junit.framework.TestCase |
countTestCases, createResult, getName, run, run, runBare, runTest, setName, tearDown, toString |
| Methods inherited from class junit.framework.Assert |
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public GFTest()
| Method Detail |
public void setUp()
public void testOracleIsTheExpectedField()
public void testMulAgainstOracle()
public void testSqrAgainstOracle()
public void testInvAgainstOracle()
public void testDivAgainstOracle()
public void testMul3AgainstOracle()
public void testFieldLaws()
|
Bouncy Castle Cryptography Library 1.86 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||