Fix assert abstraction in sim

Assertions that are expected to fail under sim test, are now marked as such
using the macro ASSERT which allows to programmatically switch between normal
assert() behavior and captured assertion.

Assertion changes were moved to more appropriate owners and code duplication
was removed.

Signed-off-by: Fabio Utzig <utzig@apache.org>
diff --git a/boot/bootutil/src/loader.c b/boot/bootutil/src/loader.c
index fbbc805..75494f6 100644
--- a/boot/bootutil/src/loader.c
+++ b/boot/bootutil/src/loader.c
@@ -41,12 +41,6 @@
 #include "mcuboot_config/mcuboot_config.h"
 #endif
 
-#ifdef __BOOTSIM__
-#undef assert
-void sim_assert(int, const char *test, const char *, unsigned int, const char *);
-#define assert(x) sim_assert((x), #x, __FILE__, __LINE__, __func__)
-#endif
-
 static struct boot_loader_state boot_data;
 
 #ifdef MCUBOOT_VALIDATE_SLOT0
@@ -58,7 +52,7 @@
         }                                    \
     } while (0)
 #else
-#define BOOT_STATUS_ASSERT(x) assert(x)
+#define BOOT_STATUS_ASSERT(x) ASSERT(x)
 #endif
 
 struct boot_status_table {
@@ -1429,7 +1423,7 @@
 
 #ifdef MCUBOOT_VALIDATE_SLOT0
     rc = boot_validate_slot(0);
-    assert(rc == 0);
+    ASSERT(rc == 0);
     if (rc != 0) {
         rc = BOOT_EBADIMAGE;
         goto out;