diff options
author | schwarze <> | 2019-08-28 10:37:42 +0000 |
---|---|---|
committer | schwarze <> | 2019-08-28 10:37:42 +0000 |
commit | 120d402beaf52528e5248e97a9a00011925570c9 (patch) | |
tree | cce87ea0ddb5bdaf5728bb00b7a12391053371d9 /src/lib/libcrypto/man/AES_encrypt.3 | |
parent | 84aca1c942ade2d6b8dc6b717cb696bcf94b8407 (diff) | |
download | openbsd-120d402beaf52528e5248e97a9a00011925570c9.tar.gz openbsd-120d402beaf52528e5248e97a9a00011925570c9.tar.bz2 openbsd-120d402beaf52528e5248e97a9a00011925570c9.zip |
new manual page AES_encrypt(3)
Diffstat (limited to 'src/lib/libcrypto/man/AES_encrypt.3')
-rw-r--r-- | src/lib/libcrypto/man/AES_encrypt.3 | 173 |
1 files changed, 173 insertions, 0 deletions
diff --git a/src/lib/libcrypto/man/AES_encrypt.3 b/src/lib/libcrypto/man/AES_encrypt.3 new file mode 100644 index 0000000000..f022848a61 --- /dev/null +++ b/src/lib/libcrypto/man/AES_encrypt.3 | |||
@@ -0,0 +1,173 @@ | |||
1 | .\" $OpenBSD: AES_encrypt.3,v 1.1 2019/08/28 10:37:42 schwarze Exp $ | ||
2 | .\" | ||
3 | .\" Copyright (c) 2019 Ingo Schwarze <schwarze@openbsd.org> | ||
4 | .\" | ||
5 | .\" Permission to use, copy, modify, and distribute this software for any | ||
6 | .\" purpose with or without fee is hereby granted, provided that the above | ||
7 | .\" copyright notice and this permission notice appear in all copies. | ||
8 | .\" | ||
9 | .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
10 | .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
11 | .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
12 | .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
13 | .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
16 | .\" | ||
17 | .Dd $Mdocdate: August 28 2019 $ | ||
18 | .Dt AES_ENCRYPT 3 | ||
19 | .Os | ||
20 | .Sh NAME | ||
21 | .Nm AES_set_encrypt_key , | ||
22 | .Nm AES_set_decrypt_key , | ||
23 | .Nm AES_encrypt , | ||
24 | .Nm AES_decrypt , | ||
25 | .Nm AES_cbc_encrypt | ||
26 | .Nd low-level interface to the AES symmetric cipher | ||
27 | .Sh SYNOPSIS | ||
28 | .In openssl/aes.h | ||
29 | .Ft int | ||
30 | .Fo AES_set_encrypt_key | ||
31 | .Fa "const unsigned char *userKey" | ||
32 | .Fa "const int bits" | ||
33 | .Fa "AES_KEY *key" | ||
34 | .Fc | ||
35 | .Ft int | ||
36 | .Fo AES_set_decrypt_key | ||
37 | .Fa "const unsigned char *userKey" | ||
38 | .Fa "const int bits" | ||
39 | .Fa "AES_KEY *key" | ||
40 | .Fc | ||
41 | .Ft void | ||
42 | .Fo AES_encrypt | ||
43 | .Fa "const unsigned char *in" | ||
44 | .Fa "unsigned char *out" | ||
45 | .Fa "const AES_KEY *key" | ||
46 | .Fc | ||
47 | .Ft void | ||
48 | .Fo AES_decrypt | ||
49 | .Fa "const unsigned char *in" | ||
50 | .Fa "unsigned char *out" | ||
51 | .Fa "const AES_KEY *key" | ||
52 | .Fc | ||
53 | .Ft void | ||
54 | .Fo AES_cbc_encrypt | ||
55 | .Fa "const unsigned char *in" | ||
56 | .Fa "unsigned char *out" | ||
57 | .Fa "size_t length" | ||
58 | .Fa "const AES_KEY *key" | ||
59 | .Fa "unsigned char *ivec" | ||
60 | .Fa "const int enc" | ||
61 | .Fc | ||
62 | .Sh DESCRIPTION | ||
63 | These function provide a low-level interface to the AES symmetric | ||
64 | cipher algorithm, also called Rijndael. | ||
65 | For reasons of flexibility, it is recommended that application | ||
66 | programs use the high-level interface described in | ||
67 | .Xr EVP_EncryptInit 3 | ||
68 | and | ||
69 | .Xr EVP_aes_128_cbc 3 | ||
70 | instead whenever possible. | ||
71 | .Pp | ||
72 | .Vt AES_KEY | ||
73 | is a structure that can hold up to 60 | ||
74 | .Vt int | ||
75 | values and a number of rounds. | ||
76 | .Pp | ||
77 | .Fn AES_set_encrypt_key | ||
78 | expands the | ||
79 | .Fa userKey , | ||
80 | which is | ||
81 | .Fa bits | ||
82 | long, into the | ||
83 | .Fa key | ||
84 | structure to prepare for encryption. | ||
85 | The number of bits and bytes read from | ||
86 | .Fa userKey , | ||
87 | the number of | ||
88 | .Vt int | ||
89 | values stored into | ||
90 | .Fa key , | ||
91 | and the number of rounds are as follows: | ||
92 | .Pp | ||
93 | .Bl -column bits bytes ints rounds -offset indent -compact | ||
94 | .It bits Ta bytes Ta ints Ta rounds | ||
95 | .It 128 Ta 16 Ta 44 Ta 10 | ||
96 | .It 192 Ta 24 Ta 52 Ta 12 | ||
97 | .It 256 Ta 32 Ta 60 Ta 14 | ||
98 | .El | ||
99 | .Pp | ||
100 | .Fn AES_set_decrypt_key | ||
101 | does the same, but in preparation for decryption. | ||
102 | .Pp | ||
103 | .Fn AES_encrypt | ||
104 | reads a single 16 byte block from | ||
105 | .Pf * Fa in , | ||
106 | encrypts it with the | ||
107 | .Fa key , | ||
108 | and writes the 16 resulting bytes to | ||
109 | .Pf * Fa out . | ||
110 | The 16 byte buffers starting at | ||
111 | .Fa in | ||
112 | and | ||
113 | .Fa out | ||
114 | can overlap, and | ||
115 | .Fa in | ||
116 | and | ||
117 | .Fa out | ||
118 | can even point to the same memory location. | ||
119 | .Pp | ||
120 | .Fn AES_decrypt | ||
121 | decrypts a single block and is otherwise identical to | ||
122 | .Fn AES_encrypt . | ||
123 | .Pp | ||
124 | If | ||
125 | .Fa enc | ||
126 | is non-zero, | ||
127 | .Fn AES_cbc_encrypt | ||
128 | encrypts | ||
129 | .Fa len | ||
130 | bytes at | ||
131 | .Fa in | ||
132 | to | ||
133 | .Fa out | ||
134 | using the 128 bit | ||
135 | .Fa key | ||
136 | and the 128 bit | ||
137 | initialization vector | ||
138 | .Fa ivec | ||
139 | in CBC mode. | ||
140 | If | ||
141 | .Fa enc | ||
142 | is 0, | ||
143 | .Fn AES_cbc_encrypt | ||
144 | performs the corresponding decryption. | ||
145 | .Sh RETURN VALUES | ||
146 | .Fn AES_set_encrypt_key | ||
147 | and | ||
148 | .Fn AES_set_decrypt_key | ||
149 | return 0 for success, -1 if | ||
150 | .Fa userKey | ||
151 | or | ||
152 | .Fa key | ||
153 | is | ||
154 | .Dv NULL , | ||
155 | or -2 if the number of | ||
156 | .Fa bits | ||
157 | is unsupported. | ||
158 | .Sh SEE ALSO | ||
159 | .Xr crypto 3 , | ||
160 | .Xr EVP_aes_128_cbc 3 , | ||
161 | .Xr EVP_EncryptInit 3 | ||
162 | .Sh STANDARDS | ||
163 | ISO/IEC 18033-3:2010 | ||
164 | Information technology \(em Security techniques \(em | ||
165 | Encryption algorithms \(em Part 3: Block ciphers | ||
166 | .Sh HISTORY | ||
167 | These functions first appeared in OpenSSL 0.9.7 | ||
168 | and have been available since | ||
169 | .Ox 3.2 . | ||
170 | .Sh AUTHORS | ||
171 | .An Vincent Rijmen | ||
172 | .An Antoon Bosselaers | ||
173 | .An Paulo Barreto | ||