Tighten ecp_mul() validity checks
diff --git a/tests/suites/test_suite_ecp.data b/tests/suites/test_suite_ecp.data
index 2f5f4ef..8dafc39 100644
--- a/tests/suites/test_suite_ecp.data
+++ b/tests/suites/test_suite_ecp.data
@@ -50,10 +50,10 @@
 ecp_small_sub:0:"14":"11":0:"14":"36":0:27:30
 
 ECP small multiplication negative
-ecp_small_mul:-1:0:0:0:POLARSSL_ERR_ECP_BAD_INPUT_DATA
+ecp_small_mul:-1:0:0:0:POLARSSL_ERR_ECP_INVALID_KEY
 
 ECP small multiplication #0
-ecp_small_mul:0:1:0:0:0
+ecp_small_mul:0:1:0:0:POLARSSL_ERR_ECP_INVALID_KEY
 
 ECP small multiplication #1
 ecp_small_mul:1:0:17:42:0
@@ -92,16 +92,10 @@
 ecp_small_mul:12:0:17:05:0
 
 ECP small multiplication #13
-ecp_small_mul:13:1:0:0:0
+ecp_small_mul:13:1:0:0:POLARSSL_ERR_ECP_INVALID_KEY
 
 ECP small multiplication #14
-ecp_small_mul:1:0:17:42:0
-
-ECP small multiplication #15
-ecp_small_mul:2:0:20:01:0
-
-ECP small multiplication too big
-ecp_small_mul:-1:0:0:0:POLARSSL_ERR_ECP_BAD_INPUT_DATA
+ecp_small_mul:14:0:17:42:POLARSSL_ERR_ECP_INVALID_KEY
 
 ECP small check pubkey #1
 ecp_small_check_pub:1:1:0:POLARSSL_ERR_ECP_INVALID_KEY
diff --git a/tests/suites/test_suite_ecp.function b/tests/suites/test_suite_ecp.function
index 4eb5259..8cc5aba 100644
--- a/tests/suites/test_suite_ecp.function
+++ b/tests/suites/test_suite_ecp.function
@@ -115,12 +115,15 @@
 
     TEST_ASSERT( ecp_mul( &grp, &R, &m, &grp.G, NULL, NULL ) == ret );
 
-    if( r_zero )
-        TEST_ASSERT( mpi_cmp_int( &R.Z, 0 ) == 0 );
-    else
+    if( ret == 0 )
     {
-        TEST_ASSERT( mpi_cmp_int( &R.X, x_r ) == 0 );
-        TEST_ASSERT( mpi_cmp_int( &R.Y, y_r ) == 0 );
+        if( r_zero )
+            TEST_ASSERT( mpi_cmp_int( &R.Z, 0 ) == 0 );
+        else
+        {
+            TEST_ASSERT( mpi_cmp_int( &R.X, x_r ) == 0 );
+            TEST_ASSERT( mpi_cmp_int( &R.Y, y_r ) == 0 );
+        }
     }
 
     /* try again with randomization */
@@ -129,12 +132,15 @@
     TEST_ASSERT( ecp_mul( &grp, &R, &m, &grp.G,
                           &rnd_pseudo_rand, &rnd_info ) == ret );
 
-    if( r_zero )
-        TEST_ASSERT( mpi_cmp_int( &R.Z, 0 ) == 0 );
-    else
+    if( ret == 0 )
     {
-        TEST_ASSERT( mpi_cmp_int( &R.X, x_r ) == 0 );
-        TEST_ASSERT( mpi_cmp_int( &R.Y, y_r ) == 0 );
+        if( r_zero )
+            TEST_ASSERT( mpi_cmp_int( &R.Z, 0 ) == 0 );
+        else
+        {
+            TEST_ASSERT( mpi_cmp_int( &R.X, x_r ) == 0 );
+            TEST_ASSERT( mpi_cmp_int( &R.Y, y_r ) == 0 );
+        }
     }
 
     ecp_group_free( &grp );