From b88dbdded6bdfdcc0549a193bdd3988267b24da6 Mon Sep 17 00:00:00 2001 From: Kazuyuki Kimura Date: Mon, 31 May 2021 17:07:28 +0900 Subject: [PATCH] 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 --- library/bn_mul.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/library/bn_mul.h b/library/bn_mul.h index 962d7a97b..4066f00d0 100644 --- a/library/bn_mul.h +++ b/library/bn_mul.h @@ -566,10 +566,20 @@ "andi r7, r6, 0xffff \n\t" \ "bsrli r6, r6, 16 \n\t" -#define MULADDC_X1_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_X1_CORE \ + MULADDC_LHUI \ "addi r3, r3, 2 \n\t" \ "mul r10, r9, r6 \n\t" \ "mul r11, r8, r7 \n\t" \