diff bootutil/do_match.c @ 12:fe5f7ba7f154

c139-analyze-boot utility put together, compiles
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 10 Jun 2023 04:58:26 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bootutil/do_match.c	Sat Jun 10 04:58:26 2023 +0000
@@ -0,0 +1,21 @@
+/*
+ * The function implemented in this module performs a single match-check
+ * between the boot image being analyzed and one of the reference versions
+ * from ../bootmatch directory.
+ */
+
+#include <sys/types.h>
+#include <string.h>
+#include <strings.h>
+#include "../bootmatch/bootmatch.h"
+
+check_for_match(image, bm)
+	u_char *image;
+	struct bootmatch *bm;
+{
+	for (; bm->nbytes; bm++) {
+		if (bcmp(image + bm->offset, bm->refbytes, bm->nbytes))
+			return(0);
+	}
+	return(1);
+}