Remove some references which called malloc and free instead of Malloc and Free.
[openssl.git] / crypto / des / MODES.DES
1 Modes of DES
2 Quite a bit of the following information has been taken from
3         AS 2805.5.2
4         Australian Standard
5         Electronic funds transfer - Requirements for interfaces,
6         Part 5.2: Modes of operation for an n-bit block cipher algorithm
7         Appendix A
8
9 There are several different modes in which DES can be used, they are
10 as follows.
11
12 Electronic Codebook Mode (ECB) (des_ecb_encrypt())
13 - 64 bits are enciphered at a time.
14 - The order of the blocks can be rearranged without detection.
15 - The same plaintext block always produces the same ciphertext block
16   (for the same key) making it vulnerable to a 'dictionary attack'.
17 - An error will only affect one ciphertext block.
18
19 Cipher Block Chaining Mode (CBC) (des_cbc_encrypt())
20 - a multiple of 64 bits are enciphered at a time.
21 - The CBC mode produces the same ciphertext whenever the same
22   plaintext is encrypted using the same key and starting variable.
23 - The chaining operation makes the ciphertext blocks dependent on the
24   current and all preceding plaintext blocks and therefore blocks can not
25   be rearranged.
26 - The use of different starting variables prevents the same plaintext
27   enciphering to the same ciphertext.
28 - An error will affect the current and the following ciphertext blocks.
29
30 Cipher Feedback Mode (CFB) (des_cfb_encrypt())
31 - a number of bits (j) <= 64 are enciphered at a time.
32 - The CFB mode produces the same ciphertext whenever the same
33   plaintext is encrypted using the same key and starting variable.
34 - The chaining operation makes the ciphertext variables dependent on the
35   current and all preceding variables and therefore j-bit variables are
36   chained together and con not be rearranged.
37 - The use of different starting variables prevents the same plaintext
38   enciphering to the same ciphertext.
39 - The strength of the CFB mode depends on the size of k (maximal if
40   j == k).  In my implementation this is always the case.
41 - Selection of a small value for j will require more cycles through
42   the encipherment algorithm per unit of plaintext and thus cause
43   greater processing overheads.
44 - Only multiples of j bits can be enciphered.
45 - An error will affect the current and the following ciphertext variables.
46
47 Output Feedback Mode (OFB) (des_ofb_encrypt())
48 - a number of bits (j) <= 64 are enciphered at a time.
49 - The OFB mode produces the same ciphertext whenever the same
50   plaintext enciphered using the same key and starting variable.  More
51   over, in the OFB mode the same key stream is produced when the same
52   key and start variable are used.  Consequently, for security reasons
53   a specific start variable should be used only once for a given key.
54 - The absence of chaining makes the OFB more vulnerable to specific attacks.
55 - The use of different start variables values prevents the same
56   plaintext enciphering to the same ciphertext, by producing different
57   key streams.
58 - Selection of a small value for j will require more cycles through
59   the encipherment algorithm per unit of plaintext and thus cause
60   greater processing overheads.
61 - Only multiples of j bits can be enciphered.
62 - OFB mode of operation does not extend ciphertext errors in the
63   resultant plaintext output.  Every bit error in the ciphertext causes
64   only one bit to be in error in the deciphered plaintext.
65 - OFB mode is not self-synchronising.  If the two operation of
66   encipherment and decipherment get out of synchronism, the system needs
67   to be re-initialised.
68 - Each re-initialisation should use a value of the start variable
69 different from the start variable values used before with the same
70 key.  The reason for this is that an identical bit stream would be
71 produced each time from the same parameters.  This would be
72 susceptible to a 'known plaintext' attack.
73
74 Triple ECB Mode (des_ecb3_encrypt())
75 - Encrypt with key1, decrypt with key2 and encrypt with key1 again.
76 - As for ECB encryption but increases the effective key length to 112 bits.
77 - If both keys are the same it is equivalent to encrypting once with
78   just one key.
79
80 Triple CBC Mode (des_3cbc_encrypt())
81 - Encrypt with key1, decrypt with key2 and encrypt with key1 again.
82 - As for CBC encryption but increases the effective key length to 112 bits.
83 - If both keys are the same it is equivalent to encrypting once with
84   just one key.