Debian Codegraph @

lib/avx2_t4/sha_ni_avx2.c

raw symbols SCIP
1 /*******************************************************************************
2 Copyright (c) 2020-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 "include/sha_generic.h"cxx . . $ `<file>/lib/include/sha_generic.h`/
29 #include "include/sha_mb_mgr.h"cxx . . $ `<file>/lib/include/sha_mb_mgr.h`/
30 #include "include/arch_avx2_type4.h"cxx . . $ `<file>/lib/include/arch_avx2_type4.h`/
31
32 /* ========================================================================== */
33 /* One block SHA384 computation for IPAD / OPAD usage only */
34 void
35 sha384_one_block_ni_avx2cxx . . $ sha384_one_block_ni_avx2(f73ea46a8f2f0896).(const void *data, void *digest)
36 {
37 sha_generic_1blockcxx . . $ sha_generic_1block(452f7686878d475b).(data, digest, ARCH_AVX2_SHANIcxx . . $ ARCH_AVX2_SHANI., 384 /* SHA384 */);
38 }
39
40 /* ========================================================================== */
41 /*
42 * SHA384 API for use in HMAC-SHA384 when key is longer than the block size
43 */
44 void
45 sha384_ni_avx2cxx . . $ sha384_ni_avx2(91ca759d5369cd6f).(const void *data, const uint64_tcxx . . $ uint64_t# length, void *digest)
46 {
47 sha_genericcxx . . $ sha_generic(97bb5f29a93dfca4).(data, length, digest, ARCH_AVX2_SHANIcxx . . $ ARCH_AVX2_SHANI., 384, IMB_SHA_384_BLOCK_SIZEcxx . . $ `lib/intel-ipsec-mb.h:142:9`!,
48 SHA384_PAD_SIZEcxx . . $ `lib/include/constants.h:81:9`!);
49 }
50
51 /* ========================================================================== */
52 /* One block SHA512 computation for IPAD / OPAD usage only */
53 void
54 sha512_one_block_ni_avx2cxx . . $ sha512_one_block_ni_avx2(f73ea46a8f2f0896).(const void *data, void *digest)
55 {
56 sha_generic_1blockcxx . . $ sha_generic_1block(452f7686878d475b).(data, digest, ARCH_AVX2_SHANIcxx . . $ ARCH_AVX2_SHANI., 512 /* SHA512 */);
57 }
58
59 /* ========================================================================== */
60 /*
61 * SHA512 API for use in HMAC-SHA512 when key is longer than the block size
62 */
63 void
64 sha512_ni_avx2cxx . . $ sha512_ni_avx2(91ca759d5369cd6f).(const void *data, const uint64_tcxx . . $ uint64_t# length, void *digest)
65 {
66 sha_genericcxx . . $ sha_generic(97bb5f29a93dfca4).(data, length, digest, ARCH_AVX2_SHANIcxx . . $ ARCH_AVX2_SHANI., 512, IMB_SHA_512_BLOCK_SIZEcxx . . $ `lib/intel-ipsec-mb.h:143:9`!,
67 SHA512_PAD_SIZEcxx . . $ `lib/include/constants.h:70:9`!);
68 }
69
70 /* ========================================================================== */
71 /*
72 * SHA384 MB API for JOB API
73 */
74 IMB_JOBcxx . . $ IMB_JOB# *
75 submit_job_sha384_ni_avx2cxx . . $ submit_job_sha384_ni_avx2(25bcca46ec3d7814).(MB_MGR_SHA_512_OOOcxx . . $ MB_MGR_SHA_512_OOO# *state, IMB_JOBcxx . . $ IMB_JOB# *job)
76 {
77 #ifdef SMX_NIcxx . . $ `<built-in>:415:9`!
78 return submit_flush_job_sha_512cxx . . $ submit_flush_job_sha_512(98ba1015a35f1bf9).(state, job, 2, 1, 384, IMB_SHA_384_BLOCK_SIZEcxx . . $ `lib/intel-ipsec-mb.h:142:9`!,
79 SHA384_PAD_SIZEcxx . . $ `lib/include/constants.h:81:9`!, call_sha512_ni_x2_avx2_from_ccxx . . $ call_sha512_ni_x2_avx2_from_c(f252089dafba9844)., 1);
80 #else
81 (void) state;
82 (void) job;
83 return NULL;
84 #endif /* ifdef SMX_NI */
85 }
86
87 IMB_JOBcxx . . $ IMB_JOB# *
88 flush_job_sha384_ni_avx2cxx . . $ flush_job_sha384_ni_avx2(25bcca46ec3d7814).(MB_MGR_SHA_512_OOOcxx . . $ MB_MGR_SHA_512_OOO# *state, IMB_JOBcxx . . $ IMB_JOB# *job)
89 {
90 #ifdef SMX_NIcxx . . $ `<built-in>:415:9`!
91 return submit_flush_job_sha_512cxx . . $ submit_flush_job_sha_512(98ba1015a35f1bf9).(state, job, 2, 0, 384, IMB_SHA_384_BLOCK_SIZEcxx . . $ `lib/intel-ipsec-mb.h:142:9`!,
92 SHA384_PAD_SIZEcxx . . $ `lib/include/constants.h:81:9`!, call_sha512_ni_x2_avx2_from_ccxx . . $ call_sha512_ni_x2_avx2_from_c(f252089dafba9844)., 1);
93 #else
94 (void) state;
95 (void) job;
96 return NULL;
97 #endif /* ifdef SMX_NI */
98 }
99
100 /* ========================================================================== */
101 /*
102 * SHA512 MB API for JOB API
103 */
104 IMB_JOBcxx . . $ IMB_JOB# *
105 submit_job_sha512_ni_avx2cxx . . $ submit_job_sha512_ni_avx2(25bcca46ec3d7814).(MB_MGR_SHA_512_OOOcxx . . $ MB_MGR_SHA_512_OOO# *state, IMB_JOBcxx . . $ IMB_JOB# *job)
106 {
107 #ifdef SMX_NIcxx . . $ `<built-in>:415:9`!
108 return submit_flush_job_sha_512cxx . . $ submit_flush_job_sha_512(98ba1015a35f1bf9).(state, job, 2, 1, 512, IMB_SHA_512_BLOCK_SIZEcxx . . $ `lib/intel-ipsec-mb.h:143:9`!,
109 SHA512_PAD_SIZEcxx . . $ `lib/include/constants.h:70:9`!, call_sha512_ni_x2_avx2_from_ccxx . . $ call_sha512_ni_x2_avx2_from_c(f252089dafba9844)., 1);
110 #else
111 (void) state;
112 (void) job;
113 return NULL;
114 #endif /* ifdef SMX_NI */
115 }
116
117 IMB_JOBcxx . . $ IMB_JOB# *
118 flush_job_sha512_ni_avx2cxx . . $ flush_job_sha512_ni_avx2(25bcca46ec3d7814).(MB_MGR_SHA_512_OOOcxx . . $ MB_MGR_SHA_512_OOO# *state, IMB_JOBcxx . . $ IMB_JOB# *job)
119 {
120 #ifdef SMX_NIcxx . . $ `<built-in>:415:9`!
121 return submit_flush_job_sha_512cxx . . $ submit_flush_job_sha_512(98ba1015a35f1bf9).(state, job, 2, 0, 512, IMB_SHA_512_BLOCK_SIZEcxx . . $ `lib/intel-ipsec-mb.h:143:9`!,
122 SHA512_PAD_SIZEcxx . . $ `lib/include/constants.h:70:9`!, call_sha512_ni_x2_avx2_from_ccxx . . $ call_sha512_ni_x2_avx2_from_c(f252089dafba9844)., 1);
123 #else
124 (void) state;
125 (void) job;
126 return NULL;
127 #endif /* ifdef SMX_NI */
128 }