1DES_MODES(7) OpenSSL DES_MODES(7)
2
3
4
6 Modes of DES - the variants of DES and other crypto algorithms of
7 OpenSSL
8
10 Several crypto algorithms for OpenSSL can be used in a number of modes.
11 Those are used for using block ciphers in a way similar to stream
12 ciphers, among other things.
13
15 Electronic Codebook Mode (ECB)
16
17 Normally, this is found as the function algorithm_ecb_encrypt().
18
19 · 64 bits are enciphered at a time.
20
21 · The order of the blocks can be rearranged without detection.
22
23 · The same plaintext block always produces the same ciphertext block
24 (for the same key) making it vulnerable to a 'dictionary attack'.
25
26 · An error will only affect one ciphertext block.
27
28 Cipher Block Chaining Mode (CBC)
29
30 Normally, this is found as the function algorithm_cbc_encrypt(). Be
31 aware that des_cbc_encrypt() is not really DES CBC (it does not update
32 the IV); use des_ncbc_encrypt() instead.
33
34 · a multiple of 64 bits are enciphered at a time.
35
36 · The CBC mode produces the same ciphertext whenever the same plaintext
37 is encrypted using the same key and starting variable.
38
39 · The chaining operation makes the ciphertext blocks dependent on the
40 current and all preceding plaintext blocks and therefore blocks can
41 not be rearranged.
42
43 · The use of different starting variables prevents the same plaintext
44 enciphering to the same ciphertext.
45
46 · An error will affect the current and the following ciphertext blocks.
47
48 Cipher Feedback Mode (CFB)
49
50 Normally, this is found as the function algorithm_cfb_encrypt().
51
52 · a number of bits (j) <= 64 are enciphered at a time.
53
54 · The CFB mode produces the same ciphertext whenever the same plaintext
55 is encrypted using the same key and starting variable.
56
57 · The chaining operation makes the ciphertext variables dependent on
58 the current and all preceding variables and therefore j-bit variables
59 are chained together and can not be rearranged.
60
61 · The use of different starting variables prevents the same plaintext
62 enciphering to the same ciphertext.
63
64 · The strength of the CFB mode depends on the size of k (maximal if j
65 == k). In my implementation this is always the case.
66
67 · Selection of a small value for j will require more cycles through the
68 encipherment algorithm per unit of plaintext and thus cause greater
69 processing overheads.
70
71 · Only multiples of j bits can be enciphered.
72
73 · An error will affect the current and the following ciphertext vari‐
74 ables.
75
76 Output Feedback Mode (OFB)
77
78 Normally, this is found as the function algorithm_ofb_encrypt().
79
80 · a number of bits (j) <= 64 are enciphered at a time.
81
82 · The OFB mode produces the same ciphertext whenever the same plaintext
83 enciphered using the same key and starting variable. More over, in
84 the OFB mode the same key stream is produced when the same key and
85 start variable are used. Consequently, for security reasons a spe‐
86 cific start variable should be used only once for a given key.
87
88 · The absence of chaining makes the OFB more vulnerable to specific
89 attacks.
90
91 · The use of different start variables values prevents the same plain‐
92 text enciphering to the same ciphertext, by producing different key
93 streams.
94
95 · Selection of a small value for j will require more cycles through the
96 encipherment algorithm per unit of plaintext and thus cause greater
97 processing overheads.
98
99 · Only multiples of j bits can be enciphered.
100
101 · OFB mode of operation does not extend ciphertext errors in the resul‐
102 tant plaintext output. Every bit error in the ciphertext causes only
103 one bit to be in error in the deciphered plaintext.
104
105 · OFB mode is not self-synchronizing. If the two operation of enci‐
106 pherment and decipherment get out of synchronism, the system needs to
107 be re-initialized.
108
109 · Each re-initialization should use a value of the start variable dif‐
110 ferent from the start variable values used before with the same key.
111 The reason for this is that an identical bit stream would be produced
112 each time from the same parameters. This would be susceptible to a
113 'known plaintext' attack.
114
115 Triple ECB Mode
116
117 Normally, this is found as the function algorithm_ecb3_encrypt().
118
119 · Encrypt with key1, decrypt with key2 and encrypt with key3 again.
120
121 · As for ECB encryption but increases the key length to 168 bits.
122 There are theoretic attacks that can be used that make the effective
123 key length 112 bits, but this attack also requires 2^56 blocks of
124 memory, not very likely, even for the NSA.
125
126 · If both keys are the same it is equivalent to encrypting once with
127 just one key.
128
129 · If the first and last key are the same, the key length is 112 bits.
130 There are attacks that could reduce the effective key strength to
131 only slightly more than 56 bits, but these require a lot of memory.
132
133 · If all 3 keys are the same, this is effectively the same as normal
134 ecb mode.
135
136 Triple CBC Mode
137
138 Normally, this is found as the function algorithm_ede3_cbc_encrypt().
139
140 · Encrypt with key1, decrypt with key2 and then encrypt with key3.
141
142 · As for CBC encryption but increases the key length to 168 bits with
143 the same restrictions as for triple ecb mode.
144
146 This text was been written in large parts by Eric Young in his original
147 documentation for SSLeay, the predecessor of OpenSSL. In turn, he at‐
148 tributed it to:
149
150 AS 2805.5.2
151 Australian Standard
152 Electronic funds transfer - Requirements for interfaces,
153 Part 5.2: Modes of operation for an n-bit block cipher algorithm
154 Appendix A
155
157 blowfish(3), des(3), idea(3), rc2(3)
158
159
160
1610.9.8b 2004-11-25 DES_MODES(7)