Recent from talks
Contribute something
Nothing was collected or created yet.
Block cipher mode of operation
View on Wikipedia
In cryptography, a block cipher mode of operation is an algorithm that uses a block cipher to provide information security such as confidentiality or authenticity.[1] A block cipher by itself is only suitable for the secure cryptographic transformation (encryption or decryption) of one fixed-length group of bits called a block.[2] A mode of operation describes how to repeatedly apply a cipher's single-block operation to securely transform amounts of data larger than a block.[3][4][5]
Most modes require a unique binary sequence, often called an initialization vector (IV), for each encryption operation. The IV must be non-repeating, and for some modes must also be random. The initialization vector is used to ensure that distinct ciphertexts are produced even when the same plaintext is encrypted multiple times independently with the same key.[6] Block ciphers may be capable of operating on more than one block size, but during transformation the block size is always fixed. Block cipher modes operate on whole blocks and require that the final data fragment be padded to a full block if it is smaller than the current block size.[2] There are, however, modes that do not require padding because they effectively use a block cipher as a stream cipher.
Historically, encryption modes have been studied extensively in regard to their error propagation properties under various scenarios of data modification. Later development regarded integrity protection as an entirely separate cryptographic goal. Some modern modes of operation combine confidentiality and authenticity in an efficient way, and are known as authenticated encryption modes.[7]
History and standardization
[edit]The earliest modes of operation, ECB, CBC, OFB, and CFB (see below for all), date back to 1981 and were specified in FIPS 81, DES Modes of Operation. In 2001, the US National Institute of Standards and Technology (NIST) revised its list of approved modes of operation by including AES as a block cipher and adding CTR mode in SP800-38A, Recommendation for Block Cipher Modes of Operation. Finally, in January, 2010, NIST added XTS-AES in SP800-38E, Recommendation for Block Cipher Modes of Operation: The XTS-AES Mode for Confidentiality on Storage Devices. Other confidentiality modes exist which have not been approved by NIST. For example, CTS is ciphertext stealing mode and available in many popular cryptographic libraries.
The block cipher modes ECB, CBC, OFB, CFB, CTR, and XTS provide confidentiality, but they do not protect against accidental modification or malicious tampering. Modification or tampering can be detected with a separate message authentication code such as CBC-MAC, or a digital signature. The cryptographic community recognized the need for dedicated integrity assurances and NIST responded with HMAC, CMAC, and GMAC. HMAC was approved in 2002 as FIPS 198, The Keyed-Hash Message Authentication Code (HMAC), CMAC was released in 2005 under SP800-38B, Recommendation for Block Cipher Modes of Operation: The CMAC Mode for Authentication, and GMAC was formalized in 2007 under SP800-38D, Recommendation for Block Cipher Modes of Operation: Galois/Counter Mode (GCM) and GMAC.
The cryptographic community observed that compositing (combining) a confidentiality mode with an authenticity mode could be difficult and error prone. They therefore began to supply modes which combined confidentiality and data integrity into a single cryptographic primitive (an encryption algorithm). These combined modes are referred to as authenticated encryption, AE or "authenc". Examples of AE modes are CCM (SP800-38C), GCM (SP800-38D), CWC, EAX, IAPM, and OCB.
Modes of operation are defined by a number of national and internationally recognized standards bodies. Notable standards organizations include NIST, ISO (with ISO/IEC 10116[5]), the IEC, the IEEE, ANSI, and the IETF.
Initialization vector (IV)
[edit]An initialization vector (IV) or starting variable (SV)[5] is a block of bits that is used by several modes to randomize the encryption and hence to produce distinct ciphertexts even if the same plaintext is encrypted multiple times, without the need for a slower re-keying process.[citation needed]
An initialization vector has different security requirements than a key, so the IV usually does not need to be secret. For most block cipher modes it is important that an initialization vector is never reused under the same key, i.e. it must be a cryptographic nonce. Many block cipher modes have stronger requirements, such as the IV must be random or pseudorandom. Some block ciphers have particular problems with certain initialization vectors, such as all zero IV generating no encryption (for some keys).
It is recommended to review relevant IV requirements for the particular block cipher mode in relevant specification, for example SP800-38A.
For CBC and CFB, reusing an IV leaks some information about the first block of plaintext, and about any common prefix shared by the two messages.
For OFB and CTR, reusing an IV causes key bitstream re-use, which breaks security.[8] This can be seen because both modes effectively create a bitstream that is XORed with the plaintext, and this bitstream is dependent on the key and IV only.
In CBC mode, the IV must be unpredictable (random or pseudorandom) at encryption time; in particular, the (previously) common practice of re-using the last ciphertext block of a message as the IV for the next message is insecure (for example, this method was used by SSL 2.0). If an attacker knows the IV (or the previous block of ciphertext) before the next plaintext is specified, they can check their guess about plaintext of some block that was encrypted with the same key before (this is known as the TLS CBC IV attack).[9]
For some keys, an all-zero initialization vector may generate some block cipher modes (CFB-8, OFB-8) to get the internal state stuck at all-zero. For CFB-8, an all-zero IV and an all-zero plaintext, causes 1/256 of keys to generate no encryption, plaintext is returned as ciphertext.[10] For OFB-8, using all zero initialization vector will generate no encryption for 1/256 of keys.[11] OFB-8 encryption returns the plaintext unencrypted for affected keys.
Some modes (such as AES-SIV and AES-GCM-SIV) are built to be more nonce-misuse resistant, i.e. resilient to scenarios in which the randomness generation is faulty or under the control of the attacker.
- Synthetic initialization vectors (SIV) synthesize an internal IV by running a pseudo-random function (PRF) construction called S2V on the input (additional data and plaintext), preventing any external data from directly controlling the IV. External nonces / IV may be fed into S2V as an additional data field.
- AES-GCM-SIVs synthesize an internal IV by running POLYVAL Galois mode of authentication on input (additional data and plaintext), followed by an AES operation.
Padding
[edit]A block cipher works on units of a fixed size (known as a block size), but messages come in a variety of lengths. So some modes (namely ECB and CBC) require that the final block be padded before encryption. Several padding schemes exist. The simplest is to add null bytes to the plaintext to bring its length up to a multiple of the block size, but care must be taken that the original length of the plaintext can be recovered; this is trivial, for example, if the plaintext is a C style string which contains no null bytes except at the end. Slightly more complex is the original DES method, which is to add a single one bit, followed by enough zero bits to fill out the block; if the message ends on a block boundary, a whole padding block will be added. Most sophisticated are CBC-specific schemes such as ciphertext stealing or residual block termination, which do not cause any extra ciphertext, at the expense of some additional complexity. Schneier and Ferguson suggest two possibilities, both simple: append a byte with value 128 (hex 80), followed by as many zero bytes as needed to fill the last block, or pad the last block with n bytes all with value n.
CFB, OFB and CTR modes do not require any special measures to handle messages whose lengths are not multiples of the block size, since the modes work by XORing the plaintext with the output of the block cipher. The last partial block of plaintext is XORed with the first few bytes of the last keystream block, producing a final ciphertext block that is the same size as the final partial plaintext block. This characteristic of stream ciphers makes them suitable for applications that require the encrypted ciphertext data to be the same size as the original plaintext data, and for applications that transmit data in streaming form where it is inconvenient to add padding bytes.
Common modes
[edit]Authenticated encryption with additional data (AEAD) modes
[edit]A number of modes of operation have been designed to combine secrecy and authentication in a single cryptographic primitive. Examples of such modes are ,[12] integrity-aware cipher block chaining (IACBC)[clarification needed], integrity-aware parallelizable mode (IAPM),[13] OCB, EAX, CWC, CCM, and GCM. Authenticated encryption modes are classified as single-pass modes or double-pass modes.
In addition, some modes also allow for the authentication of unencrypted associated data, and these are called AEAD (authenticated encryption with associated data) schemes. For example, EAX mode is a double-pass AEAD scheme while OCB mode is single-pass.
Galois/counter (GCM)
[edit]| GCM | |
|---|---|
| Galois/counter | |
| Encryption parallelizable | Yes |
| Decryption parallelizable | Yes |
| Random read access | Yes |
| Partial last block | Yes |
Galois/counter mode (GCM) combines the well-known counter mode of encryption with the new Galois mode of authentication. The key feature is the ease of parallel computation of the Galois field multiplication used for authentication. This feature permits higher throughput than encryption algorithms.
GCM is defined for block ciphers with a block size of 128 bits. Galois message authentication code (GMAC) is an authentication-only variant of the GCM which can form an incremental message authentication code. Both GCM and GMAC can accept initialization vectors of arbitrary length. GCM can take full advantage of parallel processing and implementing GCM can make efficient use of an instruction pipeline or a hardware pipeline. The CBC mode of operation incurs pipeline stalls that hamper its efficiency and performance.
Like in CTR, blocks are numbered sequentially, and then this block number is combined with an IV and encrypted with a block cipher E, usually AES. The result of this encryption is then XORed with the plaintext to produce the ciphertext. Like all counter modes, this is essentially a stream cipher, and so it is essential that a different IV is used for each stream that is encrypted.
The ciphertext blocks are considered coefficients of a polynomial which is then evaluated at a key-dependent point H, using finite field arithmetic. The result is then encrypted, producing an authentication tag that can be used to verify the integrity of the data. The encrypted text then contains the IV, ciphertext, and authentication tag.
Counter with cipher block chaining message authentication code (CCM)
[edit]Counter with cipher block chaining message authentication code (counter with CBC-MAC; CCM) is an authenticated encryption algorithm designed to provide both authentication and confidentiality. CCM mode is only defined for block ciphers with a block length of 128 bits.[14][15]
Synthetic initialization vector (SIV)
[edit]Synthetic initialization vector (SIV) is a nonce-misuse resistant block cipher mode.
SIV synthesizes an internal IV using the pseudorandom function S2V. S2V is a keyed hash based on CMAC, and the input to the function is:
- Additional authenticated data (zero, one or many AAD fields are supported)
- Plaintext
- Authentication key (K1).
SIV encrypts the S2V output[failed verification] and the plaintext using AES-CTR, keyed with the encryption key (K2).
SIV can support external nonce-based authenticated encryption, in which case one of the authenticated data fields is utilized for this purpose. RFC5297[16] specifies that for interoperability purposes the last authenticated data field should be used external nonce.
Owing to the use of two keys, the authentication key K1 and encryption key K2, naming schemes for SIV AEAD-variants may lead to some confusion; for example AEAD_AES_SIV_CMAC_256 refers to AES-SIV with two AES-128 keys and not AES-256.
AES-GCM-SIV
[edit]AES-GCM-SIV is a mode of operation for the Advanced Encryption Standard which provides similar performance to Galois/counter mode as well as misuse resistance in the event of the reuse of a cryptographic nonce. The construction is defined in RFC 8452.[17]
AES-GCM-SIV synthesizes the internal IV. It derives a hash of the additional authenticated data and plaintext using the POLYVAL Galois hash function. The hash is then encrypted an AES-key, and used as authentication tag and AES-CTR initialization vector.
AES-GCM-SIV is an improvement over the very similarly named algorithm GCM-SIV, with a few very small changes (e.g. how AES-CTR is initialized), but which yields practical benefits to its security "This addition allows for encrypting up to 250 messages with the same key, compared to the significant limitation of only 232 messages that were allowed with GCM-SIV."[18]
Confidentiality only modes
[edit]Many modes of operation have been defined. Some of these are described below. The purpose of cipher modes is to mask patterns which exist in encrypted data, as illustrated in the description of the weakness of ECB.
Different cipher modes mask patterns by cascading outputs from the cipher block or other globally deterministic variables into the subsequent cipher block. The inputs of the listed modes are summarized in the following table:
| Mode | Formulas | Ciphertext | |
|---|---|---|---|
| Electronic codebook | (ECB) | Yi = F(PlainTexti, Key) | Yi |
| Cipher block chaining | (CBC) | Yi = PlainTexti XOR Ciphertexti−1 | F(Y, Key); Ciphertext0 = IV |
| Propagating CBC | (PCBC) | Yi = PlainTexti XOR (Ciphertexti−1 XOR PlainTexti−1) | F(Y, Key); Ciphertext0 = IV |
| Cipher feedback | (CFB) | Yi = Ciphertexti−1 | Plaintext XOR F(Y, Key); Ciphertext0 = IV |
| Output feedback | (OFB) | Yi = F(Yi−1, Key); Y0 = F(IV, Key) | Plaintext XOR Yi |
| Counter | (CTR) | Yi = F(IV + g(i), Key); IV = token() | Plaintext XOR Yi |
Note: g(i) is any deterministic function, often the identity function.
Electronic codebook (ECB)
[edit]| ECB | |
|---|---|
| Electronic codebook | |
| Encryption parallelizable | Yes |
| Decryption parallelizable | Yes |
| Random read access | Yes |
| Partial last block | No |
The simplest of the encryption modes is the electronic codebook (ECB) mode (named after conventional physical codebooks[19]). The message is divided into blocks, and each block is encrypted separately. ECB is not recommended for use in cryptographic protocols: the disadvantage of this method is a lack of diffusion, wherein it fails to hide data patterns when it encrypts identical plaintext blocks into identical ciphertext blocks.[20][21][22]
A striking example of the degree to which ECB can leave plaintext data patterns in the ciphertext can be seen when ECB mode is used to encrypt a bitmap image which contains large areas of uniform color. While the color of each individual pixel has supposedly been encrypted, the overall image may still be discerned, as the pattern of identically colored pixels in the original remains visible in the encrypted version.
ECB mode can also make protocols without integrity protection even more susceptible to replay attacks, since each block gets decrypted in exactly the same way.[citation needed]
Cipher block chaining (CBC)
[edit]| CBC | |
|---|---|
| Cipher block chaining | |
| Encryption parallelizable | No |
| Decryption parallelizable | Yes |
| Random read access | Yes |
| Partial last block | No |
Ehrsam, Meyer, Smith and Tuchman invented the cipher block chaining (CBC) mode of operation in 1976. In CBC mode, each block of plaintext is XORed with the previous ciphertext block before being encrypted. This way, each ciphertext block depends on all plaintext blocks processed up to that point. To make each message unique, an initialization vector must be used in the first block.
If the first block has index 1, the mathematical formula for CBC encryption is
while the mathematical formula for CBC decryption is
Example
[edit]CBC has been the most commonly used mode of operation. Its main drawbacks are that encryption is sequential (i.e., it cannot be parallelized), and that the message must be padded to a multiple of the cipher block size. One way to handle this last issue is through the method known as ciphertext stealing. Note that a one-bit change in a plaintext or initialization vector (IV) affects all following ciphertext blocks.
Decrypting with the incorrect IV causes the first block of plaintext to be corrupt but subsequent plaintext blocks will be correct. This is because each block is XORed with the ciphertext of the previous block, not the plaintext, so one does not need to decrypt the previous block before using it as the IV for the decryption of the current one. This means that a plaintext block can be recovered from two adjacent blocks of ciphertext. As a consequence, decryption can be parallelized. Note that a one-bit change to the ciphertext causes complete corruption of the corresponding block of plaintext, and inverts the corresponding bit in the following block of plaintext, but the rest of the blocks remain intact. This peculiarity is exploited in different padding oracle attacks, such as POODLE.
Explicit initialization vectors take advantage of this property by prepending a single random block to the plaintext. Encryption is done as normal, except the IV does not need to be communicated to the decryption routine. Whatever IV decryption uses, only the random block is "corrupted". It can be safely discarded and the rest of the decryption is the original plaintext.
Propagating cipher block chaining (PCBC)
[edit]| PCBC | |
|---|---|
| Propagating cipher block chaining | |
| Encryption parallelizable | No |
| Decryption parallelizable | No |
| Random read access | No |
| Partial last block | No |
The propagating cipher block chaining[23] or plaintext cipher-block chaining[24] mode was designed to cause small changes in the ciphertext to propagate indefinitely when decrypting, as well as when encrypting. In PCBC mode, each block of plaintext is XORed with both the previous plaintext block and the previous ciphertext block before being encrypted. Like with CBC mode, an initialization vector is used in the first block. Unlike CBC, decrypting PCBC with the incorrect IV (initialization vector) causes all blocks of plaintext to be corrupt.
Encryption and decryption algorithms are as follows:
PCBC is used in Kerberos v4 and WASTE, most notably, but otherwise is not common.
On a message encrypted in PCBC mode, if two adjacent ciphertext blocks are exchanged, this does not affect the decryption of subsequent blocks.[25] For this reason, PCBC is not used in Kerberos v5.
Cipher feedback (CFB)
[edit]Full-block CFB
[edit]| CFB | |
|---|---|
| Cipher feedback | |
| Encryption parallelizable | No |
| Decryption parallelizable | Yes |
| Random read access | Yes |
| Partial last block | Yes |
The cipher feedback (CFB) mode, in its simplest form uses the entire output of the block cipher. In this variation, it is very similar to CBC, turning a block cipher into a self-synchronizing stream cipher. CFB decryption in this variation is almost identical to CBC encryption performed in reverse:
CFB-1, CFB-8, CFB-64, CFB-128, etc.
[edit]NIST SP800-38A defines CFB with a bit-width.[26] The CFB mode also requires an integer parameter, denoted s, such that 1 ≤ s ≤ b. In the specification of the CFB mode below, each plaintext segment (Pj) and ciphertext segment (Cj) consists of s bits. The value of s is sometimes incorporated into the name of the mode, e.g., the 1-bit CFB mode, the 8-bit CFB mode, the 64-bit CFB mode, or the 128-bit CFB mode.
These modes will truncate the output of the underlying block cipher.
CFB-1 is considered self synchronizing and resilient to loss of ciphertext; "When the 1-bit CFB mode is used, then the synchronization is automatically restored b+1 positions after the inserted or deleted bit. For other values of s in the CFB mode, and for the other confidentiality modes in this recommendation, the synchronization must be restored externally." (NIST SP800-38A). I.e. 1-bit loss in a 128-bit-wide block cipher like AES will render 129 invalid bits before emitting valid bits.
CFB may also self synchronize in some special cases other than those specified. For example, a one bit change in CFB-128 with an underlying 128 bit block cipher, will re-synchronize after two blocks. (However, CFB-128 etc. will not handle bit loss gracefully; a one-bit loss will cause the decryptor to lose alignment with the encryptor)
CFB compared to other modes
[edit]Like CBC mode, changes in the plaintext propagate forever in the ciphertext, and encryption cannot be parallelized. Also like CBC, decryption can be parallelized.
CFB, OFB and CTR share two advantages over CBC mode: the block cipher is only ever used in the encrypting direction, and the message does not need to be padded to a multiple of the cipher block size (though ciphertext stealing can also be used for CBC mode to make padding unnecessary).
Output feedback (OFB)
[edit]| OFB | |
|---|---|
| Output feedback | |
| Encryption parallelizable | No |
| Decryption parallelizable | No |
| Random read access | No |
| Partial last block | Yes |
The output feedback (OFB) mode makes a block cipher into a synchronous stream cipher. It generates keystream blocks, which are then XORed with the plaintext blocks to get the ciphertext. Just as with other stream ciphers, flipping a bit in the ciphertext produces a flipped bit in the plaintext at the same location. This property allows many error-correcting codes to function normally even when applied before encryption.
Because of the symmetry of the XOR operation, encryption and decryption are exactly the same:
Each output feedback block cipher operation depends on all previous ones, and so cannot be performed in parallel. However, because the plaintext or ciphertext is only used for the final XOR, the block cipher operations may be performed in advance, allowing the final step to be performed in parallel once the plaintext or ciphertext is available.
It is possible to obtain an OFB mode keystream by using CBC mode with a constant string of zeroes as input. This can be useful, because it allows the usage of fast hardware implementations of CBC mode for OFB mode encryption.
Using OFB mode with a partial block as feedback like CFB mode reduces the average cycle length by a factor of 232 or more. A mathematical model proposed by Davies and Parkin and substantiated by experimental results showed that only with full feedback an average cycle length near to the obtainable maximum can be achieved. For this reason, support for truncated feedback was removed from the specification of OFB.[27]
Counter (CTR)
[edit]| CTR | |
|---|---|
| Counter | |
| Encryption parallelizable | Yes |
| Decryption parallelizable | Yes |
| Random read access | Yes |
| Partial last block | Yes |
- Note: CTR mode (CM) is also known as integer counter mode (ICM) and segmented integer counter (SIC) mode.
Like OFB, counter mode turns a block cipher into a stream cipher. It generates the next keystream block by encrypting successive values of a "counter". The counter can be any function which produces a sequence which is guaranteed not to repeat for a long time, although an actual increment-by-one counter is the simplest and most popular. The usage of a simple deterministic input function used to be controversial; critics argued that "deliberately exposing a cryptosystem to a known systematic input represents an unnecessary risk".[28] However, today CTR mode is widely accepted, and any problems are considered a weakness of the underlying block cipher, which is expected to be secure regardless of systemic bias in its input.[29] Along with CBC, CTR mode is one of two block cipher modes recommended by Niels Ferguson and Bruce Schneier.[30]
CTR mode was introduced by Whitfield Diffie and Martin Hellman in 1979.[29]
CTR mode has similar characteristics to OFB, but also allows a random-access property during decryption. CTR mode is well suited to operate on a multi-processor machine, where blocks can be encrypted in parallel. Furthermore, it does not suffer from the short-cycle problem that can affect OFB.[31]
If the IV/nonce is random, then they can be combined with the counter using any invertible operation (concatenation, addition, or XOR) to produce the actual unique counter block for encryption. In case of a non-random nonce (such as a packet counter), the nonce and counter should be concatenated (e.g., storing the nonce in the upper 64 bits and the counter in the lower 64 bits of a 128-bit counter block). Simply adding or XORing the nonce and counter into a single value would break the security under a chosen-plaintext attack in many cases, since the attacker may be able to manipulate the entire IV–counter pair to cause a collision. Once an attacker controls the IV–counter pair and plaintext, XOR of the ciphertext with the known plaintext would yield a value that, when XORed with the ciphertext of the other block sharing the same IV–counter pair, would decrypt that block.[32]
Note that the nonce in this diagram is equivalent to the initialization vector (IV) in the other diagrams. However, if the offset/location information is corrupt, it will be impossible to partially recover such data due to the dependence on byte offset.
Error propagation
[edit]"Error propagation" properties describe how a decryption behaves during bit errors, i.e. how error in one bit cascades to different decrypted bits.
Bit errors may occur intentionally in attacks or randomly due to transmission errors.
- Random bit errors occur independently in any bit position with an expected probability of ½.
- Specific bit errors occur in the same bit position(s) as the original bit error(s).
- Specific bit errors in stream cipher modes (OFB, CTR, etc.) are trivial. They affect only the specific bit intended.
- Specific bit errors in more complex modes such (e.g. CBC): adaptive chosen-ciphertext attack may intelligently combine many different specific bit errors to break the cipher mode. In Padding oracle attack, CBC can be decrypted in the attack by guessing encryption secrets based on error responses. The Padding Oracle attack variant "CBC-R" (CBC Reverse) lets the attacker construct any valid message.
For modern authenticated encryption (AEAD) or protocols with message authentication codes chained in MAC-Then-Encrypt order, any bit error should completely abort decryption and must not generate any specific bit errors to decryptor. I.e. if decryption succeeded, there should not be any bit error. As such error propagation is less important subject in modern cipher modes than in traditional confidentiality-only modes.
| Mode | Effect of bit errors in Ci | Effect of bit errors in the IV or nonce |
|---|---|---|
| ECB | Random bit errors in Pi | — |
| CBC | Random bit errors in Pi Specific bit errors in Pi+1 |
Specific bit errors in P1 |
| CFB | Specific bit errors in Pi Random bit errors in Pi+1, …, until synchronization is restored |
Random bit errors in P1, …, until synchronization is restored |
| OFB | Specific bit errors in Pi | Random bit errors in P1, P2, …, Pn |
| CTR | Specific bit errors in Pi | Random bit errors in Pi for bit error in counter block Ti |
(Source: SP800-38A Table D.2: Summary of Effect of Bit Errors on Decryption)
It might be observed, for example, that a one-block error in the transmitted ciphertext would result in a one-block error in the reconstructed plaintext for ECB mode encryption, while in CBC mode such an error would affect two blocks. Some felt that such resilience was desirable in the face of random errors (e.g., line noise), while others argued that error correcting increased the scope for attackers to maliciously tamper with a message.
However, when proper integrity protection is used, such an error will result (with high probability) in the entire message being rejected. If resistance to random error is desirable, error-correcting codes should be applied to the ciphertext before transmission.
Other modes and other cryptographic primitives
[edit]Many more modes of operation for block ciphers have been suggested. Some have been accepted, fully described (even standardized), and are in use. Others have been found insecure, and should never be used. Still others don't categorize as confidentiality, authenticity, or authenticated encryption – for example key feedback mode and Davies–Meyer hashing.
NIST maintains a list of proposed modes for block ciphers at Modes Development.[26][33]
Disk encryption often uses special purpose modes specifically designed for the application. Tweakable narrow-block encryption modes (LRW, XEX, and XTS) and wide-block encryption modes (CMC and EME) are designed to securely encrypt sectors of a disk (see disk encryption theory).
Many modes use an initialization vector (IV) which, depending on the mode, may have requirements such as being only used once (a nonce) or being unpredictable ahead of its publication, etc. Reusing an IV with the same key in CTR, GCM or OFB mode results in XORing the same keystream with two or more plaintexts, a clear misuse of a stream, with a catastrophic loss of security. Deterministic authenticated encryption modes such as the NIST Key Wrap algorithm and the SIV (RFC 5297) AEAD mode do not require an IV as an input, and return the same ciphertext and authentication tag every time for a given plaintext and key. Other IV misuse-resistant modes such as AES-GCM-SIV benefit from an IV input, for example in the maximum amount of data that can be safely encrypted with one key, while not failing catastrophically if the same IV is used multiple times.
Block ciphers can also be used in other cryptographic protocols. They are generally used in modes of operation similar to the block modes described here. As with all protocols, to be cryptographically secure, care must be taken to design these modes of operation correctly.
There are several schemes which use a block cipher to build a cryptographic hash function. See one-way compression function for descriptions of several such methods.
Cryptographically secure pseudorandom number generators (CSPRNGs) can also be built using block ciphers.
Message authentication codes (MACs) are often built from block ciphers. CBC-MAC, OMAC and PMAC are examples.
See also
[edit]References
[edit]- ^ NIST Computer Security Division's (CSD) Security Technology Group (STG) (2013). "Block cipher modes". Cryptographic Toolkit. NIST. Archived from the original on November 6, 2012. Retrieved April 12, 2013.
- ^ a b Ferguson, N.; Schneier, B.; Kohno, T. (2010). Cryptography Engineering: Design Principles and Practical Applications. Indianapolis: Wiley Publishing, Inc. pp. 63, 64. ISBN 978-0-470-47424-2.
- ^ NIST Computer Security Division's (CSD) Security Technology Group (STG) (2013). "Proposed modes". Cryptographic Toolkit. NIST. Archived from the original on April 2, 2013. Retrieved April 14, 2013.
- ^ Alfred J. Menezes; Paul C. van Oorschot; Scott A. Vanstone (1996). Handbook of Applied Cryptography. CRC Press. pp. 228–233. ISBN 0-8493-8523-7.
- ^ a b c "ISO/IEC 10116:2006 – Information technology – Security techniques – Modes of operation for an n-bit block cipher". ISO Standards Catalogue. 2006. Archived from the original on 2012-03-17.
- ^ Conrad, Eric; Misenar, Seth; Feldman, Joshua (2017-01-01), Conrad, Eric; Misenar, Seth; Feldman, Joshua (eds.), "Chapter 3 - Domain 3: Security engineering", Eleventh Hour CISSP® (Third Edition), Syngress, pp. 47–93, doi:10.1016/b978-0-12-811248-9.00003-6, ISBN 978-0-12-811248-9, retrieved 2020-11-01
- ^ NIST Computer Security Division's (CSD) Security Technology Group (STG) (2013). "Current modes". Cryptographic Toolkit. NIST. Archived from the original on April 2, 2013. Retrieved April 12, 2013.
- ^ "Stream Cipher Reuse: A Graphic Example". Cryptosmith LLC. 31 May 2008. Archived from the original on 25 January 2015. Retrieved 7 January 2015.
- ^ B. Moeller (May 20, 2004), Security of CBC Ciphersuites in SSL/TLS: Problems and Countermeasures, archived from the original on June 30, 2012
- ^ Tervoort, Tom. "Zerologon: Unauthenticated domain controller compromise by subverting Netlogon cryptography (CVE-2020-1472)". Secura. Retrieved 14 October 2020.
- ^ Blaufish (14 October 2020). "Netlogon CFB8 considered harmful. OFB8 also". GitHub. Retrieved 14 October 2020.
- ^ Gligor, Virgil D.; Donescu, Pompiliu (2002). Matsui, M. (ed.). Fast Encryption and Authentication: XCBC Encryption and XECB Authentication Modes (PDF). Fast Software Encryption 2001. Lecture Notes in Computer Science. Vol. 2355. Berlin: Springer. pp. 92–108. doi:10.1007/3-540-45473-X_8. ISBN 978-3-540-43869-4.
- ^ Jutla, Charanjit S. (May 2001). Encryption Modes with Almost Free Message Integrity (PDF). Eurocrypt 2001. Lecture Notes in Computer Science. Vol. 2045. Springer. doi:10.1007/3-540-44987-6_32.
- ^ Dworkin, Morris (May 2004). Recommendation for Block Cipher Modes of Operation: The CCM Mode for Authentication and Confidentiality (PDF) (Technical report). NIST Special Publications. NIST. doi:10.6028/NIST.SP.800-38C. 800-38C.
- ^ Whiting, D.; Housley, R.; Ferguson, N. (September 2003). Counter with CBC-MAC (CCM). IETF. doi:10.17487/RFC3610. RFC 3610.
- ^ Harkins, Dan (October 2008). "Synthetic Initialization Vector (SIV) Authenticated Encryption Using the Advanced Encryption Standard (AES)". Retrieved 21 October 2020.
- ^ Gueron, S. (April 2019). AES-GCM-SIV: Nonce Misuse-Resistant Authenticated Encryption. IETF. doi:10.17487/RFC8452. RFC 8452. Retrieved August 14, 2019.
- ^ Gueron, Shay; Langley, Adam; Lindell, Yehuda (14 Dec 2018). "AES-GCM-SIV: Specification and Analysis". Cryptology ePrint Archive. Report (2017/168). Retrieved 19 October 2020.
- ^ "Recommendation for Block Cipher Modes of Operation" (PDF). NIST.gov. NIST. p. 9. Archived (PDF) from the original on 29 March 2017. Retrieved 1 April 2017.
- ^ Menezes, Alfred J.; van Oorschot, Paul C.; Vanstone, Scott A. (2018). Handbook of Applied Cryptography. CRC Press. p. 228. ISBN 9780429881329.
- ^ Dam, Kenneth W.; Lin, Herbert S. (1996). Cryptography's Role in Securing the Information Society. National Academies Press. p. 132. ISBN 9780309054751.
- ^ Schneier, Bruce (2015). Applied Cryptography: Protocols, Algorithms and Source Code in C. John Wiley & Sons. p. 208. ISBN 9781119096726.
- ^ "Kryptographie FAQ: Frage 84: What are the Counter and PCBC Modes?". www.iks-jena.de. Archived from the original on 16 July 2012. Retrieved 28 April 2018.
- ^ Kaufman, C.; Perlman, R.; Speciner, M. (2002). Network Security (2nd ed.). Upper Saddle River, NJ: Prentice Hall. p. 319. ISBN 0130460192.
- ^ Kohl, J. (1990). "The Use of Encryption in Kerberos for Network Authentication" (PDF). Proceedings, Crypto '89. Berlin: Springer. ISBN 0387973176. Archived from the original (PDF) on 2009-06-12.
- ^ a b Dworkin, Morris (2001). "SP 800-38A, Recommendation for Block Cipher Modes of Operation: Methods and Techniques" (PDF). csrc.nist.gov. doi:10.6028/NIST.SP.800-38A. Archived (PDF) from the original on 28 August 2017. Retrieved 28 April 2018.
- ^ Davies, D. W.; Parkin, G. I. P. (1983). "The average cycle size of the key stream in output feedback encipherment". Advances in Cryptology, Proceedings of CRYPTO 82. New York: Plenum Press. pp. 263–282. ISBN 0306413663.
- ^ Jueneman, Robert R. (1983). "Analysis of certain aspects of output feedback mode". Advances in Cryptology, Proceedings of CRYPTO 82. New York: Plenum Press. pp. 99–127. ISBN 0306413663.
- ^ a b Lipmaa, Helger; Wagner, David; Rogaway, Phillip (2000). "Comments to NIST concerning AES Modes of Operations: CTR-Mode Encryption" (PDF). Archived (PDF) from the original on 2015-02-26.
- ^ Ferguson, Niels; Schneier, Bruce; Kohno, Tadayoshi (2010). Cryptography Engineering. p. 71.
- ^ "Basic Block Cipher Modes". www.quadibloc.com. Archived from the original on 24 October 2017. Retrieved 28 April 2018.
- ^ "Cryptography I". Coursera. Archived from the original on 23 March 2018. Retrieved 28 April 2018.
- ^ "Modes Development – Block Cipher Techniques – CSRC". Computer Security Division, Information Technology Laboratory, National Institute of Standards and Technology, U.S. Department of Commerce. 4 January 2017. Archived from the original on 4 September 2017. Retrieved 28 April 2018.
Block cipher mode of operation
View on Grokipedia- Electronic Codebook (ECB): Encrypts each block independently without an IV, simple but insecure for repetitive data due to pattern leakage.[1]
- Cipher Block Chaining (CBC): Chains blocks by XORing plaintext with the previous ciphertext block, requiring a random IV and padding for non-multiple lengths.[2]
- Cipher Feedback (CFB): Turns the block cipher into a self-synchronizing stream cipher, processing data in segments smaller than the block size.[1]
- Output Feedback (OFB): Generates a keystream like a stream cipher, avoiding error propagation but vulnerable to keystream reuse if the IV repeats.[2]
- Counter (CTR): Uses a counter to produce a keystream via the cipher, enabling parallel processing and no padding needs.[1]
Fundamentals
Block Ciphers and the Need for Modes
A block cipher is a symmetric-key cryptographic algorithm that encrypts and decrypts fixed-size blocks of data, typically producing output blocks of equal length, with the process parameterized by a secret key.[4] For instance, the Advanced Encryption Standard (AES), a widely adopted block cipher, operates on 128-bit blocks using key sizes of 128, 192, or 256 bits.[4] Block ciphers first emerged in the 1970s, exemplified by the Data Encryption Standard (DES), which was developed by IBM and adopted as a U.S. federal standard in 1977 for securing 64-bit blocks with a 56-bit key.[5] Directly applying a block cipher to messages longer than its fixed block size requires dividing the plaintext into independent blocks and encrypting each separately, as in the naive Electronic Codebook (ECB) mode. This approach reveals structural patterns in the plaintext because identical blocks encrypt to identical ciphertext blocks, compromising confidentiality; for example, a message of repeated identical characters, such as "AAAA...A", produces visibly repeating ciphertext blocks that an attacker can exploit to detect the repetition without knowing the key.[6] Additionally, messages shorter than the block size cannot be encrypted without padding, and longer messages risk exposing correlations across blocks without further processing.[2] Modes of operation extend block ciphers to handle arbitrary-length messages securely by defining methods to chain or feedback block encryptions, thereby providing essential security properties such as confidentiality and resistance to pattern-based attacks or message malleability.[7] These modes transform the underlying block cipher into a versatile tool for real-world applications, mitigating the inherent limitations of block-wise encryption while preserving efficiency.[8]Initialization Vectors
An initialization vector (IV) is a fixed-length block of random or pseudo-random bits used as an additional input to certain block cipher modes of operation, alongside the secret key, to initialize the encryption or decryption process and ensure that identical plaintexts produce distinct ciphertexts under the same key.[1] Typically, the IV length matches the underlying block cipher's block size, such as 128 bits for the Advanced Encryption Standard (AES).[1] It serves a role analogous to a one-time pad component but is designed for reuse across messages only under strict conditions to maintain security.[2] For security, an IV must be unpredictable and unique for each encryption operation performed with a given key; predictability or repetition can compromise the confidentiality of the encrypted data.[1] In modes such as Cipher Block Chaining (CBC) and Cipher Feedback (CFB), the IV requires full unpredictability to prevent chosen-plaintext attacks that distinguish encryptions.[2] Output Feedback (OFB) mode treats the IV as a nonce, demanding uniqueness per message but not necessarily randomness.[1] Counter (CTR) mode uses an initial counter value—often derived from an IV or nonce—that must never repeat across messages with the same key to avoid keystream reuse.[2] If the IV is not transmitted to the recipient, it functions as a nonce, generated predictably from shared context like sequence numbers.[1] Generation methods vary by mode to meet these requirements while ensuring efficiency. For CBC, CFB, and OFB, IVs are commonly produced using a FIPS-approved pseudorandom number generator or by applying the block cipher to a unique nonce (though the latter is discouraged due to potential security weaknesses under the same key).[1] CTR mode typically employs an incrementing counter starting from an initial value, which may incorporate a fixed or derived IV component to span the full block size without overlap.[2] Deriving IVs directly from the encryption key is sometimes used but risks reducing effective key entropy and is generally avoided in favor of independent randomness.[1] Reusing an IV with the same key across multiple messages severely undermines security, often enabling recovery of plaintext information or the key itself. In CBC mode, IV reuse effectively creates a two-time pad scenario, where the exclusive-OR of corresponding plaintext blocks from the two messages can be computed from the ciphertexts, leaking sensitive data patterns or allowing partial key recovery.[2] Similar vulnerabilities arise in CFB and OFB, where repeated IVs expose plaintext XOR differences, while in CTR, reuse directly reuses keystream segments, turning the mode into a malleable stream cipher vulnerable to bit-flipping attacks.[2] NIST recommends limiting the probability of accidental reuse to less than 2^{-32} through sufficiently large IV spaces and rigorous generation practices.[1] In practical protocols, the IV is not required to remain secret and is typically transmitted alongside the ciphertext to enable decryption. For instance, in Transport Layer Security (TLS) version 1.2 using CBC mode, an explicit IV is generated randomly for each record and prepended to the encrypted data.[9] This approach ensures the recipient can initialize the decryption process without prior shared state, while maintaining the IV's role in achieving semantic security.[9]Padding
Block ciphers process fixed-size blocks of data, typically 128 bits for modern algorithms like AES, requiring input messages to be multiples of this block size for encryption. When a message length is not a multiple of the block size, padding must be added to extend it to the nearest multiple, ensuring compatibility with modes like CBC that operate on complete blocks.[1] One widely adopted padding scheme is PKCS#7, which appends a number of bytes equal to the padding length, with each padding byte set to that length value. For a block size of 16 bytes, if 3 bytes of padding are needed, three bytes each with value 0x03 are added; if the message is already a multiple of the block size, a full block of 16 bytes each with value 0x10 is appended. This method, defined for use in cryptographic message syntax, allows unambiguous removal during decryption by checking the last byte's value and verifying that all preceding padding bytes match it.[10] Another common scheme is ANSI X9.23, which pads with zero bytes followed by a single byte indicating the total padding length. For instance, with 3 bytes needed, it adds two 0x00 bytes and one 0x03 byte. This approach, retained in some implementations for compatibility despite the standard's withdrawal, provides a deterministic way to signal padding boundaries but shares similar removal validation with PKCS#7.[11] ISO 10126, an older scheme, fills the padding area with random bytes followed by a byte indicating the padding length, aiming to enhance security through unpredictability. However, it was withdrawn in 2007 primarily due to its reliance on the obsolete single-DES encryption.[11][12] During decryption in chained modes like CBC, padding is removed by reading the last byte to determine the padding length and stripping those bytes after verifying their values match the scheme; invalid padding indicates potential tampering and should trigger rejection of the message to prevent attacks. A notable vulnerability arises from padding verification, as demonstrated in padding oracle attacks where an adversary exploits error messages or timing differences to infer plaintext bits. In CBC mode, for example, Serge Vaudenay showed that by querying a padding oracle— an entity that reveals whether padding is valid—an attacker can decrypt arbitrary ciphertexts block by block with an average of 128 oracle queries per byte (approximately 2048 queries for a 128-bit block), without knowing the key.[1][13] Alternatives to traditional padding exist in modes that emulate stream ciphers, such as CTR, where the block cipher generates a keystream via counter increments, allowing direct XOR with plaintext of any length without requiring padding or block alignment. This avoids padding-related overhead and vulnerabilities while maintaining efficiency for variable-length messages.[1]Historical Development and Standardization
Early Modes
The development of block cipher modes of operation began with the publication of the Data Encryption Standard (DES) by the National Bureau of Standards (NBS, predecessor to NIST) in 1977, as specified in FIPS PUB 46, which established DES as a 64-bit block cipher based on the Feistel network structure originally proposed by Horst Feistel in the early 1970s. The Feistel structure influenced the design of modes by providing a reversible block transformation suitable for chaining operations. In response to the need for standardized ways to handle data larger than a single block, NBS proposed initial modes of operation, culminating in FIPS PUB 81 approved on December 2, 1980, which defined four modes for DES: Electronic Codebook (ECB), Cipher Block Chaining (CBC), Cipher Feedback (CFB), and Output Feedback (OFB). ECB emerged as the simplest early mode, functioning as a direct substitution cipher that encrypts each plaintext block independently using the underlying block cipher, making it straightforward but prone to revealing patterns in repetitive data. To mitigate ECB's vulnerability to pattern leakage—where identical plaintext blocks yield identical ciphertext blocks—CBC was developed, with its invention attributed to IBM researchers Eli D. Cohen, William F. Ehrsam, Carl H. W. Meyer, John L. Smith, and Walter L. Tuchman in a 1976 patent application (granted 1978), motivated by the need for diffusion across blocks via XOR chaining.[14] CFB and OFB were proposed around the same time by NBS researchers, aiming to emulate stream cipher behavior for variable-length data without requiring padding, by generating a keystream through feedback mechanisms applied to the block cipher output. These key events—DES adoption in 1977 and modes standardization in 1980—marked the formalization of block cipher operations for federal use, enabling secure handling of bulk data in applications like file encryption and communications. However, early modes lacked built-in authentication, relying solely on confidentiality, and were susceptible to known-plaintext attacks, especially in ECB where block mappings could be deduced from observed plaintext-ciphertext pairs. These foundations influenced subsequent modern standards.Modern Standards and Evolution
The selection of the Advanced Encryption Standard (AES), based on the Rijndael algorithm, in 2001 marked a pivotal advancement in block cipher standardization, replacing the aging Data Encryption Standard (DES) and enabling the development of a comprehensive suite of modes tailored for modern applications.[15] This led to the NIST Special Publication (SP) 800-38 series, beginning with SP 800-38A in December 2001, which formalized five confidentiality modes—including the newly introduced Counter (CTR) mode—for use with AES and other approved block ciphers.[16] CTR mode's design allows parallelizable encryption and decryption, addressing performance bottlenecks in high-throughput environments like network communications.[16] The evolution toward authenticated encryption with associated data (AEAD) modes accelerated in the early 2000s to provide both confidentiality and integrity in a single primitive, reducing the attack surface compared to separate encryption and authentication. Counter with CBC-MAC (CCM) was standardized in September 2003 via RFC 3610, primarily for IPsec protocols, combining CTR for encryption with CBC-MAC for authentication using 128-bit block ciphers like AES.[17] Galois/Counter Mode (GCM) followed in NIST SP 800-38D in November 2007, leveraging AES in counter mode for encryption and Galois field multiplication for efficient authentication, suitable for hardware-accelerated implementations.[18] These AEAD modes gained widespread adoption due to their resistance to padding oracle attacks, which exploit malleability in padded confidentiality-only modes like CBC; AEAD constructions avoid traditional padding altogether, ensuring integrity checks prevent such manipulations.[19] Key protocols further entrenched AEAD standards, with TLS 1.3 (RFC 8446, August 2018) mandating AEAD cipher suites—such as AES-GCM—for all record protection, eliminating legacy non-AEAD options to enhance security against chosen-ciphertext attacks.[20] Similarly, FIPS 140-3, published in March 2019, updated cryptographic module validation requirements, emphasizing proper nonce and initialization vector (IV) management to mitigate reuse vulnerabilities in modes like GCM and CCM.[21] Drivers for this shift included demands for hardware efficiency, exemplified by AES-GCM's integration into Wi-Fi Protected Access 3 (WPA3), where its parallelizable operations and low-latency authentication support high-speed wireless encryption without compromising security.[22] Recent developments up to 2025 address lingering issues like nonce misuse, with AES-GCM-SIV standardized in RFC 8452 (April 2019) to provide nonce-misuse resistance; it derives a synthetic IV from the nonce and key, ensuring that nonce repetition leaks only message equality rather than enabling full decryption.[23] Post-quantum considerations have emerged for block cipher modes, particularly in adapting classical constructions like CTR and GCM to lattice-based symmetric primitives, as analyzed in security proofs showing their resilience under quantum threats when paired with sufficiently large keys—though NIST's ongoing post-quantum efforts prioritize asymmetric algorithms, modes remain foundational for hybrid systems.[24] In 2024, NIST initiated reviews of SP 800-38B (CMAC), SP 800-38C (CCM), and SP 800-38D (GCM/GMAC) to update these modes for contemporary security needs, with decisions to revise them announced in early 2025. Additionally, NIST launched development of the Accordion mode, a new tweakable block cipher mode for variable-length inputs as a general-purpose AEAD primitive.[25][26][27]Confidentiality-Only Modes
Electronic Codebook (ECB)
The Electronic Codebook (ECB) mode is the simplest confidentiality-only mode of operation for block ciphers, where each plaintext block is encrypted independently using the same key without any chaining or dependency between blocks.[1] Introduced in the 1980 Federal Information Processing Standard (FIPS) 81 for the Data Encryption Standard (DES), ECB treats the block cipher as a fixed substitution for discrete blocks of data, analogous to looking up entries in a codebook.[28] This mode partitions the plaintext into fixed-size blocks (e.g., 64 bits for DES or 128 bits for AES) and applies the cipher function directly to each, producing corresponding ciphertext blocks.[1] In ECB encryption, for a plaintext consisting of blocks , the -th ciphertext block is computed as where denotes the block cipher encryption function with key , for to .[1] Decryption reverses this process independently for each block: where is the inverse (decryption) function.[1] This independence allows full parallelization of both encryption and decryption operations, making ECB computationally efficient on multi-processor systems, and it avoids error propagation, as a transmission error in one ciphertext block affects only the corresponding plaintext block during decryption.[1][28] Despite its simplicity, ECB has significant security limitations due to its deterministic nature: identical plaintext blocks always encrypt to identical ciphertext blocks under the same key, which can reveal statistical patterns in the plaintext.[1] For instance, encrypting structured data like an image may preserve visible outlines in the ciphertext, as repeated pixel patterns map to repeated ciphertext blocks.[1] This mode is also vulnerable to block replay attacks, where an adversary can substitute or replay individual ciphertext blocks to alter specific parts of the decrypted message without detection, especially in protocols lacking integrity protection.[3] Consequently, ECB is unsuitable for most applications requiring strong confidentiality, as it lacks diffusion across blocks—unlike chained modes such as CBC—and is explicitly discouraged for encrypting secret data prone to pattern analysis.[29] ECB finds limited use in scenarios involving small, random data where patterns are unlikely, such as single-block encryptions in challenge-response protocols for personal identity verification (PIV) cards or legacy systems processing independent data units.[3] It remains approved for such narrow cases but is not recommended for general-purpose encryption due to its inherent weaknesses.[29]Cipher Block Chaining (CBC)
Cipher Block Chaining (CBC) mode is a block cipher mode of operation that enhances security by chaining plaintext blocks with previous ciphertext blocks through XOR operations, providing better diffusion than simpler modes.[30] Introduced in the 1980 specification for Data Encryption Standard (DES) modes, CBC requires an initialization vector (IV) to start the chaining process and ensures that identical plaintext blocks do not produce identical ciphertext blocks, thereby hiding patterns in the data.[31] In CBC encryption, the first plaintext block is XORed with the IV before encryption: , where denotes encryption under key . For subsequent blocks, each plaintext block (for ) is XORed with the previous ciphertext block: . The IV, treated as , must be unpredictable and unique per encryption to prevent certain attacks.[30] Decryption reverses this process: the first plaintext block is recovered as , and subsequent blocks as , where is the decryption function. This chaining allows parallel decryption but requires sequential encryption.[30] CBC offers advantages over the Electronic Codebook (ECB) mode by diffusing each block's encryption across the entire message, making it more resistant to statistical analysis of plaintext patterns.[30] It has been widely adopted in protocols such as TLS 1.2, where cipher suites like TLS_RSA_WITH_AES_128_CBC_SHA are mandatory to implement for compatibility and security.[9] However, CBC is malleable, meaning an attacker who modifies a ciphertext block can predictably alter the corresponding plaintext block during decryption—a bit flip in will flip the same bit in , while also randomizing .[30] To mitigate risks, the IV must be randomly generated for each message, and the mode provides no authentication, requiring separate integrity checks in practice.[30] Since CBC processes fixed-size blocks, the plaintext must be padded to a multiple of the block length (e.g., 128 bits for AES) before encryption; PKCS#7 padding is typically used, appending bytes whose value equals the number of padding bytes added. This padding is removed during decryption after verifying its validity.[30]Cipher Feedback (CFB)
Cipher Feedback (CFB) mode is a block cipher mode of operation that transforms a block cipher into a self-synchronizing stream cipher, processing input data in segments of arbitrary size up to the block length. It achieves this by encrypting an initialization vector (IV) or the previous ciphertext block to generate a keystream, which is then XORed with the plaintext segment to produce the corresponding ciphertext segment. The feedback mechanism shifts the output bits, incorporating ciphertext into the next encryption input, allowing for flexible segment sizes where and is the block size. This mode was originally specified for the Data Encryption Standard (DES) in 1980 and later generalized for any approved block cipher.[32] In operation, CFB begins with an IV serving as the initial input block . For subsequent blocks, the input is formed by taking the least significant bits of the previous input and appending the most recent -bit ciphertext segment. The block cipher encrypts to produce output , and the most significant bits of , denoted , are XORed with the -bit plaintext segment to yield the ciphertext segment . Decryption reverses this process using the same keystream. For full-block CFB, where , the mode processes entire blocks and resembles Cipher Block Chaining (CBC) but uses only the encryption direction for feedback, avoiding decryption operations.[32] The general form can be expressed as: where is the IV, and indices denote segments. CFB requires no padding for non-block-aligned data, as it handles arbitrary segment lengths.[32] CFB offers advantages such as self-synchronization after transmission errors—in 1-bit CFB, correct plaintext recovery resumes after bits—and suitability for streaming applications over error-prone channels. However, it mandates serial processing due to dependency on prior ciphertext, resulting in slower performance compared to parallelizable modes like Counter (CTR). It finds use in legacy protocols and environments tolerant of limited error propagation, such as certain financial standards for Triple DES. Unlike Output Feedback (OFB) mode, CFB feeds back ciphertext rather than keystream output, introducing controlled error propagation for synchronization.[32]Output Feedback (OFB)
Output Feedback (OFB) mode is a confidentiality-only mode of operation for block ciphers that transforms the cipher into a synchronous stream cipher by generating a keystream through iterative encryption of an initialization vector (IV) and previous output blocks, which is then XORed with the plaintext to produce ciphertext.[1] The mode was originally proposed in 1976 during NBS meetings on DES modes of operation and standardized in FIPS PUB 81 (1980).[28][33] In OFB encryption, the process begins with the IV serving as the initial input block . Each subsequent output block is computed as for , where denotes the forward encryption function under key . The ciphertext block is then formed by , where is the corresponding plaintext block and represents bitwise XOR.[1] For the final partial block of length bits (where is the block size), the ciphertext is , taking only the most significant bits of the output block.[1] Decryption reverses this by regenerating the keystream identically and XORing it with the ciphertext to recover the plaintext, ensuring the process is symmetric.[1] A key advantage of OFB is its limited error propagation: a bit error in the ciphertext affects only the corresponding bit in the decrypted plaintext, with no diffusion to subsequent blocks, making it suitable for transmission over error-prone channels.[1] Additionally, the keystream can be precomputed independently of the plaintext, allowing for stream-like processing without requiring padding for messages shorter than full blocks.[34] However, the mode operates serially, as each output block depends on the previous one, limiting parallelization during encryption or decryption.[1] From a security perspective, OFB behaves as a synchronous stream cipher, providing semantic security equivalent to a pseudorandom function when the IV is unpredictable and unique per message under the same key.[1] Reusing the same IV with the same key across messages is catastrophic, as it reduces the scheme to a two-time pad, allowing an attacker to recover plaintext by XORing corresponding ciphertexts.[1] The IV must therefore function as a nonce, never repeating for a given key.[1] OFB finds application in scenarios requiring insensitivity to transmission errors, such as stream encryption over noisy channels like satellite communications, where bit errors are common but propagation must be minimized.[34]Counter (CTR)
The Counter (CTR) mode transforms a block cipher into a stream cipher by generating a keystream through the encryption of successive counter values, which is then XORed with the plaintext to produce the ciphertext.[1] This approach avoids inter-block dependencies, allowing independent processing of each block. The counter block typically consists of a nonce (a unique value per message) concatenated with an incrementing counter starting from zero.[35] The encryption operation for the -th block is given by where denotes the block cipher encryption under key , represents concatenation, and is the counter value for block , usually incremented by 1 from the previous.[1] Decryption reverses this process identically, as , since XOR is its own inverse.[35] Partial blocks at the message end are handled by truncating the keystream accordingly, eliminating the need for padding.[1] CTR mode offers several advantages, including high parallelism: multiple blocks can be encrypted or decrypted simultaneously because each requires only a single forward cipher invocation without relying on prior blocks.[35] This enables significant speedups, such as up to 4 times faster software performance compared to chained modes like CBC, and even greater gains (30–100 times) in hardware implementations.[35] Additionally, it supports random access to any block without sequential processing, making it suitable for applications like disk encryption where specific sectors may need individual updates.[35] No padding is required, allowing direct encryption of messages of arbitrary length.[1] Counter management is critical: the full counter block () must be unique for every plaintext block encrypted under the same key across all messages to prevent keystream reuse.[1] The nonce provides per-message uniqueness, while the counter increments predictably (e.g., via modular addition) within a message, typically limited to or fewer blocks to avoid overflow risks in 128-bit setups.[35] From a security perspective, CTR mode provides confidentiality equivalent to a pseudorandom function under the assumption that the block cipher is a pseudorandom permutation, with tight security bounds proven in the multi-user setting.[35] However, nonce reuse with the same key is catastrophic: it allows an attacker to recover the XOR of corresponding plaintext blocks by XORing the ciphertexts, as the keystream would be identical.[1] Nonces must therefore be chosen to ensure global uniqueness, often using random or sequential generation.[35] CTR mode is widely used in high-speed network protocols, such as IPsec for efficient packet encryption, due to its parallelizability and low latency. It also serves as the confidentiality component in many authenticated encryption modes, providing a foundation for constructions like GCM.[1]Propagating Cipher Block Chaining (PCBC)
Propagating Cipher Block Chaining (PCBC), also known as Plaintext Cipher Block Chaining, is a confidentiality-only mode of operation for block ciphers that extends the chaining mechanism of Cipher Block Chaining (CBC) by incorporating both the previous ciphertext and plaintext blocks into the feedback process.[36] This design aims to enhance diffusion and provide implicit integrity protection alongside encryption, though it achieves neither goal robustly in practice. PCBC processes data in blocks of fixed size matching the underlying block cipher, requiring an initialization vector (IV) for the first block and propagating feedback through subsequent blocks. In PCBC encryption, the -th ciphertext block is computed by XORing the -th plaintext block with both the previous ciphertext block and the previous plaintext block (or the IV for , where is typically zero or omitted), then encrypting the result with the block cipher under key : Decryption reverses this by first decrypting the ciphertext block with , then XORing the output with the same previous values: This feedback loop ensures that each block's processing depends on prior plaintext, making parallel decryption impossible and increasing computational interdependence compared to standard CBC.[37] Note that recovering during decryption requires sequential processing from the start, as it is needed for subsequent blocks. PCBC was proposed in the late 1980s during the development of Kerberos Version 4, an authentication protocol from MIT, where it was used with DES to encrypt tickets and provide both confidentiality and a form of integrity checking without separate authentication tags.[36] It appeared in the Kerberos V4 implementation around 1989 but was not formalized in any major cryptographic standard like FIPS or NIST recommendations.[38] A key advantage of PCBC over basic CBC is its improved resistance to certain malleability attacks; modifying a single ciphertext block alters the decryption of that block and propagates changes to multiple subsequent blocks due to the inclusion of plaintext in the feedback, potentially garbling more of the message and making targeted alterations harder.[37] However, this comes at the cost of increased complexity in implementation and analysis, as the dependence on prior plaintext complicates error handling and parallelization. Despite its intentions, PCBC has significant disadvantages, including severe error propagation: a bit error or block modification affects not only the immediate block but also the next one (or potentially two, depending on the error type), as the corrupted plaintext feeds into future chaining, leading to cascading decryption failures.[36] Moreover, it remains non-standard and vulnerable to specific attacks, such as swapping adjacent ciphertext blocks, which allows an adversary to rearrange message parts without immediately corrupting the entire output.[37] These issues contributed to its limited adoption beyond early Kerberos deployments. Today, PCBC sees minimal use and is considered largely obsolete, having been replaced in modern systems by authenticated encryption modes like GCM or CCM that explicitly provide both confidentiality and integrity without relying on fragile chaining tricks.[36] Kerberos Version 5, standardized in RFC 1510 (1993) and later updates, abandoned PCBC in favor of explicit checksums and standard modes to address these shortcomings.[38]Authenticated Encryption Modes
Galois/Counter Mode (GCM)
Galois/Counter Mode (GCM) is an authenticated encryption with associated data (AEAD) mode of operation for block ciphers, providing both confidentiality and integrity protection in a single pass. It combines the Counter (CTR) mode for encryption with the GHASH function, a polynomial hash based on multiplication in the finite field GF(2^128), for message authentication. The mode processes the plaintext and associated data (AAD) using a secret key and a nonce , producing ciphertext and an authentication tag . GCM is designed for efficiency in both software and hardware, particularly with 128-bit block ciphers like AES.[39] The encryption step uses CTR mode: the initial counter block is derived from the nonce (typically for 96-bit ), and the ciphertext is for to , where is the block cipher encryption and is the number of 128-bit blocks in . Authentication is computed via GHASH, where the hash subkey , and the input string is , with , , and denoting the 64-bit binary representation of the bit length. The GHASH value is then combined with the counter mode to form the tag: , where is the tag length. This construction ensures the tag authenticates both the ciphertext and AAD without requiring a separate MAC pass.[39] GCM recommends a 96-bit nonce for optimal performance, though lengths from 1 to bits are supported by padding or derivation, and a 128-bit tag length (with 96, 104, 112, or 120 bits also allowed). The mode is highly parallelizable, as both CTR encryption and GHASH computations can be distributed across multiple blocks independently, enabling high-throughput implementations. In hardware, GCM benefits from dedicated instructions like Intel's AES-NI and PCLMULQDQ, which accelerate AES encryption and Galois field multiplications, achieving speeds exceeding 10 Gbps on modern processors.[39][40] GCM provides IND-CCA security under the concrete security model when nonces are unique per key, with the adversary's advantage bounded by terms involving the number of blocks processed and nonce length. However, nonce reuse under the same key severely compromises security: it allows recovery of plaintext differences via from CTR, and enables forgery attacks by exposing the hash key or counter collisions. GCM is standardized in protocols such as TLS 1.3, where AES-128-GCM and AES-256-GCM are mandatory-to-implement cipher suites, and IPsec ESP via RFC 4106.[40][39][20][41]Counter with CBC-MAC (CCM)
Counter with CBC-MAC (CCM) is an authenticated encryption with associated data (AEAD) mode of operation for block ciphers, combining the Counter (CTR) mode for confidentiality with Cipher Block Chaining Message Authentication Code (CBC-MAC) for integrity and authenticity. It processes both the plaintext and any associated data (AAD) using a single secret key, producing a ciphertext and an authentication tag that verifies both the ciphertext and the AAD. CCM is designed specifically for 128-bit block ciphers, such as AES, and is particularly suited for resource-constrained environments due to its reliance on a single cryptographic primitive.[17] The operation of CCM involves two main phases: authentication followed by encryption. First, a CBC-MAC is computed over the AAD and the padded plaintext. The input to the CBC-MAC is formatted as a sequence of blocks: the first block includes a Flags octet (indicating AAD presence and lengths), followed by the nonce (7 to 13 octets), length fields for AAD and plaintext, the AAD itself (padded if necessary), and the plaintext padded to a multiple of the block size. The CBC-MAC value, denoted as , is the first octets (where is 4, 6, 8, 10, 12, 14, or 16) of the encryption of the final CBC-MAC input block under the key . The ciphertext is then generated by XORing the plaintext with the keystream generated in CTR mode using the same nonce concatenated with an incrementing counter starting from 1. Finally, the authentication tag is the first octets of the CTR keystream for counter value 0 (i.e., ). Decryption reverses this process, recomputing the MAC and verifying the tag before releasing the plaintext. All operations use the same key , ensuring efficiency.[17] Key parameters in CCM include the nonce length , which ranges from 7 to 13 octets (with the total length field from 2 to 8 octets to fit within 128 bits alongside the nonce), and the Flags field, which encodes whether AAD is present, the tag length , and the value of . The nonce must be unique for each key usage to prevent attacks, as reuse can compromise security. Unlike some modes, the CBC-MAC computation is sequential and cannot be parallelized, which may limit performance in high-throughput scenarios but simplifies implementation.[17] CCM's primary advantages stem from its use of a single block cipher primitive and key for both encryption and authentication, making it compact and lightweight for devices with limited resources, such as those in wireless protocols. It avoids the need for separate hash functions or multiple primitives, reducing code size and potential vulnerabilities from key separation.[17] Security analyses confirm that CCM provides IND-CCA2 security (indistinguishability under chosen-ciphertext attack) when the nonce is unique per key and the block cipher is secure; the mode is proven secure in the standard model assuming the underlying cipher's pseudorandomness. However, nonce reuse can lead to forgery attacks, emphasizing the need for careful nonce management. CCM does not support plaintext longer than octets due to counter overflow risks.[17] CCM is standardized in RFC 3610 and widely adopted in protocols requiring efficient AEAD, including Bluetooth Low Energy for link-layer security using AES-CCM, IEEE 802.11w for protected management frames via the CCMP protocol, and IPsec ESP for authenticated encryption.[17][42][43]Synthetic Initialization Vector (SIV)
The Synthetic Initialization Vector (SIV) mode is a block cipher mode of operation designed for authenticated encryption with associated data (AEAD) that provides resistance to nonce misuse, allowing secure operation even when the same nonce is reused across multiple encryptions.[44] It achieves this through a deterministic process that derives a synthetic initialization vector (SIV) from the plaintext and associated data, eliminating the need for a random or unique nonce while maintaining both confidentiality and authenticity.[45] SIV operates in two passes: first computing the synthetic IV using a pseudorandom function on the inputs, then performing encryption in counter (CTR) mode using that IV.[44] The operation begins with the derivation of the synthetic IV, denoted as , where S2V is a specific construction based on CMAC (Cipher-based Message Authentication Code) applied to the associated data (AAD) strings and plaintext , using key .[45] S2V processes the inputs by iteratively applying the block cipher in CMAC mode, incorporating doubling and XOR operations to handle variable-length strings, ensuring the output is a 128-bit value for AES.[44] In the second pass, the plaintext is encrypted in CTR mode: the counter block is formed as , and the keystream is generated as for , where is the block cipher encryption. The ciphertext is then , with padding to match the plaintext length, and the final output is , where serves dual roles as the initialization vector for CTR and the authentication tag.[45] Decryption reverses this process, recomputing from the purported plaintext and verifying it against the provided tag before applying CTR decryption.[44] SIV's key advantages stem from its deterministic nature and misuse resistance: it produces the same ciphertext for identical inputs without requiring a random IV or nonce, making it suitable for applications like key wrapping where predictability is needed, and it preserves security even if the same synthetic IV is reused, as long as the total number of encryptions remains bounded.[45] This contrasts with nonce-based modes, where reuse typically compromises security.[44] Security is formalized as a misuse-resistant AEAD (MRAE) scheme, with security that falls off approximately as σ² / 2^n (where σ is the total number of blocks processed and n=128 is the block size), allowing up to 2^{48} encryptions or 2^{64} blocks per key with negligible risk (advantage ≤2^{-56}).[44] However, SIV incurs drawbacks, including the computational overhead of two passes—which requires roughly twice the block cipher invocations of a single-pass mode—and fixed 128-bit tags, which are larger than some alternatives.[45] SIV was standardized in RFC 5297 (2011) for use with AES (in 128-, 192-, and 256-bit key variants, denoted AEAD_AES_SIV_CMAC_256, etc.), and it finds primary application in file encryption and deterministic scenarios where nonce management is impractical, such as secure storage systems.[45]AES-GCM-SIV
AES-GCM-SIV is a nonce-misuse-resistant authenticated encryption with associated data (AEAD) mode of operation for the Advanced Encryption Standard (AES) block cipher, providing both confidentiality and authenticity while tolerating nonce reuse without catastrophic security degradation.[23] Developed by researchers including Adam Langley at Google, it was proposed in 2017 and standardized in RFC 8452 in 2019, building on the efficiency of Galois/Counter Mode (GCM) but incorporating synthetic initialization vector (SIV)-like properties for enhanced robustness.[46][23] The mode supports AES-128 and AES-256, using a 96-bit nonce and producing a 128-bit authentication tag, with ciphertext length equal to the plaintext plus the tag.[47] The operation of AES-GCM-SIV involves key derivation from the master key and nonce, followed by authentication and encryption using POLYVAL (a polynomial evaluation function over GF(2^{128})) and AES in counter (CTR) mode. For encryption, subkeys are first derived: an authentication key and an encryption key are generated by encrypting the nonce concatenated with small counter values (0 to 3 for AES-128 or 0 to 5 for AES-256) under the master key, using four or six AES block encryptions respectively.[48] A value is then computed as the POLYVAL output over the associated data (AAD), padded plaintext , and length blocks: where is the padded AAD and lengths are encoded in little-endian blocks.[49] This is XORed with the nonce (padded to 128 bits), masked by clearing the least significant bit, and encrypted under with an all-zero block (except the final bit set to 1) to produce the authentication tag : The plaintext is encrypted in CTR mode starting from an initial counter block derived from the TAG (incremented and segmented for parallelization), yielding the ciphertext . Decryption reverses this: CTR decryption produces candidate plaintext, POLYVAL is recomputed on AAD and the candidate, and the tag is verified in constant time; rejection occurs if mismatched.[48][50] This two-pass design for encryption (authentication first, then encryption) enables parallelism in CTR but requires sequential POLYVAL.[48] Key advantages of AES-GCM-SIV include its balance of performance and security: encryption is approximately 50% slower than AES-GCM due to the extra pass, but decryption achieves speeds within 5% of AES-GCM for messages over a few kilobytes, leveraging hardware-accelerated AES-CTR.[48] POLYVAL offers about 1.2 times the speed of GHASH on modern hardware, and the mode supports up to messages per key with random nonces.[48] Compared to pure SIV modes, it maintains nonce-based operation for efficiency while deriving per-message subkeys and a synthetic counter from message contents, preventing plaintext recovery on nonce reuse.[51] In terms of security, AES-GCM-SIV achieves indistinguishability under chosen-ciphertext attack (IND-CCA) even if the same nonce is reused up to 256 times across messages of 1 GiB each, with an adversary advantage bounded by roughly , where is the number of encryptions and the total plaintext bits (with ).[52] Nonce reuse leaks only plaintext equality, not full contents, unlike GCM's total compromise.[48] The construction resists standard attacks like bit-flipping or padding oracles through CTR's malleability mitigation via the synthetic tag.[53] Adoption of AES-GCM-SIV has grown since its integration into BoringSSL in 2017, powering applications in Google Chrome for secure browsing and QUIC protocol source-address token protection. By 2025, it is used in cloud storage systems (e.g., via Google's Tink library) and messaging platforms like LINE for nonce-vulnerable environments, with IANA registry support (AEAD IDs 30 and 31) facilitating broader protocol integration.[54][55]Security Properties and Analysis
Error Propagation
Error propagation refers to the extent to which a bit error in the transmitted ciphertext affects the decrypted plaintext in block cipher modes of operation, a critical consideration for applications over unreliable channels such as wireless or satellite links. In noisy environments, where bit error rates (BER) can reach 10^{-6}—meaning one error per million bits transmitted—the choice of mode influences both data usability and security integrity.[56] Modes with limited propagation, like stream-cipher emulations, are preferred for such scenarios to minimize data loss beyond the erroneous bits.[57] In Electronic Codebook (ECB) mode, a bit error in a ciphertext block corrupts only the corresponding plaintext block, with no propagation to subsequent blocks, as each block is encrypted independently. This isolated impact makes ECB suitable for error-prone channels but vulnerable to pattern analysis, though its error handling is straightforward.[58] Similarly, in Counter (CTR) mode, a ciphertext bit flip affects only the matching plaintext bit, exhibiting no propagation due to the independent keystream generation; this property aligns CTR well with high-BER environments like wireless networks.[58] Output Feedback (OFB) mode behaves analogously, where an error in the ciphertext keystream segment flips solely the corresponding plaintext bit without affecting later blocks, avoiding the diffusion seen in chaining modes.[58] Cipher Block Chaining (CBC) mode, by contrast, exhibits more extensive propagation: a single bit error in ciphertext block garbles the entire plaintext block (due to the block decryption) and flips the corresponding bit in via the XOR chaining, but resynchronizes thereafter, limiting impact to two blocks.[57] In Cipher Feedback (CFB) mode—typically analyzed for s-bit segments—a bit error corrupts the current s-bit plaintext segment and injects erroneous feedback into the shift register, garbling the next s bits as well, though it self-heals after one full block as the register shifts out the error.[58] These chaining effects in CBC and CFB can amplify integrity risks in channels with BER around 10^{-6}, potentially corrupting multiple bytes per error event.[59] For Authenticated Encryption with Associated Data (AEAD) modes like Galois/Counter Mode (GCM) and Counter with CBC-MAC (CCM), error propagation mirrors the underlying confidentiality component but extends to authentication failure. In GCM, based on CTR encryption, a ciphertext bit error flips only the corresponding plaintext bit with no further propagation, yet alters the Galois Hash (GHASH) computation over the ciphertext, likely causing the authentication tag to mismatch and triggering total message rejection to preserve integrity.[2] CCM combines CTR encryption with CBC-MAC, so a bit error affects the current plaintext block and the subsequent MAC-chained block (impacting two plaintext blocks total), but again, the modified ciphertext typically invalidates the tag, resulting in outright discard of the message rather than partial decryption. This all-or-nothing rejection in AEAD modes enhances security against tampering but can exacerbate data loss in high-BER settings compared to confidentiality-only modes.[60] Mitigations for error propagation include selecting modes with minimal spread, such as CTR or OFB for noisy channels, and integrating forward error correction (FEC) techniques that add redundancy to detect and repair bit errors before decryption, reducing effective BER without altering the cipher mode.[57] For instance, FEC can correct errors at rates up to 10^{-6} BER in optical or wireless systems, ensuring reliable propagation even in chaining modes like CBC.[61]Nonce and IV Security
In block cipher modes of operation, the initialization vector (IV) or nonce plays a critical role in ensuring security by providing uniqueness and unpredictability to each encryption invocation under a given key. Reuse or predictability of these values can lead to severe vulnerabilities, including plaintext recovery and forgery attacks, across various modes. NIST Special Publication 800-38A emphasizes that IVs must be unpredictable and unique per key to maintain confidentiality and prevent such compromises.[1] In Cipher Block Chaining (CBC) mode, reusing the same IV with the same key enables chosen-plaintext attacks where an adversary can recover information about plaintext prefixes by comparing ciphertexts, as the XOR operation with the IV chains subsequent blocks predictably. This leakage occurs because the first ciphertext block is effectively the encryption of the plaintext XORed with the reused IV, allowing pattern detection without key knowledge. While CBC is more resilient than stream-like modes to single reuses, repeated misuse amplifies risks, underscoring the need for random, unique IVs of at least 128 bits.[1] Counter (CTR) and Galois/Counter (GCM) modes are particularly vulnerable to nonce reuse, as they generate a keystream from the nonce and counter; repetition exposes plaintext via simple XOR of corresponding ciphertexts. In CTR, nonce reuse produces identical keystreams, enabling direct recovery of plaintext XOR differences and trivial data forgery, as demonstrated in IPsec contexts where attackers can manipulate packets without authentication. GCM exacerbates this by also compromising authentication: a single reuse allows reconstruction of the authentication key through polynomial factorization, enabling precise message forgeries in protocols like TLS, where scans revealed over 184 vulnerable HTTPS servers.[62][63] Nonce predictability in CTR mode arises from counter exhaustion, where incrementing the counter beyond its range (typically 32 or 64 bits) under a fixed nonce leads to keystream repetition, effectively reducing security to preimage attacks after 2^{n/2} blocks for an n-bit block size. This risk is mitigated by ensuring the full nonce-counter pair spans at least 128 bits without wraparound, but poor implementation can cause unintended reuse in high-volume scenarios.[35] Best practices for nonce and IV management include using 96-bit nonces for GCM to balance efficiency and collision resistance, with a recommended limit of 2^{32} invocations per key to avoid reuse probabilities exceeding 50% under random generation. For general modes, IVs or nonces should be at least 64 bits and randomly generated or derived protocol-wide for uniqueness, as in TLS where sequence numbers ensure per-session distinctness. NIST SP 800-38A further advises against predictable constructions, favoring FIPS-approved random number generators.[18][1] A notable historical incident occurred in 2017 with the KRACK (Key Reinstallation Attack) on WPA2, where attackers forced nonce reuse during the 4-way handshake, reinstalling keys and enabling packet decryption, replay, and injection across all Wi-Fi devices, including severe impacts on Android implementations.[64] To address these risks, misuse-resistant modes like Synthetic Initialization Vector (SIV) have been developed, which treat the IV as a synthetic construct from the message and header, preserving security even under full nonce reuse by deriving unique values deterministically without relying on nonce uniqueness. Standardized in RFC 5297, SIV ensures privacy and authenticity unless identical (header, plaintext) pairs are repeated. Variants like AES-GCM-SIV extend this to high-performance authenticated encryption.[44][45] As of 2025, NIST Special Publication 800-38D is under revision to enhance GCM nonce management, proposing variants for larger block ciphers (e.g., 256-bit) to expand nonce spaces to 2^{64} and endorsing derivation methods like DNDK-GCM for rapid deployment against reuse in high-throughput applications. These updates aim to reduce rekeying frequency while maintaining forgery resistance.[65]Other Cryptographic Considerations
Block cipher modes without authentication, such as CBC and CFB, exhibit malleability, allowing an adversary to predictably alter plaintext by modifying ciphertext blocks—for instance, flipping a bit in a ciphertext block can cause a corresponding predictable change in the decrypted plaintext of the subsequent block.[2] This property enables attacks like chosen-ciphertext manipulations without detection, as the decryption process chains dependencies that propagate alterations in a controllable manner.[2] In contrast, authenticated encryption modes like GCM incorporate an authentication tag that verifies both confidentiality and integrity, rendering such malleability attacks infeasible since any ciphertext modification invalidates the tag.[39] Side-channel attacks pose significant risks to implementations of various modes, exploiting unintended information leakage through timing, power, or cache access patterns. In CBC mode, padding oracle attacks leverage timing differences during decryption and padding validation to recover plaintext byte-by-byte, as originally demonstrated against PKCS#7 padding schemes. For instance, the Lucky Thirteen attack refines this by exploiting subtle timing variations in TLS implementations using CBC, even with countermeasures.[3] GCM is susceptible to cache-timing attacks on its GHASH authentication component due to table lookups dependent on secret data, potentially leaking the hash key through cache contention.[66] Mitigations for these vulnerabilities include constant-time implementations that avoid conditional branches and data-dependent memory accesses, ensuring uniform execution regardless of input.[66] Quantum computing introduces threats to the long-term security of block cipher modes via algorithms like Grover's, which provides a quadratic speedup for brute-force key searches, effectively halving the security level of symmetric keys—for example, reducing AES-128's 128-bit security to 64 bits.[67] To counter this, modes employing larger keys, such as AES-256 in CTR or GCM, maintain adequate post-quantum security levels around 128 bits, as recommended for symmetric primitives.[67] While quantum threats primarily target asymmetric cryptography, NIST's 2024 post-quantum standards (FIPS 203, 204, and 205) emphasize hybrid approaches, but symmetric modes remain viable with key size adjustments up to 2025 guidelines.[68] Performance trade-offs among modes influence their suitability for different hardware and workloads, particularly regarding parallelism. CTR and GCM support full parallelization of encryption and decryption across blocks, enabling efficient utilization of multi-core processors and hardware accelerators, which is critical for high-throughput applications.[2] Conversely, CBC requires sequential processing due to its chaining dependency, limiting scalability on parallel architectures and increasing latency for large data.[2] These differences can result in GCM outperforming CBC by factors of 2-10x in parallel environments, though CBC may suffice for simpler, serial-bound scenarios.[2] Selecting a mode depends on the threat model, prioritizing confidentiality alone with CTR for scenarios without integrity needs, or opting for AEAD modes like GCM when both confidentiality and authentication are required to resist active adversaries.[39] NIST guidelines advocate AEAD modes for new protocols to address comprehensive security, balancing computational overhead against protection levels.[18]Additional Modes and Primitives
Stream Cipher Emulation
Block cipher modes such as Cipher Feedback (CFB), Output Feedback (OFB), and Counter (CTR) transform a block cipher into a stream cipher, enabling encryption of variable-length data without requiring padding, which is essential for processing byte streams or arbitrary data sizes.[1] In CFB and OFB modes, the block cipher generates a keystream that is XORed with plaintext segments, allowing operation on sub-block sizes; for instance, CFB supports segment sizes from 1 to the full block length (e.g., 8 bits for byte-oriented streams), while OFB uses the most significant bits of the output for partial blocks.[1] These modes emulate asynchronous (OFB) or self-synchronizing (CFB) stream ciphers, where CFB feeds back ciphertext to recover from errors after a limited number of blocks, unlike OFB's error propagation across the entire stream.[1] Among these, CTR mode has become the preferred method for modern stream emulation due to its lack of synchronization dependencies and support for parallel processing, avoiding the sequential feedback in CFB and OFB that can introduce latency or error propagation.[1] In CTR, a unique counter block is incremented for each position and encrypted to produce the keystream, enabling independent block computations without reliance on prior ciphertext or outputs.[1] This design parallels the keystream generation in native stream ciphers like RC4, but leverages the block cipher's pseudorandom permutation for stronger security guarantees, provided counter blocks remain unique across all encryptions under the same key to prevent keystream reuse and potential disclosure of plaintext XOR differences.[1][69] These emulation modes find applications in real-time communications, such as Voice over IP (VoIP), where padding is undesirable due to latency constraints and variable packet sizes; for example, the Secure Real-time Transport Protocol (SRTP) employs AES in a variant of CTR mode to encrypt RTP packets efficiently without block alignment issues.[70] In such scenarios, the stream-like behavior ensures low-overhead processing of continuous data flows, maintaining synchronization only through the initial vector or counter.[70] Despite these advantages, block cipher emulation incurs overhead from full-block operations, making it less efficient in software compared to native stream ciphers like ChaCha20, which achieves higher throughput on general-purpose processors without hardware acceleration.[71] This performance gap is particularly evident in resource-constrained environments, where ChaCha20's ARX-based design avoids the substitution-permutation complexities of block ciphers, reducing implementation time and side-channel vulnerabilities.[71] Over time, there has been a shift toward native authenticated encryption with associated data (AEAD) stream ciphers, exemplified by ChaCha20 combined with Poly1305, which provides both confidentiality and integrity in a single primitive suitable for protocols like TLS and IPsec, addressing the limitations of unauthenticated block emulations.[72] This evolution, formalized in RFC 7539, prioritizes software efficiency and nonce-based security for high-speed networks, marking a departure from traditional block-based streams in favor of dedicated designs.[72]Disk Encryption Modes
Disk encryption modes are specialized block cipher constructions designed for protecting data at rest on storage devices, such as hard drives or solid-state drives, where random access to sectors is essential and performance overhead must be minimized. These modes address unique challenges in storage environments, including the need to encrypt fixed-size sectors (typically 512 bytes or 4 KB) without requiring initialization vectors per block, while supporting partial overwrites and maintaining confidentiality against attacks like copy-paste manipulation. Unlike transmission-oriented modes, they incorporate tweaks derived from sector addresses to ensure position-dependent encryption, preventing identical plaintext blocks in different locations from producing the same ciphertext.[73] The predominant mode in this domain is XTS-AES, standardized in IEEE Std 1619-2007 and revised in subsequent standards, including IEEE Std 1619-2025, and approved by NIST in Special Publication 800-38E for confidentiality on block-oriented storage devices.[74][75][73] XTS-AES, an instantiation of the XEX (XOR-encrypt-XOR) tweakable block cipher with ciphertext stealing, uses two AES keys: one for data encryption (K1) and one for generating tweaks (K2). For a sector identified by tweak T (a 128-bit representation of the sector number), each 128-bit block j within the sector is processed as follows:- Compute the sector tweak: is a primitive element in GF(2^{128}), and the block tweak is , where denotes multiplication in GF(2^{128}).
- Encrypt the block: .