ISAL-Crypto
view release on metacpan or search on metacpan
isa-l_crypto/sha512_mb/aarch64/sha512_mb_x2_ce.S view on Meta::CPAN
/**********************************************************************
Copyright(c) 2019 Arm Corporation All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
* Neither the name of Arm Corporation nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**********************************************************************/
.arch armv8.2-a+crypto+sha3
.text
.align 2
.p2align 3,,7
/*
Macros
*/
.macro declare_var_vector_reg name:req,reg:req
\name\()_q .req q\reg
\name\()_v .req v\reg
\name\()_s .req s\reg
.endm
/**
maros for round 0-63
*/
.macro sha512_rounds_low ab,cd,ef,gh,tmp,msg0,msg1,msg4,msg5,msg7
ldr key_q , [key_adr]
add l0_tmp0_v.2d,l0_\msg0\()_v.2d,key_v.2d
add l1_tmp0_v.2d,l1_\msg0\()_v.2d,key_v.2d
add key_adr,key_adr,16
ext l0_tmp1_v.16b,l0_\ef\()_v.16b,l0_\gh\()_v.16b,#8
ext l1_tmp1_v.16b,l1_\ef\()_v.16b,l1_\gh\()_v.16b,#8
ext l0_tmp0_v.16b,l0_tmp0_v.16b,l0_tmp0_v.16b,#8
ext l1_tmp0_v.16b,l1_tmp0_v.16b,l1_tmp0_v.16b,#8
ext l0_tmp2_v.16b,l0_\cd\()_v.16b,l0_\ef\()_v.16b,#8
ext l1_tmp2_v.16b,l1_\cd\()_v.16b,l1_\ef\()_v.16b,#8
add l0_\gh\()_v.2d,l0_\gh\()_v.2d,l0_tmp0_v.2d
add l1_\gh\()_v.2d,l1_\gh\()_v.2d,l1_tmp0_v.2d
ext l0_tmp0_v.16b,l0_\msg4\()_v.16b,l0_\msg5\()_v.16b,#8
ext l1_tmp0_v.16b,l1_\msg4\()_v.16b,l1_\msg5\()_v.16b,#8
sha512su0 l0_\msg0\()_v.2d,l0_\msg1\()_v.2d
sha512su0 l1_\msg0\()_v.2d,l1_\msg1\()_v.2d
sha512h l0_\gh\()_q,l0_tmp1_q,l0_tmp2_v.2d
sha512h l1_\gh\()_q,l1_tmp1_q,l1_tmp2_v.2d
sha512su1 l0_\msg0\()_v.2d,l0_\msg7\()_v.2d,l0_tmp0_v.2d
sha512su1 l1_\msg0\()_v.2d,l1_\msg7\()_v.2d,l1_tmp0_v.2d
add l0_\tmp\()_v.2d,l0_\cd\()_v.2d,l0_\gh\()_v.2d
add l1_\tmp\()_v.2d,l1_\cd\()_v.2d,l1_\gh\()_v.2d
sha512h2 l0_\gh\()_q,l0_\cd\()_q,l0_\ab\()_v.2d
sha512h2 l1_\gh\()_q,l1_\cd\()_q,l1_\ab\()_v.2d
.endm
/**
maros for round 64-79
*/
.macro sha512_rounds_high ab,cd,ef,gh,tmp,msg0
ldr key_q , [key_adr]
add l0_tmp0_v.2d,l0_\msg0\()_v.2d,key_v.2d
add l1_tmp0_v.2d,l1_\msg0\()_v.2d,key_v.2d
add key_adr,key_adr,16
( run in 2.264 seconds using v1.01-cache-2.11-cpan-9e1a9122474 )