Tuesday, 17 October 2017

DiceLockSecurity Knowledge

DicelockSecurity (version 9.X)

Windows - Source Code

DiceLock 9.0.0.1
DiceChecker 6.0.0.1
HashDigester 6.0.0.1
DiceLockTime 4.0.0.1
Previous Versions
arrow DiceLock 9.0.0.1 arrow change.log
change.log (DiceLock change log from version 8.0.0.1 file) Print E-mail
Get C++ DiceLock cipher architecture source code packages of DiceLock for Microsoft Visual Studio 2013 and DiceLock-x for Linux with Test Driver Programs and Response Test Vector files to verify that both them work as expected.
DiceLock for Windows and Linux
DiceLock Security governing software licenses are Free/Libre Source Code License and Educational and Research License

These are the list of changes that have been perfomed from DiceLock version 8.0.0.1 to version 9.0.0.1

  • All .h header files:
    • changed all class member signatures, now each function parameter has a name parameter allowing to identify its purpose,
    • as function parameter includes name parameters, some of them have been modified in order to homogenize them all.

  • Changed class destructor definition of
    • following base abstract classes:
      • BaseAES,
      • BaseBlockCipher,
      • BaseBlockCipherOperationMode_with_IV,
      • BaseCamellia,
      • BaseCryptoPad,
      • BaseCryptoRandomStream,
      • BaseHash,
      • BaseIndexModifier,
      • BaseKeyModifier,
      • BaseRandomTest,
      • BaseRipemd,
      • BaseRipemd128X,
      • BaseRipemd160X,
      • BaseSalsa20_20,
      • BaseSha32,
      • BaseStreamCipher,
      • BaseStreamCipher_with_IV,
      • BaseSymmetricCipher,
      • BaseSymmetricStreamer,
      • BaseSymmetricStreamer_with_IV,
      • DiceLock,
      • DiceLockIV,
      • DiceLockXTS,
    • from ~destructor(); to virtual ~destructor();.

  • In all exceptions statements throw expresions have been modified from throw "string"; to throw "class::member - string";.

  • baseCryptoRandomStream class remodeled:
    • Changed members from:
      • virtual void SetCryptoRandomStreamBit(unsigned long int) {};
      • virtual void SetCryptoRandomStreamBit(void*, unsigned long int) {};
      • virtual void SetCryptoRandomStreamUC(unsigned long int) {};
      • virtual void SetCryptoRandomStreamUC(void*, unsigned long int) {};
      • virtual void SetCryptoRandomStreamUS(unsigned long int) {};
      • virtual void SetCryptoRandomStreamUS(void*, unsigned long int) {};
      • virtual void SetCryptoRandomStreamUL(unsigned long int) {};
      • virtual void SetCryptoRandomStreamUL(void*, unsigned long int) {};
      • virtual void SetCryptoRandomStreamHexString(const char*) {};
    • to:
      • void SetCryptoRandomStreamBit(unsigned long int streamBitLength);
      • void SetCryptoRandomStreamBit(void* stream, unsigned long int streamBitLength);
      • void SetCryptoRandomStreamUC(unsigned long int streamUCLength);
      • void SetCryptoRandomStreamUC(void* stream, unsigned long int streamUCLength);
      • void SetCryptoRandomStreamUS(unsigned long int streamUSLength);
      • void SetCryptoRandomStreamUS(void* stream, unsigned long int streamUSLength);
      • void SetCryptoRandomStreamUL(unsigned long int streamULLength);
      • void SetCryptoRandomStreamUL(void* stream, unsigned long int streamULLength);
      • void SetCryptoRandomStreamHexString(const char* hexStream);.
    • Added member functions:
      • void SetCryptoRandomStreamASCIIString(const char* string);
      • void GrowToBits(unsigned long int numberBits);
      • virtual void GrowToUCs(unsigned long int numberUCs) {};
      • void GrowToUSs(unsigned long int numberUSs);
      • void GrowToULs(unsigned long int numberULs);
      • void AdjustToBits(unsigned long int numberBits);
      • virtual void AdjustToUCs(unsigned long int numberUCs) {};
      • void AdjustToUSs(unsigned long int numberUSs);
      • void AdjustToULs(unsigned long int numberULs);

  • defaultCryptoRandomStream class remodeled:
    • Added member functions:
      • void GrowToUCs(unsigned long int numberUCs);
      • void AdjustToUCs(unsigned long int numberUCs);
    • Removed member functions:
      • void SetCryptoRandomStreamBit(unsigned long int);
      • void SetCryptoRandomStreamBit(void *, unsigned long int);
      • void SetCryptoRandomStreamUC(unsigned long int);
      • void SetCryptoRandomStreamUC(void *, unsigned long int);
      • void SetCryptoRandomStreamUS(unsigned long int);
      • void SetCryptoRandomStreamUS(void *, unsigned long int);
      • void SetCryptoRandomStreamUL(unsigned long int);
      • void SetCryptoRandomStreamUL(void *, unsigned long int);
      • void SetCryptoRandomStreamHexString(const char*);

  • physicalCryptoRandomStream class remodeled:
    • Added PhysicalMemory_descriptor struct grouping all physical memory related variables.
    • Added member functions:
      • private void InitializeSpecificPhysical(void);
      • void GrowToUCs(unsigned long int numberUCs);
      • void AdjustToUCs(unsigned long int numberUCs);
    • Removed member functions:
      • void SetCryptoRandomStreamBit(unsigned long int);
      • void SetCryptoRandomStreamBit(void *, unsigned long int);
      • void SetCryptoRandomStreamUC(unsigned long int);
      • void SetCryptoRandomStreamUC(void *, unsigned long int);
      • void SetCryptoRandomStreamUS(unsigned long int);
      • void SetCryptoRandomStreamUS(void *, unsigned long int);
      • void SetCryptoRandomStreamUL(unsigned long int);
      • void SetCryptoRandomStreamUL(void *, unsigned long int);
      • void SetCryptoRandomStreamHexString(const char*);

  • DiceLockXTSDigested.h header file:
    • Removed declarations:
      • void SetHashChecker(BaseCryptoRandomStream*);
      • BaseCryptoRandomStream* GetHashChecker(void);
      • void RemoveHashChecker(void);

  • ARC4.cpp source file:
    • Redefined member functions:
      • unsigned short int ARC4::GetUSCipherStream(void);
      • unsigned long int ARC4::GetULCipherStream(void);
        • Wrong results in Visual Studio C++ when using 'Full optimization' compiler option.

  • arithmeticFunctions class:
    • Removed member:
      • bool SumULIsOverflow(unsigned long int, unsigned long int);

  • Sha1 class:
    • Added definition:
      • #define SHA1_INITIALS 5 for Sha1 initial values array.

  • Sha224 class:
    • Added definition:
      • #define SHA224_INITIALS 8 for Sha224 initial values array.

  • Sha256 class:
    • Added definition:
      • #define SHA256_INITIALS 8 for Sha256 initial values array.

  • Sha384 class:
    • Added definition:
      • #define SHA384_INITIALS 12 for Sha384 initial values array.

  • Sha512 class:
    • Added definition:
      • #define SHA512_INITIALS 16 for Sha512 initial values array.

  • Sha512_224 class:
    • Added definition:
      • #define SHA512_224_INITIALS 8 for Sha512_224 initial values array.

  • Sha512_256 class:
    • Added definition:
      • #define SHA512_256_INITIALS 8 for Sha512_256 initial values array.

  • blockCipherOperationModes.h header file:
    • BlockCipherOperationModes enumeration:
      • changed NotDefined enumeration value to BCOM_NotDefined enumeration value, it implies that all occurrences of this value is changed in library.

  • blockCiphers.h header file:
    • BlockCiphers enumeration:
      • changed NotDefined enumeration value to BlockCipher_NotDefined enumeration value, it implies that all occurrences of this value is changed in library.

  • cryptoPads.h header file:
    • CryptoPads enumeration:
      • changed NotDefined enumeration value to CryptoPad_NotDefined enumeration value, it implies that all occurrences of this value is changed in library.

  • cryptoRandomStreams.h header file:
    • CryptoRandomStreams enumeration:
      • changed NotDefined enumeration value to Stream_NotDefined enumeration value, it implies that all occurrences of this value is changed in library.

  • diceLocks.h header file:
    • DiceLocks enumeration:
      • changed NotDefined enumeration value to DiceLock_NotDefined enumeration value, it implies that all occurrences of this value is changed in library.

  • diceLockXTSs.h header file:
    • DiceLockXTSs enumeration:
      • changed XTSNotDefined enumeration value to DiceLockXTS_NotDefined enumeration value, it implies that all occurrences of this value is changed in library.

  • hashes.h header file:
    • Hashes enumeration:
      • changed NotDefined enumeration value to Hash_NotDefined enumeration value, it implies that all occurrences of this value is changed in library.

  • indexModifiers.h header file:
    • IndexModifiers enumeration:
      • changed NotDefined enumeration value to IndexModifier_NotDefined enumeration value, it implies that all occurrences of this value is changed in library.

  • keyModifiers.h header file:
    • KeyModifiers enumeration:
      • changed NotDefined enumeration value to KeyModifier_NotDefined enumeration value, it implies that all occurrences of this value is changed in library.

  • randomTests.h header file:
    • RandomTests enumeration:
      • changed NotDefined enumeration value to RandomTest_NotDefined enumeration value, and NumberOfTests enumeration value to NumberOfRandomTests enumeration value, it implies that all occurrences of these values are changed in library.

  • streamCiphers.h header file:
    • StreamCiphers enumeration:
      • changed NotDefined enumeration value to StreamCipher_NotDefined enumeration value, it implies that all occurrences of this value is changed in library.

  • symmetricCiphers.h header file:
    • SymmetricCiphers enumeration:
      • changed NotDefined enumeration value to SymmetricCipher_NotDefined enumeration value, it implies that all occurrences of this value is changed in library.

  • symmetricStreamers.h header file:
    • SymmetricStreamers enumeration:
      • changed NotDefined enumeration value to SymmetricStreamer_NotDefined enumeration value, it implies that all occurrences of this value is changed in library.

  • symmetricStreamerSpecialTypes.h header file:
    • SymmetricStreamerSpecialTypes enumeration:
      • changed SpecialNotDefined enumeration value to SymmetricStreamerSpecial_NotDefined enumeration value, it implies that all occurrences of this value is changed in library.

IDE induced changes

For DiceLock 9.0.0.1 the development environment used (freely available for any user) has been:

Microsoft Visual Studio Express 2013 for Windows Desktop
Version 12.0.30110.00 Update 1
Microsoft .NET Framework
Version 4.5.50938

Visual C++ 2013 06157-004-0441005-02450
Microsoft Visual C++ 2013

This development environment has introduced code analysis to allow some beforehand checking of the code. In order to not show any kind of error that could lead to misinterpret code building (compiling and/or linking) results, found warnings have been removed through code change.

Although execution results remain the same, this modification has introduced some variations regarding DiceLock 9.0.0.1 for Linux.

Change log induced by code analysis is:


  • approximateEntropyTest.cpp source file:
    • Internally modified member function:
      • bool ApproximateEntropyTest::IsRandom(BaseCryptoRandomStream* bitStream);

  • baseRipemd.cpp source file:
    • Internally modified member function:
      • void BaseRipemd::Finalize(void);

  • baseCamellia.h header file:
    • Changed declarations, from:
      • static const unsigned long int ksft1[];
      • static const unsigned long int kidx1[];
      • static const unsigned long int ksft2[];
      • static const unsigned long int kidx2[];
    • to:
      • static const unsigned long int ksft1[26];
      • static const unsigned long int kidx1[26];
      • static const unsigned long int ksft2[34];
      • static const unsigned long int kidx2[34];

  • camellia128.cpp source file:
    • Internally modified member function:
      • void Camellia128::FinalizeKeyExpansion(void);

  • camellia192.cpp source file:
    • Internally modified member function:
      • void Camellia192::FinalizeKeyExpansion(void);

  • camellia256.cpp source file:
    • Internally modified member function:
      • void Camellia256::FinalizeKeyExpansion(void);

  • sosemanuk.cpp source file:
    • Internally modified member functions:
      • void Sosemanuk::GetUCCipherStream(void);
      • void Sosemanuk::GetUSCipherStream(void);
      • void Sosemanuk::GetULCipherStream(void);

  • HC128.cpp source file:
    • Internally modified member functions:
      • void HC128::InitializationProcess(void);
      • void HC128::GenerateKeystream(void);

  • HC256.cpp source file:
    • Internally modified member functions:
      • void HC256::InitializationProcess(void);
      • void HC256::GenerateKeystream(void);

  • md4.cpp source file:
    • Internally modified member function:
      • void Md4::Add(BaseCryptoRandomStream* stream);

  • md5.cpp source file:
    • Internally modified member function:
      • void Md5::Add(BaseCryptoRandomStream* stream);