Bouncy Castle Cryptography Library 1.86

org.bouncycastle.pqc.crypto.test
Class NTRUPlusConcurrencyTest

java.lang.Object
  extended byjunit.framework.Assert
      extended byjunit.framework.TestCase
          extended byorg.bouncycastle.pqc.crypto.test.NTRUPlusConcurrencyTest
All Implemented Interfaces:
junit.framework.Test

public class NTRUPlusConcurrencyTest
extends junit.framework.TestCase

An NTRUPlusKEMExtractor holds one NTRUPlusEngine for its lifetime, so the engine must not carry mutable state across a call. It used to keep a single SHAKE instance in a field: two threads extracting through one extractor interleaved their absorb/squeeze phases, which produced wrong shared secrets and threw . The digest is now built per call, as CMCEEngine's already was.

The generator side is exercised too, since NTRUPlusKEMGenerator builds an engine per call but its KEM keys and parameters are shared - and NTRUPlusParameters hands every engine the same zetas array, so a write to it would corrupt globally.


Constructor Summary
NTRUPlusConcurrencyTest()
           
 
Method Summary
 void testConcurrentEncapsulation()
           
 void testConcurrentExtraction()
           
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, setUp, 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

NTRUPlusConcurrencyTest

public NTRUPlusConcurrencyTest()
Method Detail

testConcurrentExtraction

public void testConcurrentExtraction()
                              throws java.lang.Exception
Throws:
java.lang.Exception

testConcurrentEncapsulation

public void testConcurrentEncapsulation()
                                 throws java.lang.Exception
Throws:
java.lang.Exception

Bouncy Castle Cryptography Library 1.86