ISAL-Crypto
view release on metacpan or search on metacpan
isa-l_crypto/sha256_mb/aarch64/sha256_mb_x4_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-a+crypto
.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 48-63
tmp0 : in
tmp1 : out
*/
.macro sha256_4_rounds_high msg:req,tmp0:req
ldr key_q , [tmp]
mov tmp0_v.16b,l0_\tmp0\()_v.16b
mov tmp1_v.16b,l1_\tmp0\()_v.16b
add l0_\tmp0\()_v.4s,l0_\msg\()_v.4s,key_v.4s
add l1_\tmp0\()_v.4s,l1_\msg\()_v.4s,key_v.4s
mov tmp2_v.16b,l0_abcd_v.16b
mov tmp3_v.16b,l1_abcd_v.16b
sha256h l0_abcd_q,l0_efgh_q,tmp0_v.4s
sha256h l1_abcd_q,l1_efgh_q,tmp1_v.4s
sha256h2 l0_efgh_q,tmp2_q,tmp0_v.4s
sha256h2 l1_efgh_q,tmp3_q,tmp1_v.4s
ldr key_q , [tmp]
mov tmp0_v.16b,l2_\tmp0\()_v.16b
mov tmp1_v.16b,l3_\tmp0\()_v.16b
add tmp,tmp,16
add l2_\tmp0\()_v.4s,l2_\msg\()_v.4s,key_v.4s
add l3_\tmp0\()_v.4s,l3_\msg\()_v.4s,key_v.4s
mov tmp2_v.16b,l2_abcd_v.16b
mov tmp3_v.16b,l3_abcd_v.16b
sha256h l2_abcd_q,l2_efgh_q,tmp0_v.4s
sha256h l3_abcd_q,l3_efgh_q,tmp1_v.4s
sha256h2 l2_efgh_q,tmp2_q,tmp0_v.4s
sha256h2 l3_efgh_q,tmp3_q,tmp1_v.4s
.endm
/**
maros for round 0-47
*/
.macro sha256_4_rounds_low msg0:req,msg1:req,msg2:req,msg3:req,tmp0:req
sha256su0 l0_\msg0\()_v.4s,l0_\msg1\()_v.4s
sha256su0 l1_\msg0\()_v.4s,l1_\msg1\()_v.4s
sha256su0 l2_\msg0\()_v.4s,l2_\msg1\()_v.4s
sha256su0 l3_\msg0\()_v.4s,l3_\msg1\()_v.4s
sha256_4_rounds_high \msg1,\tmp0
sha256su1 l0_\msg0\()_v.4s,l0_\msg2\()_v.4s,l0_\msg3\()_v.4s
sha256su1 l1_\msg0\()_v.4s,l1_\msg2\()_v.4s,l1_\msg3\()_v.4s
sha256su1 l2_\msg0\()_v.4s,l2_\msg2\()_v.4s,l2_\msg3\()_v.4s
sha256su1 l3_\msg0\()_v.4s,l3_\msg2\()_v.4s,l3_\msg3\()_v.4s
.endm
/*
Variable list
*/
( run in 1.696 second using v1.01-cache-2.11-cpan-ad19def0cd9 )