3
$\begingroup$

I have a few questions I'm stuck on for a cryptography course I'm doing, any help would be much appreciated.

The first application is for decryption on a multicore processor. I assume any of ECB, CBC, CFB or CTR would be suitable since decryption would be faster when performed in parallel, but are any of them significantly more suitable than the others and how?

The second is where it is preferred/desired to use a processor's idle time for precomputing encryption or decryption tasks before the plaintext or ciphertext is available. Not really sure how to tackle this one.

$\endgroup$
  • 1
    $\begingroup$ Tip: Only two of those modes can be encrypted and decrypted in parallel. One of those remaining two modes is typically unsuitable for use in general. $\endgroup$ – Stephen Touset Sep 10 '14 at 0:41
  • $\begingroup$ Ah okay so for the first part I'd need a mode with both parallel encryption and decryption so I see that CTR is a better choice than ECB. Would that also be the case for the second situation? The only other mode I've learned about is OFB but that has neither parallel encryption/decryption as well. $\endgroup$ – DavidR Sep 10 '14 at 1:03
  • $\begingroup$ You may want to re-review block cipher modes of operation. $\endgroup$ – Stephen Touset Sep 10 '14 at 2:23
3
$\begingroup$

The first application is for decryption on a multicore processor. I assume any of ECB, CBC, CFB or CTR would be suitable since decryption would be faster when performed in parallel, but are any of them significantly more suitable than the others and how?

CTR, CBC and CFB all allow parallel decryption. CTR allows you to decrypt any ciphertext block independently, while the other two allow you to decrypt a block if you know the ciphertext of both it and the previous one.

However, of those only CTR also allows parallel encryption. ECB is insecure in most cases, so it shouldn't be used, but also supports both.

The second is where it is preferred/desired to use a processor's idle time for precomputing encryption or decryption tasks before the plaintext or ciphertext is available. Not really sure how to tackle this one.

Like ECB, both CBC and CFB require knowing the plaintext to compute any block encryptions (beyond the first block, in the case of CFB). CTR allows you to compute the entire keystream in advance.


However, in the real world you would most likely want to use authenticated encryption. Meaning you'd want to consider authenticated cipher modes as well. Many of them use CTR internally for the encryption part, fulfilling both of the above. GCM is the most common, and also allows the authentication part to be calculated in parallel.

$\endgroup$
1
$\begingroup$

Counter mode is the only mode that fits both your use scenarios.

OFB and CTR are the 2 standard modes that convert the block cipher into a stream cipher, allowing precomputation of the key stream before plaintext or ciphertext is available, as well as allowing encryption without padding. CTR is the only one of these supporting parallel processing for both encryption and decryption (since to the block cipher it is the same operation).

CTR also allows searching at arbitrary block locations in the encrypted data stream, OFB/CFB require all previous blocks to be processed to get to a given block. This can dramatically reduce processing time if only a small part of the data requires decryption.

CTR of course requires a nonce to be secure, although that nonce does not need to be secret or unpredictable to an attacker.

$\endgroup$
  • 1
    $\begingroup$ CFB doesn't require all previous blocks, only the previous. $\endgroup$ – otus Sep 10 '14 at 4:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.