| 1 | /* Kernel crypto API AF_ALG AEAD API |
| 2 | * |
| 3 | * Copyright (C) 2016 - 2022, Stephan Mueller <[email protected]> |
| 4 | * |
| 5 | * License: see COPYING file in root directory |
| 6 | * |
| 7 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED |
| 8 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
| 9 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF |
| 10 | * WHICH ARE HEREBY DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE |
| 11 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 12 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT |
| 13 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR |
| 14 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
| 15 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 16 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE |
| 17 | * USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH |
| 18 | * DAMAGE. |
| 19 | */ |
| 20 | |
| 21 | #include "internal.h"cxx . . $ `<file>/lib/internal.h`/ |
| 22 | #include "kcapi.h"cxx . . $ `<file>/lib/kcapi.h`/ |
| 23 | |
| 24 | int kcapi_aead_initcxx . . $ kcapi_aead_init(b54728dab28c239a).(struct kcapi_handlecxx . . $ kcapi_handle# **handle, const char *ciphername, |
| 25 | uint32_tcxx . . $ uint32_t# flags) |
| 26 | { |
| 27 | return _kcapi_handle_initcxx . . $ _kcapi_handle_init(db986b7fadb21840).(handle, "aead", ciphername, flags); |
| 28 | } |
| 29 | |
| 30 | void kcapi_aead_destroycxx . . $ kcapi_aead_destroy(aba29416d24fdd59).(struct kcapi_handlecxx . . $ kcapi_handle# *handle) |
| 31 | { |
| 32 | _kcapi_handle_destroycxx . . $ _kcapi_handle_destroy(aba29416d24fdd59).(handle); |
| 33 | } |
| 34 | |
| 35 | int kcapi_aead_setkeycxx . . $ kcapi_aead_setkey(4d0e261613a805ee).(struct kcapi_handlecxx . . $ kcapi_handle# *handle, |
| 36 | const uint8_tcxx . . $ uint8_t# *key, uint32_tcxx . . $ uint32_t# keylen) |
| 37 | { |
| 38 | return _kcapi_common_setkeycxx . . $ _kcapi_common_setkey(4d0e261613a805ee).(handle, key, keylen); |
| 39 | } |
| 40 | |
| 41 | int kcapi_aead_settaglencxx . . $ kcapi_aead_settaglen(8327ae3352751b56).(struct kcapi_handlecxx . . $ kcapi_handle# *handle, uint32_tcxx . . $ uint32_t# taglen) |
| 42 | { |
| 43 | struct kcapi_handle_tfmcxx . . $ kcapi_handle_tfm# *tfm = handle->tfmcxx . . $ kcapi_handle#tfm.; |
| 44 | |
| 45 | handle->aeadcxx . . $ kcapi_handle#aead..tagcxx . . $ kcapi_aead_data#tag. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 46 | handle->aeadcxx . . $ kcapi_handle#aead..taglencxx . . $ kcapi_aead_data#taglen. = taglen; |
| 47 | if (setsockoptcxx . . $ setsockopt(506cc1d0fc70fdf1).(tfm->tfmfdcxx . . $ kcapi_handle_tfm#tfmfd., SOL_ALGcxx . . $ `<external>/8962547315054503424/socket.h:167:9`!, ALG_SET_AEAD_AUTHSIZEcxx . . $ `<external>/7256700519741588701/if_alg.h:53:9`!, |
| 48 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, taglen) == -1) |
| 49 | return -EINVALcxx . . $ `<external>/8987895939074593727/errno-base.h:26:9`!; |
| 50 | |
| 51 | return 0; |
| 52 | } |
| 53 | |
| 54 | IMPL_SYMVERcxx . . $ `lib/internal.h:363:10`!(aead_setassoclen, "1.3.1") |
| 55 | void impl_aead_setassoclencxx . . $ impl_aead_setassoclen(9c54bafaae9b2e82).(struct kcapi_handlecxx . . $ kcapi_handle# *handle, size_t assoclen) |
| 56 | { |
| 57 | handle->aeadcxx . . $ kcapi_handle#aead..assoclencxx . . $ kcapi_aead_data#assoclen. = assoclen; |
| 58 | } |
| 59 | |
| 60 | ORIG_SYMVERcxx . . $ `lib/internal.h:366:10`!(aead_setassoclen, "0.12.0") |
| 61 | void orig_aead_setassoclencxx . . $ orig_aead_setassoclen(7d84f3a1fd159834).(struct kcapi_handlecxx . . $ kcapi_handle# *handle, uint32_tcxx . . $ uint32_t# assoclen) |
| 62 | { |
| 63 | handle->aeadcxx . . $ kcapi_handle#aead..assoclencxx . . $ kcapi_aead_data#assoclen. = assoclen; |
| 64 | } |
| 65 | |
| 66 | IMPL_SYMVERcxx . . $ `lib/internal.h:363:10`!(aead_getdata_input, "1.3.1") |
| 67 | void impl_aead_getdata_inputcxx . . $ impl_aead_getdata_input(a7c1d69e2d55782f).(struct kcapi_handlecxx . . $ kcapi_handle# *handle, |
| 68 | uint8_tcxx . . $ uint8_t# *encdata, size_t encdatalen, int enc, |
| 69 | uint8_tcxx . . $ uint8_t# **aad, size_t *aadlen, |
| 70 | uint8_tcxx . . $ uint8_t# **data, size_t *datalen, |
| 71 | uint8_tcxx . . $ uint8_t# **tag, size_t *taglen) |
| 72 | { |
| 73 | uint8_tcxx . . $ uint8_t# *l_aad, *l_data, *l_tag; |
| 74 | size_t l_aadlen, l_datalen, l_taglen; |
| 75 | |
| 76 | if (encdatalen < handle->aeadcxx . . $ kcapi_handle#aead..assoclencxx . . $ kcapi_aead_data#assoclen.) { |
| 77 | kcapi_dologcxx . . $ kcapi_dolog(5f46d8f16dd28dce).(KCAPI_LOG_DEBUGcxx . . $ KCAPI_LOG_DEBUG., "AAD data not found"); |
| 78 | l_aad = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 79 | l_aadlen = 0; |
| 80 | } else { |
| 81 | l_aad = encdata; |
| 82 | l_aadlen = handle->aeadcxx . . $ kcapi_handle#aead..assoclencxx . . $ kcapi_aead_data#assoclen.; |
| 83 | encdatalen -= handle->aeadcxx . . $ kcapi_handle#aead..assoclencxx . . $ kcapi_aead_data#assoclen.; |
| 84 | } |
| 85 | |
| 86 | l_taglen = (enc && handle->flagscxx . . $ kcapi_handle#flags..ge_v4_9cxx . . $ kcapi_flags#ge_v4_9. == truecxx . . $ true.) ? 0 : |
| 87 | handle->aeadcxx . . $ kcapi_handle#aead..taglencxx . . $ kcapi_aead_data#taglen.; |
| 88 | /* databuffer is all between AAD buffer (if present) and tag */ |
| 89 | if (encdatalen < l_taglen) { |
| 90 | kcapi_dologcxx . . $ kcapi_dolog(5f46d8f16dd28dce).(KCAPI_LOG_DEBUGcxx . . $ KCAPI_LOG_DEBUG., |
| 91 | "Cipher result data not found"); |
| 92 | l_data = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 93 | l_datalen = 0; |
| 94 | } else { |
| 95 | l_data = encdata + l_aadlen; |
| 96 | l_datalen = encdatalen - l_taglen; |
| 97 | encdatalen -= l_datalen; |
| 98 | } |
| 99 | |
| 100 | if (l_taglen && encdatalen >= l_taglen) |
| 101 | l_tag = encdata + l_aadlen + l_datalen; |
| 102 | else { |
| 103 | l_tag = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 104 | l_taglen = 0; |
| 105 | } |
| 106 | |
| 107 | if (aad && encdata) |
| 108 | *aad = l_aad; |
| 109 | if (aadlen) |
| 110 | *aadlen = l_aadlen; |
| 111 | if (data && encdata) |
| 112 | *data = l_data; |
| 113 | if (datalen) |
| 114 | *datalen = l_datalen; |
| 115 | if (tag && encdata) |
| 116 | *tag = l_tag; |
| 117 | if (taglen) |
| 118 | *taglen = l_taglen; |
| 119 | } |
| 120 | |
| 121 | ORIG_SYMVERcxx . . $ `lib/internal.h:366:10`!(aead_getdata_input, "0.13.0") |
| 122 | void orig_aead_getdata_inputcxx . . $ orig_aead_getdata_input(9a928695131f1709).(struct kcapi_handlecxx . . $ kcapi_handle# *handle, |
| 123 | uint8_tcxx . . $ uint8_t# *encdata, uint32_tcxx . . $ uint32_t# encdatalen, int enc, |
| 124 | uint8_tcxx . . $ uint8_t# **aad, uint32_tcxx . . $ uint32_t# *aadlen, |
| 125 | uint8_tcxx . . $ uint8_t# **data, uint32_tcxx . . $ uint32_t# *datalen, |
| 126 | uint8_tcxx . . $ uint8_t# **tag, uint32_tcxx . . $ uint32_t# *taglen) |
| 127 | { |
| 128 | size_t s_aadlen; |
| 129 | size_t s_datalen; |
| 130 | size_t s_taglen; |
| 131 | |
| 132 | impl_aead_getdata_inputcxx . . $ impl_aead_getdata_input(a7c1d69e2d55782f).(handle, encdata, encdatalen, enc, |
| 133 | aad, aadlen?(&s_aadlen):NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, |
| 134 | data, datalen?(&s_datalen):NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, |
| 135 | tag, taglen?(&s_taglen):NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 136 | |
| 137 | if (aadlen) |
| 138 | *aadlen = (uint32_tcxx . . $ uint32_t#)s_aadlen; |
| 139 | |
| 140 | if (datalen) |
| 141 | *datalen = (uint32_tcxx . . $ uint32_t#)s_datalen; |
| 142 | |
| 143 | if (taglen) |
| 144 | *taglen = (uint32_tcxx . . $ uint32_t#)s_taglen; |
| 145 | } |
| 146 | |
| 147 | IMPL_SYMVERcxx . . $ `lib/internal.h:363:10`!(aead_getdata_output, "1.3.1") |
| 148 | void impl_aead_getdata_outputcxx . . $ impl_aead_getdata_output(a7c1d69e2d55782f).(struct kcapi_handlecxx . . $ kcapi_handle# *handle, |
| 149 | uint8_tcxx . . $ uint8_t# *encdata, size_t encdatalen, int enc, |
| 150 | uint8_tcxx . . $ uint8_t# **aad, size_t *aadlen, |
| 151 | uint8_tcxx . . $ uint8_t# **data, size_t *datalen, |
| 152 | uint8_tcxx . . $ uint8_t# **tag, size_t *taglen) |
| 153 | { |
| 154 | uint8_tcxx . . $ uint8_t# *l_aad, *l_data, *l_tag; |
| 155 | size_t l_aadlen, l_datalen, l_taglen; |
| 156 | |
| 157 | if (encdatalen < handle->aeadcxx . . $ kcapi_handle#aead..assoclencxx . . $ kcapi_aead_data#assoclen.) { |
| 158 | kcapi_dologcxx . . $ kcapi_dolog(5f46d8f16dd28dce).(KCAPI_LOG_ERRcxx . . $ KCAPI_LOG_ERR., "AAD data not found"); |
| 159 | l_aad = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 160 | l_aadlen = 0; |
| 161 | } else { |
| 162 | l_aad = encdata; |
| 163 | l_aadlen = handle->aeadcxx . . $ kcapi_handle#aead..assoclencxx . . $ kcapi_aead_data#assoclen.; |
| 164 | encdatalen -= handle->aeadcxx . . $ kcapi_handle#aead..assoclencxx . . $ kcapi_aead_data#assoclen.; |
| 165 | } |
| 166 | |
| 167 | /* with 4.9.0 we do not have a tag for decryption */ |
| 168 | if (handle->flagscxx . . $ kcapi_handle#flags..ge_v4_9cxx . . $ kcapi_flags#ge_v4_9. == truecxx . . $ true.) |
| 169 | l_taglen = (enc) ? handle->aeadcxx . . $ kcapi_handle#aead..taglencxx . . $ kcapi_aead_data#taglen. : 0; |
| 170 | else |
| 171 | l_taglen = handle->aeadcxx . . $ kcapi_handle#aead..taglencxx . . $ kcapi_aead_data#taglen.; |
| 172 | /* databuffer is all between AAD buffer (if present) and tag */ |
| 173 | if (encdatalen < l_taglen) { |
| 174 | kcapi_dologcxx . . $ kcapi_dolog(5f46d8f16dd28dce).(KCAPI_LOG_DEBUGcxx . . $ KCAPI_LOG_DEBUG., |
| 175 | "Cipher result data not found"); |
| 176 | l_data = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 177 | l_datalen = 0; |
| 178 | } else { |
| 179 | l_data = encdata + l_aadlen; |
| 180 | l_datalen = encdatalen - l_taglen; |
| 181 | encdatalen -= l_datalen; |
| 182 | } |
| 183 | |
| 184 | if (enc) { |
| 185 | if (encdatalen >= handle->aeadcxx . . $ kcapi_handle#aead..taglencxx . . $ kcapi_aead_data#taglen.) { |
| 186 | l_tag = encdata + l_aadlen + l_datalen; |
| 187 | l_taglen = handle->aeadcxx . . $ kcapi_handle#aead..taglencxx . . $ kcapi_aead_data#taglen.; |
| 188 | } else { |
| 189 | kcapi_dologcxx . . $ kcapi_dolog(5f46d8f16dd28dce).(KCAPI_LOG_DEBUGcxx . . $ KCAPI_LOG_DEBUG., |
| 190 | "Tag data not found"); |
| 191 | l_tag = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 192 | l_taglen = 0; |
| 193 | } |
| 194 | } else { |
| 195 | l_tag = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 196 | l_taglen = 0; |
| 197 | } |
| 198 | |
| 199 | if (aad && encdata) |
| 200 | *aad = l_aad; |
| 201 | if (aadlen) |
| 202 | *aadlen = l_aadlen; |
| 203 | if (data && encdata) |
| 204 | *data = l_data; |
| 205 | if (datalen) |
| 206 | *datalen = l_datalen; |
| 207 | if (tag && encdata) |
| 208 | *tag = l_tag; |
| 209 | if (taglen) |
| 210 | *taglen = l_taglen; |
| 211 | } |
| 212 | |
| 213 | ORIG_SYMVERcxx . . $ `lib/internal.h:366:10`!(aead_getdata_output, "0.13.0") |
| 214 | void orig_aead_getdata_outputcxx . . $ orig_aead_getdata_output(9a928695131f1709).(struct kcapi_handlecxx . . $ kcapi_handle# *handle, |
| 215 | uint8_tcxx . . $ uint8_t# *encdata, uint32_tcxx . . $ uint32_t# encdatalen, int enc, |
| 216 | uint8_tcxx . . $ uint8_t# **aad, uint32_tcxx . . $ uint32_t# *aadlen, |
| 217 | uint8_tcxx . . $ uint8_t# **data, uint32_tcxx . . $ uint32_t# *datalen, |
| 218 | uint8_tcxx . . $ uint8_t# **tag, uint32_tcxx . . $ uint32_t# *taglen) |
| 219 | { |
| 220 | size_t s_aadlen; |
| 221 | size_t s_datalen; |
| 222 | size_t s_taglen; |
| 223 | |
| 224 | impl_aead_getdata_outputcxx . . $ impl_aead_getdata_output(a7c1d69e2d55782f).(handle, encdata, encdatalen, enc, |
| 225 | aad, aadlen?(&s_aadlen):NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, |
| 226 | data, datalen?(&s_datalen):NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, |
| 227 | tag, taglen?(&s_taglen):NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 228 | |
| 229 | if (aadlen) |
| 230 | *aadlen = (uint32_tcxx . . $ uint32_t#)s_aadlen; |
| 231 | |
| 232 | if (datalen) |
| 233 | *datalen = (uint32_tcxx . . $ uint32_t#)s_datalen; |
| 234 | |
| 235 | if (taglen) |
| 236 | *taglen = (uint32_tcxx . . $ uint32_t#)s_taglen; |
| 237 | } |
| 238 | |
| 239 | IMPL_SYMVERcxx . . $ `lib/internal.h:363:10`!(aead_encrypt, "1.3.1") |
| 240 | ssize_tcxx . . $ ssize_t# impl_aead_encryptcxx . . $ impl_aead_encrypt(c011db556473c11f).(struct kcapi_handlecxx . . $ kcapi_handle# *handle, |
| 241 | const uint8_tcxx . . $ uint8_t# *in, size_t inlen, |
| 242 | const uint8_tcxx . . $ uint8_t# *iv, |
| 243 | uint8_tcxx . . $ uint8_t# *out, size_t outlen, int access) |
| 244 | { |
| 245 | ssize_tcxx . . $ ssize_t# ret = 0; |
| 246 | |
| 247 | handle->ciphercxx . . $ kcapi_handle#cipher..ivcxx . . $ kcapi_cipher_data#iv. = iv; |
| 248 | ret = _kcapi_cipher_cryptcxx . . $ _kcapi_cipher_crypt(8a744cecfacfebd9).(handle, in, inlen, out, outlen, access, |
| 249 | ALG_OP_ENCRYPTcxx . . $ `<external>/7256700519741588701/if_alg.h:59:9`!); |
| 250 | if (ret < 0) |
| 251 | return ret; |
| 252 | if ((ret < (int32_tcxx . . $ int32_t#)handle->aeadcxx . . $ kcapi_handle#aead..taglencxx . . $ kcapi_aead_data#taglen.)) |
| 253 | return -E2BIGcxx . . $ `<external>/8987895939074593727/errno-base.h:11:9`!; |
| 254 | |
| 255 | return ret; |
| 256 | } |
| 257 | |
| 258 | ORIG_SYMVERcxx . . $ `lib/internal.h:366:10`!(aead_encrypt, "0.12.0") |
| 259 | int32_tcxx . . $ int32_t# orig_aead_encryptcxx . . $ orig_aead_encrypt(2bb63b96ebaef8c9).(struct kcapi_handlecxx . . $ kcapi_handle# *handle, |
| 260 | const uint8_tcxx . . $ uint8_t# *in, uint32_tcxx . . $ uint32_t# inlen, |
| 261 | const uint8_tcxx . . $ uint8_t# *iv, |
| 262 | uint8_tcxx . . $ uint8_t# *out, uint32_tcxx . . $ uint32_t# outlen, int access) |
| 263 | { |
| 264 | return (int32_tcxx . . $ int32_t#)impl_aead_encryptcxx . . $ impl_aead_encrypt(c011db556473c11f).(handle, in, inlen, iv, out, outlen, |
| 265 | access); |
| 266 | } |
| 267 | |
| 268 | /* |
| 269 | * Fallback function if AIO is not present, but caller requested AIO operation. |
| 270 | */ |
| 271 | static ssize_tcxx . . $ ssize_t# |
| 272 | _kcapi_aead_encrypt_aio_fallbackcxx . . $ _kcapi_aead_encrypt_aio_fallback(555cd3245f36046).(struct kcapi_handlecxx . . $ kcapi_handle# *handle, |
| 273 | struct ioveccxx . . $ iovec# *iniov, struct ioveccxx . . $ iovec# *outiov, |
| 274 | size_t iovlen, const uint8_tcxx . . $ uint8_t# *iv) |
| 275 | { |
| 276 | size_t i; |
| 277 | ssize_tcxx . . $ ssize_t# ret = 0; |
| 278 | |
| 279 | for (i = 0; i < iovlen; i++) { |
| 280 | ssize_tcxx . . $ ssize_t# rc = kcapi_aead_stream_init_enccxx . . $ kcapi_aead_stream_init_enc(71df3816f1c2c97b).(handle, iv, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, 0); |
| 281 | |
| 282 | if (rc < 0) |
| 283 | return rc; |
| 284 | |
| 285 | rc = kcapi_aead_stream_update_lastcxx . . $ kcapi_aead_stream_update_last(8a8f5b62e036cb66).(handle, iniov, 1); |
| 286 | if (rc < 0) |
| 287 | return rc; |
| 288 | |
| 289 | rc = kcapi_aead_stream_opcxx . . $ kcapi_aead_stream_op(8a8f5b62e036cb66).(handle, outiov, 1); |
| 290 | if (rc < 0) |
| 291 | return rc; |
| 292 | |
| 293 | ret += rc; |
| 294 | |
| 295 | iniov++; |
| 296 | outiov++; |
| 297 | } |
| 298 | |
| 299 | return ret; |
| 300 | } |
| 301 | |
| 302 | IMPL_SYMVERcxx . . $ `lib/internal.h:363:10`!(aead_encrypt_aio, "1.3.1") |
| 303 | ssize_tcxx . . $ ssize_t# impl_aead_encrypt_aiocxx . . $ impl_aead_encrypt_aio(642fe7813a90216d).(struct kcapi_handlecxx . . $ kcapi_handle# *handle, struct ioveccxx . . $ iovec# *iniov, |
| 304 | struct ioveccxx . . $ iovec# *outiov, size_t iovlen, |
| 305 | const uint8_tcxx . . $ uint8_t# *iv, int access) |
| 306 | { |
| 307 | ssize_tcxx . . $ ssize_t# ret = 0; |
| 308 | |
| 309 | handle->ciphercxx . . $ kcapi_handle#cipher..ivcxx . . $ kcapi_cipher_data#iv. = iv; |
| 310 | |
| 311 | ret = _kcapi_cipher_crypt_aiocxx . . $ _kcapi_cipher_crypt_aio(2eaa747523f18d63).(handle, iniov, outiov, iovlen, |
| 312 | access, ALG_OP_ENCRYPTcxx . . $ `<external>/7256700519741588701/if_alg.h:59:9`!); |
| 313 | if (ret != -EOPNOTSUPPcxx . . $ `<external>/17922322188510340118/errno.h:79:9`!) |
| 314 | return ret; |
| 315 | |
| 316 | return _kcapi_aead_encrypt_aio_fallbackcxx . . $ _kcapi_aead_encrypt_aio_fallback(555cd3245f36046).(handle, iniov, outiov, iovlen, |
| 317 | iv); |
| 318 | } |
| 319 | |
| 320 | ORIG_SYMVERcxx . . $ `lib/internal.h:366:10`!(aead_encrypt_aio, "0.12.0") |
| 321 | int32_tcxx . . $ int32_t# orig_aead_encrypt_aiocxx . . $ orig_aead_encrypt_aio(9c7ca60b62de7fac).(struct kcapi_handlecxx . . $ kcapi_handle# *handle, struct ioveccxx . . $ iovec# *iniov, |
| 322 | struct ioveccxx . . $ iovec# *outiov, uint32_tcxx . . $ uint32_t# iovlen, |
| 323 | const uint8_tcxx . . $ uint8_t# *iv, int access) |
| 324 | { |
| 325 | return (int32_tcxx . . $ int32_t#)impl_aead_encrypt_aiocxx . . $ impl_aead_encrypt_aio(642fe7813a90216d).(handle, iniov, outiov, iovlen, |
| 326 | iv, access); |
| 327 | } |
| 328 | |
| 329 | IMPL_SYMVERcxx . . $ `lib/internal.h:363:10`!(aead_decrypt, "1.3.1") |
| 330 | ssize_tcxx . . $ ssize_t# impl_aead_decryptcxx . . $ impl_aead_decrypt(c011db556473c11f).(struct kcapi_handlecxx . . $ kcapi_handle# *handle, |
| 331 | const uint8_tcxx . . $ uint8_t# *in, size_t inlen, |
| 332 | const uint8_tcxx . . $ uint8_t# *iv, |
| 333 | uint8_tcxx . . $ uint8_t# *out, size_t outlen, int access) |
| 334 | { |
| 335 | handle->ciphercxx . . $ kcapi_handle#cipher..ivcxx . . $ kcapi_cipher_data#iv. = iv; |
| 336 | return _kcapi_cipher_cryptcxx . . $ _kcapi_cipher_crypt(8a744cecfacfebd9).(handle, in, inlen, out, outlen, access, |
| 337 | ALG_OP_DECRYPTcxx . . $ `<external>/7256700519741588701/if_alg.h:58:9`!); |
| 338 | } |
| 339 | |
| 340 | ORIG_SYMVERcxx . . $ `lib/internal.h:366:10`!(aead_decrypt, "0.12.0") |
| 341 | int32_tcxx . . $ int32_t# orig_aead_decryptcxx . . $ orig_aead_decrypt(2bb63b96ebaef8c9).(struct kcapi_handlecxx . . $ kcapi_handle# *handle, |
| 342 | const uint8_tcxx . . $ uint8_t# *in, uint32_tcxx . . $ uint32_t# inlen, |
| 343 | const uint8_tcxx . . $ uint8_t# *iv, |
| 344 | uint8_tcxx . . $ uint8_t# *out, uint32_tcxx . . $ uint32_t# outlen, int access) |
| 345 | { |
| 346 | return (int32_tcxx . . $ int32_t#)impl_aead_decryptcxx . . $ impl_aead_decrypt(c011db556473c11f).(handle, in, inlen, iv, out, outlen, |
| 347 | access); |
| 348 | } |
| 349 | |
| 350 | /* |
| 351 | * Fallback function if AIO is not present, but caller requested AIO operation. |
| 352 | */ |
| 353 | static ssize_tcxx . . $ ssize_t# |
| 354 | _kcapi_aead_decrypt_aio_fallbackcxx . . $ _kcapi_aead_decrypt_aio_fallback(555cd3245f36046).(struct kcapi_handlecxx . . $ kcapi_handle# *handle, |
| 355 | struct ioveccxx . . $ iovec# *iniov, struct ioveccxx . . $ iovec# *outiov, |
| 356 | size_t iovlen, const uint8_tcxx . . $ uint8_t# *iv) |
| 357 | { |
| 358 | size_t i; |
| 359 | ssize_tcxx . . $ ssize_t# ret = 0; |
| 360 | |
| 361 | for (i = 0; i < iovlen; i++) { |
| 362 | ssize_tcxx . . $ ssize_t# rc = kcapi_aead_stream_init_deccxx . . $ kcapi_aead_stream_init_dec(71df3816f1c2c97b).(handle, iv, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, 0); |
| 363 | |
| 364 | if (rc < 0) |
| 365 | return rc; |
| 366 | |
| 367 | rc = kcapi_aead_stream_update_lastcxx . . $ kcapi_aead_stream_update_last(8a8f5b62e036cb66).(handle, iniov, 1); |
| 368 | if (rc < 0) |
| 369 | return rc; |
| 370 | |
| 371 | rc = kcapi_aead_stream_opcxx . . $ kcapi_aead_stream_op(8a8f5b62e036cb66).(handle, outiov, 1); |
| 372 | if (rc < 0) |
| 373 | return rc; |
| 374 | |
| 375 | ret += rc; |
| 376 | |
| 377 | iniov++; |
| 378 | outiov++; |
| 379 | } |
| 380 | |
| 381 | return ret; |
| 382 | } |
| 383 | |
| 384 | IMPL_SYMVERcxx . . $ `lib/internal.h:363:10`!(aead_decrypt_aio, "1.3.1") |
| 385 | ssize_tcxx . . $ ssize_t# impl_aead_decrypt_aiocxx . . $ impl_aead_decrypt_aio(642fe7813a90216d).(struct kcapi_handlecxx . . $ kcapi_handle# *handle, struct ioveccxx . . $ iovec# *iniov, |
| 386 | struct ioveccxx . . $ iovec# *outiov, size_t iovlen, |
| 387 | const uint8_tcxx . . $ uint8_t# *iv, int access) |
| 388 | { |
| 389 | ssize_tcxx . . $ ssize_t# ret = 0; |
| 390 | |
| 391 | handle->ciphercxx . . $ kcapi_handle#cipher..ivcxx . . $ kcapi_cipher_data#iv. = iv; |
| 392 | |
| 393 | ret = _kcapi_cipher_crypt_aiocxx . . $ _kcapi_cipher_crypt_aio(2eaa747523f18d63).(handle, iniov, outiov, iovlen, |
| 394 | access, ALG_OP_DECRYPTcxx . . $ `<external>/7256700519741588701/if_alg.h:58:9`!); |
| 395 | |
| 396 | if (ret != -EOPNOTSUPPcxx . . $ `<external>/17922322188510340118/errno.h:79:9`!) |
| 397 | return ret; |
| 398 | |
| 399 | return _kcapi_aead_decrypt_aio_fallbackcxx . . $ _kcapi_aead_decrypt_aio_fallback(555cd3245f36046).(handle, iniov, outiov, iovlen, |
| 400 | iv); |
| 401 | } |
| 402 | |
| 403 | ORIG_SYMVERcxx . . $ `lib/internal.h:366:10`!(aead_decrypt_aio, "0.12.0") |
| 404 | int32_tcxx . . $ int32_t# orig_aead_decrypt_aiocxx . . $ orig_aead_decrypt_aio(9c7ca60b62de7fac).(struct kcapi_handlecxx . . $ kcapi_handle# *handle, struct ioveccxx . . $ iovec# *iniov, |
| 405 | struct ioveccxx . . $ iovec# *outiov, uint32_tcxx . . $ uint32_t# iovlen, |
| 406 | const uint8_tcxx . . $ uint8_t# *iv, int access) |
| 407 | { |
| 408 | return (int32_tcxx . . $ int32_t#)impl_aead_decrypt_aiocxx . . $ impl_aead_decrypt_aio(642fe7813a90216d).(handle, iniov, outiov, iovlen, |
| 409 | iv, access); |
| 410 | } |
| 411 | |
| 412 | IMPL_SYMVERcxx . . $ `lib/internal.h:363:10`!(aead_stream_init_enc, "1.3.1") |
| 413 | ssize_tcxx . . $ ssize_t# impl_aead_stream_init_enccxx . . $ impl_aead_stream_init_enc(71df3816f1c2c97b).(struct kcapi_handlecxx . . $ kcapi_handle# *handle, |
| 414 | const uint8_tcxx . . $ uint8_t# *iv, |
| 415 | struct ioveccxx . . $ iovec# *iov, size_t iovlen) |
| 416 | { |
| 417 | handle->ciphercxx . . $ kcapi_handle#cipher..ivcxx . . $ kcapi_cipher_data#iv. = iv; |
| 418 | return _kcapi_common_send_metacxx . . $ _kcapi_common_send_meta(f4e40828a4f4c91f).(handle, iov, iovlen, ALG_OP_ENCRYPTcxx . . $ `<external>/7256700519741588701/if_alg.h:59:9`!, |
| 419 | MSG_MOREcxx . . $ `<external>/8962547315054503424/socket.h:244:9`!); |
| 420 | } |
| 421 | |
| 422 | ORIG_SYMVERcxx . . $ `lib/internal.h:366:10`!(aead_stream_init_enc, "0.12.0") |
| 423 | int32_tcxx . . $ int32_t# orig_aead_stream_init_enccxx . . $ orig_aead_stream_init_enc(9733c0cb68428d4b).(struct kcapi_handlecxx . . $ kcapi_handle# *handle, |
| 424 | const uint8_tcxx . . $ uint8_t# *iv, |
| 425 | struct ioveccxx . . $ iovec# *iov, uint32_tcxx . . $ uint32_t# iovlen) |
| 426 | { |
| 427 | return (int32_tcxx . . $ int32_t#)impl_aead_stream_init_enccxx . . $ impl_aead_stream_init_enc(71df3816f1c2c97b).(handle, iv, iov, iovlen); |
| 428 | } |
| 429 | |
| 430 | IMPL_SYMVERcxx . . $ `lib/internal.h:363:10`!(aead_stream_init_dec, "1.3.1") |
| 431 | ssize_tcxx . . $ ssize_t# impl_aead_stream_init_deccxx . . $ impl_aead_stream_init_dec(71df3816f1c2c97b).(struct kcapi_handlecxx . . $ kcapi_handle# *handle, |
| 432 | const uint8_tcxx . . $ uint8_t# *iv, |
| 433 | struct ioveccxx . . $ iovec# *iov, size_t iovlen) |
| 434 | { |
| 435 | handle->ciphercxx . . $ kcapi_handle#cipher..ivcxx . . $ kcapi_cipher_data#iv. = iv; |
| 436 | return _kcapi_common_send_metacxx . . $ _kcapi_common_send_meta(f4e40828a4f4c91f).(handle, iov, iovlen, ALG_OP_DECRYPTcxx . . $ `<external>/7256700519741588701/if_alg.h:58:9`!, |
| 437 | MSG_MOREcxx . . $ `<external>/8962547315054503424/socket.h:244:9`!); |
| 438 | } |
| 439 | |
| 440 | ORIG_SYMVERcxx . . $ `lib/internal.h:366:10`!(aead_stream_init_dec, "0.12.0") |
| 441 | int32_tcxx . . $ int32_t# orig_aead_stream_init_deccxx . . $ orig_aead_stream_init_dec(9733c0cb68428d4b).(struct kcapi_handlecxx . . $ kcapi_handle# *handle, |
| 442 | const uint8_tcxx . . $ uint8_t# *iv, |
| 443 | struct ioveccxx . . $ iovec# *iov, uint32_tcxx . . $ uint32_t# iovlen) |
| 444 | { |
| 445 | return (int32_tcxx . . $ int32_t#)impl_aead_stream_init_deccxx . . $ impl_aead_stream_init_dec(71df3816f1c2c97b).(handle, iv, iov, iovlen); |
| 446 | } |
| 447 | |
| 448 | IMPL_SYMVERcxx . . $ `lib/internal.h:363:10`!(aead_stream_update, "1.3.1") |
| 449 | ssize_tcxx . . $ ssize_t# impl_aead_stream_updatecxx . . $ impl_aead_stream_update(8a8f5b62e036cb66).(struct kcapi_handlecxx . . $ kcapi_handle# *handle, |
| 450 | struct ioveccxx . . $ iovec# *iov, size_t iovlen) |
| 451 | { |
| 452 | if (handle->processed_sgcxx . . $ kcapi_handle#processed_sg. <= handle->flagscxx . . $ kcapi_handle#flags..alg_max_pagescxx . . $ kcapi_flags#alg_max_pages.) |
| 453 | return _kcapi_common_vmsplice_iovcxx . . $ _kcapi_common_vmsplice_iov(367dd066ce527de7).(handle, iov, iovlen, |
| 454 | SPLICE_F_MOREcxx . . $ `<external>/14578502075116107718/fcntl-linux.h:350:10`!); |
| 455 | else |
| 456 | return _kcapi_common_send_datacxx . . $ _kcapi_common_send_data(367dd066ce527de7).(handle, iov, iovlen, MSG_MOREcxx . . $ `<external>/8962547315054503424/socket.h:244:9`!); |
| 457 | } |
| 458 | |
| 459 | ORIG_SYMVERcxx . . $ `lib/internal.h:366:10`!(aead_stream_update, "0.12.0") |
| 460 | int32_tcxx . . $ int32_t# orig_aead_stream_updatecxx . . $ orig_aead_stream_update(c4d2c5412bbf44d9).(struct kcapi_handlecxx . . $ kcapi_handle# *handle, |
| 461 | struct ioveccxx . . $ iovec# *iov, uint32_tcxx . . $ uint32_t# iovlen) |
| 462 | { |
| 463 | return (int32_tcxx . . $ int32_t#)impl_aead_stream_updatecxx . . $ impl_aead_stream_update(8a8f5b62e036cb66).(handle, iov, iovlen); |
| 464 | } |
| 465 | |
| 466 | IMPL_SYMVERcxx . . $ `lib/internal.h:363:10`!(aead_stream_update_last, "1.3.1") |
| 467 | ssize_tcxx . . $ ssize_t# impl_aead_stream_update_lastcxx . . $ impl_aead_stream_update_last(8a8f5b62e036cb66).(struct kcapi_handlecxx . . $ kcapi_handle# *handle, |
| 468 | struct ioveccxx . . $ iovec# *iov, size_t iovlen) |
| 469 | { |
| 470 | if (handle->processed_sgcxx . . $ kcapi_handle#processed_sg. <= handle->flagscxx . . $ kcapi_handle#flags..alg_max_pagescxx . . $ kcapi_flags#alg_max_pages.) |
| 471 | return _kcapi_common_vmsplice_iovcxx . . $ _kcapi_common_vmsplice_iov(367dd066ce527de7).(handle, iov, iovlen, 0); |
| 472 | else |
| 473 | return _kcapi_common_send_datacxx . . $ _kcapi_common_send_data(367dd066ce527de7).(handle, iov, iovlen, 0); |
| 474 | } |
| 475 | |
| 476 | ORIG_SYMVERcxx . . $ `lib/internal.h:366:10`!(aead_stream_update_last, "0.12.0") |
| 477 | int32_tcxx . . $ int32_t# orig_aead_stream_update_lastcxx . . $ orig_aead_stream_update_last(c4d2c5412bbf44d9).(struct kcapi_handlecxx . . $ kcapi_handle# *handle, |
| 478 | struct ioveccxx . . $ iovec# *iov, uint32_tcxx . . $ uint32_t# iovlen) |
| 479 | { |
| 480 | return (int32_tcxx . . $ int32_t#)impl_aead_stream_update_lastcxx . . $ impl_aead_stream_update_last(8a8f5b62e036cb66).(handle, iov, iovlen); |
| 481 | } |
| 482 | |
| 483 | IMPL_SYMVERcxx . . $ `lib/internal.h:363:10`!(aead_stream_op, "1.3.1") |
| 484 | ssize_tcxx . . $ ssize_t# impl_aead_stream_opcxx . . $ impl_aead_stream_op(8a8f5b62e036cb66).(struct kcapi_handlecxx . . $ kcapi_handle# *handle, |
| 485 | struct ioveccxx . . $ iovec# *iov, size_t iovlen) |
| 486 | { |
| 487 | if (!iov) { |
| 488 | kcapi_dologcxx . . $ kcapi_dolog(5f46d8f16dd28dce).(KCAPI_LOG_ERRcxx . . $ KCAPI_LOG_ERR., |
| 489 | "AEAD operation: No buffer for output data provided"); |
| 490 | return -EINVALcxx . . $ `<external>/8987895939074593727/errno-base.h:26:9`!; |
| 491 | } |
| 492 | |
| 493 | return _kcapi_common_recv_datacxx . . $ _kcapi_common_recv_data(8a8f5b62e036cb66).(handle, iov, iovlen); |
| 494 | } |
| 495 | |
| 496 | ORIG_SYMVERcxx . . $ `lib/internal.h:366:10`!(aead_stream_op, "0.12.0") |
| 497 | int32_tcxx . . $ int32_t# orig_aead_stream_opcxx . . $ orig_aead_stream_op(c4d2c5412bbf44d9).(struct kcapi_handlecxx . . $ kcapi_handle# *handle, |
| 498 | struct ioveccxx . . $ iovec# *iov, uint32_tcxx . . $ uint32_t# iovlen) |
| 499 | { |
| 500 | return (int32_tcxx . . $ int32_t#)impl_aead_stream_opcxx . . $ impl_aead_stream_op(8a8f5b62e036cb66).(handle, iov, iovlen); |
| 501 | } |
| 502 | |
| 503 | uint32_tcxx . . $ uint32_t# kcapi_aead_ivsizecxx . . $ kcapi_aead_ivsize(994c7fcc3809be77).(struct kcapi_handlecxx . . $ kcapi_handle# *handle) |
| 504 | { |
| 505 | struct kcapi_handle_tfmcxx . . $ kcapi_handle_tfm# *tfm = handle->tfmcxx . . $ kcapi_handle#tfm.; |
| 506 | |
| 507 | return tfm->infocxx . . $ kcapi_handle_tfm#info..ivsizecxx . . $ kcapi_cipher_info#ivsize.; |
| 508 | } |
| 509 | |
| 510 | uint32_tcxx . . $ uint32_t# kcapi_aead_blocksizecxx . . $ kcapi_aead_blocksize(994c7fcc3809be77).(struct kcapi_handlecxx . . $ kcapi_handle# *handle) |
| 511 | { |
| 512 | struct kcapi_handle_tfmcxx . . $ kcapi_handle_tfm# *tfm = handle->tfmcxx . . $ kcapi_handle#tfm.; |
| 513 | |
| 514 | return tfm->infocxx . . $ kcapi_handle_tfm#info..blocksizecxx . . $ kcapi_cipher_info#blocksize.; |
| 515 | } |
| 516 | |
| 517 | uint32_tcxx . . $ uint32_t# kcapi_aead_authsizecxx . . $ kcapi_aead_authsize(994c7fcc3809be77).(struct kcapi_handlecxx . . $ kcapi_handle# *handle) |
| 518 | { |
| 519 | struct kcapi_handle_tfmcxx . . $ kcapi_handle_tfm# *tfm = handle->tfmcxx . . $ kcapi_handle#tfm.; |
| 520 | |
| 521 | return tfm->infocxx . . $ kcapi_handle_tfm#info..aead_maxauthsizecxx . . $ kcapi_cipher_info#aead_maxauthsize.; |
| 522 | } |
| 523 | |
| 524 | IMPL_SYMVERcxx . . $ `lib/internal.h:363:10`!(aead_inbuflen_enc, "1.3.1") |
| 525 | size_t impl_aead_inbuflen_enccxx . . $ impl_aead_inbuflen_enc(7ed64dbb494a2be8).(struct kcapi_handlecxx . . $ kcapi_handle# *handle, |
| 526 | size_t inlen, size_t assoclen, size_t taglen) |
| 527 | { |
| 528 | size_t len = inlen + assoclen; |
| 529 | |
| 530 | if (!handle->flagscxx . . $ kcapi_handle#flags..ge_v4_9cxx . . $ kcapi_flags#ge_v4_9. == truecxx . . $ true.) |
| 531 | len += taglen; |
| 532 | |
| 533 | return len; |
| 534 | } |
| 535 | |
| 536 | ORIG_SYMVERcxx . . $ `lib/internal.h:366:10`!(aead_inbuflen_enc, "0.13.0") |
| 537 | uint32_tcxx . . $ uint32_t# orig_aead_inbuflen_enccxx . . $ orig_aead_inbuflen_enc(bc6ba79e1f9cc2e2).(struct kcapi_handlecxx . . $ kcapi_handle# *handle, |
| 538 | uint32_tcxx . . $ uint32_t# inlen, uint32_tcxx . . $ uint32_t# assoclen, |
| 539 | uint32_tcxx . . $ uint32_t# taglen) |
| 540 | { |
| 541 | return (uint32_tcxx . . $ uint32_t#)impl_aead_inbuflen_enccxx . . $ impl_aead_inbuflen_enc(7ed64dbb494a2be8).(handle, inlen, assoclen, |
| 542 | taglen); |
| 543 | } |
| 544 | |
| 545 | IMPL_SYMVERcxx . . $ `lib/internal.h:363:10`!(aead_inbuflen_dec, "1.3.1") |
| 546 | size_t impl_aead_inbuflen_deccxx . . $ impl_aead_inbuflen_dec(7ed64dbb494a2be8).(struct kcapi_handlecxx . . $ kcapi_handle# *handle, |
| 547 | size_t inlen, size_t assoclen, size_t taglen) |
| 548 | { |
| 549 | (void)handle; |
| 550 | return (inlen + assoclen + taglen); |
| 551 | } |
| 552 | |
| 553 | ORIG_SYMVERcxx . . $ `lib/internal.h:366:10`!(aead_inbuflen_dec, "0.13.0") |
| 554 | uint32_tcxx . . $ uint32_t# orig_aead_inbuflen_deccxx . . $ orig_aead_inbuflen_dec(bc6ba79e1f9cc2e2).(struct kcapi_handlecxx . . $ kcapi_handle# *handle, |
| 555 | uint32_tcxx . . $ uint32_t# inlen, uint32_tcxx . . $ uint32_t# assoclen, |
| 556 | uint32_tcxx . . $ uint32_t# taglen) |
| 557 | { |
| 558 | return (uint32_tcxx . . $ uint32_t#)impl_aead_inbuflen_deccxx . . $ impl_aead_inbuflen_dec(7ed64dbb494a2be8).(handle, inlen, assoclen, |
| 559 | taglen); |
| 560 | } |
| 561 | |
| 562 | IMPL_SYMVERcxx . . $ `lib/internal.h:363:10`!(aead_outbuflen_enc, "1.3.1") |
| 563 | size_t impl_aead_outbuflen_enccxx . . $ impl_aead_outbuflen_enc(7ed64dbb494a2be8).(struct kcapi_handlecxx . . $ kcapi_handle# *handle, |
| 564 | size_t inlen, size_t assoclen, |
| 565 | size_t taglen) |
| 566 | { |
| 567 | struct kcapi_handle_tfmcxx . . $ kcapi_handle_tfm# *tfm = handle->tfmcxx . . $ kcapi_handle#tfm.; |
| 568 | uint32_tcxx . . $ uint32_t# bs = tfm->infocxx . . $ kcapi_handle_tfm#info..blocksizecxx . . $ kcapi_cipher_info#blocksize.; |
| 569 | size_t outlen = (inlen + bs - 1) / bs * bs + taglen + assoclen; |
| 570 | |
| 571 | /* the kernel does not like zero length output buffers */ |
| 572 | if (!outlen) |
| 573 | outlen = 1; |
| 574 | |
| 575 | return outlen; |
| 576 | } |
| 577 | |
| 578 | ORIG_SYMVERcxx . . $ `lib/internal.h:366:10`!(aead_outbuflen_enc, "0.13.0") |
| 579 | uint32_tcxx . . $ uint32_t# orig_aead_outbuflen_enccxx . . $ orig_aead_outbuflen_enc(bc6ba79e1f9cc2e2).(struct kcapi_handlecxx . . $ kcapi_handle# *handle, |
| 580 | uint32_tcxx . . $ uint32_t# inlen, uint32_tcxx . . $ uint32_t# assoclen, |
| 581 | uint32_tcxx . . $ uint32_t# taglen) |
| 582 | { |
| 583 | return (uint32_tcxx . . $ uint32_t#)impl_aead_outbuflen_enccxx . . $ impl_aead_outbuflen_enc(7ed64dbb494a2be8).(handle, inlen, assoclen, |
| 584 | taglen); |
| 585 | } |
| 586 | |
| 587 | IMPL_SYMVERcxx . . $ `lib/internal.h:363:10`!(aead_outbuflen_dec, "1.3.1") |
| 588 | size_t impl_aead_outbuflen_deccxx . . $ impl_aead_outbuflen_dec(7ed64dbb494a2be8).(struct kcapi_handlecxx . . $ kcapi_handle# *handle, |
| 589 | size_t inlen, size_t assoclen, |
| 590 | size_t taglen) |
| 591 | { |
| 592 | struct kcapi_handle_tfmcxx . . $ kcapi_handle_tfm# *tfm = handle->tfmcxx . . $ kcapi_handle#tfm.; |
| 593 | uint32_tcxx . . $ uint32_t# bs = tfm->infocxx . . $ kcapi_handle_tfm#info..blocksizecxx . . $ kcapi_cipher_info#blocksize.; |
| 594 | size_t outlen = (inlen + bs - 1) / bs * bs + assoclen; |
| 595 | |
| 596 | if (!handle->flagscxx . . $ kcapi_handle#flags..ge_v4_9cxx . . $ kcapi_flags#ge_v4_9. == truecxx . . $ true.) |
| 597 | outlen += taglen; |
| 598 | |
| 599 | /* the kernel does not like zero length output buffers */ |
| 600 | if (!outlen) |
| 601 | outlen = 1; |
| 602 | |
| 603 | return outlen; |
| 604 | } |
| 605 | |
| 606 | ORIG_SYMVERcxx . . $ `lib/internal.h:366:10`!(aead_outbuflen_dec, "0.13.0") |
| 607 | uint32_tcxx . . $ uint32_t# orig_aead_outbuflen_deccxx . . $ orig_aead_outbuflen_dec(bc6ba79e1f9cc2e2).(struct kcapi_handlecxx . . $ kcapi_handle# *handle, |
| 608 | uint32_tcxx . . $ uint32_t# inlen, uint32_tcxx . . $ uint32_t# assoclen, |
| 609 | uint32_tcxx . . $ uint32_t# taglen) |
| 610 | { |
| 611 | return (uint32_tcxx . . $ uint32_t#)impl_aead_outbuflen_deccxx . . $ impl_aead_outbuflen_dec(7ed64dbb494a2be8).(handle, inlen, assoclen, |
| 612 | taglen); |
| 613 | } |
| 614 | |
| 615 | int kcapi_aead_ccm_nonce_to_ivcxx . . $ kcapi_aead_ccm_nonce_to_iv(28c625d051fa9729).(const uint8_tcxx . . $ uint8_t# *nonce, uint32_tcxx . . $ uint32_t# noncelen, |
| 616 | uint8_tcxx . . $ uint8_t# **iv, uint32_tcxx . . $ uint32_t# *ivlen) |
| 617 | { |
| 618 | uint8_tcxx . . $ uint8_t# *newiv = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 619 | uint8_tcxx . . $ uint8_t# l = (uint8_tcxx . . $ uint8_t#)(16 - 2 - noncelen); |
| 620 | int ret = 0; |
| 621 | |
| 622 | if (noncelen > 16 - 2) |
| 623 | return -EINVALcxx . . $ `<external>/8987895939074593727/errno-base.h:26:9`!; |
| 624 | ret = posix_memaligncxx . . $ posix_memalign(e974a8a87fa206f3).((void *)&newiv, 16, 16); |
| 625 | if (ret) |
| 626 | return -ret; |
| 627 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(newiv, 0, 16); |
| 628 | newiv[0] = l; |
| 629 | memcpycxx . . $ memcpy(cc817cb175f282d).(newiv + 1, nonce, noncelen); |
| 630 | |
| 631 | *iv = newiv; |
| 632 | *ivlen = 16; |
| 633 | |
| 634 | return 0; |
| 635 | } |