From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> To: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Herbert Xu <herbert@gondor.apana.org.au>, "linux-crypto@vger.kernel.org" <linux-crypto@vger.kernel.org>, Sami Tolvanen <samitolvanen@google.com>, Andy Polyakov <appro@openssl.org>, "David S. Miller" <davem@davemloft.net>, "linux-arm-kernel@lists.infradead.org" <linux-arm-kernel@lists.infradead.org> Subject: Re: [PATCHv2] arm: crypto: Add optimized SHA-256/224 Date: Tue, 24 Mar 2015 18:05:43 +0100 [thread overview] Message-ID: <20150324170543.GL14457@ns203013.ovh.net> (raw) In-Reply-To: <CAKv+Gu_4G69JZJPex_=1xOZ4z5Fxtht4YG4G=TnYrkXPuiXvFg@mail.gmail.com> On 15:46 Tue 24 Mar , Ard Biesheuvel wrote: > On 24 March 2015 at 14:06, Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote: > > On 24 March 2015 at 14:05, Jean-Christophe PLAGNIOL-VILLARD > > <plagnioj@jcrosoft.com> wrote: > >> >> + '&eor ($t0,$t0,$a,"ror#".($Sigma0[2]-$Sigma0[0]))', # Sigma0(a) > >>> >> + '&add ($h,$h,$t1)', # h+=Ch(e,f,g) > >>> >> + '&ldr ($t1,sprintf "[sp,#%d]",4*(($j+1)&15)) if (($j&15)!=15);'. > >>> >> + '&ldr ($t1,"[$Ktbl]") if ($j==15);'. > >>> >> + '&ldr ($t1,"[sp,#64]") if ($j==31)', > >>> >> + '&and ($t3,$t3,$t2)', # (b^c)&=(a^b) > >>> >> + '&add ($d,$d,$h)', # d+=h > >>> >> + '&add ($h,$h,$t0,"ror#$Sigma0[0]");'. # h+=Sigma0(a) > >>> >> + '&eor ($t3,$t3,$b)', # Maj(a,b,c) > >>> >> + '$j++; unshift(@V,pop(@V)); ($t2,$t3)=($t3,$t2);' > >>> >> + ) > >>> >> +} > >>> >> + > >>> >> +$code.=<<___; > >>> >> +#if __ARM_MAX_ARCH__>=7 > >>> > this will be compile on armv4 but gcc will not allow it > >>> > > >>> > we need to drop the neon code for older non v7 build > >>> > > >>> > >>> The .arch and .fpu declarations ensure that it can be built regardless > >>> of the platform you are compiling for, unless you have a really old > >>> toolchain. > >> I known but does not work for me > >>> The glue code ensures that the module can only be loaded if HWCAP_NEON is set. > >>> > >>> Did you get errors trying to build it? > >> > >> yes I do > >> > >> I use > >> > >> arm-none-linux-gnueabi-gcc (Sourcery CodeBench Lite 2014.05-29) 4.8.3 20140320 > >> (prerelease) > >> Copyright (C) 2013 Free Software Foundation, Inc. > >> This is free software; see the source for copying conditions. There is NO > >> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. > >> > >> so it's not that old > >> > > > > Could you share the error log please? > > OK, I spotted one issue with this code: > > arch/arm/crypto/sha256-core.S: Assembler messages: > arch/arm/crypto/sha256-core.S:1847: Error: invalid constant (ffffefb0) > after fixup yes exactly > > This is caused by the fact that, when building the integer-only code > for an older architecture, the conditional compilation produces a > slightly bigger preceding function, and the symbol K256 is out of > range for the adr instruction. Yeap I see that too when debuging > > @Jean-Christophe: is that the same problem that you hit? > > @Andy: I propose we do something similar as in the bsaes code: > > #ifdef __thumb__ > #define adrl adr > #endif > > and replace the offending line with > > adrl r14,K256 Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Tested-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> on arm926ejs Best Regards, J.
WARNING: multiple messages have this Message-ID (diff)
From: plagnioj@jcrosoft.com (Jean-Christophe PLAGNIOL-VILLARD) To: linux-arm-kernel@lists.infradead.org Subject: [PATCHv2] arm: crypto: Add optimized SHA-256/224 Date: Tue, 24 Mar 2015 18:05:43 +0100 [thread overview] Message-ID: <20150324170543.GL14457@ns203013.ovh.net> (raw) In-Reply-To: <CAKv+Gu_4G69JZJPex_=1xOZ4z5Fxtht4YG4G=TnYrkXPuiXvFg@mail.gmail.com> On 15:46 Tue 24 Mar , Ard Biesheuvel wrote: > On 24 March 2015 at 14:06, Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote: > > On 24 March 2015 at 14:05, Jean-Christophe PLAGNIOL-VILLARD > > <plagnioj@jcrosoft.com> wrote: > >> >> + '&eor ($t0,$t0,$a,"ror#".($Sigma0[2]-$Sigma0[0]))', # Sigma0(a) > >>> >> + '&add ($h,$h,$t1)', # h+=Ch(e,f,g) > >>> >> + '&ldr ($t1,sprintf "[sp,#%d]",4*(($j+1)&15)) if (($j&15)!=15);'. > >>> >> + '&ldr ($t1,"[$Ktbl]") if ($j==15);'. > >>> >> + '&ldr ($t1,"[sp,#64]") if ($j==31)', > >>> >> + '&and ($t3,$t3,$t2)', # (b^c)&=(a^b) > >>> >> + '&add ($d,$d,$h)', # d+=h > >>> >> + '&add ($h,$h,$t0,"ror#$Sigma0[0]");'. # h+=Sigma0(a) > >>> >> + '&eor ($t3,$t3,$b)', # Maj(a,b,c) > >>> >> + '$j++; unshift(@V,pop(@V)); ($t2,$t3)=($t3,$t2);' > >>> >> + ) > >>> >> +} > >>> >> + > >>> >> +$code.=<<___; > >>> >> +#if __ARM_MAX_ARCH__>=7 > >>> > this will be compile on armv4 but gcc will not allow it > >>> > > >>> > we need to drop the neon code for older non v7 build > >>> > > >>> > >>> The .arch and .fpu declarations ensure that it can be built regardless > >>> of the platform you are compiling for, unless you have a really old > >>> toolchain. > >> I known but does not work for me > >>> The glue code ensures that the module can only be loaded if HWCAP_NEON is set. > >>> > >>> Did you get errors trying to build it? > >> > >> yes I do > >> > >> I use > >> > >> arm-none-linux-gnueabi-gcc (Sourcery CodeBench Lite 2014.05-29) 4.8.3 20140320 > >> (prerelease) > >> Copyright (C) 2013 Free Software Foundation, Inc. > >> This is free software; see the source for copying conditions. There is NO > >> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. > >> > >> so it's not that old > >> > > > > Could you share the error log please? > > OK, I spotted one issue with this code: > > arch/arm/crypto/sha256-core.S: Assembler messages: > arch/arm/crypto/sha256-core.S:1847: Error: invalid constant (ffffefb0) > after fixup yes exactly > > This is caused by the fact that, when building the integer-only code > for an older architecture, the conditional compilation produces a > slightly bigger preceding function, and the symbol K256 is out of > range for the adr instruction. Yeap I see that too when debuging > > @Jean-Christophe: is that the same problem that you hit? > > @Andy: I propose we do something similar as in the bsaes code: > > #ifdef __thumb__ > #define adrl adr > #endif > > and replace the offending line with > > adrl r14,K256 Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Tested-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> on arm926ejs Best Regards, J.
next prev parent reply other threads:[~2015-03-24 17:05 UTC|newest] Thread overview: 66+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-03-16 15:48 [PATCH] arm: crypto: Add NEON optimized SHA-256 Sami Tolvanen 2015-03-16 15:48 ` Sami Tolvanen 2015-03-16 16:08 ` Ard Biesheuvel 2015-03-16 16:08 ` Ard Biesheuvel 2015-03-16 16:23 ` Sami Tolvanen 2015-03-16 16:23 ` Sami Tolvanen 2015-03-17 6:56 ` Ard Biesheuvel 2015-03-17 6:56 ` Ard Biesheuvel 2015-03-17 15:09 ` Andy Polyakov 2015-03-17 15:09 ` Andy Polyakov 2015-03-17 15:21 ` Sami Tolvanen 2015-03-17 15:21 ` Sami Tolvanen 2015-03-17 15:51 ` Ard Biesheuvel 2015-03-17 15:51 ` Ard Biesheuvel 2015-03-23 13:50 ` [PATCHv2] arm: crypto: Add optimized SHA-256/224 Sami Tolvanen 2015-03-23 13:50 ` Sami Tolvanen 2015-03-23 18:26 ` Ard Biesheuvel 2015-03-23 18:26 ` Ard Biesheuvel 2015-03-24 11:35 ` Herbert Xu 2015-03-24 11:35 ` Herbert Xu 2015-03-24 11:40 ` Ard Biesheuvel 2015-03-24 11:40 ` Ard Biesheuvel 2015-03-24 11:46 ` Herbert Xu 2015-03-24 11:46 ` Herbert Xu 2015-03-24 11:57 ` Ard Biesheuvel 2015-03-24 11:57 ` Ard Biesheuvel 2015-03-24 11:32 ` Herbert Xu 2015-03-24 11:32 ` Herbert Xu 2015-03-24 11:33 ` Ard Biesheuvel 2015-03-24 11:33 ` Ard Biesheuvel 2015-03-24 12:27 ` Jean-Christophe PLAGNIOL-VILLARD 2015-03-24 12:27 ` Jean-Christophe PLAGNIOL-VILLARD 2015-03-24 12:42 ` Ard Biesheuvel 2015-03-24 12:42 ` Ard Biesheuvel 2015-03-24 13:05 ` Jean-Christophe PLAGNIOL-VILLARD 2015-03-24 13:05 ` Jean-Christophe PLAGNIOL-VILLARD 2015-03-24 13:06 ` Ard Biesheuvel 2015-03-24 13:06 ` Ard Biesheuvel 2015-03-24 14:46 ` Ard Biesheuvel 2015-03-24 14:46 ` Ard Biesheuvel 2015-03-24 17:05 ` Jean-Christophe PLAGNIOL-VILLARD [this message] 2015-03-24 17:05 ` Jean-Christophe PLAGNIOL-VILLARD 2015-03-24 17:40 ` Ard Biesheuvel 2015-03-24 17:40 ` Ard Biesheuvel 2015-03-24 18:17 ` Sami Tolvanen 2015-03-24 18:17 ` Sami Tolvanen 2015-03-25 6:49 ` Ard Biesheuvel 2015-03-25 6:49 ` Ard Biesheuvel 2015-03-27 10:42 ` Andy Polyakov 2015-03-27 10:42 ` Andy Polyakov 2015-03-27 10:44 ` Ard Biesheuvel 2015-03-27 10:44 ` Ard Biesheuvel 2015-03-27 18:07 ` Ard Biesheuvel 2015-03-27 18:07 ` Ard Biesheuvel 2015-03-29 13:27 ` Andy Polyakov 2015-03-29 13:27 ` Andy Polyakov 2015-03-30 8:37 ` [PATCHv3] " Sami Tolvanen 2015-03-30 8:37 ` Sami Tolvanen 2015-04-01 12:43 ` Herbert Xu 2015-04-01 12:43 ` Herbert Xu 2015-04-01 13:19 ` Sami Tolvanen 2015-04-01 13:19 ` Sami Tolvanen 2015-04-03 10:04 ` Herbert Xu 2015-04-03 10:04 ` Herbert Xu 2015-03-25 20:00 ` [PATCH] arm: crypto: Add NEON optimized SHA-256 Jean-Christophe PLAGNIOL-VILLARD 2015-03-25 20:00 ` Jean-Christophe PLAGNIOL-VILLARD
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20150324170543.GL14457@ns203013.ovh.net \ --to=plagnioj@jcrosoft.com \ --cc=appro@openssl.org \ --cc=ard.biesheuvel@linaro.org \ --cc=davem@davemloft.net \ --cc=herbert@gondor.apana.org.au \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-crypto@vger.kernel.org \ --cc=samitolvanen@google.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.