From 90b99bf964ab7e1521029b7b8c5d5a74cfa2edef Mon Sep 17 00:00:00 2001 From: Kazuyuki Kimura Date: Mon, 31 May 2021 17:07:28 +0900 Subject: [PATCH 1/2] fix issue #2020 Fixed a bug that the little-endian Microblaze does not work when MBEDTLS_HAVE_ASM is defined. Signed-off-by: Kazuyuki Kimura Signed-off-by: Dave Rodgman --- include/mbedtls/bn_mul.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/include/mbedtls/bn_mul.h b/include/mbedtls/bn_mul.h index 029eff2185b8..a3fc3638150a 100644 --- a/include/mbedtls/bn_mul.h +++ b/include/mbedtls/bn_mul.h @@ -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" \ From 7d4a8da1b743d4f9f85695bbe4c90bd1392078d6 Mon Sep 17 00:00:00 2001 From: Dave Rodgman Date: Mon, 30 May 2022 17:48:17 +0100 Subject: [PATCH 2/2] Add Changelog entry Signed-off-by: Dave Rodgman --- ChangeLog.d/muladdc_microblaze.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 ChangeLog.d/muladdc_microblaze.txt diff --git a/ChangeLog.d/muladdc_microblaze.txt b/ChangeLog.d/muladdc_microblaze.txt new file mode 100644 index 000000000000..70fdff0204c5 --- /dev/null +++ b/ChangeLog.d/muladdc_microblaze.txt @@ -0,0 +1,3 @@ +Bugfix + * Fix support for little-endian Microblaze when MBEDTLS_HAVE_ASM is defined. + Contributed by Kazuyuki Kimura to fix #2020.