xref: /isa-l_crypto/include/sha512_mb_internal.h (revision d57a697cfda8b34985b3e1eba01f8a39e8486ff3)
1 /**********************************************************************
2   Copyright(c) 2024 Intel Corporation All rights reserved.
3 
4   Redistribution and use in source and binary forms, with or without
5   modification, are permitted provided that the following conditions
6   are met:
7     * Redistributions of source code must retain the above copyright
8       notice, 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
11       the documentation and/or other materials provided with the
12       distribution.
13     * Neither the name of Intel Corporation nor the names of its
14       contributors may be used to endorse or promote products derived
15       from this software without specific prior written permission.
16 
17   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 **********************************************************************/
29 
30 #ifndef _SHA512_MB_INTERNAL_H_
31 #define _SHA512_MB_INTERNAL_H_
32 
33 /**
34  *  @file sha512_mb_internal.h
35  *  @brief Multi-buffer CTX API function prototypes and structures
36  *
37  */
38 
39 #include <stdint.h>
40 #include <string.h>
41 
42 #include "sha512_mb.h"
43 #include "multi_buffer.h"
44 #include "types.h"
45 
46 #ifdef __cplusplus
47 extern "C" {
48 #endif
49 
50 /*******************************************************************
51  * Scheduler (internal) level out-of-order function prototypes
52  ******************************************************************/
53 
54 void
55 _sha512_mb_mgr_init_sse(SHA512_MB_JOB_MGR *state);
56 SHA512_JOB *
57 _sha512_mb_mgr_submit_sse(SHA512_MB_JOB_MGR *state, SHA512_JOB *job);
58 SHA512_JOB *
59 _sha512_mb_mgr_flush_sse(SHA512_MB_JOB_MGR *state);
60 
61 #define _sha512_mb_mgr_init_avx _sha512_mb_mgr_init_sse
62 SHA512_JOB *
63 _sha512_mb_mgr_submit_avx(SHA512_MB_JOB_MGR *state, SHA512_JOB *job);
64 SHA512_JOB *
65 _sha512_mb_mgr_flush_avx(SHA512_MB_JOB_MGR *state);
66 
67 void
68 _sha512_mb_mgr_init_avx2(SHA512_MB_JOB_MGR *state);
69 SHA512_JOB *
70 _sha512_mb_mgr_submit_avx2(SHA512_MB_JOB_MGR *state, SHA512_JOB *job);
71 SHA512_JOB *
72 _sha512_mb_mgr_flush_avx2(SHA512_MB_JOB_MGR *state);
73 
74 void
75 _sha512_mb_mgr_init_avx512(SHA512_MB_JOB_MGR *state);
76 SHA512_JOB *
77 _sha512_mb_mgr_submit_avx512(SHA512_MB_JOB_MGR *state, SHA512_JOB *job);
78 SHA512_JOB *
79 _sha512_mb_mgr_flush_avx512(SHA512_MB_JOB_MGR *state);
80 
81 // Single buffer SHA512 APIs, optimized for SLM.
82 void
83 _sha512_sse4(const void *M, void *D, uint64_t L);
84 // Note that these APIs comply with multi-buffer APIs' high level usage
85 void
86 _sha512_sb_mgr_init_sse4(SHA512_MB_JOB_MGR *state);
87 SHA512_JOB *
88 _sha512_sb_mgr_submit_sse4(SHA512_MB_JOB_MGR *state, SHA512_JOB *job);
89 SHA512_JOB *
90 _sha512_sb_mgr_flush_sse4(SHA512_MB_JOB_MGR *state);
91 #ifdef __cplusplus
92 }
93 #endif
94 
95 #endif // _SHA512_MB_INTERNAL_H_
96