1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
|
.\" $OpenBSD: EVP_aes_128_cbc.3,v 1.4 2020/06/24 18:15:00 jmc Exp $
.\" selective merge up to: OpenSSL 7c6d372a Nov 20 13:20:01 2018 +0000
.\"
.\" This file was written by Ronald Tse <ronald.tse@ribose.com>
.\" Copyright (c) 2017 The OpenSSL Project. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\"
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\"
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\"
.\" 3. All advertising materials mentioning features or use of this
.\" software must display the following acknowledgment:
.\" "This product includes software developed by the OpenSSL Project
.\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
.\"
.\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
.\" endorse or promote products derived from this software without
.\" prior written permission. For written permission, please contact
.\" openssl-core@openssl.org.
.\"
.\" 5. Products derived from this software may not be called "OpenSSL"
.\" nor may "OpenSSL" appear in their names without prior written
.\" permission of the OpenSSL Project.
.\"
.\" 6. Redistributions of any form whatsoever must retain the following
.\" acknowledgment:
.\" "This product includes software developed by the OpenSSL Project
.\" for use in the OpenSSL Toolkit (http://www.openssl.org/)"
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
.\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
.\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: June 24 2020 $
.Dt EVP_AES_128_CBC 3
.Os
.Sh NAME
.Nm EVP_aes_128_cbc ,
.Nm EVP_aes_192_cbc ,
.Nm EVP_aes_256_cbc ,
.Nm EVP_aes_128_cfb1 ,
.Nm EVP_aes_192_cfb1 ,
.Nm EVP_aes_256_cfb1 ,
.Nm EVP_aes_128_cfb8 ,
.Nm EVP_aes_192_cfb8 ,
.Nm EVP_aes_256_cfb8 ,
.Nm EVP_aes_128_cfb128 ,
.Nm EVP_aes_192_cfb128 ,
.Nm EVP_aes_256_cfb128 ,
.Nm EVP_aes_128_cfb ,
.Nm EVP_aes_192_cfb ,
.Nm EVP_aes_256_cfb ,
.Nm EVP_aes_128_ctr ,
.Nm EVP_aes_192_ctr ,
.Nm EVP_aes_256_ctr ,
.Nm EVP_aes_128_ecb ,
.Nm EVP_aes_192_ecb ,
.Nm EVP_aes_256_ecb ,
.Nm EVP_aes_128_ofb ,
.Nm EVP_aes_192_ofb ,
.Nm EVP_aes_256_ofb ,
.Nm EVP_aes_128_cbc_hmac_sha1 ,
.Nm EVP_aes_256_cbc_hmac_sha1 ,
.Nm EVP_aes_128_ccm ,
.Nm EVP_aes_192_ccm ,
.Nm EVP_aes_256_ccm ,
.Nm EVP_aes_128_gcm ,
.Nm EVP_aes_192_gcm ,
.Nm EVP_aes_256_gcm ,
.Nm EVP_aes_128_wrap ,
.Nm EVP_aes_192_wrap ,
.Nm EVP_aes_256_wrap ,
.Nm EVP_aes_128_xts ,
.Nm EVP_aes_256_xts
.Nd EVP AES cipher
.Sh SYNOPSIS
.In openssl/evp.h
.Ft const EVP_CIPHER *
.Fn EVP_aes_128_cbc void
.Ft const EVP_CIPHER *
.Fn EVP_aes_192_cbc void
.Ft const EVP_CIPHER *
.Fn EVP_aes_256_cbc void
.Ft const EVP_CIPHER *
.Fn EVP_aes_128_cfb1 void
.Ft const EVP_CIPHER *
.Fn EVP_aes_192_cfb1 void
.Ft const EVP_CIPHER *
.Fn EVP_aes_256_cfb1 void
.Ft const EVP_CIPHER *
.Fn EVP_aes_128_cfb8 void
.Ft const EVP_CIPHER *
.Fn EVP_aes_192_cfb8 void
.Ft const EVP_CIPHER *
.Fn EVP_aes_256_cfb8 void
.Ft const EVP_CIPHER *
.Fn EVP_aes_128_cfb128 void
.Ft const EVP_CIPHER *
.Fn EVP_aes_192_cfb128 void
.Ft const EVP_CIPHER *
.Fn EVP_aes_256_cfb128 void
.Ft const EVP_CIPHER *
.Fn EVP_aes_128_cfb void
.Ft const EVP_CIPHER *
.Fn EVP_aes_192_cfb void
.Ft const EVP_CIPHER *
.Fn EVP_aes_256_cfb void
.Ft const EVP_CIPHER *
.Fn EVP_aes_128_ctr void
.Ft const EVP_CIPHER *
.Fn EVP_aes_192_ctr void
.Ft const EVP_CIPHER *
.Fn EVP_aes_256_ctr void
.Ft const EVP_CIPHER *
.Fn EVP_aes_128_ecb void
.Ft const EVP_CIPHER *
.Fn EVP_aes_192_ecb void
.Ft const EVP_CIPHER *
.Fn EVP_aes_256_ecb void
.Ft const EVP_CIPHER *
.Fn EVP_aes_128_ofb void
.Ft const EVP_CIPHER *
.Fn EVP_aes_192_ofb void
.Ft const EVP_CIPHER *
.Fn EVP_aes_256_ofb void
.Ft const EVP_CIPHER *
.Fn EVP_aes_128_cbc_hmac_sha1 void
.Ft const EVP_CIPHER *
.Fn EVP_aes_256_cbc_hmac_sha1 void
.Ft const EVP_CIPHER *
.Fn EVP_aes_128_ccm void
.Ft const EVP_CIPHER *
.Fn EVP_aes_192_ccm void
.Ft const EVP_CIPHER *
.Fn EVP_aes_256_ccm void
.Ft const EVP_CIPHER *
.Fn EVP_aes_128_gcm void
.Ft const EVP_CIPHER *
.Fn EVP_aes_192_gcm void
.Ft const EVP_CIPHER *
.Fn EVP_aes_256_gcm void
.Ft const EVP_CIPHER *
.Fn EVP_aes_128_wrap void
.Ft const EVP_CIPHER *
.Fn EVP_aes_192_wrap void
.Ft const EVP_CIPHER *
.Fn EVP_aes_256_wrap void
.Ft const EVP_CIPHER *
.Fn EVP_aes_128_xts void
.Ft const EVP_CIPHER *
.Fn EVP_aes_256_xts void
.Sh DESCRIPTION
These functions provide the AES encryption algorithm in the
.Xr evp 3
framework.
.Pp
.Fn EVP_aes_128_cbc ,
.Fn EVP_aes_192_cbc ,
.Fn EVP_aes_256_cbc ,
.Fn EVP_aes_128_cfb1 ,
.Fn EVP_aes_192_cfb1 ,
.Fn EVP_aes_256_cfb1 ,
.Fn EVP_aes_128_cfb8 ,
.Fn EVP_aes_192_cfb8 ,
.Fn EVP_aes_256_cfb8 ,
.Fn EVP_aes_128_cfb128 ,
.Fn EVP_aes_192_cfb128 ,
.Fn EVP_aes_256_cfb128 ,
.Fn EVP_aes_128_ctr ,
.Fn EVP_aes_192_ctr ,
.Fn EVP_aes_256_ctr ,
.Fn EVP_aes_128_ecb ,
.Fn EVP_aes_192_ecb ,
.Fn EVP_aes_256_ecb ,
.Fn EVP_aes_128_ofb ,
.Fn EVP_aes_192_ofb ,
and
.Fn EVP_aes_256_ofb
provide AES for 128, 192, and 256-bit keys in the following modes:
CBC, CFB with 1-bit shift, CFB with 8-bit shift, CFB with 128-bit shift,
CTR, ECB, and OFB.
.Pp
.Fn EVP_aes_128_cfb ,
.Fn EVP_aes_192_cfb ,
and
.Fn EVP_aes_256_cfb
are aliases for
.Fn EVP_aes_128_cfb128 ,
.Fn EVP_aes_192_cfb128 ,
and
.Fn EVP_aes_256_cfb128 .
.Pp
.Fn EVP_aes_128_cbc_hmac_sha1
and
.Fn EVP_aes_256_cbc_hmac_sha1
provide authenticated encryption with AES in CBC mode using SHA-1 as HMAC,
with keys of 128 and 256-bit length respectively.
The authentication tag is 160 bits long.
This is not intended for usage outside of TLS and requires
calling of some undocumented control functions.
These ciphers do not conform to the EVP AEAD interface.
.Pp
.Fn EVP_aes_128_ccm ,
.Fn EVP_aes_192_ccm ,
.Fn EVP_aes_256_ccm ,
.Fn EVP_aes_128_gcm ,
.Fn EVP_aes_192_gcm ,
and
.Fn EVP_aes_256_gcm
provide AES for 128, 192 and 256-bit keys in CBC-MAC Mode (CCM)
and Galois Counter Mode (GCM), respectively.
These ciphers require additional control operations to function
correctly; see
.Xr EVP_EncryptInit 3
for details.
.Pp
.Fn EVP_aes_128_wrap ,
.Fn EVP_aes_192_wrap ,
and
.Fn EVP_aes_256_wrap
provide AES key wrap with 128, 192 and 256-bit keys
according to RFC 3394 section 2.2.1 ("wrap").
When the returned
.Vt EVP_CIPHER
object is later passed to
.Xr EVP_CipherInit_ex 3 ,
.Xr EVP_EncryptInit_ex 3 ,
or
.Xr EVP_DecryptInit_ex 3
together with an
.Vt EVP_CIPHER_CTX
object, the flag
.Dv EVP_CIPHER_CTX_FLAG_WRAP_ALLOW
must have been set in the
.Vt EVP_CIPHER_CTX
using
.Xr EVP_CIPHER_CTX_set_flags 3 .
Otherwise, or when passing the returned
.Vt EVP_CIPHER
object to
.Xr EVP_CipherInit 3 ,
.Xr EVP_EncryptInit 3 ,
or
.Xr EVP_DecryptInit 3 ,
initialization fails with a
.Dq wrap not allowed
error.
.Pp
.Fn EVP_aes_128_xts
and
.Fn EVP_aes_256_xts
provide XEX-based tweaked-codebook mode with ciphertext stealing (XTS-AES)
as specified in IEEE Std. 1619-2007 and described in NIST SP 800-38E.
It was designed for encrypting data on a storage device,
provides confidentiality but not authentication of data,
and requires a key of double length for protection of a certain key size.
In particular, XTS-AES-128 takes input of a 256-bit key to achieve
AES 128-bit security, and XTS-AES-256 takes input of a 512-bit key
to achieve AES 256-bit security.
.Sh RETURN VALUES
These functions return an
.Vt EVP_CIPHER
structure that provides the implementation of the symmetric cipher.
.Sh SEE ALSO
.Xr AES_encrypt 3 ,
.Xr evp 3 ,
.Xr EVP_EncryptInit 3
.Sh HISTORY
.Fn EVP_aes_128_cbc ,
.Fn EVP_aes_192_cbc ,
.Fn EVP_aes_256_cbc ,
.Fn EVP_aes_128_cfb ,
.Fn EVP_aes_192_cfb ,
.Fn EVP_aes_256_cfb ,
.Fn EVP_aes_128_ebc ,
.Fn EVP_aes_192_ebc ,
.Fn EVP_aes_256_ebc ,
.Fn EVP_aes_128_ofb ,
.Fn EVP_aes_192_ofb ,
and
.Fn EVP_aes_256_ofb
first appeared in OpenSSL 0.9.7 and have been available since
.Ox 3.2 .
.Pp
.Fn EVP_aes_128_cfb1 ,
.Fn EVP_aes_192_cfb1 ,
.Fn EVP_aes_256_cfb1 ,
.Fn EVP_aes_128_cfb8 ,
.Fn EVP_aes_192_cfb8 ,
.Fn EVP_aes_256_cfb8 ,
.Fn EVP_aes_128_cfb128 ,
.Fn EVP_aes_192_cfb128 ,
and
.Fn EVP_aes_256_cfb128
first appeared in OpenSSL 0.9.7e and have been available since
.Ox 3.8 .
.Pp
.Fn EVP_aes_128_ctr ,
.Fn EVP_aes_192_ctr ,
.Fn EVP_aes_256_ctr ,
.Fn EVP_aes_128_cbc_hmac_sha1 ,
.Fn EVP_aes_256_cbc_hmac_sha1 ,
.Fn EVP_aes_128_ccm ,
.Fn EVP_aes_192_ccm ,
.Fn EVP_aes_256_ccm ,
.Fn EVP_aes_128_gcm ,
.Fn EVP_aes_192_gcm ,
.Fn EVP_aes_256_gcm ,
.Fn EVP_aes_128_xts ,
and
.Fn EVP_aes_256_xts
first appeared in OpenSSL 1.0.1 and have been available since
.Ox 5.3 .
.Pp
.Fn EVP_aes_128_wrap ,
.Fn EVP_aes_192_wrap ,
and
.Fn EVP_aes_256_wrap
first appeared in OpenSSL 1.0.2 and have been available since
.Ox 6.5 .
|