[PATCH v2 0/7] crypto: sha256 - Merge 2 separate C implementations into 1, put into separate library

2019-08-17 Thread Hans de Goede
Hi All, Here is v2 of my patch series refactoring the current 2 separate SHA256 C implementations into 1 and put it into a separate library. There are 3 reasons for this: 1) Remove the code duplication of having 2 separate implementations 2) Offer a separate library SHA256 implementation which

[PATCH v2 7/7] crypto: sha256_generic - Switch to the generic lib/crypto/sha256.c lib code

2019-08-17 Thread Hans de Goede
Drop the duplicate generic sha256 (and sha224) implementation from crypto/sha256_generic.c and use the implementation from lib/crypto/sha256.c instead. "diff -u lib/crypto/sha256.c sha256_generic.c" shows that the core sha256_transform function from both implementations is identical and the other

[PATCH v2 3/7] crypto: sha256 - Move lib/sha256.c to lib/crypto

2019-08-17 Thread Hans de Goede
Generic crypto implementations belong under lib/crypto not directly in lib, likewise the header should be in include/crypto, not include/linux. Note that the code in lib/crypto/sha256.c is not yet available for generic use after this commit, it is still only used by the s390 and x86 purgatory code

[PATCH v2 2/7] crypto: sha256_generic - Fix some coding style issues

2019-08-17 Thread Hans de Goede
Add a bunch of missing spaces after commas and arround operators. Note the main goal of this is to make sha256_transform and its helpers identical in formatting too the duplcate implementation in lib/sha256.c, so that "diff -u" can be used to compare them to prove that no functional changes are ma

[PATCH v2 4/7] crypto: sha256 - Use get/put_unaligned_be32 to get input, memzero_explicit

2019-08-17 Thread Hans de Goede
Use get/put_unaligned_be32 in lib/crypto/sha256.c to load / store data so that it can be used with unaligned buffers too, making it more generic. And use memzero_explicit for better clearing of sensitive data. Note unlike other patches in this series this commit actually makes functional changes

[PATCH v2 5/7] crypto: sha256 - Make lib/crypto/sha256.c suitable for generic use

2019-08-17 Thread Hans de Goede
Before this commit lib/crypto/sha256.c has only been used in the s390 and x86 purgatory code, make it suitable for generic use: * Export interesting symbols * Add -D__DISABLE_EXPORTS to CFLAGS_sha256.o for purgatory builds to avoid the exports for the purgatory builds * Add to lib/crypto/Makefi

[PATCH v2 6/7] crypto: sha256 - Add sha224 support to sha256 library code

2019-08-17 Thread Hans de Goede
Add sha224 support to the lib/crypto/sha256 library code. This will allow us to replace both the sha256 and sha224 parts of crypto/sha256_generic.c when we remove the code duplication in further patches in this series. Suggested-by: Eric Biggers Signed-off-by: Hans de Goede --- include/crypto/s

[PATCH v2 1/7] crypto: sha256 - Fix some coding style issues

2019-08-17 Thread Hans de Goede
For some reason after the first 15 steps the last statement of each step ends with "t1+t2", missing spaces around the "+". This commit fixes this. This was done with a 's/= t1+t2/= t1 + t2/' to make sure no functional changes are introduced. Note the main goal of this is to make lib/sha256.c's sha

Re: [PATCH 6/6] crypto: sha256_generic - Use sha256_transform from generic sha256 lib

2019-08-17 Thread Hans de Goede
Hi Eric, Thank you for the review and for the quick turn around time on the review. On 17-08-19 07:35, Eric Biggers wrote: On Fri, Aug 16, 2019 at 10:13:18PM -0700, Eric Biggers wrote: On Fri, Aug 16, 2019 at 11:16:11PM +0200, Hans de Goede wrote: Drop the duplicate sha256_transform function

Re: [PATCH v8 06/28] x86/asm/crypto: annotate local functions

2019-08-17 Thread Borislav Petkov
On Thu, Aug 08, 2019 at 12:38:32PM +0200, Jiri Slaby wrote: > Use the newly added SYM_FUNC_START_LOCAL to annotate starts of all > functions which do not have ".globl" annotation, but their ends are > annotated by ENDPROC. This is needed to balance ENDPROC for tools that > generate debuginfo. > >

Re: [PATCH 3/6] crypto: sha256 - Move lib/sha256.c to lib/crypto

2019-08-17 Thread Hans de Goede
Hi, On 17-08-19 07:19, Eric Biggers wrote: On Fri, Aug 16, 2019 at 11:16:08PM +0200, Hans de Goede wrote: diff --git a/include/linux/sha256.h b/include/crypto/sha256.h similarity index 100% rename from include/linux/sha256.h rename to include/crypto/sha256.h already has the declarations for