Is it possible to randomly seek when using GCM?

146 views
Skip to first unread message

bhj.re...@gmail.com

unread,
Aug 26, 2014, 6:18:21 AM8/26/14
to cryptop...@googlegroups.com
For example, when using CTR mode, I can use something like the following code fragment to randomly seek to a position in a data buffer:

        CryptoPP::CTR_Mode<CryptoPP::AES>::Encryption encryptor;
        encryptor.SetKeyWithIV(key, sizeof(key), iv);
        encryptor.Seek(startPosition);
        encryptor.ProcessData(out, in, length);

This works very nicely but I would like to use GCM instead.

Can I therefore do something like the following?

        CryptoPP::GCM<CryptoPP::AES>::Encryption encryptor;
        encryptor.SetKeyWithIV(key, sizeof(key), iv);
        encryptor.Seek(startPosition);
        encryptor.ProcessData(out, in, length);

As you can probably tell, I'm not a cryptographer.

Many thanks,

Ben.


bhj.re...@gmail.com

unread,
Aug 26, 2014, 8:28:50 AM8/26/14
to cryptop...@googlegroups.com
I think I understand a little better now what GCM does. Probably what I'm looking for is XTS; but this doesn't appear supported in cryptopp (?). 

Ruben De Smet

unread,
Aug 26, 2014, 8:55:02 AM8/26/14
to bhj.re...@gmail.com, cryptop...@googlegroups.com
On 08/26/2014 02:28 PM, bhj.re...@gmail.com wrote:
> I think I understand a little better now what GCM does. Probably what I'm
> looking for is XTS; but this doesn't appear supported in cryptopp (?).


Wei Dai on 08-08-10:
It'll have to be in the next version after 5.6.1, because I just spent
several days testing 5.6.1 on a large number of platforms, and if I add a
new feature I'll have go through that again.

https://groups.google.com/forum/#!topic/cryptopp-users/QF0cM04JTDE

A quick grep in the source of cryptopp doesn't give me results for XTS.
If Wei Dai reads this, he might be interested in implementing it.

Ruben

(excuse me for forgetting to CC the list. Again.)

signature.asc

bhj.re...@gmail.com

unread,
Aug 26, 2014, 9:00:25 AM8/26/14
to cryptop...@googlegroups.com, bhj.re...@gmail.com
Many thanks Ruben. Fingers crossed it will be implemented in the near future. Cheers.

Ruben De Smet

unread,
Aug 26, 2014, 9:01:34 AM8/26/14
to bhj.re...@gmail.com, cryptop...@googlegroups.com
On 08/26/2014 03:00 PM, bhj.re...@gmail.com wrote:
> Many thanks Ruben. Fingers crossed it will be implemented in the near
> future. Cheers.

You're welcome!
Btw, the source I grep'd through was 5.6.2 :)

signature.asc

Andreas Tscharner

unread,
Aug 27, 2014, 5:30:57 AM8/27/14
to cryptop...@googlegroups.com, bhj.re...@gmail.com
On 26.08.2014 15:00, bhj.re...@gmail.com wrote:
> Many thanks Ruben. Fingers crossed it will be implemented in the near
> future. Cheers.

Don't count on that!
>

[snip]
> Wei Dai on 08-08-10:
> It'll have to be in the next version after 5.6.1, because I just

Please note that this information is 4 years old (have a look at the date).
A quick look into the SVN showed that the last commit was 2013-02-20
(1.5 years) when 5.6.2 was released...

Best regards
Andreas
--
Andreas Tscharner <sterne...@gmail.com>
----------------------------------------------------------------------
"Intruder on level one. All Aliens please proceed to level one."
-- Call in "Alien: Resurrection"

bhj.re...@gmail.com

unread,
Aug 27, 2014, 5:39:37 AM8/27/14
to cryptop...@googlegroups.com, bhj.re...@gmail.com
Yeah, I know.. still.. It would be nice not to have to switch to a different library. I love the simplicity of cryptopp's API but the application domain I'm working in (filesystem encryption) kind of demands XTS.

Jeffrey Walton

unread,
Aug 30, 2014, 11:49:04 PM8/30/14
to cryptop...@googlegroups.com


On Tuesday, August 26, 2014 6:18:21 AM UTC-4, bhj.re...@gmail.com wrote:
For example, when using CTR mode, I can use something like the following code fragment to randomly seek to a position in a data buffer:

        CryptoPP::CTR_Mode<CryptoPP::AES>::Encryption encryptor;
        encryptor.SetKeyWithIV(key, sizeof(key), iv);
        encryptor.Seek(startPosition);
        encryptor.ProcessData(out, in, length);

This works very nicely but I would like to use GCM instead.
It does not appear so.
 
        GCM< AES >::Decryption dec;
        cout << (dec.IsRandomAccess() ? "Yes, is seekable" : "No, is not seekable") << endl;

Results in:

    $ ./cryptopp-test.exe
    No, is not seekable

Jeff
Reply all
Reply to author
Forward
0 new messages