xref: /isa-l_crypto/include/sha1_mb.h (revision 8cb7fe780eac8ee5f1e0aa3ca37466e89c673ccd)
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 _SHA1_MB_H_
316df3ef80SGreg Tucker #define _SHA1_MB_H_
326df3ef80SGreg Tucker 
336df3ef80SGreg Tucker /**
346df3ef80SGreg Tucker  *  @file sha1_mb.h
356df3ef80SGreg Tucker  *  @brief Multi-buffer CTX API SHA1 function prototypes and structures
36070644e4SPablo de Lara  *  @warning: SHA1 is considered unsafe, so it is recommended to use SHA256 instead.
376df3ef80SGreg Tucker  *
386df3ef80SGreg Tucker  * Interface for multi-buffer SHA1 functions
396df3ef80SGreg Tucker  *
406df3ef80SGreg Tucker  * <b> Multi-buffer SHA1  Entire or First-Update..Update-Last </b>
416df3ef80SGreg Tucker  *
426df3ef80SGreg Tucker  * The interface to this multi-buffer hashing code is carried out through the
430106da91SPablo de Lara  * context-level (CTX) init, submit and flush functions and the ISAL_SHA1_HASH_CTX_MGR and
440106da91SPablo de Lara  * ISAL_SHA1_HASH_CTX objects. Numerous ISAL_SHA1_HASH_CTX objects may be instantiated by the
450106da91SPablo de Lara  * application for use with a single ISAL_SHA1_HASH_CTX_MGR.
466df3ef80SGreg Tucker  *
476df3ef80SGreg Tucker  * The CTX interface functions carry out the initialization and padding of the jobs
486df3ef80SGreg Tucker  * entered by the user and add them to the multi-buffer manager. The lower level "scheduler"
496df3ef80SGreg Tucker  * layer then processes the jobs in an out-of-order manner. The scheduler layer functions
506df3ef80SGreg Tucker  * are internal and are not intended to be invoked directly. Jobs can be submitted
51*8cb7fe78SPablo de Lara  * to a CTX as a complete buffer to be hashed, using the ISAL_HASH_ENTIRE flag, or as partial
52*8cb7fe78SPablo de Lara  * jobs which can be started using the ISAL_HASH_FIRST flag, and later resumed or finished
53*8cb7fe78SPablo de Lara  * using the ISAL_HASH_UPDATE and ISAL_HASH_LAST flags respectively.
546df3ef80SGreg Tucker  *
556df3ef80SGreg Tucker  * <b>Note:</b> The submit function does not require data buffers to be block sized.
566df3ef80SGreg Tucker  *
576df3ef80SGreg Tucker  * The SHA1 CTX interface functions are available for 4 architectures: SSE, AVX, AVX2 and
586df3ef80SGreg Tucker  * AVX512. In addition, a multibinary interface is provided, which selects the appropriate
596df3ef80SGreg Tucker  * architecture-specific function at runtime.
606df3ef80SGreg Tucker  *
610106da91SPablo de Lara  * <b>Usage:</b> The application creates a ISAL_SHA1_HASH_CTX_MGR object and initializes it
626df3ef80SGreg Tucker  * with a call to sha1_ctx_mgr_init*() function, where henceforth "*" stands for the
636df3ef80SGreg Tucker  * relevant suffix for each architecture; _sse, _avx, _avx2, _avx512(or no suffix for the
640106da91SPablo de Lara  * multibinary version). The ISAL_SHA1_HASH_CTX_MGR object will be used to schedule processor
650106da91SPablo de Lara  * resources, with up to 4 ISAL_SHA1_HASH_CTX objects (or 8 in the AVX2 case, 16 in the AVX512)
666df3ef80SGreg Tucker  * being processed at a time.
676df3ef80SGreg Tucker  *
68*8cb7fe78SPablo de Lara  * Each ISAL_SHA1_HASH_CTX must be initialized before first use by the isal_hash_ctx_init macro
696df3ef80SGreg Tucker  * defined in multi_buffer.h. After initialization, the application may begin computing
700106da91SPablo de Lara  * a hash by giving the ISAL_SHA1_HASH_CTX to a ISAL_SHA1_HASH_CTX_MGR using the submit functions
71*8cb7fe78SPablo de Lara  * sha1_ctx_mgr_submit*() with the ISAL_HASH_FIRST flag set. When the ISAL_SHA1_HASH_CTX is
726df3ef80SGreg Tucker  * returned to the application (via this or a later call to sha1_ctx_mgr_submit*() or
736df3ef80SGreg Tucker  * sha1_ctx_mgr_flush*()), the application can then re-submit it with another call to
74*8cb7fe78SPablo de Lara  * sha1_ctx_mgr_submit*(), but without the ISAL_HASH_FIRST flag set.
756df3ef80SGreg Tucker  *
766df3ef80SGreg Tucker  * Ideally, on the last buffer for that hash, sha1_ctx_mgr_submit_sse is called with
77*8cb7fe78SPablo de Lara  * ISAL_HASH_LAST, although it is also possible to submit the hash with ISAL_HASH_LAST and a zero
780106da91SPablo de Lara  * length if necessary. When a ISAL_SHA1_HASH_CTX is returned after having been submitted with
79*8cb7fe78SPablo de Lara  * ISAL_HASH_LAST, it will contain a valid hash. The ISAL_SHA1_HASH_CTX can be reused immediately
80*8cb7fe78SPablo de Lara  * by submitting with ISAL_HASH_FIRST.
816df3ef80SGreg Tucker  *
826df3ef80SGreg Tucker  * For example, you would submit hashes with the following flags for the following numbers
836df3ef80SGreg Tucker  * of buffers:
846df3ef80SGreg Tucker  * <ul>
85*8cb7fe78SPablo de Lara  *  <li> one buffer: ISAL_HASH_FIRST | ISAL_HASH_LAST  (or, equivalently, ISAL_HASH_ENTIRE)
86*8cb7fe78SPablo de Lara  *  <li> two buffers: ISAL_HASH_FIRST, ISAL_HASH_LAST
87*8cb7fe78SPablo de Lara  *  <li> three buffers: ISAL_HASH_FIRST, ISAL_HASH_UPDATE, ISAL_HASH_LAST
886df3ef80SGreg Tucker  * etc.
896df3ef80SGreg Tucker  * </ul>
906df3ef80SGreg Tucker  *
910106da91SPablo de Lara  * The order in which ISAL_SHA1_CTX objects are returned is in general different from the order
926df3ef80SGreg Tucker  * in which they are submitted.
936df3ef80SGreg Tucker  *
946df3ef80SGreg Tucker  * A few possible error conditions exist:
956df3ef80SGreg Tucker  * <ul>
966df3ef80SGreg Tucker  *  <li> Submitting flags other than the allowed entire/first/update/last values
970106da91SPablo de Lara  *  <li> Submitting a context that is currently being managed by a ISAL_SHA1_HASH_CTX_MGR.
98*8cb7fe78SPablo de Lara  *  <li> Submitting a context after ISAL_HASH_LAST is used but before ISAL_HASH_FIRST is set.
996df3ef80SGreg Tucker  * </ul>
1006df3ef80SGreg Tucker  *
1010106da91SPablo de Lara  *  These error conditions are reported by returning the ISAL_SHA1_HASH_CTX immediately after
1026df3ef80SGreg Tucker  *  a submit with its error member set to a non-zero error code (defined in
1030106da91SPablo de Lara  *  multi_buffer.h). No changes are made to the ISAL_SHA1_HASH_CTX_MGR in the case of an
1046df3ef80SGreg Tucker  *  error; no processing is done for other hashes.
1056df3ef80SGreg Tucker  *
1066df3ef80SGreg Tucker  */
1076df3ef80SGreg Tucker 
1086df3ef80SGreg Tucker #include <stdint.h>
109fabd0c36SMarcel Cornu #include <string.h>
1106df3ef80SGreg Tucker #include "multi_buffer.h"
1116df3ef80SGreg Tucker #include "types.h"
1126df3ef80SGreg Tucker 
1136df3ef80SGreg Tucker #ifndef _MSC_VER
1146df3ef80SGreg Tucker #include <stdbool.h>
1156df3ef80SGreg Tucker #endif
1166df3ef80SGreg Tucker 
1176df3ef80SGreg Tucker #ifdef __cplusplus
1186df3ef80SGreg Tucker extern "C" {
1196df3ef80SGreg Tucker #endif
1206df3ef80SGreg Tucker 
1210106da91SPablo de Lara /*
1220106da91SPablo de Lara  * Define enums from API v2.24, so applications that were using this version
1230106da91SPablo de Lara  * will still be compiled successfully.
1240106da91SPablo de Lara  * This list does not need to be extended for new enums.
1250106da91SPablo de Lara  */
1260106da91SPablo de Lara #ifndef NO_COMPAT_ISAL_CRYPTO_API_2_24
1270106da91SPablo de Lara /***** Previous hash constants and typedefs *****/
1280106da91SPablo de Lara #define SHA1_DIGEST_NWORDS       ISAL_SHA1_DIGEST_NWORDS
1290106da91SPablo de Lara #define SHA1_PADLENGTHFIELD_SIZE ISAL_SHA1_PADLENGTHFIELD_SIZE
1300106da91SPablo de Lara #define SHA1_MAX_LANES           ISAL_SHA1_MAX_LANES
1310106da91SPablo de Lara #define SHA1_MIN_LANES           ISAL_SHA1_MIN_LANES
1320106da91SPablo de Lara #define SHA1_BLOCK_SIZE          ISAL_SHA1_BLOCK_SIZE
1330106da91SPablo de Lara #define SHA1_WORD_T              ISAL_SHA1_WORD_T
1346df3ef80SGreg Tucker 
1350106da91SPablo de Lara /***** Previous structure definitions *****/
1360106da91SPablo de Lara #define SHA1_JOB          ISAL_SHA1_JOB
1370106da91SPablo de Lara #define SHA1_MB_ARGS_X16  ISAL_SHA1_MB_ARGS_X16
1380106da91SPablo de Lara #define SHA1_LANE_DATA    ISAL_SHA1_LANE_DATA
1390106da91SPablo de Lara #define SHA1_MB_JOB_MGR   ISAL_SHA1_MB_JOB_MGR
1400106da91SPablo de Lara #define SHA1_HASH_CTX_MGR ISAL_SHA1_HASH_CTX_MGR
1410106da91SPablo de Lara #define SHA1_HASH_CTX     ISAL_SHA1_HASH_CTX
1420106da91SPablo de Lara #endif /* !NO_COMPAT_ISAL_CRYPTO_API_2_24 */
1430106da91SPablo de Lara 
1440106da91SPablo de Lara // Hash Constants and Typedefs
1450106da91SPablo de Lara #define ISAL_SHA1_DIGEST_NWORDS       5
1460106da91SPablo de Lara #define ISAL_SHA1_MAX_LANES           16
1470106da91SPablo de Lara #define ISAL_SHA1_MIN_LANES           4
1480106da91SPablo de Lara #define ISAL_SHA1_BLOCK_SIZE          64
1490106da91SPablo de Lara #define ISAL_SHA1_PADLENGTHFIELD_SIZE 8
1500106da91SPablo de Lara 
1510106da91SPablo de Lara typedef uint32_t sha1_digest_array[ISAL_SHA1_DIGEST_NWORDS][ISAL_SHA1_MAX_LANES];
1520106da91SPablo de Lara typedef uint32_t ISAL_SHA1_WORD_T;
1536df3ef80SGreg Tucker 
1546df3ef80SGreg Tucker /** @brief Scheduler layer - Holds info describing a single SHA1 job for the multi-buffer manager */
1556df3ef80SGreg Tucker 
1566df3ef80SGreg Tucker typedef struct {
1576df3ef80SGreg Tucker         uint8_t *buffer; //!< pointer to data buffer for this job
1586df3ef80SGreg Tucker         uint32_t len;    //!< length of buffer for this job in blocks.
1590106da91SPablo de Lara         DECLARE_ALIGNED(uint32_t result_digest[ISAL_SHA1_DIGEST_NWORDS], 64);
160*8cb7fe78SPablo de Lara         ISAL_JOB_STS status; //!< output job status
1616df3ef80SGreg Tucker         void *user_data;     //!< pointer for user's job-related data
1620106da91SPablo de Lara } ISAL_SHA1_JOB;
1636df3ef80SGreg Tucker 
1646df3ef80SGreg Tucker /** @brief Scheduler layer -  Holds arguments for submitted SHA1 job */
1656df3ef80SGreg Tucker 
1666df3ef80SGreg Tucker typedef struct {
1676df3ef80SGreg Tucker         sha1_digest_array digest;
1680106da91SPablo de Lara         uint8_t *data_ptr[ISAL_SHA1_MAX_LANES];
1690106da91SPablo de Lara } ISAL_SHA1_MB_ARGS_X16;
1706df3ef80SGreg Tucker 
1716df3ef80SGreg Tucker /** @brief Scheduler layer - Lane data */
1726df3ef80SGreg Tucker 
1736df3ef80SGreg Tucker typedef struct {
1740106da91SPablo de Lara         ISAL_SHA1_JOB *job_in_lane;
1750106da91SPablo de Lara } ISAL_SHA1_LANE_DATA;
1766df3ef80SGreg Tucker 
1776df3ef80SGreg Tucker /** @brief Scheduler layer - Holds state for multi-buffer SHA1 jobs */
1786df3ef80SGreg Tucker 
1796df3ef80SGreg Tucker typedef struct {
1800106da91SPablo de Lara         ISAL_SHA1_MB_ARGS_X16 args;
1810106da91SPablo de Lara         DECLARE_ALIGNED(uint32_t lens[ISAL_SHA1_MAX_LANES], 16);
1821de5344dSMarcel Cornu         uint64_t unused_lanes; //!< each nibble is index (0...3 or 0...7 or 0...15) of unused lanes,
1831de5344dSMarcel Cornu                                //!< nibble 4 or 8 is set to F as a flag
1840106da91SPablo de Lara         ISAL_SHA1_LANE_DATA ldata[ISAL_SHA1_MAX_LANES];
1856df3ef80SGreg Tucker         uint32_t num_lanes_inuse;
1860106da91SPablo de Lara } ISAL_SHA1_MB_JOB_MGR;
1876df3ef80SGreg Tucker 
1886df3ef80SGreg Tucker /** @brief Context layer - Holds state for multi-buffer SHA1 jobs */
1896df3ef80SGreg Tucker 
1906df3ef80SGreg Tucker typedef struct {
1910106da91SPablo de Lara         ISAL_SHA1_MB_JOB_MGR mgr;
1920106da91SPablo de Lara } ISAL_SHA1_HASH_CTX_MGR;
1936df3ef80SGreg Tucker 
19446a0dff7SPablo de Lara /** @brief Context layer - Holds info describing a single SHA1 job for the multi-buffer CTX manager.
19546a0dff7SPablo de Lara  * This structure must be allocated to 16-byte aligned memory */
1966df3ef80SGreg Tucker 
1976df3ef80SGreg Tucker typedef struct {
1980106da91SPablo de Lara         ISAL_SHA1_JOB job;               // Must be at struct offset 0.
199*8cb7fe78SPablo de Lara         ISAL_HASH_CTX_STS status;        //!< Context status flag
200*8cb7fe78SPablo de Lara         ISAL_HASH_CTX_ERROR error;       //!< Context error flag
201d155fb20SChunyang 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.
2040106da91SPablo de Lara         uint8_t partial_block_buffer[ISAL_SHA1_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
2070106da91SPablo de Lara } ISAL_SHA1_HASH_CTX;
2086df3ef80SGreg Tucker 
20930604006SXiaodong Liu /******************** multibinary function prototypes **********************/
21030604006SXiaodong Liu 
21130604006SXiaodong Liu /**
21230604006SXiaodong Liu  * @brief Initialize the SHA1 multi-buffer manager structure.
21330604006SXiaodong Liu  * @requires SSE4.1 or AVX or AVX2 or AVX512
2147f87eab4SPablo de Lara  * @deprecated Please use isal_sha1_ctx_mgr_init() instead.
21530604006SXiaodong Liu  *
21630604006SXiaodong Liu  * @param mgr Structure holding context level state info
21730604006SXiaodong Liu  * @returns void
21830604006SXiaodong Liu  */
2197f87eab4SPablo de Lara ISAL_DEPRECATED("Please use isal_sha1_ctx_mgr_init() instead")
2201de5344dSMarcel Cornu void
2210106da91SPablo de Lara sha1_ctx_mgr_init(ISAL_SHA1_HASH_CTX_MGR *mgr);
22230604006SXiaodong Liu 
22330604006SXiaodong Liu /**
22430604006SXiaodong Liu  * @brief  Submit a new SHA1 job to the multi-buffer manager.
22530604006SXiaodong Liu  * @requires SSE4.1 or AVX or AVX2 or AVX512
2267f87eab4SPablo de Lara  * @deprecated Please use isal_sha1_ctx_mgr_submit() instead.
22730604006SXiaodong Liu  *
22830604006SXiaodong Liu  * @param  mgr Structure holding context level state info
22930604006SXiaodong Liu  * @param  ctx Structure holding ctx job info
23030604006SXiaodong Liu  * @param  buffer Pointer to buffer to be processed
23130604006SXiaodong Liu  * @param  len Length of buffer (in bytes) to be processed
23230604006SXiaodong Liu  * @param  flags Input flag specifying job type (first, update, last or entire)
23330604006SXiaodong Liu  * @returns NULL if no jobs complete or pointer to jobs structure.
23430604006SXiaodong Liu  */
2357f87eab4SPablo de Lara ISAL_DEPRECATED("Please use isal_sha1_ctx_mgr_submit() instead")
2360106da91SPablo de Lara ISAL_SHA1_HASH_CTX *
2370106da91SPablo de Lara sha1_ctx_mgr_submit(ISAL_SHA1_HASH_CTX_MGR *mgr, ISAL_SHA1_HASH_CTX *ctx, const void *buffer,
238*8cb7fe78SPablo de Lara                     uint32_t len, ISAL_HASH_CTX_FLAG flags);
23930604006SXiaodong Liu 
24030604006SXiaodong Liu /**
24130604006SXiaodong Liu  * @brief Finish all submitted SHA1 jobs and return when complete.
24230604006SXiaodong Liu  * @requires SSE4.1 or AVX or AVX2 or AVX512
2437f87eab4SPablo de Lara  * @deprecated Please use isal_sha1_ctx_mgr_flush() instead.
24430604006SXiaodong Liu  *
24530604006SXiaodong Liu  * @param mgr	Structure holding context level state info
24630604006SXiaodong Liu  * @returns NULL if no jobs to complete or pointer to jobs structure.
24730604006SXiaodong Liu  */
2487f87eab4SPablo de Lara ISAL_DEPRECATED("Please use isal_sha1_ctx_mgr_flush() instead")
2490106da91SPablo de Lara ISAL_SHA1_HASH_CTX *
2500106da91SPablo de Lara sha1_ctx_mgr_flush(ISAL_SHA1_HASH_CTX_MGR *mgr);
25130604006SXiaodong Liu 
2528c5795a3SMarcel Cornu /**
2538c5795a3SMarcel Cornu  * @brief Initialize the SHA1 multi-buffer manager structure.
2548c5795a3SMarcel Cornu  * @requires SSE4.1 for x86 or ASIMD for ARM
2558c5795a3SMarcel Cornu  *
2568c5795a3SMarcel Cornu  * @param[in] mgr Structure holding context level state info
2578c5795a3SMarcel Cornu  * @return Operation status
2588c5795a3SMarcel Cornu  * @retval 0 on success
2598c5795a3SMarcel Cornu  * @retval Non-zero \a ISAL_CRYPTO_ERR on failure
2608c5795a3SMarcel Cornu  */
2611de5344dSMarcel Cornu int
2620106da91SPablo de Lara isal_sha1_ctx_mgr_init(ISAL_SHA1_HASH_CTX_MGR *mgr);
2638c5795a3SMarcel Cornu 
2648c5795a3SMarcel Cornu /**
2658c5795a3SMarcel Cornu  * @brief  Submit a new SHA1 job to the multi-buffer manager.
2668c5795a3SMarcel Cornu  * @requires SSE4.1 for x86 or ASIMD for ARM
2678c5795a3SMarcel Cornu  * @param[in] mgr Structure holding context level state info
2688c5795a3SMarcel Cornu  * @param[in] ctx_in Structure holding ctx job info
2698c5795a3SMarcel Cornu  * @param[out] ctx_out	Pointer address to output job ctx info.
2708c5795a3SMarcel Cornu  *			Modified to point to completed job structure or
2718c5795a3SMarcel Cornu  *			NULL if no jobs completed.
2728c5795a3SMarcel Cornu  * @param[in] buffer Pointer to buffer to be processed
2738c5795a3SMarcel Cornu  * @param[in] len Length of buffer (in bytes) to be processed
2748c5795a3SMarcel Cornu  * @param[in] flags Input flag specifying job type (first, update, last or entire)
2758c5795a3SMarcel Cornu  * @return Operation status
2768c5795a3SMarcel Cornu  * @retval 0 on success
2778c5795a3SMarcel Cornu  * @retval Non-zero \a ISAL_CRYPTO_ERR on failure
2788c5795a3SMarcel Cornu  */
2791de5344dSMarcel Cornu int
2800106da91SPablo de Lara isal_sha1_ctx_mgr_submit(ISAL_SHA1_HASH_CTX_MGR *mgr, ISAL_SHA1_HASH_CTX *ctx_in,
2810106da91SPablo de Lara                          ISAL_SHA1_HASH_CTX **ctx_out, const void *buffer, const uint32_t len,
282*8cb7fe78SPablo de Lara                          const ISAL_HASH_CTX_FLAG flags);
2838c5795a3SMarcel Cornu 
2848c5795a3SMarcel Cornu /**
2858c5795a3SMarcel Cornu  * @brief Finish all submitted SHA1 jobs and return when complete.
2868c5795a3SMarcel Cornu  * @requires SSE4.1 for x86 or ASIMD for ARM
2878c5795a3SMarcel Cornu  *
2888c5795a3SMarcel Cornu  * @param[in] mgr Structure holding context level state info
2892aa9474eSMarcel Cornu  * @param[out] ctx_out	Pointer address to output job ctx info.
2902aa9474eSMarcel Cornu  *			Modified to point to completed job structure or
2912aa9474eSMarcel Cornu  *			NULL if no jobs completed.
2928c5795a3SMarcel Cornu  * @return Operation status
2938c5795a3SMarcel Cornu  * @retval 0 on success
2948c5795a3SMarcel Cornu  * @retval Non-zero \a ISAL_CRYPTO_ERR on failure
2958c5795a3SMarcel Cornu  */
2961de5344dSMarcel Cornu int
2970106da91SPablo de Lara isal_sha1_ctx_mgr_flush(ISAL_SHA1_HASH_CTX_MGR *mgr, ISAL_SHA1_HASH_CTX **ctx_out);
2986df3ef80SGreg Tucker 
2996df3ef80SGreg Tucker #ifdef __cplusplus
3006df3ef80SGreg Tucker }
3016df3ef80SGreg Tucker #endif
3026df3ef80SGreg Tucker 
3036df3ef80SGreg Tucker #endif // _SHA1_MB_H_
304