| 1 | /******************************************************************************* |
| 2 | Copyright (c) 2009-2024, Intel Corporation |
| 3 | |
| 4 | Redistribution and use in source and binary forms, with or without |
| 5 | modification, are permitted provided that the following conditions are met: |
| 6 | |
| 7 | * Redistributions of source code must retain the above copyright notice, |
| 8 | this list of conditions and the following disclaimer. |
| 9 | * Redistributions in binary form must reproduce the above copyright |
| 10 | notice, this list of conditions and the following disclaimer in the |
| 11 | documentation and/or other materials provided with the distribution. |
| 12 | * Neither the name of Intel Corporation nor the names of its contributors |
| 13 | may be used to endorse or promote products derived from this software |
| 14 | without specific prior written permission. |
| 15 | |
| 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 17 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 18 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE |
| 20 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 21 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| 22 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
| 23 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| 24 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 26 | *******************************************************************************/ |
| 27 | |
| 28 | #include <limits.h> |
| 29 | |
| 30 | #define CLEAR_SCRATCH_SIMD_REGScxx . . $ `lib/sse_t1/kasumi_sse.c:30:9`! clear_scratch_xmms_sse |
| 31 | |
| 32 | #include "include/kasumi_internal.h"cxx . . $ `<file>/lib/include/kasumi_internal.h`/ |
| 33 | #include "include/save_xmms.h"cxx . . $ `<file>/lib/include/save_xmms.h`/ |
| 34 | #include "include/clear_regs_mem.h"cxx . . $ `<file>/lib/include/clear_regs_mem.h`/ |
| 35 | #include "include/error.h"cxx . . $ `<file>/lib/include/error.h`/ |
| 36 | |
| 37 | #define SAVE_XMMScxx . . $ `lib/sse_t1/kasumi_sse.c:37:9`! save_xmms |
| 38 | #define RESTORE_XMMScxx . . $ `lib/sse_t1/kasumi_sse.c:38:9`! restore_xmms |
| 39 | |
| 40 | void |
| 41 | kasumi_f8_1_buffer_ssecxx . . $ kasumi_f8_1_buffer_sse(bc9a9741f6da43c1).(const kasumi_key_sched_tcxx . . $ kasumi_key_sched_t# *pCtx, const uint64_tcxx . . $ uint64_t# IV, const void *pBufferIn, |
| 42 | void *pBufferOut, const uint32_tcxx . . $ uint32_t# cipherLengthInBytes) |
| 43 | { |
| 44 | #ifndef LINUXcxx . . $ `<built-in>:413:9`! |
| 45 | DECLARE_ALIGNED(imb_uint128_t xmm_save[10], 16); |
| 46 | |
| 47 | SAVE_XMMS(xmm_save); |
| 48 | #endif |
| 49 | #ifdef SAFE_PARAMcxx . . $ `<built-in>:418:9`! |
| 50 | /* Check for NULL pointers */ |
| 51 | imb_set_errnocxx . . $ imb_set_errno(beec41fcb78e7267).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, 0); |
| 52 | if (pCtx == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 53 | imb_set_errnocxx . . $ imb_set_errno(beec41fcb78e7267).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, IMB_ERR_NULL_EXP_KEYcxx . . $ IMB_ERR_NULL_EXP_KEY.); |
| 54 | return; |
| 55 | } |
| 56 | if (pBufferIn == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 57 | imb_set_errnocxx . . $ imb_set_errno(beec41fcb78e7267).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, IMB_ERR_NULL_SRCcxx . . $ IMB_ERR_NULL_SRC.); |
| 58 | return; |
| 59 | } |
| 60 | if (pBufferOut == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 61 | imb_set_errnocxx . . $ imb_set_errno(beec41fcb78e7267).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, IMB_ERR_NULL_DSTcxx . . $ IMB_ERR_NULL_DST.); |
| 62 | return; |
| 63 | } |
| 64 | /* Check input data is in range of supported length */ |
| 65 | if (cipherLengthInBytes == 0 || cipherLengthInBytes > (KASUMI_MAX_LENcxx . . $ `lib/include/kasumi_interface.h:36:9`! / CHAR_BITcxx . . $ `<external>/67164224788392828/limits.h:64:9`!)) { |
| 66 | imb_set_errnocxx . . $ imb_set_errno(beec41fcb78e7267).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, IMB_ERR_CIPH_LENcxx . . $ IMB_ERR_CIPH_LEN.); |
| 67 | return; |
| 68 | } |
| 69 | #endif |
| 70 | kasumi_f8_1_buffercxx . . $ kasumi_f8_1_buffer(bc9a9741f6da43c1).(pCtx, IV, pBufferIn, pBufferOut, cipherLengthInBytes); |
| 71 | #ifdef SAFE_DATAcxx . . $ `<built-in>:417:9`! |
| 72 | /* Clear sensitive data in registers */ |
| 73 | CLEAR_SCRATCH_GPScxx . . $ `lib/include/clear_regs_mem.h:31:9`!(); |
| 74 | CLEAR_SCRATCH_SIMD_REGScxx . . $ `lib/sse_t1/kasumi_sse.c:30:9`!(); |
| 75 | #endif |
| 76 | #ifndef LINUXcxx . . $ `<built-in>:413:9`! |
| 77 | RESTORE_XMMS(xmm_save); |
| 78 | #endif |
| 79 | } |
| 80 | |
| 81 | void |
| 82 | kasumi_f8_1_buffer_bit_ssecxx . . $ kasumi_f8_1_buffer_bit_sse(27c577c4c4fccc14).(const kasumi_key_sched_tcxx . . $ kasumi_key_sched_t# *pCtx, const uint64_tcxx . . $ uint64_t# IV, const void *pBufferIn, |
| 83 | void *pBufferOut, const uint32_tcxx . . $ uint32_t# cipherLengthInBits, |
| 84 | const uint32_tcxx . . $ uint32_t# offsetInBits) |
| 85 | { |
| 86 | #ifndef LINUXcxx . . $ `<built-in>:413:9`! |
| 87 | DECLARE_ALIGNED(imb_uint128_t xmm_save[10], 16); |
| 88 | |
| 89 | SAVE_XMMS(xmm_save); |
| 90 | #endif |
| 91 | #ifdef SAFE_PARAMcxx . . $ `<built-in>:418:9`! |
| 92 | /* Check for NULL pointers */ |
| 93 | imb_set_errnocxx . . $ imb_set_errno(beec41fcb78e7267).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, 0); |
| 94 | if (pCtx == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 95 | imb_set_errnocxx . . $ imb_set_errno(beec41fcb78e7267).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, IMB_ERR_NULL_EXP_KEYcxx . . $ IMB_ERR_NULL_EXP_KEY.); |
| 96 | return; |
| 97 | } |
| 98 | if (pBufferIn == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 99 | imb_set_errnocxx . . $ imb_set_errno(beec41fcb78e7267).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, IMB_ERR_NULL_SRCcxx . . $ IMB_ERR_NULL_SRC.); |
| 100 | return; |
| 101 | } |
| 102 | if (pBufferOut == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 103 | imb_set_errnocxx . . $ imb_set_errno(beec41fcb78e7267).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, IMB_ERR_NULL_DSTcxx . . $ IMB_ERR_NULL_DST.); |
| 104 | return; |
| 105 | } |
| 106 | /* Check input data is in range of supported length */ |
| 107 | if (cipherLengthInBits == 0 || cipherLengthInBits > KASUMI_MAX_LENcxx . . $ `lib/include/kasumi_interface.h:36:9`!) { |
| 108 | imb_set_errnocxx . . $ imb_set_errno(beec41fcb78e7267).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, IMB_ERR_CIPH_LENcxx . . $ IMB_ERR_CIPH_LEN.); |
| 109 | return; |
| 110 | } |
| 111 | #endif |
| 112 | kasumi_f8_1_buffer_bitcxx . . $ kasumi_f8_1_buffer_bit(27c577c4c4fccc14).(pCtx, IV, pBufferIn, pBufferOut, cipherLengthInBits, offsetInBits); |
| 113 | #ifdef SAFE_DATAcxx . . $ `<built-in>:417:9`! |
| 114 | /* Clear sensitive data in registers */ |
| 115 | CLEAR_SCRATCH_GPScxx . . $ `lib/include/clear_regs_mem.h:31:9`!(); |
| 116 | CLEAR_SCRATCH_SIMD_REGScxx . . $ `lib/sse_t1/kasumi_sse.c:30:9`!(); |
| 117 | #endif |
| 118 | #ifndef LINUXcxx . . $ `<built-in>:413:9`! |
| 119 | RESTORE_XMMS(xmm_save); |
| 120 | #endif |
| 121 | } |
| 122 | |
| 123 | void |
| 124 | kasumi_f8_2_buffer_ssecxx . . $ kasumi_f8_2_buffer_sse(36d1e6b5cd98a241).(const kasumi_key_sched_tcxx . . $ kasumi_key_sched_t# *pCtx, const uint64_tcxx . . $ uint64_t# IV1, const uint64_tcxx . . $ uint64_t# IV2, |
| 125 | const void *pBufferIn1, void *pBufferOut1, const uint32_tcxx . . $ uint32_t# lengthInBytes1, |
| 126 | const void *pBufferIn2, void *pBufferOut2, const uint32_tcxx . . $ uint32_t# lengthInBytes2) |
| 127 | { |
| 128 | #ifndef LINUXcxx . . $ `<built-in>:413:9`! |
| 129 | DECLARE_ALIGNED(imb_uint128_t xmm_save[10], 16); |
| 130 | |
| 131 | SAVE_XMMS(xmm_save); |
| 132 | #endif |
| 133 | #ifdef SAFE_PARAMcxx . . $ `<built-in>:418:9`! |
| 134 | /* Check for NULL pointers */ |
| 135 | imb_set_errnocxx . . $ imb_set_errno(beec41fcb78e7267).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, 0); |
| 136 | if (pCtx == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 137 | imb_set_errnocxx . . $ imb_set_errno(beec41fcb78e7267).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, IMB_ERR_NULL_EXP_KEYcxx . . $ IMB_ERR_NULL_EXP_KEY.); |
| 138 | return; |
| 139 | } |
| 140 | if (pBufferIn1 == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! || pBufferIn2 == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 141 | imb_set_errnocxx . . $ imb_set_errno(beec41fcb78e7267).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, IMB_ERR_NULL_SRCcxx . . $ IMB_ERR_NULL_SRC.); |
| 142 | return; |
| 143 | } |
| 144 | if (pBufferOut1 == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! || pBufferOut2 == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 145 | imb_set_errnocxx . . $ imb_set_errno(beec41fcb78e7267).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, IMB_ERR_NULL_DSTcxx . . $ IMB_ERR_NULL_DST.); |
| 146 | return; |
| 147 | } |
| 148 | /* Check input data is in range of supported length */ |
| 149 | if (lengthInBytes1 == 0 || lengthInBytes1 > (KASUMI_MAX_LENcxx . . $ `lib/include/kasumi_interface.h:36:9`! / CHAR_BITcxx . . $ `<external>/67164224788392828/limits.h:64:9`!)) { |
| 150 | imb_set_errnocxx . . $ imb_set_errno(beec41fcb78e7267).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, IMB_ERR_CIPH_LENcxx . . $ IMB_ERR_CIPH_LEN.); |
| 151 | return; |
| 152 | } |
| 153 | |
| 154 | if (lengthInBytes2 == 0 || lengthInBytes2 > (KASUMI_MAX_LENcxx . . $ `lib/include/kasumi_interface.h:36:9`! / CHAR_BITcxx . . $ `<external>/67164224788392828/limits.h:64:9`!)) { |
| 155 | imb_set_errnocxx . . $ imb_set_errno(beec41fcb78e7267).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, IMB_ERR_CIPH_LENcxx . . $ IMB_ERR_CIPH_LEN.); |
| 156 | return; |
| 157 | } |
| 158 | #endif |
| 159 | kasumi_f8_2_buffercxx . . $ kasumi_f8_2_buffer(36d1e6b5cd98a241).(pCtx, IV1, IV2, pBufferIn1, pBufferOut1, lengthInBytes1, pBufferIn2, |
| 160 | pBufferOut2, lengthInBytes2); |
| 161 | #ifdef SAFE_DATAcxx . . $ `<built-in>:417:9`! |
| 162 | /* Clear sensitive data in registers */ |
| 163 | CLEAR_SCRATCH_GPScxx . . $ `lib/include/clear_regs_mem.h:31:9`!(); |
| 164 | CLEAR_SCRATCH_SIMD_REGScxx . . $ `lib/sse_t1/kasumi_sse.c:30:9`!(); |
| 165 | #endif |
| 166 | #ifndef LINUXcxx . . $ `<built-in>:413:9`! |
| 167 | RESTORE_XMMS(xmm_save); |
| 168 | #endif |
| 169 | } |
| 170 | |
| 171 | void |
| 172 | kasumi_f8_3_buffer_ssecxx . . $ kasumi_f8_3_buffer_sse(225b8a73657161b6).(const kasumi_key_sched_tcxx . . $ kasumi_key_sched_t# *pCtx, const uint64_tcxx . . $ uint64_t# IV1, const uint64_tcxx . . $ uint64_t# IV2, |
| 173 | const uint64_tcxx . . $ uint64_t# IV3, const void *pBufferIn1, void *pBufferOut1, |
| 174 | const void *pBufferIn2, void *pBufferOut2, const void *pBufferIn3, |
| 175 | void *pBufferOut3, const uint32_tcxx . . $ uint32_t# lengthInBytes) |
| 176 | { |
| 177 | #ifndef LINUXcxx . . $ `<built-in>:413:9`! |
| 178 | DECLARE_ALIGNED(imb_uint128_t xmm_save[10], 16); |
| 179 | |
| 180 | SAVE_XMMS(xmm_save); |
| 181 | #endif |
| 182 | #ifdef SAFE_PARAMcxx . . $ `<built-in>:418:9`! |
| 183 | /* Check for NULL pointers */ |
| 184 | imb_set_errnocxx . . $ imb_set_errno(beec41fcb78e7267).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, 0); |
| 185 | if (pCtx == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 186 | imb_set_errnocxx . . $ imb_set_errno(beec41fcb78e7267).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, IMB_ERR_NULL_EXP_KEYcxx . . $ IMB_ERR_NULL_EXP_KEY.); |
| 187 | return; |
| 188 | } |
| 189 | if (pBufferIn1 == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! || pBufferIn2 == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! || pBufferIn3 == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 190 | imb_set_errnocxx . . $ imb_set_errno(beec41fcb78e7267).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, IMB_ERR_NULL_SRCcxx . . $ IMB_ERR_NULL_SRC.); |
| 191 | return; |
| 192 | } |
| 193 | if (pBufferOut1 == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! || pBufferOut2 == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! || pBufferOut3 == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 194 | imb_set_errnocxx . . $ imb_set_errno(beec41fcb78e7267).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, IMB_ERR_NULL_DSTcxx . . $ IMB_ERR_NULL_DST.); |
| 195 | return; |
| 196 | } |
| 197 | /* Check input data is in range of supported length */ |
| 198 | if (lengthInBytes == 0 || lengthInBytes > (KASUMI_MAX_LENcxx . . $ `lib/include/kasumi_interface.h:36:9`! / CHAR_BITcxx . . $ `<external>/67164224788392828/limits.h:64:9`!)) { |
| 199 | imb_set_errnocxx . . $ imb_set_errno(beec41fcb78e7267).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, IMB_ERR_CIPH_LENcxx . . $ IMB_ERR_CIPH_LEN.); |
| 200 | return; |
| 201 | } |
| 202 | #endif |
| 203 | kasumi_f8_3_buffercxx . . $ kasumi_f8_3_buffer(225b8a73657161b6).(pCtx, IV1, IV2, IV3, pBufferIn1, pBufferOut1, pBufferIn2, pBufferOut2, |
| 204 | pBufferIn3, pBufferOut3, lengthInBytes); |
| 205 | #ifdef SAFE_DATAcxx . . $ `<built-in>:417:9`! |
| 206 | /* Clear sensitive data in registers */ |
| 207 | CLEAR_SCRATCH_GPScxx . . $ `lib/include/clear_regs_mem.h:31:9`!(); |
| 208 | CLEAR_SCRATCH_SIMD_REGScxx . . $ `lib/sse_t1/kasumi_sse.c:30:9`!(); |
| 209 | #endif |
| 210 | #ifndef LINUXcxx . . $ `<built-in>:413:9`! |
| 211 | RESTORE_XMMS(xmm_save); |
| 212 | #endif |
| 213 | } |
| 214 | |
| 215 | void |
| 216 | kasumi_f8_4_buffer_ssecxx . . $ kasumi_f8_4_buffer_sse(6adbeca5e9a8cdc9).(const kasumi_key_sched_tcxx . . $ kasumi_key_sched_t# *pCtx, const uint64_tcxx . . $ uint64_t# IV1, const uint64_tcxx . . $ uint64_t# IV2, |
| 217 | const uint64_tcxx . . $ uint64_t# IV3, const uint64_tcxx . . $ uint64_t# IV4, const void *pBufferIn1, |
| 218 | void *pBufferOut1, const void *pBufferIn2, void *pBufferOut2, |
| 219 | const void *pBufferIn3, void *pBufferOut3, const void *pBufferIn4, |
| 220 | void *pBufferOut4, const uint32_tcxx . . $ uint32_t# lengthInBytes) |
| 221 | { |
| 222 | #ifndef LINUXcxx . . $ `<built-in>:413:9`! |
| 223 | DECLARE_ALIGNED(imb_uint128_t xmm_save[10], 16); |
| 224 | |
| 225 | SAVE_XMMS(xmm_save); |
| 226 | #endif |
| 227 | #ifdef SAFE_PARAMcxx . . $ `<built-in>:418:9`! |
| 228 | /* Check for NULL pointers */ |
| 229 | imb_set_errnocxx . . $ imb_set_errno(beec41fcb78e7267).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, 0); |
| 230 | if (pCtx == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 231 | imb_set_errnocxx . . $ imb_set_errno(beec41fcb78e7267).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, IMB_ERR_NULL_EXP_KEYcxx . . $ IMB_ERR_NULL_EXP_KEY.); |
| 232 | return; |
| 233 | } |
| 234 | if (pBufferIn1 == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! || pBufferIn2 == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! || pBufferIn3 == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! || pBufferIn4 == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 235 | imb_set_errnocxx . . $ imb_set_errno(beec41fcb78e7267).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, IMB_ERR_NULL_SRCcxx . . $ IMB_ERR_NULL_SRC.); |
| 236 | return; |
| 237 | } |
| 238 | if (pBufferOut1 == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! || pBufferOut2 == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! || pBufferOut3 == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! || |
| 239 | pBufferOut4 == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 240 | imb_set_errnocxx . . $ imb_set_errno(beec41fcb78e7267).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, IMB_ERR_NULL_DSTcxx . . $ IMB_ERR_NULL_DST.); |
| 241 | return; |
| 242 | } |
| 243 | /* Check input data is in range of supported length */ |
| 244 | if (lengthInBytes == 0 || lengthInBytes > (KASUMI_MAX_LENcxx . . $ `lib/include/kasumi_interface.h:36:9`! / CHAR_BITcxx . . $ `<external>/67164224788392828/limits.h:64:9`!)) { |
| 245 | imb_set_errnocxx . . $ imb_set_errno(beec41fcb78e7267).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, IMB_ERR_CIPH_LENcxx . . $ IMB_ERR_CIPH_LEN.); |
| 246 | return; |
| 247 | } |
| 248 | #endif |
| 249 | kasumi_f8_4_buffercxx . . $ kasumi_f8_4_buffer(6adbeca5e9a8cdc9).(pCtx, IV1, IV2, IV3, IV4, pBufferIn1, pBufferOut1, pBufferIn2, |
| 250 | pBufferOut2, pBufferIn3, pBufferOut3, pBufferIn4, pBufferOut4, |
| 251 | lengthInBytes); |
| 252 | #ifdef SAFE_DATAcxx . . $ `<built-in>:417:9`! |
| 253 | /* Clear sensitive data in registers */ |
| 254 | CLEAR_SCRATCH_GPScxx . . $ `lib/include/clear_regs_mem.h:31:9`!(); |
| 255 | CLEAR_SCRATCH_SIMD_REGScxx . . $ `lib/sse_t1/kasumi_sse.c:30:9`!(); |
| 256 | #endif |
| 257 | #ifndef LINUXcxx . . $ `<built-in>:413:9`! |
| 258 | RESTORE_XMMS(xmm_save); |
| 259 | #endif |
| 260 | } |
| 261 | |
| 262 | void |
| 263 | kasumi_f8_n_buffer_ssecxx . . $ kasumi_f8_n_buffer_sse(9a9eea56c12acbba).(const kasumi_key_sched_tcxx . . $ kasumi_key_sched_t# *pKeySchedule, const uint64_tcxx . . $ uint64_t# IV[], |
| 264 | const void *const pDataIn[], void *pDataOut[], const uint32_tcxx . . $ uint32_t# dataLen[], |
| 265 | const uint32_tcxx . . $ uint32_t# dataCount) |
| 266 | { |
| 267 | #ifndef LINUXcxx . . $ `<built-in>:413:9`! |
| 268 | DECLARE_ALIGNED(imb_uint128_t xmm_save[10], 16); |
| 269 | |
| 270 | SAVE_XMMS(xmm_save); |
| 271 | #endif |
| 272 | uint32_tcxx . . $ uint32_t# numLeft = dataCount; |
| 273 | uint32_tcxx . . $ uint32_t# i = 0; |
| 274 | |
| 275 | #ifdef SAFE_PARAMcxx . . $ `<built-in>:418:9`! |
| 276 | /* Check for NULL pointers */ |
| 277 | imb_set_errnocxx . . $ imb_set_errno(beec41fcb78e7267).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, 0); |
| 278 | |
| 279 | if (pKeySchedule == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 280 | imb_set_errnocxx . . $ imb_set_errno(beec41fcb78e7267).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, IMB_ERR_NULL_EXP_KEYcxx . . $ IMB_ERR_NULL_EXP_KEY.); |
| 281 | return; |
| 282 | } |
| 283 | if (pDataIn == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 284 | imb_set_errnocxx . . $ imb_set_errno(beec41fcb78e7267).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, IMB_ERR_NULL_SRCcxx . . $ IMB_ERR_NULL_SRC.); |
| 285 | return; |
| 286 | } |
| 287 | if (pDataOut == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 288 | imb_set_errnocxx . . $ imb_set_errno(beec41fcb78e7267).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, IMB_ERR_NULL_DSTcxx . . $ IMB_ERR_NULL_DST.); |
| 289 | return; |
| 290 | } |
| 291 | if (dataLen == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 292 | imb_set_errnocxx . . $ imb_set_errno(beec41fcb78e7267).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, IMB_ERR_CIPH_LENcxx . . $ IMB_ERR_CIPH_LEN.); |
| 293 | return; |
| 294 | } |
| 295 | if (IV == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 296 | imb_set_errnocxx . . $ imb_set_errno(beec41fcb78e7267).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, IMB_ERR_NULL_IVcxx . . $ IMB_ERR_NULL_IV.); |
| 297 | return; |
| 298 | } |
| 299 | |
| 300 | for (i = 0; i < dataCount; i++) { |
| 301 | /* Check for NULL pointers */ |
| 302 | if (pDataIn[i] == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 303 | imb_set_errnocxx . . $ imb_set_errno(beec41fcb78e7267).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, IMB_ERR_NULL_SRCcxx . . $ IMB_ERR_NULL_SRC.); |
| 304 | return; |
| 305 | } |
| 306 | if (pDataOut[i] == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 307 | imb_set_errnocxx . . $ imb_set_errno(beec41fcb78e7267).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, IMB_ERR_NULL_DSTcxx . . $ IMB_ERR_NULL_DST.); |
| 308 | return; |
| 309 | } |
| 310 | /* Check input data is in range of supported length */ |
| 311 | if (dataLen[i] == 0 || dataLen[i] > (KASUMI_MAX_LENcxx . . $ `lib/include/kasumi_interface.h:36:9`! / CHAR_BITcxx . . $ `<external>/67164224788392828/limits.h:64:9`!)) { |
| 312 | imb_set_errnocxx . . $ imb_set_errno(beec41fcb78e7267).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, IMB_ERR_CIPH_LENcxx . . $ IMB_ERR_CIPH_LEN.); |
| 313 | return; |
| 314 | } |
| 315 | } |
| 316 | #endif |
| 317 | |
| 318 | i = 0; |
| 319 | |
| 320 | /* KASUMI F8 n buffer function can handle up to 16 buffers */ |
| 321 | while (numLeft > 0) { |
| 322 | const uint64_tcxx . . $ uint64_t# *IVPtr = &IV[i]; |
| 323 | const void *const *pDataInPtr = &pDataIn[i]; |
| 324 | void **pDataOutPtr = &pDataOut[i]; |
| 325 | const uint32_tcxx . . $ uint32_t# *dataLenPtr = &dataLen[i]; |
| 326 | const uint32_tcxx . . $ uint32_t# numBuffs = (numLeft > 16) ? 16 : numLeft; |
| 327 | |
| 328 | kasumi_f8_n_buffercxx . . $ kasumi_f8_n_buffer(9a9eea56c12acbba).(pKeySchedule, IVPtr, pDataInPtr, pDataOutPtr, dataLenPtr, |
| 329 | numBuffs); |
| 330 | i += numBuffs; |
| 331 | numLeft -= numBuffs; |
| 332 | } |
| 333 | #ifdef SAFE_DATAcxx . . $ `<built-in>:417:9`! |
| 334 | /* Clear sensitive data in registers */ |
| 335 | CLEAR_SCRATCH_GPScxx . . $ `lib/include/clear_regs_mem.h:31:9`!(); |
| 336 | CLEAR_SCRATCH_SIMD_REGScxx . . $ `lib/sse_t1/kasumi_sse.c:30:9`!(); |
| 337 | #endif |
| 338 | #ifndef LINUXcxx . . $ `<built-in>:413:9`! |
| 339 | RESTORE_XMMS(xmm_save); |
| 340 | #endif |
| 341 | } |
| 342 | |
| 343 | void |
| 344 | kasumi_f9_1_buffer_ssecxx . . $ kasumi_f9_1_buffer_sse(dfcf01f1a581a6e0).(const kasumi_key_sched_tcxx . . $ kasumi_key_sched_t# *pCtx, const void *pBufferIn, |
| 345 | const uint32_tcxx . . $ uint32_t# lengthInBytes, void *pDigest) |
| 346 | { |
| 347 | #ifndef LINUXcxx . . $ `<built-in>:413:9`! |
| 348 | DECLARE_ALIGNED(imb_uint128_t xmm_save[10], 16); |
| 349 | |
| 350 | SAVE_XMMS(xmm_save); |
| 351 | #endif |
| 352 | #ifdef SAFE_PARAMcxx . . $ `<built-in>:418:9`! |
| 353 | /* Reset error */ |
| 354 | imb_set_errnocxx . . $ imb_set_errno(beec41fcb78e7267).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, 0); |
| 355 | |
| 356 | /* Check for NULL pointers */ |
| 357 | if (pCtx == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 358 | imb_set_errnocxx . . $ imb_set_errno(beec41fcb78e7267).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, IMB_ERR_NULL_EXP_KEYcxx . . $ IMB_ERR_NULL_EXP_KEY.); |
| 359 | return; |
| 360 | } |
| 361 | if (pBufferIn == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 362 | imb_set_errnocxx . . $ imb_set_errno(beec41fcb78e7267).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, IMB_ERR_NULL_SRCcxx . . $ IMB_ERR_NULL_SRC.); |
| 363 | return; |
| 364 | } |
| 365 | if (pDigest == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 366 | imb_set_errnocxx . . $ imb_set_errno(beec41fcb78e7267).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, IMB_ERR_NULL_AUTHcxx . . $ IMB_ERR_NULL_AUTH.); |
| 367 | return; |
| 368 | } |
| 369 | /* Check input data is in range of supported length */ |
| 370 | if (lengthInBytes == 0 || lengthInBytes > (KASUMI_MAX_LENcxx . . $ `lib/include/kasumi_interface.h:36:9`! / CHAR_BITcxx . . $ `<external>/67164224788392828/limits.h:64:9`!)) { |
| 371 | imb_set_errnocxx . . $ imb_set_errno(beec41fcb78e7267).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, IMB_ERR_AUTH_LENcxx . . $ IMB_ERR_AUTH_LEN.); |
| 372 | return; |
| 373 | } |
| 374 | #endif |
| 375 | kasumi_f9_1_buffercxx . . $ kasumi_f9_1_buffer(dfcf01f1a581a6e0).(pCtx, pBufferIn, lengthInBytes, pDigest); |
| 376 | #ifdef SAFE_DATAcxx . . $ `<built-in>:417:9`! |
| 377 | /* Clear sensitive data in registers */ |
| 378 | CLEAR_SCRATCH_GPScxx . . $ `lib/include/clear_regs_mem.h:31:9`!(); |
| 379 | CLEAR_SCRATCH_SIMD_REGScxx . . $ `lib/sse_t1/kasumi_sse.c:30:9`!(); |
| 380 | #endif |
| 381 | #ifndef LINUXcxx . . $ `<built-in>:413:9`! |
| 382 | RESTORE_XMMS(xmm_save); |
| 383 | #endif |
| 384 | } |
| 385 | |
| 386 | void |
| 387 | kasumi_f9_1_buffer_user_ssecxx . . $ kasumi_f9_1_buffer_user_sse(ae37f0517e7f5471).(const kasumi_key_sched_tcxx . . $ kasumi_key_sched_t# *pCtx, const uint64_tcxx . . $ uint64_t# IV, |
| 388 | const void *pBufferIn, const uint32_tcxx . . $ uint32_t# lengthInBits, void *pDigest, |
| 389 | const uint32_tcxx . . $ uint32_t# direction) |
| 390 | { |
| 391 | #ifndef LINUXcxx . . $ `<built-in>:413:9`! |
| 392 | DECLARE_ALIGNED(imb_uint128_t xmm_save[10], 16); |
| 393 | |
| 394 | SAVE_XMMS(xmm_save); |
| 395 | #endif |
| 396 | #ifdef SAFE_PARAMcxx . . $ `<built-in>:418:9`! |
| 397 | /* Reset error */ |
| 398 | imb_set_errnocxx . . $ imb_set_errno(beec41fcb78e7267).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, 0); |
| 399 | |
| 400 | /* Check for NULL pointers */ |
| 401 | if (pCtx == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 402 | imb_set_errnocxx . . $ imb_set_errno(beec41fcb78e7267).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, IMB_ERR_NULL_EXP_KEYcxx . . $ IMB_ERR_NULL_EXP_KEY.); |
| 403 | return; |
| 404 | } |
| 405 | if (pBufferIn == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 406 | imb_set_errnocxx . . $ imb_set_errno(beec41fcb78e7267).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, IMB_ERR_NULL_SRCcxx . . $ IMB_ERR_NULL_SRC.); |
| 407 | return; |
| 408 | } |
| 409 | if (pDigest == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 410 | imb_set_errnocxx . . $ imb_set_errno(beec41fcb78e7267).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, IMB_ERR_NULL_AUTHcxx . . $ IMB_ERR_NULL_AUTH.); |
| 411 | return; |
| 412 | } |
| 413 | /* Check input data is in range of supported length */ |
| 414 | if (lengthInBits == 0 || lengthInBits > KASUMI_MAX_LENcxx . . $ `lib/include/kasumi_interface.h:36:9`!) { |
| 415 | imb_set_errnocxx . . $ imb_set_errno(beec41fcb78e7267).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, IMB_ERR_AUTH_LENcxx . . $ IMB_ERR_AUTH_LEN.); |
| 416 | return; |
| 417 | } |
| 418 | #endif |
| 419 | kasumi_f9_1_buffer_usercxx . . $ kasumi_f9_1_buffer_user(ae37f0517e7f5471).(pCtx, IV, pBufferIn, lengthInBits, pDigest, direction); |
| 420 | #ifdef SAFE_DATAcxx . . $ `<built-in>:417:9`! |
| 421 | /* Clear sensitive data in registers */ |
| 422 | CLEAR_SCRATCH_GPScxx . . $ `lib/include/clear_regs_mem.h:31:9`!(); |
| 423 | CLEAR_SCRATCH_SIMD_REGScxx . . $ `lib/sse_t1/kasumi_sse.c:30:9`!(); |
| 424 | #endif |
| 425 | #ifndef LINUXcxx . . $ `<built-in>:413:9`! |
| 426 | RESTORE_XMMS(xmm_save); |
| 427 | #endif |
| 428 | } |
| 429 | |
| 430 | int |
| 431 | kasumi_init_f8_key_sched_ssecxx . . $ kasumi_init_f8_key_sched_sse(2db23bd1fa122aa7).(const void *const pKey, kasumi_key_sched_tcxx . . $ kasumi_key_sched_t# *pCtx) |
| 432 | { |
| 433 | return kasumi_init_f8_key_schedcxx . . $ kasumi_init_f8_key_sched(2db23bd1fa122aa7).(pKey, pCtx); |
| 434 | } |
| 435 | |
| 436 | int |
| 437 | kasumi_init_f9_key_sched_ssecxx . . $ kasumi_init_f9_key_sched_sse(2db23bd1fa122aa7).(const void *const pKey, kasumi_key_sched_tcxx . . $ kasumi_key_sched_t# *pCtx) |
| 438 | { |
| 439 | return kasumi_init_f9_key_schedcxx . . $ kasumi_init_f9_key_sched(2db23bd1fa122aa7).(pKey, pCtx); |
| 440 | } |
| 441 | |
| 442 | size_t |
| 443 | kasumi_key_sched_size_ssecxx . . $ kasumi_key_sched_size_sse(f708dce9a8856c70).(void) |
| 444 | { |
| 445 | return kasumi_key_sched_sizecxx . . $ kasumi_key_sched_size(f708dce9a8856c70).(); |
| 446 | } |