Upgrade to OpenSSL 0.9.8h.
[dragonfly.git] / secure / lib / libcrypto / man / des_modes.7
CommitLineData
aac4ff6f 1.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
984263bc
MD
2.\"
3.\" Standard preamble:
a561f9ff 4.\" ========================================================================
984263bc
MD
5.de Sh \" Subsection heading
6.br
7.if t .Sp
8.ne 5
9.PP
10\fB\\$1\fR
11.PP
12..
13.de Sp \" Vertical space (when we can't use .PP)
14.if t .sp .5v
15.if n .sp
16..
984263bc
MD
17.de Vb \" Begin verbatim text
18.ft CW
19.nf
20.ne \\$1
21..
22.de Ve \" End verbatim text
23.ft R
984263bc
MD
24.fi
25..
26.\" Set up some character translations and predefined strings. \*(-- will
27.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
aac4ff6f
PA
28.\" double quote, and \*(R" will give a right double quote. | will give a
29.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
30.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
31.\" expand to `' in nroff, nothing in troff, for use with C<>.
32.tr \(*W-|\(bv\*(Tr
984263bc
MD
33.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
34.ie n \{\
35. ds -- \(*W-
36. ds PI pi
37. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
38. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
39. ds L" ""
40. ds R" ""
41. ds C` ""
42. ds C' ""
43'br\}
44.el\{\
45. ds -- \|\(em\|
46. ds PI \(*p
47. ds L" ``
48. ds R" ''
49'br\}
50.\"
a561f9ff
SS
51.\" If the F register is turned on, we'll generate index entries on stderr for
52.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
53.\" entries marked with X<> in POD. Of course, you'll have to process the
54.\" output yourself in some meaningful fashion.
984263bc
MD
55.if \nF \{\
56. de IX
57. tm Index:\\$1\t\\n%\t"\\$2"
58..
59. nr % 0
60. rr F
61.\}
62.\"
aac4ff6f
PA
63.\" For nroff, turn off justification. Always turn off hyphenation; it makes
64.\" way too many mistakes in technical documents.
65.hy 0
66.if n .na
67.\"
984263bc
MD
68.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
69.\" Fear. Run. Save yourself. No user-serviceable parts.
984263bc
MD
70. \" fudge factors for nroff and troff
71.if n \{\
72. ds #H 0
73. ds #V .8m
74. ds #F .3m
75. ds #[ \f1
76. ds #] \fP
77.\}
78.if t \{\
79. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
80. ds #V .6m
81. ds #F 0
82. ds #[ \&
83. ds #] \&
84.\}
85. \" simple accents for nroff and troff
86.if n \{\
87. ds ' \&
88. ds ` \&
89. ds ^ \&
90. ds , \&
91. ds ~ ~
92. ds /
93.\}
94.if t \{\
95. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
96. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
97. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
98. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
99. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
100. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
101.\}
102. \" troff and (daisy-wheel) nroff accents
103.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
104.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
105.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
106.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
107.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
108.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
109.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
110.ds ae a\h'-(\w'a'u*4/10)'e
111.ds Ae A\h'-(\w'A'u*4/10)'E
112. \" corrections for vroff
113.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
114.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
115. \" for low resolution devices (crt and lpr)
116.if \n(.H>23 .if \n(.V>19 \
117\{\
118. ds : e
119. ds 8 ss
120. ds o a
121. ds d- d\h'-1'\(ga
122. ds D- D\h'-1'\(hy
123. ds th \o'bp'
124. ds Th \o'LP'
125. ds ae ae
126. ds Ae AE
127.\}
128.rm #[ #] #H #V #F C
a561f9ff 129.\" ========================================================================
984263bc 130.\"
a561f9ff 131.IX Title "DES_MODES 7"
aac4ff6f 132.TH DES_MODES 7 "2008-09-06" "0.9.8h" "OpenSSL"
984263bc 133.SH "NAME"
2c0715f4 134des_modes \- the variants of DES and other crypto algorithms of OpenSSL
984263bc
MD
135.SH "DESCRIPTION"
136.IX Header "DESCRIPTION"
137Several crypto algorithms for OpenSSL can be used in a number of modes. Those
138are used for using block ciphers in a way similar to stream ciphers, among
139other things.
140.SH "OVERVIEW"
141.IX Header "OVERVIEW"
142.Sh "Electronic Codebook Mode (\s-1ECB\s0)"
143.IX Subsection "Electronic Codebook Mode (ECB)"
144Normally, this is found as the function \fIalgorithm\fR\fI_ecb_encrypt()\fR.
a561f9ff 145.IP "\(bu" 2
984263bc 14664 bits are enciphered at a time.
a561f9ff 147.IP "\(bu" 2
984263bc 148The order of the blocks can be rearranged without detection.
a561f9ff 149.IP "\(bu" 2
984263bc
MD
150The same plaintext block always produces the same ciphertext block
151(for the same key) making it vulnerable to a 'dictionary attack'.
a561f9ff 152.IP "\(bu" 2
984263bc
MD
153An error will only affect one ciphertext block.
154.Sh "Cipher Block Chaining Mode (\s-1CBC\s0)"
155.IX Subsection "Cipher Block Chaining Mode (CBC)"
156Normally, this is found as the function \fIalgorithm\fR\fI_cbc_encrypt()\fR.
157Be aware that \fIdes_cbc_encrypt()\fR is not really \s-1DES\s0 \s-1CBC\s0 (it does
158not update the \s-1IV\s0); use \fIdes_ncbc_encrypt()\fR instead.
a561f9ff 159.IP "\(bu" 2
984263bc 160a multiple of 64 bits are enciphered at a time.
a561f9ff 161.IP "\(bu" 2
984263bc
MD
162The \s-1CBC\s0 mode produces the same ciphertext whenever the same
163plaintext is encrypted using the same key and starting variable.
a561f9ff 164.IP "\(bu" 2
984263bc
MD
165The chaining operation makes the ciphertext blocks dependent on the
166current and all preceding plaintext blocks and therefore blocks can not
167be rearranged.
a561f9ff 168.IP "\(bu" 2
984263bc
MD
169The use of different starting variables prevents the same plaintext
170enciphering to the same ciphertext.
a561f9ff 171.IP "\(bu" 2
984263bc
MD
172An error will affect the current and the following ciphertext blocks.
173.Sh "Cipher Feedback Mode (\s-1CFB\s0)"
174.IX Subsection "Cipher Feedback Mode (CFB)"
175Normally, this is found as the function \fIalgorithm\fR\fI_cfb_encrypt()\fR.
a561f9ff 176.IP "\(bu" 2
984263bc 177a number of bits (j) <= 64 are enciphered at a time.
a561f9ff 178.IP "\(bu" 2
984263bc
MD
179The \s-1CFB\s0 mode produces the same ciphertext whenever the same
180plaintext is encrypted using the same key and starting variable.
a561f9ff 181.IP "\(bu" 2
984263bc 182The chaining operation makes the ciphertext variables dependent on the
a561f9ff 183current and all preceding variables and therefore j\-bit variables are
984263bc 184chained together and can not be rearranged.
a561f9ff 185.IP "\(bu" 2
984263bc
MD
186The use of different starting variables prevents the same plaintext
187enciphering to the same ciphertext.
a561f9ff 188.IP "\(bu" 2
984263bc
MD
189The strength of the \s-1CFB\s0 mode depends on the size of k (maximal if
190j == k). In my implementation this is always the case.
a561f9ff 191.IP "\(bu" 2
984263bc
MD
192Selection of a small value for j will require more cycles through
193the encipherment algorithm per unit of plaintext and thus cause
194greater processing overheads.
a561f9ff 195.IP "\(bu" 2
984263bc 196Only multiples of j bits can be enciphered.
a561f9ff 197.IP "\(bu" 2
984263bc
MD
198An error will affect the current and the following ciphertext variables.
199.Sh "Output Feedback Mode (\s-1OFB\s0)"
200.IX Subsection "Output Feedback Mode (OFB)"
201Normally, this is found as the function \fIalgorithm\fR\fI_ofb_encrypt()\fR.
a561f9ff 202.IP "\(bu" 2
984263bc 203a number of bits (j) <= 64 are enciphered at a time.
a561f9ff 204.IP "\(bu" 2
984263bc
MD
205The \s-1OFB\s0 mode produces the same ciphertext whenever the same
206plaintext enciphered using the same key and starting variable. More
207over, in the \s-1OFB\s0 mode the same key stream is produced when the same
208key and start variable are used. Consequently, for security reasons
209a specific start variable should be used only once for a given key.
a561f9ff 210.IP "\(bu" 2
984263bc 211The absence of chaining makes the \s-1OFB\s0 more vulnerable to specific attacks.
a561f9ff 212.IP "\(bu" 2
984263bc
MD
213The use of different start variables values prevents the same
214plaintext enciphering to the same ciphertext, by producing different
215key streams.
a561f9ff 216.IP "\(bu" 2
984263bc
MD
217Selection of a small value for j will require more cycles through
218the encipherment algorithm per unit of plaintext and thus cause
219greater processing overheads.
a561f9ff 220.IP "\(bu" 2
984263bc 221Only multiples of j bits can be enciphered.
a561f9ff 222.IP "\(bu" 2
984263bc
MD
223\&\s-1OFB\s0 mode of operation does not extend ciphertext errors in the
224resultant plaintext output. Every bit error in the ciphertext causes
225only one bit to be in error in the deciphered plaintext.
a561f9ff 226.IP "\(bu" 2
aac4ff6f 227\&\s-1OFB\s0 mode is not self\-synchronizing. If the two operation of
984263bc 228encipherment and decipherment get out of synchronism, the system needs
aac4ff6f 229to be re\-initialized.
a561f9ff 230.IP "\(bu" 2
984263bc
MD
231Each re-initialization should use a value of the start variable
232different from the start variable values used before with the same
233key. The reason for this is that an identical bit stream would be
234produced each time from the same parameters. This would be
235susceptible to a 'known plaintext' attack.
236.Sh "Triple \s-1ECB\s0 Mode"
237.IX Subsection "Triple ECB Mode"
238Normally, this is found as the function \fIalgorithm\fR\fI_ecb3_encrypt()\fR.
a561f9ff 239.IP "\(bu" 2
984263bc 240Encrypt with key1, decrypt with key2 and encrypt with key3 again.
a561f9ff 241.IP "\(bu" 2
984263bc
MD
242As for \s-1ECB\s0 encryption but increases the key length to 168 bits.
243There are theoretic attacks that can be used that make the effective
244key length 112 bits, but this attack also requires 2^56 blocks of
245memory, not very likely, even for the \s-1NSA\s0.
a561f9ff 246.IP "\(bu" 2
984263bc
MD
247If both keys are the same it is equivalent to encrypting once with
248just one key.
a561f9ff 249.IP "\(bu" 2
984263bc
MD
250If the first and last key are the same, the key length is 112 bits.
251There are attacks that could reduce the effective key strength
252to only slightly more than 56 bits, but these require a lot of memory.
a561f9ff 253.IP "\(bu" 2
984263bc
MD
254If all 3 keys are the same, this is effectively the same as normal
255ecb mode.
256.Sh "Triple \s-1CBC\s0 Mode"
257.IX Subsection "Triple CBC Mode"
258Normally, this is found as the function \fIalgorithm\fR\fI_ede3_cbc_encrypt()\fR.
a561f9ff 259.IP "\(bu" 2
984263bc 260Encrypt with key1, decrypt with key2 and then encrypt with key3.
a561f9ff 261.IP "\(bu" 2
984263bc
MD
262As for \s-1CBC\s0 encryption but increases the key length to 168 bits with
263the same restrictions as for triple ecb mode.
264.SH "NOTES"
265.IX Header "NOTES"
266This text was been written in large parts by Eric Young in his original
267documentation for SSLeay, the predecessor of OpenSSL. In turn, he attributed
268it to:
269.PP
270.Vb 5
271\& AS 2805.5.2
272\& Australian Standard
aac4ff6f
PA
273\& Electronic funds transfer - Requirements for interfaces,
274\& Part 5.2: Modes of operation for an n-bit block cipher algorithm
984263bc
MD
275\& Appendix A
276.Ve
277.SH "SEE ALSO"
278.IX Header "SEE ALSO"
a561f9ff
SS
279\&\fIblowfish\fR\|(3), \fIdes\fR\|(3), \fIidea\fR\|(3),
280\&\fIrc2\fR\|(3)