CHANGE-LOG
==========

April 2026	CP Version 16 (b):
~~~~~~~~~~	~~~~~~~~~~~~~~~~~~

o Correct a mistake in Random::PError() (missed during the previous
  warning fixes).
o Correct a mistake in CipherPacket::FileDecrypt() (missed during the
  previous warning fixes).



April 2026	CP Version 16:
~~~~~~~~~~	~~~~~~~~~~~~~~

o Fix the Copyright Notice syntax to adhere to the modern standard;
  Refer to Wikipedia for the details.

o Bring in a stand-alone AES module (in the "rijndael" directory).
  Ported/Taken from FreeBSD-14.4-REL /sys/crypto/rijndael/
  This became necessary since newer versions of OpenSSL had deprecated
  the AES API that CP had previously been using. Now CP no longer
  requires OpenSSL to compile/build - which is a good thing.

	*** Not yet tested with i.e. AES test-vectors. ***

o Fix various warnings that became visible using the more recent clang(1)
  compiler present in FreeBSD-14.4.

o There should be no functional change.


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~





			29 January 2021
			===============

Cipher-Packet Version 15:
------------------------

o A new and better software license.
o Various source code improvements.
o No functional change.





			28 December 2018
			================

Cipher-Packet Version 14 (No functional change):
-----------------------------------------------

CipherPacket.h:
^^^^^^^^^^^^^^
o class CipherPacket had become bloated; Factor out and separate its
  encryption/decryption supporting/utility methods into two new separate
  classes:
		class CP_Encrypt
		class CP_Decrypt

o Improve the poorly written StreamDecrypt() method (in particular getting
  rid of its static variables).

o Delete some comments that weren't strictly necessary - saving space and
  clarifying the code.

o Remove the class Random "random" variable from class CipherPacket.
  Replace it with a new private-global variable "randDev" - since all
  of the classes in CipherPacket.h need/use it.

o Expand/Clarify the class CipherPacket comment.

o Add an assertion to the end of FileEncrypt(); "(accum == inSize)",
  and then assign "accum" to 0.

o Improve the FileEncrypt()/FileDecrypt() comments.

o Add a few more assertions to the code.

o Set "outIndex" to 0 in PacketEncrypt() (after completion).


Changes made to other files:
^^^^^^^^^^^^^^^^^^^^^^^^^^^
o Counter128::CounterPrint(): Correct the printf(3) format string
  when printing the "unsigned char" type ("%3u" -> "%3hhu").

o Counter128::CounterPrint(): Add a precision to the printf(3)
  field when printing "ctrName" - ensuring the field is never
  overflowed (with characters).

o AES_CTR::GetNextByte(): Add the assertion:

	assert (outputIndex < sizeof (output))

o Random::Close(): Add the assertion:

	assert (FD >= 0)

o Random::Random(): Add the assertion:

	assert (fd >= 0)

o Counter128::SetIv(): Simplify by using memcpy(3) instead of the for-loop.

o Counter128::printState(): Simplify by removing unneeded variables.

o Counter128::QueryCounterSize(): Return sizeof(counter) (instead of
                                  counterSize).
o Counter128::QueryIvSize(): Return sizeof(iv) (instead of counterSize).


o LICENSE.TXT --> 2019



			5 October 2018
			==============

Cipher-Packet Version 13:
------------------------

o All source code files: Introduce a new license (which is almost
  identical to the previous license; just as Free !).

o Introduce a new uniform coding convention for all classes:

	StartUpAssertions()

  This method executes all sanity-check assertions, allowing class
  variable initializations to remain separate in the Constructor.


o AES_CTR.h: Add a Destructor which Zeroes all class variables for
             Security reasons.
o Counter128.h: Add a Destructor which Zeroes all class variables for
                Security reasons.
o Counter128.h: Correctly reorder certain methods.
o CipherPacket.h: Add a Destructor which Zeroes all class variables for
                  Security reasons.
o CipherPacket.h: Rename "STATE_INIT" to the more meaningful "STATE_START".
o CipherPacket.h: Reposition the StartPad()/EndPad() methods closer to
                  StreamDecrypt() (where they are used).


o Update "COMPILE.TXT".



			6 August 2017
			=============

Cipher-Packet Version 12:
------------------------

o Counter128.h: Correct an incorrect field-width in printState().
o Counter128.h: Improve the display output/clarity of printState().
o Counter128.h: Add CounterPrint() method to remove code duplication.
o Counter128.h: fflush(stdout) after the last printf(3) in printState().
o Counter128.h: Reorder the declaration of "counterSize" to be more intuitive.
o Counter128.h: Simplify the QueryIv() method.
o Counter128.h: Make QueryCounterXORIv() return COUNTER (instead of NULL)
                if the IV has not been set (to simplify AES_CTR.h).
o AES_CTR.h: Simplify GenNextBlock() utilizing the above QueryCounterXORIv()
             change - allowing "in" to become const (address).
             Change GenNextBlock() to return void (the pointer it was
             returning was never used).
o AES_CTR.h: Reorder the variable declarations to be more intuitive.
o ByteType.h: Minor cleanup.
o CipherPacket.h: Correct two mistakes in the API USAGE comment, and
                  provide a further minor clarification.
o Random.h: Minor improvement in PError().

o Some indentation corrections.
o Some grammar/comment improvements.
o Update LICENSE.TXT to 2017.
o Update COMPILE.TXT.




			21 November 2016
			================


Cipher-Packet Version 11:
------------------------

o Minor clarification of the comment preceding CipherPacket::FileDecrypt().

o Move type definitions of PacketType and DataType inside class
  CipherPacket (private). They are private/internal definitions
  and should not be API visible.

o Cleanup Counter128::printState().

o In CipherPacket::FileDecrypt(), correct a mistake I introduced when
  fixing "the bug" in CP10 (the correct size for "inBuf" - which depends
  on the (boolean) value of "chunkMode"). Also clarify the arithmetic
  for that size.
o In CipherPacket::FileDecrypt(), move the declaration of "inBuf"
  inside the DO-WHILE loop.

o In the type definition of PacketType, rename "data" to "packet"
  (clarity RE DataType).
o In the type definition of PacketType, rename "dataSize" to "packetSize"
  (clarity RE DataType).

o Assert(BYTE_MAX == 255) in the CipherPacket class constructor.





			30 October 2016
			===============


Cipher-Packet Version 10:
------------------------

o assert (inSize > 0) in CipherPacket::FileEncrypt().

o assert (maxOutSize >= 255) in CipherPacket::FileDecrypt().
o In CipherPacket::FileDecrypt(), change "inBuf" size to be:
	maxOutSize - 253
  This fixes a bug where "out" was being overflowed under certain
  "maxOutSize" values (resulting in a Bus error/Core Dump). The bug
  was related to the re-entrant nature of StreamDecrypt().
o In CipherPacket::FileDecrypt(), add the following assertion:
	assert ((maxOutSize - outIndex) >= outDecrypted->dataSize);
  This precedes the memcpy(3) call and will catch the above bug/
  error-condition before it degenerates into a Bus error/Core Dump.



			22 October 2016
			===============


Cipher-Packet Version 9:
-----------------------

o Rename the "result" variable in Random::Byte() to "out" (clarity).
o Reorder the Random::Byte() variable declarations to be more intuitive.
o Remove the "#include <sys/types.h>" inclusion in Random.h - the
  prescribed system-call FreeBSD 11.0-RELEASE-p1 manual pages do
  not list it as a requirement (any more).
o Cleanup the (main/initial) comment in CipherPacket::StreamDecrypt().


o Update/Cleanup "README-COMPILE.TXT".
o Create the "cp9.tar.gz" tar(1) archive using the "--posix" flag -
  adhere to the POSIX file-format standard (pax file-format).




				19 April 2016
				=============

Cipher-Packet; Version 8:
------------------------

o As per the API Usage comment in CipherPacket.h, enforce the
  requirement (using two assertions) that the API can only
  perform one Encryption operation OR one Decryption operation
  (using a singular instance of a CipherPacket Object).
    It is not possible to enforce the other requirement (that
  the API only uses one file/data-set per CipherPacket Object
  instance) since a CipherPacket Object cannot determine when
  the end of the first file/data-set has been reached (and
  the start of the second file/data-set begins).

o Whitespace cleanups.

o In CipherPacket::FileEncrypt(), rename "data" to "in", and "dataSize"
  to "inSize" (clarification).
o In CipherPacket::FileEncrypt(), rename "Data" to "inPlaintext"
  (clarification).
o In CipherPacket::FileEncrypt(), rename "Packet" to "outEncrypted"
  (clarification).
o In CipherPacket::FileEncrypt(), rearrange the "?" statement (clarification).

o In CipherPacket::FileDecrypt(), rename "data" to "out", and "maxDataSize"
  to "maxOutSize" (clarification).
o In CipherPacket::FileDecrypt(), rename "dataIndex" to "outIndex"
  (clarification).
o In CipherPacket::FileDecrypt(), rename "buf" to "inBuf" (clarification).
o In CipherPacket::FileDecrypt(), rename "Data" to "outDecrypted"
  (clarification).

o In class CipherPacket, rename "plaintext" to "sdPlaintext"
  (StreamDecrypt()) (clarification).
o In CipherPacket::StreamDecrypt(), rename "plaintextIndex" to
  "sdPlaintextIndex" (clarification).
o In class CipherPacket, rename "StateType" to "sdStateType" (clarification).
o In class CipherPacket, rename "state" to "sdState" (clarification).

o Cleanup the comment preceding CipherPacket::FileDecrypt().

o In Random::Bytes(), rename "data" to "out" (clarification).

o Some minor cleanups.

o Make CipherPacket::CipherPacket() take "unsigned char *" (instead of
  "ByteType *") - to match AES_CTR::AES_CTR() constructor.

o Reposition the "encryptInit" and "decryptInit" variable declarations
  to the start of the CipherPacket class declaration (beside the rest
  of the variable declarations).

o Add missing "const" to "key" argument of AES_CTR::AES_CTR() constructor.




			22 January 2016
			===============

--> The primary objective of engineering CP Version 7 was to implement
support for the encryption/decryption of huge files/data-sets (in
manageable chunks).
	In addition to achieving that, the following improvements were
made:


Cipher-Packet; Version 7:
------------------------


o Update LICENSE.TXT to 2016 (Copyright notice/license).

o In CipherPacket.h, hide PacketEncrypt() and StreamDecrypt() in the
  private part of the class (they are not public/API methods).

o In CipherPacket.h, simplify DataEncrypt() by extracting (private):

	FileEncrypt_PAD()
	FileEncrypt_IV()

  Rename DataEncrypt() to: FileEncrypt()

o In CipherPacket.h, simplify DataDecrypt() by extracting (private):

	FileDecrypt_PAD()
	FileDecrypt_IV()

  Rename DataDecrypt() to: FileDecrypt()

o In CipherPacket.h, insert meaningful comments regarding the intended
  use of the FileEncrypt()/FileDecrypt() methods.

o In CipherPacket.h, add support for the encryption/decryption of huge
  files/data-sets (in manageable chunks); support recursive calling of
  the FileEncrypt()/FileDecrypt() methods.

o Add a QueryDevice() method to class Random. Add a QueryRndDevice()
  method to class CipherPacket.

o Make the source code simpler and easier to read by removing the
  "inline" keyword from all methods which are not performance-critical.

o Make class Random open "/dev/random" by default. Remove all of
  the RND_DEVICE rubbish from CipherPacket.h.

o In Counter128.h, assert "ivSet" is false before setting the IV
  in SetIv().

o Remove an incorrect comment from AES_CTR.h, replacing it with a
  new/correct one (regarding the same subject).

o Cleanup/Add some comments.

o In AES_CTR.h, assert/check the return value of AES_set_encrypt_key()
  directly (no need for a variable declaration/assignment).

o In CipherPacket.h, reorder the variable declarations to be
  more intuitive (FileEncrypt()).

o In Counter128.h, simplify QueryIv() and QueryCounterXORIv() by
  removing the ELSE clause.

o In Random::OpenRndDev() and Random::Close(); rename local variable
  "fd" to "FD" - to avoid confusion with the class/private "fd"
  variable.

o In Random::Random(), assert/check the return value of fcntl()
  directly (no need for a variable declaration/assignment).

o Add a comment to CipherPacket.h clarifying API usage of class
  CipherPacket.



			13 September 2015
			=================

Cipher-Packet; Version 6:
------------------------

o In Counter128::QueryCounter(), make "ctr1" and "ctr2" (const) local
  variables (instead of class-scope).
o Cleanup Counter128.h
o Cleanup CipherPacket.h
o Improve software quality by isolating temporary/short-term variable
  delcarations (and associated source code) inside their own braces. Since
  these variables no longer exist after the end-brace, they cannot be
  incorrectly referenced by the following source code.
o Change the EOF/Error message in class Random to use the same syntax
  as the other error messages (in class Random).
o Miscellaneous cleanups.
o Make the following methods in class AES_CTR "inline":
	QueryBlockSize ()
	QueryIvSize ()
	SetIv ()
o Make the following methods in class Counter128 "inline":
	Increment ()
	QueryCounterSize ()
	QueryIvSize ()
	QueryIvSet ()
	QueryIv ()
o Remove "flags" variable declaration from Random::OpenRndDev() (instead
  using O_RDONLY, directly, in the call to open(2)).
o Remove the returning "const" qualifier (which served no purpose) from:
	AES_CTR::QueryBlockSize()
	AES_CTR::QueryIvSize()
	AES_CTR::GetNextByte()
	Counter128::QueryIvSet()
o In ByteType.h, "0xff" -> "0xFF" for readability.



			23 August 2015
			==============

Cipher-Packet; Version 5:
------------------------

o Updated README-COMPILE.TXT regarding compilation on the most recent
  version of FreeBSD; 10.2-RELEASE/amd64 (clang(1)).
o Added an important note to README-COMPILE.TXT regarding compilation
  with the "-DNDEBUG" compiler option (assert(3)).
o Updated the Copyright notice in LICENSE.TXT to this year; 2015.

o Removed Random::Ulong(); it is not used.
o Changed the type of the "nbytes" variable in Random::Byte() to size_t.
  Clang(1) does not generate a warning for the "got != nbytes" comparison.
o Added some missing items to the comments describing what each "#include"
  file is needed for (Random.h).


[ EOF ]
