summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorschwarze <>2024-12-20 01:54:03 +0000
committerschwarze <>2024-12-20 01:54:03 +0000
commit0f29c352ca0efe3c3a1facb4e84a69fb6c5bd49f (patch)
treeec0a01cc8ba2795f04119ef34853baa40299213e /src/lib
parentf7a74f625be911c8fc0cafe6e5e0d4d2add39d8e (diff)
downloadopenbsd-0f29c352ca0efe3c3a1facb4e84a69fb6c5bd49f.tar.gz
openbsd-0f29c352ca0efe3c3a1facb4e84a69fb6c5bd49f.tar.bz2
openbsd-0f29c352ca0efe3c3a1facb4e84a69fb6c5bd49f.zip
Move the horrific EVP_aes_128_ccm(3) API out of the important,
algorithm-independent EVP_EncryptInit(3) manual as another step in making the latter leaner and more palatable. As a side benefit, the new EVP_aes_128_ccm(3) manual page may provide a better fighting chance to programmers who see themselves forced to support CCM for whatever reason. It documents the mandatory, but so far undocumented EVP_CTRL_CCM_GET_TAG control command and makes the description of the three EVP_CTRL_CCM_SET_* control commands and the numerous related quirks more precise.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libcrypto/man/EVP_EncryptInit.354
-rw-r--r--src/lib/libcrypto/man/EVP_aes_128_cbc.327
-rw-r--r--src/lib/libcrypto/man/EVP_aes_128_ccm.3348
-rw-r--r--src/lib/libcrypto/man/Makefile3
4 files changed, 357 insertions, 75 deletions
diff --git a/src/lib/libcrypto/man/EVP_EncryptInit.3 b/src/lib/libcrypto/man/EVP_EncryptInit.3
index 8f977b7a2a..7765be2ca6 100644
--- a/src/lib/libcrypto/man/EVP_EncryptInit.3
+++ b/src/lib/libcrypto/man/EVP_EncryptInit.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: EVP_EncryptInit.3,v 1.55 2024/12/17 18:11:44 schwarze Exp $ 1.\" $OpenBSD: EVP_EncryptInit.3,v 1.56 2024/12/20 01:54:03 schwarze Exp $
2.\" full merge up to: OpenSSL 5211e094 Nov 11 14:39:11 2014 -0800 2.\" full merge up to: OpenSSL 5211e094 Nov 11 14:39:11 2014 -0800
3.\" EVP_bf_cbc.pod EVP_cast5_cbc.pod EVP_idea_cbc.pod EVP_rc2_cbc.pod 3.\" EVP_bf_cbc.pod EVP_cast5_cbc.pod EVP_idea_cbc.pod EVP_rc2_cbc.pod
4.\" 7c6d372a Nov 20 13:20:01 2018 +0000 4.\" 7c6d372a Nov 20 13:20:01 2018 +0000
@@ -69,7 +69,7 @@
69.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 69.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
70.\" OF THE POSSIBILITY OF SUCH DAMAGE. 70.\" OF THE POSSIBILITY OF SUCH DAMAGE.
71.\" 71.\"
72.Dd $Mdocdate: December 17 2024 $ 72.Dd $Mdocdate: December 20 2024 $
73.Dt EVP_ENCRYPTINIT 3 73.Dt EVP_ENCRYPTINIT 3
74.Os 74.Os
75.Sh NAME 75.Sh NAME
@@ -600,6 +600,7 @@ Some algorithms are documented in separate manual pages:
600.Bl -column "EVP_camellia_128_cbc(3)" "block size" -compact 600.Bl -column "EVP_camellia_128_cbc(3)" "block size" -compact
601.It manual page Ta block size Ta Fa key No size Pq in bits 601.It manual page Ta block size Ta Fa key No size Pq in bits
602.It Xr EVP_aes_128_cbc 3 Ta 128 Ta 128, 192, 256 602.It Xr EVP_aes_128_cbc 3 Ta 128 Ta 128, 192, 256
603.It Xr EVP_aes_128_ccm 3 Ta 128 Ta 128, 192, 256
603.It Xr EVP_aes_128_gcm 3 Ta 128 Ta 128, 192, 256 604.It Xr EVP_aes_128_gcm 3 Ta 128 Ta 128, 192, 256
604.It Xr EVP_camellia_128_cbc 3 Ta 128 Ta 128, 192, 256 605.It Xr EVP_camellia_128_cbc 3 Ta 128 Ta 128, 192, 256
605.It Xr EVP_chacha20 3 Ta stream Ta 256 606.It Xr EVP_chacha20 3 Ta stream Ta 256
@@ -608,54 +609,6 @@ Some algorithms are documented in separate manual pages:
608.It Xr EVP_rc4 3 Ta stream Ta variable, default 128 609.It Xr EVP_rc4 3 Ta stream Ta variable, default 128
609.It Xr EVP_sm4_cbc 3 Ta 128 Ta 128 610.It Xr EVP_sm4_cbc 3 Ta 128 Ta 128
610.El 611.El
611.Ss CCM mode
612The behaviour of CCM mode ciphers is similar to GCM mode, but with
613a few additional requirements and different ctrl values.
614.Pp
615Like GCM mode any additional authenticated data (AAD) is passed
616by calling
617.Fn EVP_CipherUpdate ,
618.Fn EVP_EncryptUpdate ,
619or
620.Fn EVP_DecryptUpdate
621with the output parameter
622.Fa out
623set to
624.Dv NULL .
625Additionally, the total
626plaintext or ciphertext length MUST be passed to
627.Fn EVP_CipherUpdate ,
628.Fn EVP_EncryptUpdate ,
629or
630.Fn EVP_DecryptUpdate
631with the output and input
632parameters
633.Pq Fa in No and Fa out
634set to
635.Dv NULL
636and the length passed in the
637.Fa in_len
638parameter.
639.Pp
640The following ctrls are supported in CCM mode:
641.Bl -tag -width Ds
642.It Fn EVP_CIPHER_CTX_ctrl ctx EVP_CTRL_CCM_SET_TAG taglen tag
643This call is made to set the expected CCM tag value when decrypting or
644the length of the tag (with the
645.Fa tag
646parameter set to
647.Dv NULL )
648when encrypting.
649The tag length is often referred to as M.
650If not set, a default value is used (12 for AES).
651.It Fn EVP_CIPHER_CTX_ctrl ctx EVP_CTRL_CCM_SET_L ivlen NULL
652Sets the CCM L value.
653If not set, a default is used (8 for AES).
654.It Fn EVP_CIPHER_CTX_ctrl ctx EVP_CTRL_CCM_SET_IVLEN ivlen NULL
655Sets the CCM nonce (IV) length: this call can only be made before
656specifying a nonce value.
657The nonce length is given by 15 - L so it is 7 by default for AES.
658.El
659.Sh EXAMPLES 612.Sh EXAMPLES
660Encrypt a string using blowfish: 613Encrypt a string using blowfish:
661.Bd -literal -offset 3n 614.Bd -literal -offset 3n
@@ -770,6 +723,7 @@ do_crypt(FILE *in_fileptr, FILE *out_fileptr, int do_encrypt)
770.Xr evp 3 , 723.Xr evp 3 ,
771.Xr EVP_AEAD_CTX_init 3 , 724.Xr EVP_AEAD_CTX_init 3 ,
772.Xr EVP_aes_128_cbc 3 , 725.Xr EVP_aes_128_cbc 3 ,
726.Xr EVP_aes_128_ccm 3 ,
773.Xr EVP_aes_128_gcm 3 , 727.Xr EVP_aes_128_gcm 3 ,
774.Xr EVP_camellia_128_cbc 3 , 728.Xr EVP_camellia_128_cbc 3 ,
775.Xr EVP_chacha20 3 , 729.Xr EVP_chacha20 3 ,
diff --git a/src/lib/libcrypto/man/EVP_aes_128_cbc.3 b/src/lib/libcrypto/man/EVP_aes_128_cbc.3
index cbb68e1543..46e3ef0bdc 100644
--- a/src/lib/libcrypto/man/EVP_aes_128_cbc.3
+++ b/src/lib/libcrypto/man/EVP_aes_128_cbc.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: EVP_aes_128_cbc.3,v 1.7 2024/12/17 18:11:44 schwarze Exp $ 1.\" $OpenBSD: EVP_aes_128_cbc.3,v 1.8 2024/12/20 01:54:03 schwarze Exp $
2.\" selective merge up to: OpenSSL 7c6d372a Nov 20 13:20:01 2018 +0000 2.\" selective merge up to: OpenSSL 7c6d372a Nov 20 13:20:01 2018 +0000
3.\" 3.\"
4.\" This file was written by Ronald Tse <ronald.tse@ribose.com> 4.\" This file was written by Ronald Tse <ronald.tse@ribose.com>
@@ -48,7 +48,7 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: December 17 2024 $ 51.Dd $Mdocdate: December 20 2024 $
52.Dt EVP_AES_128_CBC 3 52.Dt EVP_AES_128_CBC 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
@@ -78,9 +78,6 @@
78.Nm EVP_aes_256_ofb , 78.Nm EVP_aes_256_ofb ,
79.Nm EVP_aes_128_cbc_hmac_sha1 , 79.Nm EVP_aes_128_cbc_hmac_sha1 ,
80.Nm EVP_aes_256_cbc_hmac_sha1 , 80.Nm EVP_aes_256_cbc_hmac_sha1 ,
81.Nm EVP_aes_128_ccm ,
82.Nm EVP_aes_192_ccm ,
83.Nm EVP_aes_256_ccm ,
84.Nm EVP_aes_128_wrap , 81.Nm EVP_aes_128_wrap ,
85.Nm EVP_aes_192_wrap , 82.Nm EVP_aes_192_wrap ,
86.Nm EVP_aes_256_wrap , 83.Nm EVP_aes_256_wrap ,
@@ -142,12 +139,6 @@
142.Ft const EVP_CIPHER * 139.Ft const EVP_CIPHER *
143.Fn EVP_aes_256_cbc_hmac_sha1 void 140.Fn EVP_aes_256_cbc_hmac_sha1 void
144.Ft const EVP_CIPHER * 141.Ft const EVP_CIPHER *
145.Fn EVP_aes_128_ccm void
146.Ft const EVP_CIPHER *
147.Fn EVP_aes_192_ccm void
148.Ft const EVP_CIPHER *
149.Fn EVP_aes_256_ccm void
150.Ft const EVP_CIPHER *
151.Fn EVP_aes_128_wrap void 142.Fn EVP_aes_128_wrap void
152.Ft const EVP_CIPHER * 143.Ft const EVP_CIPHER *
153.Fn EVP_aes_192_wrap void 144.Fn EVP_aes_192_wrap void
@@ -211,16 +202,6 @@ This is not intended for usage outside of TLS and requires
211calling of some undocumented control functions. 202calling of some undocumented control functions.
212These ciphers do not conform to the EVP AEAD interface. 203These ciphers do not conform to the EVP AEAD interface.
213.Pp 204.Pp
214.Fn EVP_aes_128_ccm ,
215.Fn EVP_aes_192_ccm ,
216and
217.Fn EVP_aes_256_ccm
218provide AES for 128, 192 and 256-bit keys in CBC-MAC Mode (CCM), respectively.
219These ciphers require additional control operations to function
220correctly; see
221.Xr EVP_EncryptInit 3
222for details.
223.Pp
224.Fn EVP_aes_128_wrap , 205.Fn EVP_aes_128_wrap ,
225.Fn EVP_aes_192_wrap , 206.Fn EVP_aes_192_wrap ,
226and 207and
@@ -271,6 +252,7 @@ structure that provides the implementation of the symmetric cipher.
271.Sh SEE ALSO 252.Sh SEE ALSO
272.Xr AES_encrypt 3 , 253.Xr AES_encrypt 3 ,
273.Xr evp 3 , 254.Xr evp 3 ,
255.Xr EVP_aes_128_ccm 3 ,
274.Xr EVP_aes_128_gcm 3 , 256.Xr EVP_aes_128_gcm 3 ,
275.Xr EVP_EncryptInit 3 257.Xr EVP_EncryptInit 3
276.Sh HISTORY 258.Sh HISTORY
@@ -308,9 +290,6 @@ first appeared in OpenSSL 0.9.7e and have been available since
308.Fn EVP_aes_256_ctr , 290.Fn EVP_aes_256_ctr ,
309.Fn EVP_aes_128_cbc_hmac_sha1 , 291.Fn EVP_aes_128_cbc_hmac_sha1 ,
310.Fn EVP_aes_256_cbc_hmac_sha1 , 292.Fn EVP_aes_256_cbc_hmac_sha1 ,
311.Fn EVP_aes_128_ccm ,
312.Fn EVP_aes_192_ccm ,
313.Fn EVP_aes_256_ccm ,
314.Fn EVP_aes_128_xts , 293.Fn EVP_aes_128_xts ,
315and 294and
316.Fn EVP_aes_256_xts 295.Fn EVP_aes_256_xts
diff --git a/src/lib/libcrypto/man/EVP_aes_128_ccm.3 b/src/lib/libcrypto/man/EVP_aes_128_ccm.3
new file mode 100644
index 0000000000..251e805fb0
--- /dev/null
+++ b/src/lib/libcrypto/man/EVP_aes_128_ccm.3
@@ -0,0 +1,348 @@
1.\" $OpenBSD: EVP_aes_128_ccm.3,v 1.1 2024/12/20 01:54:03 schwarze Exp $
2.\" full merge up to:
3.\" OpenSSL EVP_EncryptInit.pod 0874d7f2 Oct 11 13:13:47 2022 +0100
4.\" OpenSSL EVP_aes.pod a1ec85c1 Apr 21 10:49:12 2020 +0100
5.\"
6.\" Copyright (c) 2024 Ingo Schwarze <schwarze@openbsd.org>
7.\"
8.\" Permission to use, copy, modify, and distribute this software for any
9.\" purpose with or without fee is hereby granted, provided that the above
10.\" copyright notice and this permission notice appear in all copies.
11.\"
12.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
13.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
14.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
15.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
16.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
18.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19.\"
20.\" This file is a derived work containing a few sentences
21.\" written by Dr. Stephen Henson <steve@openssl.org>
22.\" covered by the following license:
23.\"
24.\" Copyright (c) 2012 The OpenSSL Project. All rights reserved.
25.\"
26.\" Redistribution and use in source and binary forms, with or without
27.\" modification, are permitted provided that the following conditions
28.\" are met:
29.\"
30.\" 1. Redistributions of source code must retain the above copyright
31.\" notice, this list of conditions and the following disclaimer.
32.\"
33.\" 2. Redistributions in binary form must reproduce the above copyright
34.\" notice, this list of conditions and the following disclaimer in
35.\" the documentation and/or other materials provided with the
36.\" distribution.
37.\"
38.\" 3. All advertising materials mentioning features or use of this
39.\" software must display the following acknowledgment:
40.\" "This product includes software developed by the OpenSSL Project
41.\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
42.\"
43.\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
44.\" endorse or promote products derived from this software without
45.\" prior written permission. For written permission, please contact
46.\" openssl-core@openssl.org.
47.\"
48.\" 5. Products derived from this software may not be called "OpenSSL"
49.\" nor may "OpenSSL" appear in their names without prior written
50.\" permission of the OpenSSL Project.
51.\"
52.\" 6. Redistributions of any form whatsoever must retain the following
53.\" acknowledgment:
54.\" "This product includes software developed by the OpenSSL Project
55.\" for use in the OpenSSL Toolkit (http://www.openssl.org/)"
56.\"
57.\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
58.\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
59.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
60.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
61.\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
62.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
63.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
64.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
65.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
66.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
67.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
68.\" OF THE POSSIBILITY OF SUCH DAMAGE.
69.\"
70.Dd $Mdocdate: December 20 2024 $
71.Dt EVP_AES_128_CCM 3
72.Os
73.Sh NAME
74.Nm EVP_aes_128_ccm ,
75.Nm EVP_aes_192_ccm ,
76.Nm EVP_aes_256_ccm
77.Nd EVP AES cipher in Counter with CBC-MAC mode
78.Sh SYNOPSIS
79.In openssl/evp.h
80.Ft const EVP_CIPHER *
81.Fn EVP_aes_128_ccm void
82.Ft const EVP_CIPHER *
83.Fn EVP_aes_192_ccm void
84.Ft const EVP_CIPHER *
85.Fn EVP_aes_256_ccm void
86.Sh DESCRIPTION
87.Fn EVP_aes_128_ccm ,
88.Fn EVP_aes_192_ccm ,
89and
90.Fn EVP_aes_256_ccm
91provide the Advanced Encryption Standard algorithm for 128, 192 and 256-bit
92keys in Counter with CBC-MAC (CCM) mode in the
93.Xr evp 3
94framework.
95This mode supports Authenticated Encryption with Additional Data (AEAD)
96and can be used in a number of communication protocols.
97Longer keys make precomputation attacks harder at a cost in performance.
98.Pp
99For CCM mode ciphers, the behaviour of the EVP interface is subtly
100altered and several additional
101.Xr EVP_CIPHER_CTX_ctrl 3
102operations are required to function correctly.
103.Pp
104The less cumbersome and less error-prone
105.Xr EVP_AEAD_CTX_new 3
106API does not provide CCM modes.
107Some communication protocols support alternatives to CCM, which may
108sometimes allow choosing the better API by avoiding CCM.
109.Ss Configuration controls
110The following two control commands can be issued as soon as
111.Xr EVP_EncryptInit 3
112has been called with a CCM
113.Fa type
114and
115.Dv NULL
116pointers for
117.Fa key
118and
119.Fa iv .
120Both commands are optional and override each other.
121If issued when a nonce is already set, they silently cause data corruption.
122The
123.Fa ptr
124argument is ignored by both; passing
125.Dv NULL
126is recommended.
127.Bl -tag -width Ds
128.It Dv EVP_CTRL_CCM_SET_L
129Set the size
130.Ms L
131of the length field to
132.Fa arg
133bytes and the size of the nonce to
134.No 15 \- Fa arg
135bytes.
136By default, 8 bytes are used for the length field and 7 for the nonce.
137Selecting a smaller size
138.Ms L
139for the length field reduces des maximum size of messages that can be sent,
140but in return allows transmitting more messages with the same key.
141It is an error to pass less than 2 or more than the default value of 8 for
142.Fa arg .
143.It Dv EVP_CTRL_CCM_SET_IVLEN
144Set the size of the nonce to
145.Fa arg
146bytes and the size
147.Ms L
148of the length field to
149.No 15 \- Fa arg
150bytes.
151By default, 7 bytes are used for the nonce and 8 for the length field.
152Selecting a larger size of the nonce allows transmitting more messages with
153the same key at the expense of reducing the maximum size for each message.
154It is an error to pass more than 13 or less than the default value of 7 for
155.Fa arg .
156.El
157.Pp
158After optionally issuing one of the above control commands,
159.Xr EVP_EncryptInit 3
160can be called a second time, this time passing
161.Dv NULL
162for the
163.Fa type
164argument, with the other two arguments pointing to the desired AES key
165and to the desired nonce.
166.Ss Encryption controls
167.Bl -tag -width Ds
168.It Dv EVP_CTRL_CCM_SET_TAG
169If the
170.Fa ptr
171argument is
172.Dv NULL ,
173set the tag length
174.Ms M
175to
176.Fa arg
177bytes.
178The default value is 12.
179Selecting a larger value makes tampering harder for an attacker,
180at a small expense of making the messages slightly longer.
181Selecting a smaller value is not recommended.
182It is an error to pass an odd number for
183.Fa arg ,
184or a number that is less than 4 or greater than 16, or to pass
185.Dv NULL
186to
187.Fa ptr
188when
189.Fa ctx
190is not configured for encrypting.
191Issuing this control command when an encryption key is already configured
192silently causes data corruption.
193.It Dv EVP_CTRL_CCM_GET_TAG
194Store the
195.Fa arg
196bytes of the tag in the memory provided by the caller starting at
197.Fa ptr .
198It is an error to issue this control command when
199.Fa ctx
200is not configured for encrypting, when no data was encrypted yet, with an
201.Fa arg
202that does not match the configured tag length
203.Ms M ,
204or when the tag has already been retrieved earlier.
205.El
206.Pp
207Before passing any plaintext data to
208.Xr EVP_EncryptUpdate 3 ,
209call
210.Xr EVP_EncryptUpdate 3
211with both
212.Fa in
213and
214.Fa out
215set to
216.Dv NULL ,
217passing the total plaintext length in bytes as
218.Fa in_len .
219This constructs the first block to be digested with CBC-MAC
220and copies the text length to
221.Pf * Fa out_len .
222It does not check whether
223.Fa in_len
224exceeds the limit of
225.Pf 256\(ha Ms L ;
226the most significant bytes of excessive values are silently discarded.
227.Pp
228It is an error if the
229.Fa in_len
230argument of the
231.Xr EVP_EncryptUpdate 3
232call passing the plaintext data does not match the total length
233specified ealier.
234Splitting the text into more than one chunks to be passed in multiple calls of
235.Xr EVP_EncryptUpdate 3
236is not supported for CCM.
237.Pp
238To specify any additional authenticated data (AAD), call
239.Xr EVP_EncryptUpdate 3
240with the
241.Fa out
242argument set to
243.Dv NULL .
244.Ss Decryption controls
245.Bl -tag -width Ds
246.It Dv EVP_CTRL_CCM_SET_TAG
247If the
248.Fa ptr
249argument is not
250.Dv NULL ,
251copy
252.Fa arg
253bytes starting at
254.Fa ptr
255to the expected CCM tag value.
256It is an error to pass an odd number for
257.Fa arg ,
258or a number that is less than 4 or greater than 16.
259Passing a number that does not correspond to the tag length
260.Ms M
261that was used for encryption does not raise an error right away,
262but results in undefined behaviour
263and typically causes subsequent authentication failure.
264It is also an error to pass a
265.Pf non- Dv NULL
266.Fa ptr
267when
268.Fa ctx
269is configured for encryption.
270.El
271.Pp
272Before passing any ciphertext data to
273.Xr EVP_DecryptUpdate 3 ,
274call
275.Xr EVP_DecryptUpdate 3
276with both
277.Fa in
278and
279.Fa out
280set to
281.Dv NULL ,
282passing the total ciphertext length in bytes as
283.Fa in_len .
284This constructs the first block to be digested with CBC-MAC
285and copies the text length to
286.Pf * Fa out_len .
287It does not check whether
288.Fa in_len
289exceeds the limit of
290.Pf 256\(ha Ms L ;
291the most significant bytes of excessive values are silently discarded.
292.Pp
293It is an error if the
294.Fa in_len
295argument of the
296.Xr EVP_DecryptUpdate 3
297call passing the ciphertext data does not match the total length
298specified ealier.
299Splitting the text into more than one chunks to be passed in multiple calls of
300.Xr EVP_DecryptUpdate 3
301is not supported for CCM.
302.Pp
303To specify any additional authenticated data (AAD), call
304.Xr EVP_DecryptUpdate 3
305with the
306.Fa out
307argument set to
308.Dv NULL .
309.Pp
310If the return value of
311.Xr EVP_DecryptUpdate 3
312does not indicate success, the authentication operation may have failed.
313In that case, regard any output data as corrupted.
314.Pp
315Do not call
316.Xr EVP_DecryptFinal 3
317when using CCM.
318Such a call would not do anything useful, and it would fail
319because the tag that was set with
320.Dv EVP_CTRL_CCM_SET_TAG
321was already consumed by
322.Xr EVP_DecryptUpdate 3 .
323.Sh RETURN VALUES
324These functions return a static constant
325.Vt EVP_CIPHER
326structure that provides the implementation of the respective AEAD cipher mode.
327.Sh SEE ALSO
328.Xr AES_encrypt 3 ,
329.Xr evp 3 ,
330.Xr EVP_aes_128_cbc 3 ,
331.Xr EVP_aes_128_gcm 3 ,
332.Xr EVP_EncryptInit 3
333.Sh STANDARDS
334.Rs
335.%A Doug Whiting
336.%A Russ Housley
337.%A Niels Ferguson
338.%T Counter with CBC-MAC (CCM)
339.%R RFC 3610
340.%D September 2003
341.Re
342.Sh HISTORY
343.Fn EVP_aes_128_ccm ,
344.Fn EVP_aes_192_ccm ,
345and
346.Fn EVP_aes_256_ccm
347first appeared in OpenSSL 1.0.1 and have been available since
348.Ox 5.3 .
diff --git a/src/lib/libcrypto/man/Makefile b/src/lib/libcrypto/man/Makefile
index 137540c69a..9c05e70748 100644
--- a/src/lib/libcrypto/man/Makefile
+++ b/src/lib/libcrypto/man/Makefile
@@ -1,4 +1,4 @@
1# $OpenBSD: Makefile,v 1.301 2024/12/17 18:11:44 schwarze Exp $ 1# $OpenBSD: Makefile,v 1.302 2024/12/20 01:54:03 schwarze Exp $
2 2
3.include <bsd.own.mk> 3.include <bsd.own.mk>
4 4
@@ -196,6 +196,7 @@ MAN= \
196 EVP_SignInit.3 \ 196 EVP_SignInit.3 \
197 EVP_VerifyInit.3 \ 197 EVP_VerifyInit.3 \
198 EVP_aes_128_cbc.3 \ 198 EVP_aes_128_cbc.3 \
199 EVP_aes_128_ccm.3 \
199 EVP_aes_128_gcm.3 \ 200 EVP_aes_128_gcm.3 \
200 EVP_camellia_128_cbc.3 \ 201 EVP_camellia_128_cbc.3 \
201 EVP_chacha20.3 \ 202 EVP_chacha20.3 \