Skip to content

Commit 74ff6cb

Browse files
marcelocerriherbertx
authored andcommitted
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>
1 parent 50d2e6d commit 74ff6cb

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

‎arch/powerpc/crypto/sha1-powerpc-asm.S‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@
77
#include <asm/ppc_asm.h>
88
#include <asm/asm-offsets.h>
99

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+
1019
/*
1120
* We roll the registers for T, A, B, C, D, E around on each
1221
* iteration; T on iteration t is A on iteration t+1, and so on.
@@ -23,7 +32,7 @@
2332
#define W(t) (((t)%16)+16)
2433

2534
#define LOADW(t) \
26-
lwz W(t),(t)*4(r4)
35+
LWZ(W(t),(t)*4,r4)
2736

2837
#define STEPD0_LOAD(t) \
2938
andc r0,RD(t),RB(t); \
@@ -33,7 +42,7 @@
3342
add r0,RE(t),r15; \
3443
add RT(t),RT(t),r6; \
3544
add r14,r0,W(t); \
36-
lwz W((t)+4),((t)+4)*4(r4); \
45+
LWZ(W((t)+4),((t)+4)*4,r4); \
3746
rotlwi RB(t),RB(t),30; \
3847
add RT(t),RT(t),r14
3948

0 commit comments

Comments
 (0)