Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

crypto: sha1-powerpc - little-endian support

The driver does not handle endianness properly when loading the input
data.

Signed-off-by: Marcelo Cerri <marcelo.cerri@canonical.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Marcelo Cerri and committed by
Herbert Xu
74ff6cb3 50d2e6dc

+11 -2
+11 -2
arch/powerpc/crypto/sha1-powerpc-asm.S
··· 7 7 #include <asm/ppc_asm.h> 8 8 #include <asm/asm-offsets.h> 9 9 10 + #ifdef __BIG_ENDIAN__ 11 + #define LWZ(rt, d, ra) \ 12 + lwz rt,d(ra) 13 + #else 14 + #define LWZ(rt, d, ra) \ 15 + li rt,d; \ 16 + lwbrx rt,rt,ra 17 + #endif 18 + 10 19 /* 11 20 * We roll the registers for T, A, B, C, D, E around on each 12 21 * iteration; T on iteration t is A on iteration t+1, and so on. ··· 32 23 #define W(t) (((t)%16)+16) 33 24 34 25 #define LOADW(t) \ 35 - lwz W(t),(t)*4(r4) 26 + LWZ(W(t),(t)*4,r4) 36 27 37 28 #define STEPD0_LOAD(t) \ 38 29 andc r0,RD(t),RB(t); \ ··· 42 33 add r0,RE(t),r15; \ 43 34 add RT(t),RT(t),r6; \ 44 35 add r14,r0,W(t); \ 45 - lwz W((t)+4),((t)+4)*4(r4); \ 36 + LWZ(W((t)+4),((t)+4)*4,r4); \ 46 37 rotlwi RB(t),RB(t),30; \ 47 38 add RT(t),RT(t),r14 48 39