Skip to content

Commit

Permalink
crypto: blake2b - Fix clang optimization for ARMv7-M
Browse files Browse the repository at this point in the history
When building for ARMv7-M, clang-9 or higher tries to unroll some loops,
which ends up confusing the register allocator to the point of generating
rather bad code and using more than the warning limit for stack frames:

warning: stack frame size of 1200 bytes in function 'blake2b_compress' [-Wframe-larger-than=]

Forcing it to not unroll the final loop avoids this problem.

Fixes: 91d6893 ("crypto: blake2b - add blake2b generic implementation")
Signed-off-by: Arnd Bergmann <[email protected]>
Reviewed-by: Nathan Chancellor <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
arndb authored and herbertx committed May 15, 2020
1 parent 9a611a1 commit 0c0408e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion crypto/blake2b_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@ static void blake2b_compress(struct blake2b_state *S,
ROUND(9);
ROUND(10);
ROUND(11);

#ifdef CONFIG_CC_IS_CLANG
#pragma nounroll /* https://bugs.llvm.org/show_bug.cgi?id=45803 */
#endif
for (i = 0; i < 8; ++i)
S->h[i] = S->h[i] ^ v[i] ^ v[i + 8];
}
Expand Down

0 comments on commit 0c0408e

Please sign in to comment.