On Sat, Jan 9, 2021 at 5:07 AM Xamix <
gma...@gmail.com> wrote:
>
> Thank you for your answer,
>
> For the moment I will do something like the following:
>
> // Create vector to store result
> std::vector<CryptoPP::byte> decoded(data_len);
>
> // Set counter before decoding
> decryptor_.Resynchronize(counter, 16);
> // Decrypt data
> decryptor_.ProcessData(decoded.data(), data, data_len);
>
> // For the moment we compute ourself the value of IV after decrypting
> // But maybe we could optimize by retrieving it from decryptor object?
> for(std::size_t i = 0; i < data_len / 16; ++i)
> {
> for(int j = 15; j >= 0; --j)
> {
> if (++counter[j] != 0)
> break;
> }
> }
>
> Note that data_len is a multiple of block size (i.e 16).
>
> Do you think it is possible to me to patch your library to get back the current IV in order to optimize the code a bit?
> I haven't take a look in the underling code, but is the current IV available in private member at one moment?
> Or maybe it is not available because you are using some Hardware function which do not return the IV?
The problem is not so much hardware. The problem is Filters and
Buffering. The current IV is held in an appropriate buffer provided by
a mode object, like CBC_Mode or CTR_Mode. The mode may only use a few