Re: Get current IV value in decrypt AES256 CTR mode

Jeffrey Walton <[email protected]>
Newsgroups gmane.comp.encryption.cryptopp
Message-ID <CAH8yC8=cMsyNUr-ds6du1xErKfqXMA25aURXYtLpgomoG=1dbA@mail.gmail.com>
On Sat, Jan 9, 2021 at 5:07 AM Xamix <[email protected]> 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
bytes of the iv, so the question becomes - what do you return?

Jeff

-- 
You received this message because you are subscribed to "Crypto++ Users". More information about Crypto++ and this group is available at http://www.cryptopp.com and http://groups.google.com/forum/#!forum/cryptopp-users.
--- 
You received this message because you are subscribed to the Google Groups "Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/cryptopp-users/CAH8yC8%3DcMsyNUr-ds6du1xErKfqXMA25aURXYtLpgomoG%3D1dbA%40mail.gmail.com.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.