xref: /isa-l_crypto/include/sha256_mb.h (revision 672a042c19c7c87254f91480c1dd123e38f226e0)
16df3ef80SGreg Tucker /**********************************************************************
26df3ef80SGreg Tucker   Copyright(c) 2011-2016 Intel Corporation All rights reserved.
36df3ef80SGreg Tucker 
46df3ef80SGreg Tucker   Redistribution and use in source and binary forms, with or without
56df3ef80SGreg Tucker   modification, are permitted provided that the following conditions
66df3ef80SGreg Tucker   are met:
76df3ef80SGreg Tucker     * Redistributions of source code must retain the above copyright
86df3ef80SGreg Tucker       notice, this list of conditions and the following disclaimer.
96df3ef80SGreg Tucker     * Redistributions in binary form must reproduce the above copyright
106df3ef80SGreg Tucker       notice, this list of conditions and the following disclaimer in
116df3ef80SGreg Tucker       the documentation and/or other materials provided with the
126df3ef80SGreg Tucker       distribution.
136df3ef80SGreg Tucker     * Neither the name of Intel Corporation nor the names of its
146df3ef80SGreg Tucker       contributors may be used to endorse or promote products derived
156df3ef80SGreg Tucker       from this software without specific prior written permission.
166df3ef80SGreg Tucker 
176df3ef80SGreg Tucker   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
186df3ef80SGreg Tucker   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
196df3ef80SGreg Tucker   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
206df3ef80SGreg Tucker   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
216df3ef80SGreg Tucker   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
226df3ef80SGreg Tucker   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
236df3ef80SGreg Tucker   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
246df3ef80SGreg Tucker   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
256df3ef80SGreg Tucker   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
266df3ef80SGreg Tucker   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
276df3ef80SGreg Tucker   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
286df3ef80SGreg Tucker **********************************************************************/
296df3ef80SGreg Tucker 
306df3ef80SGreg Tucker #ifndef _SHA256_MB_H_
316df3ef80SGreg Tucker #define _SHA256_MB_H_
326df3ef80SGreg Tucker 
336df3ef80SGreg Tucker /**
346df3ef80SGreg Tucker  *  @file sha256_mb.h
356df3ef80SGreg Tucker  *  @brief Multi-buffer CTX API SHA256 function prototypes and structures
366df3ef80SGreg Tucker  *
376df3ef80SGreg Tucker  * Interface for multi-buffer SHA256 functions
386df3ef80SGreg Tucker  *
396df3ef80SGreg Tucker  * <b> Multi-buffer SHA256  Entire or First-Update..Update-Last </b>
406df3ef80SGreg Tucker  *
416df3ef80SGreg Tucker  * The interface to this multi-buffer hashing code is carried out through the
420a437795SPablo de Lara  * context-level (CTX) init, submit and flush functions and the ISAL_SHA256_HASH_CTX_MGR and
430a437795SPablo de Lara  * ISAL_SHA256_HASH_CTX objects. Numerous ISAL_SHA256_HASH_CTX objects may be instantiated by the
440a437795SPablo de Lara  * application for use with a single ISAL_SHA256_HASH_CTX_MGR.
456df3ef80SGreg Tucker  *
466df3ef80SGreg Tucker  * The CTX interface functions carry out the initialization and padding of the jobs
476df3ef80SGreg Tucker  * entered by the user and add them to the multi-buffer manager. The lower level "scheduler"
486df3ef80SGreg Tucker  * layer then processes the jobs in an out-of-order manner. The scheduler layer functions
496df3ef80SGreg Tucker  * are internal and are not intended to be invoked directly. Jobs can be submitted
508cb7fe78SPablo de Lara  * to a CTX as a complete buffer to be hashed, using the ISAL_HASH_ENTIRE flag, or as partial
518cb7fe78SPablo de Lara  * jobs which can be started using the ISAL_HASH_FIRST flag, and later resumed or finished
528cb7fe78SPablo de Lara  * using the ISAL_HASH_UPDATE and ISAL_HASH_LAST flags respectively.
536df3ef80SGreg Tucker  *
546df3ef80SGreg Tucker  * <b>Note:</b> The submit function does not require data buffers to be block sized.
556df3ef80SGreg Tucker  *
566df3ef80SGreg Tucker  * The SHA256 CTX interface functions are available for 4 architectures: SSE, AVX, AVX2 and
576df3ef80SGreg Tucker  * AVX512. In addition, a multibinary interface is provided, which selects the appropriate
586df3ef80SGreg Tucker  * architecture-specific function at runtime.
596df3ef80SGreg Tucker  *
600a437795SPablo de Lara  * <b>Usage:</b> The application creates a ISAL_SHA256_HASH_CTX_MGR object and initializes it
616df3ef80SGreg Tucker  * with a call to sha256_ctx_mgr_init*() function, where henceforth "*" stands for the
626df3ef80SGreg Tucker  * relevant suffix for each architecture; _sse, _avx, _avx2, _avx512(or no suffix for the
630a437795SPablo de Lara  * multibinary version). The ISAL_SHA256_HASH_CTX_MGR object will be used to schedule processor
640a437795SPablo de Lara  * resources, with up to 4 ISAL_SHA256_HASH_CTX objects (or 8 in the AVX2 case, 16 in the AVX512)
656df3ef80SGreg Tucker  * being processed at a time.
666df3ef80SGreg Tucker  *
670a437795SPablo de Lara  * Each ISAL_SHA256_HASH_CTX must be initialized before first use by the isal_hash_ctx_init macro
686df3ef80SGreg Tucker  * defined in multi_buffer.h. After initialization, the application may begin computing
690a437795SPablo de Lara  * a hash by giving the ISAL_SHA256_HASH_CTX to a ISAL_SHA256_HASH_CTX_MGR using the submit
700a437795SPablo de Lara  * functions sha256_ctx_mgr_submit*() with the ISAL_HASH_FIRST flag set. When the
710a437795SPablo de Lara  * ISAL_SHA256_HASH_CTX is returned to the application (via this or a later call to
720a437795SPablo de Lara  * sha256_ctx_mgr_submit*() or sha256_ctx_mgr_flush*()), the application can then re-submit it with
730a437795SPablo de Lara  * another call to sha256_ctx_mgr_submit*(), but without the ISAL_HASH_FIRST flag set.
746df3ef80SGreg Tucker  *
752fb85107SPablo de Lara  * Ideally, on the last buffer for that hash, sha256_ctx_mgr_submit is called with
768cb7fe78SPablo de Lara  * ISAL_HASH_LAST, although it is also possible to submit the hash with ISAL_HASH_LAST and a zero
770a437795SPablo de Lara  * length if necessary. When a ISAL_SHA256_HASH_CTX is returned after having been submitted with
780a437795SPablo de Lara  * ISAL_HASH_LAST, it will contain a valid hash. The ISAL_SHA256_HASH_CTX can be reused immediately
798cb7fe78SPablo de Lara  * by submitting with ISAL_HASH_FIRST.
806df3ef80SGreg Tucker  *
816df3ef80SGreg Tucker  * For example, you would submit hashes with the following flags for the following numbers
826df3ef80SGreg Tucker  * of buffers:
836df3ef80SGreg Tucker  * <ul>
848cb7fe78SPablo de Lara  *  <li> one buffer: ISAL_HASH_FIRST | ISAL_HASH_LAST  (or, equivalently, ISAL_HASH_ENTIRE)
858cb7fe78SPablo de Lara  *  <li> two buffers: ISAL_HASH_FIRST, ISAL_HASH_LAST
868cb7fe78SPablo de Lara  *  <li> three buffers: ISAL_HASH_FIRST, ISAL_HASH_UPDATE, ISAL_HASH_LAST
876df3ef80SGreg Tucker  * etc.
886df3ef80SGreg Tucker  * </ul>
896df3ef80SGreg Tucker  *
906df3ef80SGreg Tucker  * The order in which SHA256_CTX objects are returned is in general different from the order
916df3ef80SGreg Tucker  * in which they are submitted.
926df3ef80SGreg Tucker  *
936df3ef80SGreg Tucker  * A few possible error conditions exist:
946df3ef80SGreg Tucker  * <ul>
956df3ef80SGreg Tucker  *  <li> Submitting flags other than the allowed entire/first/update/last values
960a437795SPablo de Lara  *  <li> Submitting a context that is currently being managed by a ISAL_SHA256_HASH_CTX_MGR.
978cb7fe78SPablo de Lara  *  <li> Submitting a context after ISAL_HASH_LAST is used but before ISAL_HASH_FIRST is set.
986df3ef80SGreg Tucker  * </ul>
996df3ef80SGreg Tucker  *
1000a437795SPablo de Lara  *  These error conditions are reported by returning the ISAL_SHA256_HASH_CTX immediately after
1016df3ef80SGreg Tucker  *  a submit with its error member set to a non-zero error code (defined in
1020a437795SPablo de Lara  *  multi_buffer.h). No changes are made to the ISAL_SHA256_HASH_CTX_MGR in the case of an
1036df3ef80SGreg Tucker  *  error; no processing is done for other hashes.
1046df3ef80SGreg Tucker  *
1056df3ef80SGreg Tucker  */
1066df3ef80SGreg Tucker 
1076df3ef80SGreg Tucker #include <stdint.h>
108fabd0c36SMarcel Cornu #include <string.h>
1096df3ef80SGreg Tucker #include "multi_buffer.h"
1106df3ef80SGreg Tucker #include "types.h"
1116df3ef80SGreg Tucker 
1126df3ef80SGreg Tucker #ifndef _MSC_VER
1136df3ef80SGreg Tucker #include <stdbool.h>
1146df3ef80SGreg Tucker #endif
1156df3ef80SGreg Tucker 
1166df3ef80SGreg Tucker #ifdef __cplusplus
1176df3ef80SGreg Tucker extern "C" {
1186df3ef80SGreg Tucker #endif
1196df3ef80SGreg Tucker 
1200a437795SPablo de Lara /*
1210a437795SPablo de Lara  * Define enums from API v2.24, so applications that were using this version
1220a437795SPablo de Lara  * will still be compiled successfully.
1230a437795SPablo de Lara  * This list does not need to be extended for new definitions.
1240a437795SPablo de Lara  */
1250a437795SPablo de Lara #ifndef NO_COMPAT_ISAL_CRYPTO_API_2_24
1260a437795SPablo de Lara /***** Previous hash constants and typedefs *****/
1270a437795SPablo de Lara #define SHA256_DIGEST_NWORDS       ISAL_SHA256_DIGEST_NWORDS
1280a437795SPablo de Lara #define SHA256_PADLENGTHFIELD_SIZE ISAL_SHA256_PADLENGTHFIELD_SIZE
1290a437795SPablo de Lara #define SHA256_MAX_LANES           ISAL_SHA256_MAX_LANES
1300a437795SPablo de Lara #define SHA256_MIN_LANES           ISAL_SHA256_MIN_LANES
1310a437795SPablo de Lara #define SHA256_BLOCK_SIZE          ISAL_SHA256_BLOCK_SIZE
1320a437795SPablo de Lara #define SHA256_WORD_T              ISAL_SHA256_WORD_T
1336df3ef80SGreg Tucker 
1340a437795SPablo de Lara /***** Previous structure definitions *****/
1350a437795SPablo de Lara #define SHA256_JOB          ISAL_SHA256_JOB
1360a437795SPablo de Lara #define SHA256_MB_ARGS_X16  ISAL_SHA256_MB_ARGS_X16
1370a437795SPablo de Lara #define SHA256_LANE_DATA    ISAL_SHA256_LANE_DATA
1380a437795SPablo de Lara #define SHA256_MB_JOB_MGR   ISAL_SHA256_MB_JOB_MGR
1390a437795SPablo de Lara #define SHA256_HASH_CTX_MGR ISAL_SHA256_HASH_CTX_MGR
1400a437795SPablo de Lara #define SHA256_HASH_CTX     ISAL_SHA256_HASH_CTX
1410a437795SPablo de Lara #endif /* !NO_COMPAT_ISAL_CRYPTO_API_2_24 */
1420a437795SPablo de Lara 
1430a437795SPablo de Lara // Hash Constants and Typedefs
1440a437795SPablo de Lara #define ISAL_SHA256_DIGEST_NWORDS       8
1450a437795SPablo de Lara #define ISAL_SHA256_MAX_LANES           16
1460a437795SPablo de Lara #define ISAL_SHA256_MIN_LANES           4
1470a437795SPablo de Lara #define ISAL_SHA256_BLOCK_SIZE          64
1480a437795SPablo de Lara #define ISAL_SHA256_PADLENGTHFIELD_SIZE 8
1490a437795SPablo de Lara 
1500a437795SPablo de Lara typedef uint32_t sha256_digest_array[ISAL_SHA256_DIGEST_NWORDS][ISAL_SHA256_MAX_LANES];
1510a437795SPablo de Lara typedef uint32_t ISAL_SHA256_WORD_T;
1526df3ef80SGreg Tucker 
1531de5344dSMarcel Cornu /** @brief Scheduler layer - Holds info describing a single SHA256 job for the multi-buffer manager
1541de5344dSMarcel Cornu  */
1556df3ef80SGreg Tucker 
1566df3ef80SGreg Tucker typedef struct {
1576df3ef80SGreg Tucker         uint8_t *buffer; //!< pointer to data buffer for this job
1586df3ef80SGreg Tucker         uint64_t len;    //!< length of buffer for this job in blocks.
1590a437795SPablo de Lara         DECLARE_ALIGNED(uint32_t result_digest[ISAL_SHA256_DIGEST_NWORDS], 64);
1608cb7fe78SPablo de Lara         ISAL_JOB_STS status; //!< output job status
1616df3ef80SGreg Tucker         void *user_data;     //!< pointer for user's job-related data
1620a437795SPablo de Lara } ISAL_SHA256_JOB;
1636df3ef80SGreg Tucker 
1646df3ef80SGreg Tucker /** @brief Scheduler layer -  Holds arguments for submitted SHA256 job */
1656df3ef80SGreg Tucker 
1666df3ef80SGreg Tucker typedef struct {
1676df3ef80SGreg Tucker         sha256_digest_array digest;
1680a437795SPablo de Lara         uint8_t *data_ptr[ISAL_SHA256_MAX_LANES];
1690a437795SPablo de Lara } ISAL_SHA256_MB_ARGS_X16;
1706df3ef80SGreg Tucker 
1716df3ef80SGreg Tucker /** @brief Scheduler layer - Lane data */
1726df3ef80SGreg Tucker 
1736df3ef80SGreg Tucker typedef struct {
1740a437795SPablo de Lara         ISAL_SHA256_JOB *job_in_lane;
1750a437795SPablo de Lara } ISAL_SHA256_LANE_DATA;
1766df3ef80SGreg Tucker 
1776df3ef80SGreg Tucker /** @brief Scheduler layer - Holds state for multi-buffer SHA256 jobs */
1786df3ef80SGreg Tucker 
1796df3ef80SGreg Tucker typedef struct {
1800a437795SPablo de Lara         ISAL_SHA256_MB_ARGS_X16 args;
1810a437795SPablo de Lara         DECLARE_ALIGNED(uint32_t lens[ISAL_SHA256_MAX_LANES], 16);
1821de5344dSMarcel Cornu         uint64_t unused_lanes; //!< each nibble is index (0...3 or 0...7) of unused lanes, nibble 4
1831de5344dSMarcel Cornu                                //!< or 8 is set to F as a flag
1840a437795SPablo de Lara         ISAL_SHA256_LANE_DATA ldata[ISAL_SHA256_MAX_LANES];
1856df3ef80SGreg Tucker         uint32_t num_lanes_inuse;
1860a437795SPablo de Lara } ISAL_SHA256_MB_JOB_MGR;
1876df3ef80SGreg Tucker 
1886df3ef80SGreg Tucker /** @brief Context layer - Holds state for multi-buffer SHA256 jobs */
1896df3ef80SGreg Tucker 
1906df3ef80SGreg Tucker typedef struct {
1910a437795SPablo de Lara         ISAL_SHA256_MB_JOB_MGR mgr;
1920a437795SPablo de Lara } ISAL_SHA256_HASH_CTX_MGR;
1936df3ef80SGreg Tucker 
1941de5344dSMarcel Cornu /** @brief Context layer - Holds info describing a single SHA256 job for the multi-buffer CTX
1951de5344dSMarcel Cornu  * manager This structure must be allocated to 16-byte aligned memory */
1966df3ef80SGreg Tucker 
1976df3ef80SGreg Tucker typedef struct {
1980a437795SPablo de Lara         ISAL_SHA256_JOB job;             // Must be at struct offset 0.
1998cb7fe78SPablo de Lara         ISAL_HASH_CTX_STS status;        //!< Context status flag
2008cb7fe78SPablo de Lara         ISAL_HASH_CTX_ERROR error;       //!< Context error flag
2010c953239SChunyang Hui         uint64_t total_length;           //!< Running counter of length processed for this CTX's job
2026df3ef80SGreg Tucker         const void *incoming_buffer;     //!< pointer to data input buffer for this CTX's job
2036df3ef80SGreg Tucker         uint32_t incoming_buffer_length; //!< length of buffer for this job in bytes.
2040a437795SPablo de Lara         uint8_t partial_block_buffer[ISAL_SHA256_BLOCK_SIZE * 2]; //!< CTX partial blocks
2056df3ef80SGreg Tucker         uint32_t partial_block_buffer_length;
2066df3ef80SGreg Tucker         void *user_data; //!< pointer for user to keep any job-related data
2070a437795SPablo de Lara } ISAL_SHA256_HASH_CTX;
2086df3ef80SGreg Tucker 
20910f7e16bSXiaodong Liu /******************** multibinary function prototypes **********************/
21010f7e16bSXiaodong Liu 
21110f7e16bSXiaodong Liu /**
21210f7e16bSXiaodong Liu  * @brief Initialize the SHA256 multi-buffer manager structure.
21310f7e16bSXiaodong Liu  * @requires SSE4.1 or AVX or AVX2
214bc903ec1SPablo de Lara  * @deprecated Please use isal_sha256_ctx_mgr_init() instead.
21510f7e16bSXiaodong Liu  *
21610f7e16bSXiaodong Liu  * @param mgr	Structure holding context level state info
21710f7e16bSXiaodong Liu  * @returns void
21810f7e16bSXiaodong Liu  */
219bc903ec1SPablo de Lara ISAL_DEPRECATED("Please use isal_sha256_ctx_mgr_init() instead")
2201de5344dSMarcel Cornu void
2210a437795SPablo de Lara sha256_ctx_mgr_init(ISAL_SHA256_HASH_CTX_MGR *mgr);
22210f7e16bSXiaodong Liu 
22310f7e16bSXiaodong Liu /**
22410f7e16bSXiaodong Liu  * @brief  Submit a new SHA256 job to the multi-buffer manager.
22510f7e16bSXiaodong Liu  * @requires SSE4.1 or AVX or AVX2
226bc903ec1SPablo de Lara  * @deprecated Please use isal_sha256_ctx_mgr_submit() instead.
22710f7e16bSXiaodong Liu  *
22810f7e16bSXiaodong Liu  * @param  mgr Structure holding context level state info
22910f7e16bSXiaodong Liu  * @param  ctx Structure holding ctx job info
23010f7e16bSXiaodong Liu  * @param  buffer Pointer to buffer to be processed
23110f7e16bSXiaodong Liu  * @param  len Length of buffer (in bytes) to be processed
23210f7e16bSXiaodong Liu  * @param  flags Input flag specifying job type (first, update, last or entire)
23310f7e16bSXiaodong Liu  * @returns NULL if no jobs complete or pointer to jobs structure.
23410f7e16bSXiaodong Liu  */
235bc903ec1SPablo de Lara ISAL_DEPRECATED("Please use isal_sha256_ctx_mgr_submit() instead")
2360a437795SPablo de Lara ISAL_SHA256_HASH_CTX *
2370a437795SPablo de Lara sha256_ctx_mgr_submit(ISAL_SHA256_HASH_CTX_MGR *mgr, ISAL_SHA256_HASH_CTX *ctx, const void *buffer,
2388cb7fe78SPablo de Lara                       uint32_t len, ISAL_HASH_CTX_FLAG flags);
23910f7e16bSXiaodong Liu 
24010f7e16bSXiaodong Liu /**
24110f7e16bSXiaodong Liu  * @brief Finish all submitted SHA256 jobs and return when complete.
24210f7e16bSXiaodong Liu  * @requires SSE4.1 or AVX or AVX2
243bc903ec1SPablo de Lara  * @deprecated Please use isal_sha256_ctx_mgr_flush() instead.
24410f7e16bSXiaodong Liu  *
24510f7e16bSXiaodong Liu  * @param mgr	Structure holding context level state info
24610f7e16bSXiaodong Liu  * @returns NULL if no jobs to complete or pointer to jobs structure.
24710f7e16bSXiaodong Liu  */
248bc903ec1SPablo de Lara ISAL_DEPRECATED("Please use isal_sha256_ctx_mgr_flush() instead")
2490a437795SPablo de Lara ISAL_SHA256_HASH_CTX *
2500a437795SPablo de Lara sha256_ctx_mgr_flush(ISAL_SHA256_HASH_CTX_MGR *mgr);
25110f7e16bSXiaodong Liu 
252fc3226e8SMarcel Cornu /**
253fc3226e8SMarcel Cornu  * @brief Initialize the SHA256 multi-buffer manager structure.
254fc3226e8SMarcel Cornu  * @requires SSE4.1 for x86 or ASIMD for ARM
255fc3226e8SMarcel Cornu  *
256fc3226e8SMarcel Cornu  * @param[in] mgr Structure holding context level state info
257fc3226e8SMarcel Cornu  * @return Operation status
258fc3226e8SMarcel Cornu  * @retval 0 on success
259fc3226e8SMarcel Cornu  * @retval Non-zero \a ISAL_CRYPTO_ERR on failure
260fc3226e8SMarcel Cornu  */
2611de5344dSMarcel Cornu int
2620a437795SPablo de Lara isal_sha256_ctx_mgr_init(ISAL_SHA256_HASH_CTX_MGR *mgr);
263fc3226e8SMarcel Cornu 
264fc3226e8SMarcel Cornu /**
265fc3226e8SMarcel Cornu  * @brief  Submit a new SHA256 job to the multi-buffer manager.
266fc3226e8SMarcel Cornu  * @requires SSE4.1 for x86 or ASIMD for ARM
267fc3226e8SMarcel Cornu  *
268fc3226e8SMarcel Cornu  * @param[in] mgr Structure holding context level state info
269fc3226e8SMarcel Cornu  * @param[in] ctx_in Structure holding ctx job info
270fc3226e8SMarcel Cornu  * @param[out] ctx_out	Pointer address to output job ctx info.
271fc3226e8SMarcel Cornu  *			Modified to point to completed job structure or
272fc3226e8SMarcel Cornu  *			NULL if no jobs completed.
273fc3226e8SMarcel Cornu  * @param[in] buffer Pointer to buffer to be processed
274fc3226e8SMarcel Cornu  * @param[in] len Length of buffer (in bytes) to be processed
275fc3226e8SMarcel Cornu  * @param[in] flags Input flag specifying job type (first, update, last or entire)
276fc3226e8SMarcel Cornu  * @return Operation status
277fc3226e8SMarcel Cornu  * @retval 0 on success
278fc3226e8SMarcel Cornu  * @retval Non-zero \a ISAL_CRYPTO_ERR on failure
279fc3226e8SMarcel Cornu  */
2801de5344dSMarcel Cornu int
2810a437795SPablo de Lara isal_sha256_ctx_mgr_submit(ISAL_SHA256_HASH_CTX_MGR *mgr, ISAL_SHA256_HASH_CTX *ctx_in,
2820a437795SPablo de Lara                            ISAL_SHA256_HASH_CTX **ctx_out, const void *buffer, const uint32_t len,
2838cb7fe78SPablo de Lara                            const ISAL_HASH_CTX_FLAG flags);
284fc3226e8SMarcel Cornu 
285fc3226e8SMarcel Cornu /**
286fc3226e8SMarcel Cornu  * @brief Finish all submitted SHA256 jobs and return when complete.
287fc3226e8SMarcel Cornu  * @requires SSE4.1 for x86 or ASIMD for ARM
288fc3226e8SMarcel Cornu  *
289fc3226e8SMarcel Cornu  * @param[in] mgr Structure holding context level state info
290*672a042cSMarcel Cornu  * @param[out] ctx_out	Pointer address to output job ctx info.
291*672a042cSMarcel Cornu  *			Modified to point to completed job structure or
292*672a042cSMarcel Cornu  *			NULL if no jobs completed.
293fc3226e8SMarcel Cornu  * @return Operation status
294fc3226e8SMarcel Cornu  * @retval 0 on success
295fc3226e8SMarcel Cornu  * @retval Non-zero \a ISAL_CRYPTO_ERR on failure
296fc3226e8SMarcel Cornu  */
2971de5344dSMarcel Cornu int
2980a437795SPablo de Lara isal_sha256_ctx_mgr_flush(ISAL_SHA256_HASH_CTX_MGR *mgr, ISAL_SHA256_HASH_CTX **ctx_out);
2996df3ef80SGreg Tucker #ifdef __cplusplus
3006df3ef80SGreg Tucker }
3016df3ef80SGreg Tucker #endif
3026df3ef80SGreg Tucker 
3036df3ef80SGreg Tucker #endif // _SHA256_MB_H_
304