Skip to content

Commit

Permalink
Merge pull request #6156 from daverodgman/microblaze-littleendian-bac…
Browse files Browse the repository at this point in the history
…kport-2.28

Microblaze littleendian backport 2.28
  • Loading branch information
daverodgman authored Jul 29, 2022
2 parents 8934db7 + 7d4a8da commit 62067bc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
3 changes: 3 additions & 0 deletions ChangeLog.d/muladdc_microblaze.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Bugfix
* Fix support for little-endian Microblaze when MBEDTLS_HAVE_ASM is defined.
Contributed by Kazuyuki Kimura to fix #2020.
14 changes: 12 additions & 2 deletions include/mbedtls/bn_mul.h
Original file line number Diff line number Diff line change
Expand Up @@ -579,10 +579,20 @@
"andi r7, r6, 0xffff \n\t" \
"bsrli r6, r6, 16 \n\t"

#define MULADDC_CORE \
#if(__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
#define MULADDC_LHUI \
"lhui r9, r3, 0 \n\t" \
"addi r3, r3, 2 \n\t" \
"lhui r8, r3, 0 \n\t"
#else
#define MULADDC_LHUI \
"lhui r8, r3, 0 \n\t" \
"addi r3, r3, 2 \n\t" \
"lhui r9, r3, 0 \n\t" \
"lhui r9, r3, 0 \n\t"
#endif

#define MULADDC_CORE \
MULADDC_LHUI \
"addi r3, r3, 2 \n\t" \
"mul r10, r9, r6 \n\t" \
"mul r11, r8, r7 \n\t" \
Expand Down

0 comments on commit 62067bc

Please sign in to comment.