Bouncy Castle Cryptography Library 1.86

org.bouncycastle.crypto.test
Class SICPositionTest

java.lang.Object
  extended byorg.bouncycastle.util.test.SimpleTest
      extended byorg.bouncycastle.crypto.test.SICPositionTest
All Implemented Interfaces:
Test

public class SICPositionTest
extends SimpleTest

Regression test for SICBlockCipher position tracking (getPosition/seekTo/skip) around counter-increment carries. getPosition() used to apply the borrow in its counter-minus-IV subtraction as a raw byte decrement, dropping the borrow when the decremented byte wrapped 0x00 to 0xFF - i.e. once an increment had carried across consecutive 0xFF IV bytes - and it never subtracted IV[0], so 8-byte block ciphers with a full-length IV reported a position offset by IV[0] * 2^56 blocks. Also covers skip() from mid-block positions: a backward skip smaller than the intra-block offset used to rewind to the block start instead of moving exactly |n| bytes.

Also covers the full-block IV counter-range bound: the advance since init is limited to 2^64 blocks (one carry past the low 8-byte lane is legal, reaching 2^64 blocks throws), a backward move below the initial counter throws, and the short-IV counter-space check fires on the processBlock() path as well as processBytes().


Nested Class Summary
 
Nested classes inherited from class org.bouncycastle.util.test.SimpleTest
SimpleTest.TestExceptionOperation
 
Constructor Summary
SICPositionTest()
           
 
Method Summary
 java.lang.String getName()
           
static void main(java.lang.String[] args)
           
 void performTest()
           
 
Methods inherited from class org.bouncycastle.util.test.SimpleTest
areEqual, areEqual, areEqual, fail, fail, fail, isEquals, isEquals, isEquals, isEquals, isEquals, isEquals, isEquals, isTrue, isTrue, perform, runTest, runTest, runTests, runTests, testException
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SICPositionTest

public SICPositionTest()
Method Detail

getName

public java.lang.String getName()
Specified by:
getName in interface Test
Specified by:
getName in class SimpleTest

performTest

public void performTest()
Specified by:
performTest in class SimpleTest

main

public static void main(java.lang.String[] args)

Bouncy Castle Cryptography Library 1.86