Add test code for big endian write/read

Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
diff --git a/tests/suites/test_suite_ecp.function b/tests/suites/test_suite_ecp.function
index d1d7644..e5ec373 100644
--- a/tests/suites/test_suite_ecp.function
+++ b/tests/suites/test_suite_ecp.function
@@ -1591,6 +1591,9 @@
 
     bytes = limbs * ciL;
     ASSERT_ALLOC(bufx, limbs);
+    /* Write source mod residue to a buffer, then read it back to
+     * the destination mod residue, compare the two mod residues.
+     * Firstly test little endian write and read */
     TEST_EQUAL(0, mbedtls_mpi_mod_write(&rA, &m, (unsigned char *) bufx,
                                         bytes,
                                         MBEDTLS_MPI_MOD_EXT_REP_LE));
@@ -1602,6 +1605,20 @@
     TEST_EQUAL(limbs, rX.limbs);
     ASSERT_COMPARE(rA.p, bytes, rX.p, bytes);
 
+    memset(bufx, 0x00, bytes);
+    memset(rX_raw, 0x00, bytes);
+    /* Then test big endian write and read */
+    TEST_EQUAL(0, mbedtls_mpi_mod_write(&rA, &m, (unsigned char *) bufx,
+                                        bytes,
+                                        MBEDTLS_MPI_MOD_EXT_REP_BE));
+
+    TEST_EQUAL(0, mbedtls_mpi_mod_read(&rX, &m, (unsigned char *) bufx,
+                                       bytes,
+                                       MBEDTLS_MPI_MOD_EXT_REP_BE));
+
+    TEST_EQUAL(limbs, rX.limbs);
+    ASSERT_COMPARE(rA.p, bytes, rX.p, bytes);
+
 exit:
     mbedtls_mpi_mod_modulus_free(&m);
     mbedtls_mpi_mod_residue_release(&rA);