HLRichardson-Git / Gestalt

A user-friendly cryptography library
https://gestaltcrypto.github.io
MIT License
2 stars 2 forks source link

Refactors unit testing #27

Closed HLRichardson-Git closed 2 months ago

HLRichardson-Git commented 2 months ago

Description of the Change

There are two main changes that come with this pr:

  1. The way we are organizing unit tests has now changed. Before we threw all unit tests into the tests directory, organized by algorithm. Now there will be new directories made in tests for each algorithm where contributors can split up the unit tests into more files to make it easier to maintain. For example, aes unit tests were all in tests/aesTests.cpp, this was split up into three files and an additional vectors file which can be found in tests/aes/. Similar changes were made for all the other algorithms currently supported by Gestalt.
  2. I went on a "journey" to try and update our general block cipher modes of operation templates to be used by both AES and DES. This can be seen in Issue #25 to better understand why I decided to make the decision I made. TLDR, I decided to get rid of the general templates in favor of implementing tailored modes of operation individually for each block cipher. This is in my observation of performance hit for both ciphers using the template, and will only get worse as more ciphers are added.
  3. I said there were two main changes, but that doesn't mean there isn't a third less important one ;). While trying to get the templates working I found places in the current AES implementation to improve a bit of performance. Again a more detailed summary of this can be read in Issue #25 if you're interested. TLDR, we improved performance by around ~25%.

Updates the following documentation:

Alternate Designs

I am not completely abandoning the idea of templates for the block cipher modes of operation, but unless I learn a better way to approach it where performance is not compromised I do not plan at the moment to spend more time pursuing this.

Verification Process

Both the new individual AES modes of operation used the previously made unit tests, and verified that all tests were passing before committing. Similarly, the previous unit tests also tested the individual AES functions, so the optimizations I made to AES were properly validated.

Release Notes