Checking in critical places if secured memset() and memcpy() was successful

Signed-off-by: Piotr Nowicki <piotr.nowicki@arm.com>
diff --git a/tinycrypt/ecc_dh.c b/tinycrypt/ecc_dh.c
index 512686c..6285cf3 100644
--- a/tinycrypt/ecc_dh.c
+++ b/tinycrypt/ecc_dh.c
@@ -81,7 +81,10 @@
 	/* This function is designed for test purposes-only (such as validating NIST
 	 * test vectors) as it uses a provided value for d instead of generating
 	 * it uniformly at random. */
-	mbedtls_platform_memcpy (_private, d, NUM_ECC_BYTES);
+	if( mbedtls_platform_memcpy (_private, d, NUM_ECC_BYTES) != _private )
+	{
+		goto exit;
+	}
 
 	/* Computing public-key from private: */
 	ret = EccPoint_compute_public_key(_public, _private);