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%include "datastruct.asm" 316df3ef80SGreg Tucker 326df3ef80SGreg Tucker;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 336df3ef80SGreg Tucker;;;; Define constants 346df3ef80SGreg Tucker;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 356df3ef80SGreg Tucker 368cb7fe78SPablo de Lara%define ISAL_STS_UNKNOWN 0 378cb7fe78SPablo de Lara%define ISAL_STS_BEING_PROCESSED 1 388cb7fe78SPablo de Lara%define ISAL_STS_COMPLETED 2 396df3ef80SGreg Tucker 406df3ef80SGreg Tucker;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 41246221b0SXiaodong Liu;;;; Threshold constants 42246221b0SXiaodong Liu;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 43246221b0SXiaodong Liu; if number of lanes in use <= threshold, using sb func 44246221b0SXiaodong Liu%define SHA256_SB_THRESHOLD_SSE 1 45246221b0SXiaodong Liu%define SHA256_SB_THRESHOLD_AVX 1 46246221b0SXiaodong Liu%define SHA256_SB_THRESHOLD_AVX2 1 47246221b0SXiaodong Liu%define SHA256_SB_THRESHOLD_AVX512 1 48246221b0SXiaodong Liu%define SHA256_NI_SB_THRESHOLD_SSE 4 ; shani is faster than sse sha256_mb 49246221b0SXiaodong Liu%define SHA256_NI_SB_THRESHOLD_AVX512 6 50246221b0SXiaodong Liu 51246221b0SXiaodong Liu;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 52*0a437795SPablo de Lara;;;; Define ISAL_SHA256_JOB structure 536df3ef80SGreg Tucker;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 546df3ef80SGreg Tucker 55*0a437795SPablo de LaraSTART_FIELDS ; ISAL_SHA256_JOB 566df3ef80SGreg Tucker 576df3ef80SGreg Tucker;;; name size align 586df3ef80SGreg TuckerFIELD _buffer, 8, 8 ; pointer to buffer 596df3ef80SGreg TuckerFIELD _len, 8, 8 ; length in bytes 606df3ef80SGreg TuckerFIELD _result_digest, 8*4, 64 ; Digest (output) 616df3ef80SGreg TuckerFIELD _status, 4, 4 626df3ef80SGreg TuckerFIELD _user_data, 8, 8 636df3ef80SGreg Tucker 64*0a437795SPablo de Lara%assign _ISAL_SHA256_JOB_size _FIELD_OFFSET 65*0a437795SPablo de Lara%assign _ISAL_SHA256_JOB_align _STRUCT_ALIGN 66