diff options
| author | cvs2svn <admin@example.com> | 2021-08-18 16:06:57 +0000 |
|---|---|---|
| committer | cvs2svn <admin@example.com> | 2021-08-18 16:06:57 +0000 |
| commit | d56c8fa8260d226f98b26f017b45b9c2b135f38d (patch) | |
| tree | 348178b41617813cc93787187984a734ef8379ca /src/lib/libcrypto/man/CMAC_Init.3 | |
| parent | 18b9c1bcab7c37d8c5bd05b8e0d14d0c59d96650 (diff) | |
| download | openbsd-tb_20210818.tar.gz openbsd-tb_20210818.tar.bz2 openbsd-tb_20210818.zip | |
This commit was manufactured by cvs2git to create tag 'tb_20210818'.tb_20210818
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/man/CMAC_Init.3 | 293 |
1 files changed, 0 insertions, 293 deletions
diff --git a/src/lib/libcrypto/man/CMAC_Init.3 b/src/lib/libcrypto/man/CMAC_Init.3 deleted file mode 100644 index a938c0db64..0000000000 --- a/src/lib/libcrypto/man/CMAC_Init.3 +++ /dev/null | |||
| @@ -1,293 +0,0 @@ | |||
| 1 | .\" $OpenBSD: CMAC_Init.3,v 1.4 2020/08/06 22:17:49 schwarze Exp $ | ||
| 2 | .\" | ||
| 3 | .\" Copyright (c) 2020 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 6 2020 $ | ||
| 18 | .Dt CMAC_INIT 3 | ||
| 19 | .Os | ||
| 20 | .Sh NAME | ||
| 21 | .Nm CMAC_CTX_new , | ||
| 22 | .Nm CMAC_Init , | ||
| 23 | .Nm CMAC_Update , | ||
| 24 | .Nm CMAC_Final , | ||
| 25 | .Nm CMAC_resume , | ||
| 26 | .Nm CMAC_CTX_copy , | ||
| 27 | .Nm CMAC_CTX_get0_cipher_ctx , | ||
| 28 | .Nm CMAC_CTX_cleanup , | ||
| 29 | .Nm CMAC_CTX_free | ||
| 30 | .Nd Cipher-based message authentication code | ||
| 31 | .Sh SYNOPSIS | ||
| 32 | .In openssl/cmac.h | ||
| 33 | .Ft CMAC_CTX * | ||
| 34 | .Fn CMAC_CTX_new void | ||
| 35 | .Ft int | ||
| 36 | .Fo CMAC_Init | ||
| 37 | .Fa "CMAC_CTX *ctx" | ||
| 38 | .Fa "const void *key" | ||
| 39 | .Fa "size_t key_len" | ||
| 40 | .Fa "const EVP_CIPHER *cipher" | ||
| 41 | .Fa "ENGINE *impl" | ||
| 42 | .Fc | ||
| 43 | .Ft int | ||
| 44 | .Fo CMAC_Update | ||
| 45 | .Fa "CMAC_CTX *ctx" | ||
| 46 | .Fa "const void *in_data" | ||
| 47 | .Fa "size_t in_len" | ||
| 48 | .Fc | ||
| 49 | .Ft int | ||
| 50 | .Fo CMAC_Final | ||
| 51 | .Fa "CMAC_CTX *ctx" | ||
| 52 | .Fa "unsigned char *out_mac" | ||
| 53 | .Fa "size_t *out_len" | ||
| 54 | .Fc | ||
| 55 | .Ft int | ||
| 56 | .Fn CMAC_resume "CMAC_CTX *ctx" | ||
| 57 | .Ft int | ||
| 58 | .Fo CMAC_CTX_copy | ||
| 59 | .Fa "CMAC_CTX *out_ctx" | ||
| 60 | .Fa "CMAC_CTX *in_ctx" | ||
| 61 | .Fc | ||
| 62 | .Ft EVP_CIPHER_CTX * | ||
| 63 | .Fn CMAC_CTX_get0_cipher_ctx "CMAC_CTX *ctx" | ||
| 64 | .Ft void | ||
| 65 | .Fn CMAC_CTX_cleanup "CMAC_CTX *ctx" | ||
| 66 | .Ft void | ||
| 67 | .Fn CMAC_CTX_free "CMAC_CTX *ctx" | ||
| 68 | .Sh DESCRIPTION | ||
| 69 | CMAC is a message authentication code algorithm that can employ an | ||
| 70 | arbitrary block cipher using a symmetric key. | ||
| 71 | .Pp | ||
| 72 | The present manual page describes low-level functions implementing CMAC. | ||
| 73 | Instead of using these functions directly, | ||
| 74 | application programs normally call | ||
| 75 | .Xr EVP_PKEY_CTX_new_id 3 | ||
| 76 | with an argument of | ||
| 77 | .Dv EVP_PKEY_CMAC | ||
| 78 | and then pass the resulting | ||
| 79 | .Vt EVP_MD_CTX | ||
| 80 | object to | ||
| 81 | .Xr EVP_DigestInit_ex 3 . | ||
| 82 | .Pp | ||
| 83 | The CMAC API is object-oriented. | ||
| 84 | Calculating a message authentication code requires a | ||
| 85 | .Vt CMAC_CTX | ||
| 86 | object. | ||
| 87 | Usually, the functions | ||
| 88 | .Fn CMAC_CTX_new , | ||
| 89 | .Fn CMAC_Init , | ||
| 90 | .Fn CMAC_Update , | ||
| 91 | .Fn CMAC_Final , | ||
| 92 | and | ||
| 93 | .Fn CMAC_CTX_free | ||
| 94 | need to be called in this order. | ||
| 95 | .Pp | ||
| 96 | .Fn CMAC_CTX_new | ||
| 97 | allocates a new | ||
| 98 | .Vt CMAC_CTX | ||
| 99 | object, initializes the embedded | ||
| 100 | .Vt EVP_CIPHER_CTX | ||
| 101 | object, and marks the object itself as uninitialized. | ||
| 102 | .Pp | ||
| 103 | .Fn CMAC_Init | ||
| 104 | selects the given block | ||
| 105 | .Fa cipher | ||
| 106 | for use by | ||
| 107 | .Fa ctx . | ||
| 108 | Functions to obtain suitable | ||
| 109 | .Vt EVP_CIPHER | ||
| 110 | objects are listed in the CIPHER LISTING section of the | ||
| 111 | .Xr EVP_Cipher 3 | ||
| 112 | manual page. | ||
| 113 | Unless | ||
| 114 | .Fa key | ||
| 115 | is | ||
| 116 | .Dv NULL , | ||
| 117 | .Fn CMAC_Init | ||
| 118 | also initializes | ||
| 119 | .Fa ctx | ||
| 120 | for use with the given symmetric | ||
| 121 | .Fa key | ||
| 122 | that is | ||
| 123 | .Fa key_len | ||
| 124 | bytes long. | ||
| 125 | In particular, it calculates and internally stores the two subkeys | ||
| 126 | and initializes | ||
| 127 | .Fa ctx | ||
| 128 | for subsequently feeding in data with | ||
| 129 | .Fn CMAC_Update . | ||
| 130 | To use the default cipher implementations provided by the library, pass | ||
| 131 | .Dv NULL | ||
| 132 | as the | ||
| 133 | .Fa impl | ||
| 134 | argument. | ||
| 135 | .Pp | ||
| 136 | If | ||
| 137 | .Fa ctx | ||
| 138 | is already initialized, | ||
| 139 | .Fn CMAC_Init | ||
| 140 | can be called again with | ||
| 141 | .Fa key , | ||
| 142 | .Fa cipher , | ||
| 143 | and | ||
| 144 | .Fa impl | ||
| 145 | all set to | ||
| 146 | .Dv NULL | ||
| 147 | and | ||
| 148 | .Fa key_len | ||
| 149 | set to 0. | ||
| 150 | In that case, any data already processed is discarded and | ||
| 151 | .Fa ctx | ||
| 152 | is re-initialized to start reading data anew. | ||
| 153 | .Pp | ||
| 154 | .Fn CMAC_Update | ||
| 155 | processes | ||
| 156 | .Fa in_len | ||
| 157 | bytes of input data pointed to by | ||
| 158 | .Fa in_data . | ||
| 159 | Depending on the number of input bytes already cached in | ||
| 160 | .Fa ctx , | ||
| 161 | on | ||
| 162 | .Fa in_len , | ||
| 163 | and on the block size, this may encrypt zero or more blocks. | ||
| 164 | Unless | ||
| 165 | .Fa in_len | ||
| 166 | is zero, this function leaves at least one byte and at most one | ||
| 167 | block of input cached but unprocessed inside the | ||
| 168 | .Fa ctx | ||
| 169 | object. | ||
| 170 | .Fn CMAC_Update | ||
| 171 | can be called multiple times | ||
| 172 | to concatenate several chunks of input data of varying sizes. | ||
| 173 | .Pp | ||
| 174 | .Fn CMAC_Final | ||
| 175 | stores the length of the message authentication code in bytes, | ||
| 176 | which equals the cipher block size, into | ||
| 177 | .Pf * Fa out_len . | ||
| 178 | Unless | ||
| 179 | .Fa out_mac | ||
| 180 | is | ||
| 181 | .Dv NULL , | ||
| 182 | it encrypts the last block, padding it if required, and copies the | ||
| 183 | resulting message authentication code to | ||
| 184 | .Fa out_mac . | ||
| 185 | The caller is responsible for providing a buffer of sufficient size. | ||
| 186 | .Pp | ||
| 187 | Calling | ||
| 188 | .Fn CMAC_resume | ||
| 189 | after | ||
| 190 | .Fn CMAC_Final | ||
| 191 | allows the user to subsequently append additional data with | ||
| 192 | .Fn CMAC_Update . | ||
| 193 | Otherwise, unless | ||
| 194 | .Fn CMAC_Init | ||
| 195 | is called to start from scratch, | ||
| 196 | .Fn CMAC_Update | ||
| 197 | can no longer be used after | ||
| 198 | .Fn CMAC_Final . | ||
| 199 | .Pp | ||
| 200 | .Fn CMAC_CTX_copy | ||
| 201 | performs a deep copy of the already initialized | ||
| 202 | .Fa in_ctx | ||
| 203 | into | ||
| 204 | .Fa out_ctx . | ||
| 205 | .Pp | ||
| 206 | .Fn CMAC_CTX_cleanup | ||
| 207 | zeros out both subkeys and all temporary data in | ||
| 208 | .Fa ctx | ||
| 209 | and in the embedded | ||
| 210 | .Vt EVP_CIPHER_CTX | ||
| 211 | object, frees all allocated memory associated with it, | ||
| 212 | except for | ||
| 213 | .Fa ctx | ||
| 214 | itself, and marks it as uninitialized, | ||
| 215 | such that it can be reused for subsequent | ||
| 216 | .Fn CMAC_Init . | ||
| 217 | .Pp | ||
| 218 | .Fn CMAC_CTX_free | ||
| 219 | calls | ||
| 220 | .Fn CMAC_CTX_cleanup , | ||
| 221 | then frees | ||
| 222 | .Fa ctx | ||
| 223 | itself. | ||
| 224 | If | ||
| 225 | .Fa ctx | ||
| 226 | is | ||
| 227 | .Dv NULL , | ||
| 228 | no action occurs. | ||
| 229 | .Sh RETURN VALUES | ||
| 230 | .Fn CMAC_CTX_new | ||
| 231 | returns the new context object or | ||
| 232 | .Dv NULL | ||
| 233 | in case of failure. | ||
| 234 | It succeeds unless memory is exhausted. | ||
| 235 | .Pp | ||
| 236 | .Fn CMAC_Init , | ||
| 237 | .Fn CMAC_Update , | ||
| 238 | .Fn CMAC_Final , | ||
| 239 | .Fn CMAC_resume , | ||
| 240 | and | ||
| 241 | .Fn CMAC_CTX_copy | ||
| 242 | return 1 on success or 0 on failure. | ||
| 243 | .Fn CMAC_Init | ||
| 244 | fails if initializing the embedded | ||
| 245 | .Vt EVP_CIPHER_CTX | ||
| 246 | object fails. | ||
| 247 | The others fail if | ||
| 248 | .Fa in_ctx | ||
| 249 | is uninitialized. | ||
| 250 | .Fn CMAC_Update | ||
| 251 | and | ||
| 252 | .Fn CMAC_Final | ||
| 253 | also fail if encrypting a block fails, and | ||
| 254 | .Fn CMAC_CTX_copy | ||
| 255 | if copying the embedded | ||
| 256 | .Vt EVP_CIPHER_CTX | ||
| 257 | object fails, which can for example happen when memory is exhausted. | ||
| 258 | .Pp | ||
| 259 | .Fn CMAC_CTX_get0_cipher_ctx | ||
| 260 | returns an internal pointer to the | ||
| 261 | .Vt EVP_CIPHER_CTX | ||
| 262 | object that is embedded in | ||
| 263 | .Fa ctx . | ||
| 264 | .Sh ERRORS | ||
| 265 | The CMAC code itself does not use the | ||
| 266 | .In openssl/err.h | ||
| 267 | framework, so in general, the reasons for failure cannot be found out with | ||
| 268 | .Xr ERR_get_error 3 . | ||
| 269 | However, since the | ||
| 270 | .Xr EVP_Cipher 3 | ||
| 271 | functions are used internally, entries may still get pushed onto | ||
| 272 | the error stack in some cases of failure. | ||
| 273 | .Sh SEE ALSO | ||
| 274 | .Xr EVP_aes_128_cbc 3 , | ||
| 275 | .Xr EVP_Cipher 3 , | ||
| 276 | .Xr EVP_DigestInit 3 , | ||
| 277 | .Xr EVP_PKEY_CTX_new_id 3 , | ||
| 278 | .Xr HMAC 3 | ||
| 279 | .Sh STANDARDS | ||
| 280 | .Rs | ||
| 281 | .%A Morris Dworkin | ||
| 282 | .%T "Recommendation for Block Cipher Modes of Operation:\ | ||
| 283 | The CMAC Mode for Authentication" | ||
| 284 | .%I National Institute of Standards and Technology | ||
| 285 | .%R NIST Special Publication 800-38B | ||
| 286 | .%U https://doi.org/10.6028/NIST.SP.800-38B | ||
| 287 | .%C Gaithersburg, Maryland | ||
| 288 | .%D May 2005, updated October 6, 2016 | ||
| 289 | .Re | ||
| 290 | .Sh HISTORY | ||
| 291 | These functions first appeared in OpenSSL 1.0.1 | ||
| 292 | and have been available since | ||
| 293 | .Ox 5.3 . | ||
