diff options
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/man/EVP_EncryptInit.3 | 54 | ||||
| -rw-r--r-- | src/lib/libcrypto/man/EVP_aes_128_cbc.3 | 27 | ||||
| -rw-r--r-- | src/lib/libcrypto/man/EVP_aes_128_ccm.3 | 348 | ||||
| -rw-r--r-- | src/lib/libcrypto/man/Makefile | 3 |
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 | ||
| 612 | The behaviour of CCM mode ciphers is similar to GCM mode, but with | ||
| 613 | a few additional requirements and different ctrl values. | ||
| 614 | .Pp | ||
| 615 | Like GCM mode any additional authenticated data (AAD) is passed | ||
| 616 | by calling | ||
| 617 | .Fn EVP_CipherUpdate , | ||
| 618 | .Fn EVP_EncryptUpdate , | ||
| 619 | or | ||
| 620 | .Fn EVP_DecryptUpdate | ||
| 621 | with the output parameter | ||
| 622 | .Fa out | ||
| 623 | set to | ||
| 624 | .Dv NULL . | ||
| 625 | Additionally, the total | ||
| 626 | plaintext or ciphertext length MUST be passed to | ||
| 627 | .Fn EVP_CipherUpdate , | ||
| 628 | .Fn EVP_EncryptUpdate , | ||
| 629 | or | ||
| 630 | .Fn EVP_DecryptUpdate | ||
| 631 | with the output and input | ||
| 632 | parameters | ||
| 633 | .Pq Fa in No and Fa out | ||
| 634 | set to | ||
| 635 | .Dv NULL | ||
| 636 | and the length passed in the | ||
| 637 | .Fa in_len | ||
| 638 | parameter. | ||
| 639 | .Pp | ||
| 640 | The 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 | ||
| 643 | This call is made to set the expected CCM tag value when decrypting or | ||
| 644 | the length of the tag (with the | ||
| 645 | .Fa tag | ||
| 646 | parameter set to | ||
| 647 | .Dv NULL ) | ||
| 648 | when encrypting. | ||
| 649 | The tag length is often referred to as M. | ||
| 650 | If 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 | ||
| 652 | Sets the CCM L value. | ||
| 653 | If not set, a default is used (8 for AES). | ||
| 654 | .It Fn EVP_CIPHER_CTX_ctrl ctx EVP_CTRL_CCM_SET_IVLEN ivlen NULL | ||
| 655 | Sets the CCM nonce (IV) length: this call can only be made before | ||
| 656 | specifying a nonce value. | ||
| 657 | The nonce length is given by 15 - L so it is 7 by default for AES. | ||
| 658 | .El | ||
| 659 | .Sh EXAMPLES | 612 | .Sh EXAMPLES |
| 660 | Encrypt a string using blowfish: | 613 | Encrypt 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 | |||
| 211 | calling of some undocumented control functions. | 202 | calling of some undocumented control functions. |
| 212 | These ciphers do not conform to the EVP AEAD interface. | 203 | These 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 , | ||
| 216 | and | ||
| 217 | .Fn EVP_aes_256_ccm | ||
| 218 | provide AES for 128, 192 and 256-bit keys in CBC-MAC Mode (CCM), respectively. | ||
| 219 | These ciphers require additional control operations to function | ||
| 220 | correctly; see | ||
| 221 | .Xr EVP_EncryptInit 3 | ||
| 222 | for 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 , |
| 226 | and | 207 | and |
| @@ -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 , |
| 315 | and | 294 | and |
| 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 , | ||
| 89 | and | ||
| 90 | .Fn EVP_aes_256_ccm | ||
| 91 | provide the Advanced Encryption Standard algorithm for 128, 192 and 256-bit | ||
| 92 | keys in Counter with CBC-MAC (CCM) mode in the | ||
| 93 | .Xr evp 3 | ||
| 94 | framework. | ||
| 95 | This mode supports Authenticated Encryption with Additional Data (AEAD) | ||
| 96 | and can be used in a number of communication protocols. | ||
| 97 | Longer keys make precomputation attacks harder at a cost in performance. | ||
| 98 | .Pp | ||
| 99 | For CCM mode ciphers, the behaviour of the EVP interface is subtly | ||
| 100 | altered and several additional | ||
| 101 | .Xr EVP_CIPHER_CTX_ctrl 3 | ||
| 102 | operations are required to function correctly. | ||
| 103 | .Pp | ||
| 104 | The less cumbersome and less error-prone | ||
| 105 | .Xr EVP_AEAD_CTX_new 3 | ||
| 106 | API does not provide CCM modes. | ||
| 107 | Some communication protocols support alternatives to CCM, which may | ||
| 108 | sometimes allow choosing the better API by avoiding CCM. | ||
| 109 | .Ss Configuration controls | ||
| 110 | The following two control commands can be issued as soon as | ||
| 111 | .Xr EVP_EncryptInit 3 | ||
| 112 | has been called with a CCM | ||
| 113 | .Fa type | ||
| 114 | and | ||
| 115 | .Dv NULL | ||
| 116 | pointers for | ||
| 117 | .Fa key | ||
| 118 | and | ||
| 119 | .Fa iv . | ||
| 120 | Both commands are optional and override each other. | ||
| 121 | If issued when a nonce is already set, they silently cause data corruption. | ||
| 122 | The | ||
| 123 | .Fa ptr | ||
| 124 | argument is ignored by both; passing | ||
| 125 | .Dv NULL | ||
| 126 | is recommended. | ||
| 127 | .Bl -tag -width Ds | ||
| 128 | .It Dv EVP_CTRL_CCM_SET_L | ||
| 129 | Set the size | ||
| 130 | .Ms L | ||
| 131 | of the length field to | ||
| 132 | .Fa arg | ||
| 133 | bytes and the size of the nonce to | ||
| 134 | .No 15 \- Fa arg | ||
| 135 | bytes. | ||
| 136 | By default, 8 bytes are used for the length field and 7 for the nonce. | ||
| 137 | Selecting a smaller size | ||
| 138 | .Ms L | ||
| 139 | for the length field reduces des maximum size of messages that can be sent, | ||
| 140 | but in return allows transmitting more messages with the same key. | ||
| 141 | It 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 | ||
| 144 | Set the size of the nonce to | ||
| 145 | .Fa arg | ||
| 146 | bytes and the size | ||
| 147 | .Ms L | ||
| 148 | of the length field to | ||
| 149 | .No 15 \- Fa arg | ||
| 150 | bytes. | ||
| 151 | By default, 7 bytes are used for the nonce and 8 for the length field. | ||
| 152 | Selecting a larger size of the nonce allows transmitting more messages with | ||
| 153 | the same key at the expense of reducing the maximum size for each message. | ||
| 154 | It is an error to pass more than 13 or less than the default value of 7 for | ||
| 155 | .Fa arg . | ||
| 156 | .El | ||
| 157 | .Pp | ||
| 158 | After optionally issuing one of the above control commands, | ||
| 159 | .Xr EVP_EncryptInit 3 | ||
| 160 | can be called a second time, this time passing | ||
| 161 | .Dv NULL | ||
| 162 | for the | ||
| 163 | .Fa type | ||
| 164 | argument, with the other two arguments pointing to the desired AES key | ||
| 165 | and to the desired nonce. | ||
| 166 | .Ss Encryption controls | ||
| 167 | .Bl -tag -width Ds | ||
| 168 | .It Dv EVP_CTRL_CCM_SET_TAG | ||
| 169 | If the | ||
| 170 | .Fa ptr | ||
| 171 | argument is | ||
| 172 | .Dv NULL , | ||
| 173 | set the tag length | ||
| 174 | .Ms M | ||
| 175 | to | ||
| 176 | .Fa arg | ||
| 177 | bytes. | ||
| 178 | The default value is 12. | ||
| 179 | Selecting a larger value makes tampering harder for an attacker, | ||
| 180 | at a small expense of making the messages slightly longer. | ||
| 181 | Selecting a smaller value is not recommended. | ||
| 182 | It is an error to pass an odd number for | ||
| 183 | .Fa arg , | ||
| 184 | or a number that is less than 4 or greater than 16, or to pass | ||
| 185 | .Dv NULL | ||
| 186 | to | ||
| 187 | .Fa ptr | ||
| 188 | when | ||
| 189 | .Fa ctx | ||
| 190 | is not configured for encrypting. | ||
| 191 | Issuing this control command when an encryption key is already configured | ||
| 192 | silently causes data corruption. | ||
| 193 | .It Dv EVP_CTRL_CCM_GET_TAG | ||
| 194 | Store the | ||
| 195 | .Fa arg | ||
| 196 | bytes of the tag in the memory provided by the caller starting at | ||
| 197 | .Fa ptr . | ||
| 198 | It is an error to issue this control command when | ||
| 199 | .Fa ctx | ||
| 200 | is not configured for encrypting, when no data was encrypted yet, with an | ||
| 201 | .Fa arg | ||
| 202 | that does not match the configured tag length | ||
| 203 | .Ms M , | ||
| 204 | or when the tag has already been retrieved earlier. | ||
| 205 | .El | ||
| 206 | .Pp | ||
| 207 | Before passing any plaintext data to | ||
| 208 | .Xr EVP_EncryptUpdate 3 , | ||
| 209 | call | ||
| 210 | .Xr EVP_EncryptUpdate 3 | ||
| 211 | with both | ||
| 212 | .Fa in | ||
| 213 | and | ||
| 214 | .Fa out | ||
| 215 | set to | ||
| 216 | .Dv NULL , | ||
| 217 | passing the total plaintext length in bytes as | ||
| 218 | .Fa in_len . | ||
| 219 | This constructs the first block to be digested with CBC-MAC | ||
| 220 | and copies the text length to | ||
| 221 | .Pf * Fa out_len . | ||
| 222 | It does not check whether | ||
| 223 | .Fa in_len | ||
| 224 | exceeds the limit of | ||
| 225 | .Pf 256\(ha Ms L ; | ||
| 226 | the most significant bytes of excessive values are silently discarded. | ||
| 227 | .Pp | ||
| 228 | It is an error if the | ||
| 229 | .Fa in_len | ||
| 230 | argument of the | ||
| 231 | .Xr EVP_EncryptUpdate 3 | ||
| 232 | call passing the plaintext data does not match the total length | ||
| 233 | specified ealier. | ||
| 234 | Splitting the text into more than one chunks to be passed in multiple calls of | ||
| 235 | .Xr EVP_EncryptUpdate 3 | ||
| 236 | is not supported for CCM. | ||
| 237 | .Pp | ||
| 238 | To specify any additional authenticated data (AAD), call | ||
| 239 | .Xr EVP_EncryptUpdate 3 | ||
| 240 | with the | ||
| 241 | .Fa out | ||
| 242 | argument set to | ||
| 243 | .Dv NULL . | ||
| 244 | .Ss Decryption controls | ||
| 245 | .Bl -tag -width Ds | ||
| 246 | .It Dv EVP_CTRL_CCM_SET_TAG | ||
| 247 | If the | ||
| 248 | .Fa ptr | ||
| 249 | argument is not | ||
| 250 | .Dv NULL , | ||
| 251 | copy | ||
| 252 | .Fa arg | ||
| 253 | bytes starting at | ||
| 254 | .Fa ptr | ||
| 255 | to the expected CCM tag value. | ||
| 256 | It is an error to pass an odd number for | ||
| 257 | .Fa arg , | ||
| 258 | or a number that is less than 4 or greater than 16. | ||
| 259 | Passing a number that does not correspond to the tag length | ||
| 260 | .Ms M | ||
| 261 | that was used for encryption does not raise an error right away, | ||
| 262 | but results in undefined behaviour | ||
| 263 | and typically causes subsequent authentication failure. | ||
| 264 | It is also an error to pass a | ||
| 265 | .Pf non- Dv NULL | ||
| 266 | .Fa ptr | ||
| 267 | when | ||
| 268 | .Fa ctx | ||
| 269 | is configured for encryption. | ||
| 270 | .El | ||
| 271 | .Pp | ||
| 272 | Before passing any ciphertext data to | ||
| 273 | .Xr EVP_DecryptUpdate 3 , | ||
| 274 | call | ||
| 275 | .Xr EVP_DecryptUpdate 3 | ||
| 276 | with both | ||
| 277 | .Fa in | ||
| 278 | and | ||
| 279 | .Fa out | ||
| 280 | set to | ||
| 281 | .Dv NULL , | ||
| 282 | passing the total ciphertext length in bytes as | ||
| 283 | .Fa in_len . | ||
| 284 | This constructs the first block to be digested with CBC-MAC | ||
| 285 | and copies the text length to | ||
| 286 | .Pf * Fa out_len . | ||
| 287 | It does not check whether | ||
| 288 | .Fa in_len | ||
| 289 | exceeds the limit of | ||
| 290 | .Pf 256\(ha Ms L ; | ||
| 291 | the most significant bytes of excessive values are silently discarded. | ||
| 292 | .Pp | ||
| 293 | It is an error if the | ||
| 294 | .Fa in_len | ||
| 295 | argument of the | ||
| 296 | .Xr EVP_DecryptUpdate 3 | ||
| 297 | call passing the ciphertext data does not match the total length | ||
| 298 | specified ealier. | ||
| 299 | Splitting the text into more than one chunks to be passed in multiple calls of | ||
| 300 | .Xr EVP_DecryptUpdate 3 | ||
| 301 | is not supported for CCM. | ||
| 302 | .Pp | ||
| 303 | To specify any additional authenticated data (AAD), call | ||
| 304 | .Xr EVP_DecryptUpdate 3 | ||
| 305 | with the | ||
| 306 | .Fa out | ||
| 307 | argument set to | ||
| 308 | .Dv NULL . | ||
| 309 | .Pp | ||
| 310 | If the return value of | ||
| 311 | .Xr EVP_DecryptUpdate 3 | ||
| 312 | does not indicate success, the authentication operation may have failed. | ||
| 313 | In that case, regard any output data as corrupted. | ||
| 314 | .Pp | ||
| 315 | Do not call | ||
| 316 | .Xr EVP_DecryptFinal 3 | ||
| 317 | when using CCM. | ||
| 318 | Such a call would not do anything useful, and it would fail | ||
| 319 | because the tag that was set with | ||
| 320 | .Dv EVP_CTRL_CCM_SET_TAG | ||
| 321 | was already consumed by | ||
| 322 | .Xr EVP_DecryptUpdate 3 . | ||
| 323 | .Sh RETURN VALUES | ||
| 324 | These functions return a static constant | ||
| 325 | .Vt EVP_CIPHER | ||
| 326 | structure 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 , | ||
| 345 | and | ||
| 346 | .Fn EVP_aes_256_ccm | ||
| 347 | first 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 \ |
