Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
New Contributor II
65 Views

AESEncryptCBC on a large files

Jump to solution

Hi!

I want to encrypt (or decrypt) large file.

It is unreasonable/impossible to load the whole file into memory and process it by single AESEncryptCBC call.

The more affordable way is to process that file using consecutive smaller chunks.

So, as far as I understand, the term "initialization vector" is need only for a first Encrypt call.

And subsequent Encrypt calls require knowledge of some state from previous call.

Is it possible with IPP primitives to process large amounts through several AESEncryptCBC calls?

 

And one more question regarding AESEncryptCBC/AESDecryptCBC.

Can pSrc and pDst pointers be the same?

0 Kudos

Accepted Solutions
Highlighted
65 Views

Hello,

Yes, you can do AES CBC encryption by chunks, but in this case you should take care about IV for any subsequent chunk yourself.

The algorithm uses previous encrypted block as an input for the next block processing, so when you encrypt first chunk with the "original" IV, you should take last block of the last encrypted chunk as an IV for the next ippsAESEncryptCBC() call. Please also make sure that size of your chunks is a multiple of block size.

As to the second question, yes, they support in-place mode.

 

Regards,

Andrey

View solution in original post

0 Kudos
2 Replies
Highlighted
66 Views

Hello,

Yes, you can do AES CBC encryption by chunks, but in this case you should take care about IV for any subsequent chunk yourself.

The algorithm uses previous encrypted block as an input for the next block processing, so when you encrypt first chunk with the "original" IV, you should take last block of the last encrypted chunk as an IV for the next ippsAESEncryptCBC() call. Please also make sure that size of your chunks is a multiple of block size.

As to the second question, yes, they support in-place mode.

 

Regards,

Andrey

View solution in original post

0 Kudos
Highlighted
New Contributor II
65 Views

Andrey-Matyukov (Intel) wrote:


Yes, it works! Thank you!

0 Kudos