From 44fbf91f019e18ba317121328101d72be18458b8 Mon Sep 17 00:00:00 2001
From: Jeffrey Martin <Jeffrey_Martin@rapid7.com>
Date: Mon, 14 Jan 2019 18:13:06 -0600
Subject: [PATCH] Backport #1949 into mbedtls-2.7

Signed-off-by: Jeffrey Martin <Jeffrey_Martin@rapid7.com>
---
 ChangeLog                | 4 ++++
 include/mbedtls/bn_mul.h | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 005573d81..09ab3db1c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,10 @@ mbed TLS ChangeLog (Sorted per branch, date)
 Bugfix
    * Run the AD too long test only if MBEDTLS_CCM_ALT is not defined.
      Raised as a comment in #1996.
+   * Extend register cleanup needed on MIPS assembly optimizations. Adds hi, lo
+     registers hints to the compiler for usage with the embedded MIPS assembly.
+     Reported in #1722, fix suggested by @aurel32 and submitted
+     by Jeffrey Martin, #1949.
 
 = mbed TLS 2.7.9 branch released 2018-12-21
 
diff --git a/include/mbedtls/bn_mul.h b/include/mbedtls/bn_mul.h
index 80e4b380d..9d32f2bac 100644
--- a/include/mbedtls/bn_mul.h
+++ b/include/mbedtls/bn_mul.h
@@ -734,7 +734,7 @@
         "sw     $10, %2         \n\t"   \
         : "=m" (c), "=m" (d), "=m" (s)                      \
         : "m" (s), "m" (d), "m" (c), "m" (b)                \
-        : "$9", "$10", "$11", "$12", "$13", "$14", "$15"    \
+        : "$9", "$10", "$11", "$12", "$13", "$14", "$15", "lo", "hi" \
     );
 
 #endif /* MIPS */