The current mbedtls integration was not working for some modes. See for
example #1316 and also lots of failing integration tests.
For example in pattern encryptor it works on one block at a time so it
cannot assume it's going to always get a buffer with a padding for an
extra block.
From what I can tell when the padding mode is correctly set to
`MBEDTLS_PADDING_NONE` there is no extra block being written to or
required.
This passes all crypto unit tests and integration tests.
Closes#1316
This work was done over ~80 individual commits in the `cmake` branch,
which are now being merged back into `main`. As a roll-up commit, it is
too big to be reviewable, but each change was reviewed individually in
context of the `cmake` branch. After this, the `cmake` branch will be
renamed `cmake-porting-history` and preserved.
---------
Co-authored-by: Geoff Jukes <geoffjukes@users.noreply.github.com>
Co-authored-by: Bartek Zdanowski <bartek.zdanowski@gmail.com>
Co-authored-by: Carlos Bentzen <cadubentzen@gmail.com>
Co-authored-by: Dennis E. Mungai <2356871+Brainiarc7@users.noreply.github.com>
Co-authored-by: Cosmin Stejerean <cstejerean@gmail.com>
Co-authored-by: Carlos Bentzen <carlos.bentzen@bitmovin.com>
Co-authored-by: Cosmin Stejerean <cstejerean@meta.com>
Co-authored-by: Cosmin Stejerean <cosmin@offbytwo.com>
Call CRYPTO_library_init to properly initialize crypto engine, which
enables AES-NI (Hardware AES) if it is supported by CPU.
Also added a performance benchmark test.
Closes#198.
Change-Id: I962a2da588d2f4f6cbe00c83ecc9a832db0e6042
1. Replace STLDeleter with unique_ptr in container, which is
supported in C++11
2. Replace string_as_array with &string[0] which is guaranteed
to work in C++11
Change-Id: I7f39c0e51fc8a3fcbb41313094a0ca6b33db7bf3
- CBC cryptors should accept IV of size 8 bytes - it will be zero
extended to 16 bytes.
- Fixed iv() not updated problem in AesPatternCryptor.
- Replace kChainAcrossCalls with ConstantIvFlag enum flags.
Change-Id: I3fb4de0e8abbe891e6271e779373ba53f8df660d
- Remove EncryptionMode enums
- Remove AesEncryptor::InitializeWithRandomIv, replaced with
a static function AesCryptor::GenerateRandomIv, which should
be called to generate the iv if the iv is empty.
This change is to prepare support for CBCS and CENS pattern-based
protection schemes.
Issue #77
Change-Id: Icba35089d6e451cbea7ebbf5dd5674079f206390
- Create AesCryptor class as the common base
- AesCryptor::Crypt function will serve as an Encrypt function for
encryptor and a Decrypt function for Decryptor.
Change-Id: Ie91fb14964b5091786705bf510656f40d73af160