summaryrefslogtreecommitdiff
path: root/plugins/readmc
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2017-05-13 22:06:28 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2017-05-13 22:06:28 (GMT)
commit198ba09ef74a02a727ac3e679edfa328b2508152 (patch)
tree8846e81d7e3eb3e7b00c9363feba36c77fe058f8 /plugins/readmc
parent5fce21379baac06b7b9359c4b0fcb7fb3867c301 (diff)
Preloaded Mobicore information at loading.
Diffstat (limited to 'plugins/readmc')
-rw-r--r--plugins/readmc/Makefile.am18
-rw-r--r--plugins/readmc/header.c119
-rw-r--r--plugins/readmc/header.h38
-rw-r--r--plugins/readmc/reader.c92
-rw-r--r--plugins/readmc/reader.h38
-rw-r--r--plugins/readmc/text.c145
-rw-r--r--plugins/readmc/text.h38
-rw-r--r--plugins/readmc/v21.c244
-rw-r--r--plugins/readmc/v21.h38
-rw-r--r--plugins/readmc/v23.c91
-rw-r--r--plugins/readmc/v23.h38
-rw-r--r--plugins/readmc/v24.c90
-rw-r--r--plugins/readmc/v24.h38
13 files changed, 1027 insertions, 0 deletions
diff --git a/plugins/readmc/Makefile.am b/plugins/readmc/Makefile.am
new file mode 100644
index 0000000..f1b0845
--- /dev/null
+++ b/plugins/readmc/Makefile.am
@@ -0,0 +1,18 @@
+
+lib_LTLIBRARIES = libreadmc.la
+
+libreadmc_la_SOURCES = \
+ header.h header.c \
+ reader.h reader.c \
+ text.h text.c \
+ v21.h v21.c \
+ v23.h v23.c \
+ v24.h v24.c
+
+libreadmc_la_CFLAGS = $(AM_CFLAGS)
+
+libreadmc_la_LDFLAGS = -L../../plugins/fmtp/.libs -lfmtp
+
+AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) -I../../src -I../..
+
+AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS)
diff --git a/plugins/readmc/header.c b/plugins/readmc/header.c
new file mode 100644
index 0000000..98cf803
--- /dev/null
+++ b/plugins/readmc/header.c
@@ -0,0 +1,119 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * header.c - annotation des en-têtes de binaires ELF
+ *
+ * Copyright (C) 2015-2017 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * Chrysalide is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Chrysalide is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#include "header.h"
+
+
+#include <plugins/fmtp/parser.h>
+
+
+
+/* Définition des champs */
+
+/* Récupère la version du format. */
+static bool get_mclf_version(const fmt_field_def *, GBinContent *, vmpa2t *, SourceEndian, uint32_t *);
+
+
+static fmt_field_def _mc_intro[] = {
+
+ {
+ .name = "magic",
+
+ .size = MDS_8_BITS,
+ .repeat = 4,
+
+ DISPLAY_RULES(IOD_CHAR, IOD_CHAR, IOD_CHAR, IOD_CHAR),
+
+ PLAIN_COMMENT(__("Header magic value"))
+
+ },
+
+ {
+ .name = "version",
+
+ .get_value = (get_fdef_value_cb)get_mclf_version,
+
+ .size = MDS_32_BITS,
+ .repeat = 1,
+
+ DISPLAY_RULES(IOD_DEC),
+
+ PLAIN_COMMENT(__("Version of the MCLF header structure"))
+
+ }
+
+};
+
+
+
+/******************************************************************************
+* *
+* Paramètres : def = définition à l'origine de l'appel. *
+* content = contenu binaire à venir lire. *
+* pos = position de la tête de lecture. *
+* endian = ordre des bits dans la source. *
+* version = lieu d'enregistrement de la lecture. [OUT] *
+* *
+* Description : Récupère la version du format. *
+* *
+* Retour : Bilan de l'opération. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static bool get_mclf_version(const fmt_field_def *def, GBinContent *content, vmpa2t *pos, SourceEndian endian, uint32_t *version)
+{
+ bool result; /* Bilan à retourner */
+
+ result = g_binary_content_read_u32(content, pos, endian, version);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : format = description de l'exécutable à compléter. *
+* info = informations à constituer en avance de phase. *
+* pos = tête de lecture courante. [OUT] *
+* version = version du format récupérée. [OUT] *
+* *
+* Description : Charge tous les symboles de l'en-tête Mobicore. *
+* *
+* Retour : Bilan de l'opération. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+bool annotate_mobicore_header(GBinFormat *format, GPreloadInfo *info, vmpa2t *pos, uint32_t *version)
+{
+ bool result; /* Bilan à retourner */
+
+ result = parse_field_definitions(PARSING_DEFS(_mc_intro), format, info, pos, version);
+
+ return result;
+
+}
diff --git a/plugins/readmc/header.h b/plugins/readmc/header.h
new file mode 100644
index 0000000..1b8d44e
--- /dev/null
+++ b/plugins/readmc/header.h
@@ -0,0 +1,38 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * header.h - prototypes pour l'annotation des en-têtes de binaires Mobicore
+ *
+ * Copyright (C) 2017 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * Chrysalide is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Chrysalide is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#ifndef _PLUGINS_READMC_HEADER_H
+#define _PLUGINS_READMC_HEADER_H
+
+
+#include <format/format.h>
+#include <format/preload.h>
+
+
+
+/* Charge tous les symboles de l'en-tête Mobicore. */
+bool annotate_mobicore_header(GBinFormat *, GPreloadInfo *, vmpa2t *, uint32_t *);
+
+
+
+#endif /* _PLUGINS_READMC_HEADER_H */
diff --git a/plugins/readmc/reader.c b/plugins/readmc/reader.c
new file mode 100644
index 0000000..3042e83
--- /dev/null
+++ b/plugins/readmc/reader.c
@@ -0,0 +1,92 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * reader.c - interprétation des informations secondaires contenues dans un fichier Mobicore
+ *
+ * Copyright (C) 2017 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * Chrysalide is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Chrysalide is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#include "reader.h"
+
+
+#include <plugins/mobicore/mclf.h>
+#include <plugins/plugin-def.h>
+
+
+#include "header.h"
+#include "text.h"
+#include "v21.h"
+#include "v23.h"
+#include "v24.h"
+
+
+
+DEFINE_CHRYSALIDE_ACTIVE_PLUGIN("readmc", "Displays information about Mobicore files", "0.2.0",
+ PGA_FORMAT_PRELOAD);
+
+
+/******************************************************************************
+* *
+* Paramètres : plugin = greffon à manipuler. *
+* action = type d'action attendue. *
+* format = description de l'exécutable à compléter. *
+* info = informations à constituer en avance de phase. *
+* status = barre de statut à tenir informée. *
+* *
+* Description : Etablit des symboles complémentaires dans un format Mobicore.*
+* *
+* Retour : Bilan de l'opération. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+G_MODULE_EXPORT bool preload_binary_format(const GPluginModule *plugin, PluginAction action, GBinFormat *format, GPreloadInfo *info, GtkStatusStack *status)
+{
+ bool result; /* Bilan à retourner */
+ vmpa2t pos; /* Tête de lecture des symboles*/
+ uint32_t version; /* Version du format analysé */
+
+ if (!G_IS_MCLF_FORMAT(format))
+ {
+ result = true;
+ goto pbf_exit;
+ }
+
+ result = g_exe_format_translate_offset_into_vmpa(G_EXE_FORMAT(format), 0, &pos);
+
+ if (result)
+ result = annotate_mobicore_header(format, info, &pos, &version);
+
+ if (result)
+ result = annotate_mobicore_v21_header(format, info, &pos);
+
+ if (result)
+ result = annotate_mobicore_v23_header(format, info, &pos);
+
+ if (result)
+ result = annotate_mobicore_v24_header(format, info, &pos);
+
+ if (result)
+ result = annotate_mobicore_text_header(format, info, &pos);
+
+ pbf_exit:
+
+ return result;
+
+}
diff --git a/plugins/readmc/reader.h b/plugins/readmc/reader.h
new file mode 100644
index 0000000..a68b288
--- /dev/null
+++ b/plugins/readmc/reader.h
@@ -0,0 +1,38 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * reader.h - prototypes pour l'interprétation des informations secondaires contenues dans un fichier Mobicore
+ *
+ * Copyright (C) 2017 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * Chrysalide is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Chrysalide is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#ifndef _PLUGINS_READMC_READER_H
+#define _PLUGINS_READMC_READER_H
+
+
+#include <plugins/plugin.h>
+#include <plugins/plugin-int.h>
+
+
+
+/* Etablit des symboles complémentaires dans un format Mobicore. */
+G_MODULE_EXPORT bool preload_binary_format(const GPluginModule *, PluginAction, GBinFormat *, GPreloadInfo *, GtkStatusStack *);
+
+
+
+#endif /* _PLUGINS_READMC_READER_H */
diff --git a/plugins/readmc/text.c b/plugins/readmc/text.c
new file mode 100644
index 0000000..3e15493
--- /dev/null
+++ b/plugins/readmc/text.c
@@ -0,0 +1,145 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * text.c - annotation de l'en-tête du code pour Mobicore
+ *
+ * Copyright (C) 2017 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * Chrysalide is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Chrysalide is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#include "text.h"
+
+
+#include <plugins/fmtp/parser.h>
+
+
+
+/* Définition des champs */
+
+static fmt_field_def _mobicore_text_header[] = {
+
+ {
+ .name = "version",
+
+ .size = MDS_32_BITS,
+ .repeat = 1,
+
+ DISPLAY_RULES(IOD_DEC),
+
+ PLAIN_COMMENT(__("Version of the TextHeader structure"))
+
+ },
+
+ {
+ .name = "textHeaderLen",
+
+ .size = MDS_32_BITS,
+ .repeat = 1,
+
+ DISPLAY_RULES(IOD_DEC),
+
+ PLAIN_COMMENT(__("Size of this structure (fixed at compile time)"))
+
+ },
+
+ {
+ .name = "requiredFeat",
+
+ .size = MDS_32_BITS,
+ .repeat = 1,
+
+ PLAIN_COMMENT(__("Features that Mobicore must understand/interprete when loading"))
+
+ },
+
+ {
+ .name = "mcLibEntry",
+
+ .size = MDS_32_BITS,
+ .repeat = 1,
+
+ PLAIN_COMMENT(__("Address for McLib entry"))
+
+ },
+
+ {
+ .name = "mcIMD",
+
+ .size = MDS_32_BITS,
+ .repeat = 2,
+
+ PLAIN_COMMENT(__("McLib Internal Management Data"))
+
+ },
+
+ {
+ .name = "tlApiVers",
+
+ .size = MDS_32_BITS,
+ .repeat = 1,
+
+ PLAIN_COMMENT(__("TlApi version used when building trustlet"))
+
+ },
+
+ {
+ .name = "drApiVers",
+
+ .size = MDS_32_BITS,
+ .repeat = 1,
+
+ PLAIN_COMMENT(__("DrApi version used when building trustlet"))
+
+ },
+
+ {
+ .name = "ta_properties",
+
+ .size = MDS_32_BITS,
+ .repeat = 1,
+
+ PLAIN_COMMENT(__("Address of _TA_Properties in the TA"))
+
+ }
+
+};
+
+
+
+/******************************************************************************
+* *
+* Paramètres : format = description de l'exécutable à compléter. *
+* info = informations à constituer en avance de phase. *
+* pos = tête de lecture courante. [OUT] *
+* *
+* Description : Charge les symboles d'un en-tête de code pour Mobicore. *
+* *
+* Retour : Bilan de l'opération. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+bool annotate_mobicore_text_header(GBinFormat *format, GPreloadInfo *info, vmpa2t *pos)
+{
+ bool result; /* Bilan à retourner */
+
+ result = parse_field_definitions(PARSING_DEFS(_mobicore_text_header), format, info, pos, NULL);
+
+ return result;
+
+}
diff --git a/plugins/readmc/text.h b/plugins/readmc/text.h
new file mode 100644
index 0000000..f1da5da
--- /dev/null
+++ b/plugins/readmc/text.h
@@ -0,0 +1,38 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * text.h - prototypes pour l'annotation de l'en-tête du code pour Mobicore
+ *
+ * Copyright (C) 2017 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * Chrysalide is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Chrysalide is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#ifndef _PLUGINS_READMC_TEXT_H
+#define _PLUGINS_READMC_TEXT_H
+
+
+#include <format/format.h>
+#include <format/preload.h>
+
+
+
+/* Charge les symboles d'un en-tête de code pour Mobicore. */
+bool annotate_mobicore_text_header(GBinFormat *, GPreloadInfo *, vmpa2t *);
+
+
+
+#endif /* _PLUGINS_READMC_TEXT_H */
diff --git a/plugins/readmc/v21.c b/plugins/readmc/v21.c
new file mode 100644
index 0000000..ae74809
--- /dev/null
+++ b/plugins/readmc/v21.c
@@ -0,0 +1,244 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * v21.c - annotation des parties spécifiques à la version 2.1/2.2 de Mobicore
+ *
+ * Copyright (C) 2017 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * Chrysalide is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Chrysalide is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#include "v21.h"
+
+
+#include <plugins/fmtp/parser.h>
+#include <plugins/mobicore/mclf-def.h>
+
+
+
+/* Définition des champs */
+
+static field_desc_switch _v21_mc_memories[] = {
+
+ { .fixed = MCLF_MEM_TYPE_INTERNAL_PREFERRED, .desc = __("If available use internal memory; otherwise external memory") },
+ { .fixed = MCLF_MEM_TYPE_INTERNAL, .desc = __("Internal memory must be used for executing the service") },
+ { .fixed = MCLF_MEM_TYPE_EXTERNAL, .desc = __("External memory must be used for executing the service") }
+
+};
+
+static field_desc_switch _v21_mc_services[] = {
+
+ { .fixed = SERVICE_TYPE_ILLEGAL, .desc = __("Service type is invalid") },
+ { .fixed = SERVICE_TYPE_DRIVER, .desc = __("Service is a driver") },
+ { .fixed = SERVICE_TYPE_SP_TRUSTLET, .desc = __("Service is a Trustlet") },
+ { .fixed = SERVICE_TYPE_SYSTEM_TRUSTLET, .desc = __("Service is a system Trustlet") },
+ { .fixed = SERVICE_TYPE_MIDDLEWARE, .desc = __("Service is a middleware") }
+
+};
+
+static field_desc_switch _v21_mc_drivers[] = {
+
+ { .fixed = MC_DRV_ID_INVALID, .desc = "MC_DRV_ID_INVALID" },
+ { .fixed = MC_DRV_ID_CRYPTO, .desc = "MC_DRV_ID_CRYPTO" },
+ { .fixed = MC_DRV_ID_LAST_PRE_INSTALLED, .desc = "MC_DRV_ID_LAST_PRE_INSTALLED" },
+ { .fixed = TB_DRV_ID_TUI, .desc = "TB_DRV_ID_TUI" },
+ { .fixed = TB_DRV_ID_TPLAY, .desc = "TB_DRV_ID_TPLAY" }
+
+};
+
+static fmt_field_def _mobicore_v21_header[] = {
+
+ {
+ .name = "flags",
+
+ .size = MDS_32_BITS,
+ .repeat = 1,
+
+ PLAIN_COMMENT(__("Service flags"))
+
+ },
+
+ {
+ .name = "memType",
+
+ .size = MDS_32_BITS,
+ .repeat = 1,
+
+ DISPLAY_RULES(IOD_DEC),
+
+ SWITCH_COMMENT(_v21_mc_memories, __("The service must be executed from unknown memory type"))
+
+ },
+
+ {
+ .name = "serviceType",
+
+ .size = MDS_32_BITS,
+ .repeat = 1,
+
+ DISPLAY_RULES(IOD_DEC),
+
+ SWITCH_COMMENT(_v21_mc_services, __("Service is unknown"))
+
+ },
+
+ {
+ .name = "numInstances",
+
+ .size = MDS_32_BITS,
+ .repeat = 1,
+
+ DISPLAY_RULES(IOD_DEC),
+
+ PLAIN_COMMENT(__("Number of instances which can be run simultaneously"))
+
+ },
+
+ {
+ .name = "uuid",
+
+ .size = MDS_32_BITS,
+ .repeat = 4,
+
+ PLAIN_COMMENT(__("Loadable service unique identifier (UUID)"))
+
+ },
+
+ {
+ .name = "driverId",
+
+ .size = MDS_32_BITS,
+ .repeat = 1,
+
+ SWITCH_COMMENT(_v21_mc_drivers, __("Unknown driver identifier"))
+
+ },
+
+ {
+ .name = "numThreads",
+
+ .size = MDS_32_BITS,
+ .repeat = 1,
+
+ DISPLAY_RULES(IOD_DEC),
+
+ PLAIN_COMMENT(__("Number of threads in a service depending on service type"))
+
+ },
+
+ {
+ .name = "text_start",
+
+ .size = MDS_32_BITS,
+ .repeat = 1,
+
+ PLAIN_COMMENT(__("Text segment: virtual start address"))
+
+ },
+
+ {
+ .name = "text_len",
+
+ .size = MDS_32_BITS,
+ .repeat = 1,
+
+ DISPLAY_RULES(IOD_DEC),
+
+ PLAIN_COMMENT(__("Text segment: length in bytes"))
+
+ },
+
+ {
+ .name = "data_start",
+
+ .size = MDS_32_BITS,
+ .repeat = 1,
+
+ PLAIN_COMMENT(__("Data segment: virtual start address"))
+
+ },
+
+ {
+ .name = "data_len",
+
+ .size = MDS_32_BITS,
+ .repeat = 1,
+
+ DISPLAY_RULES(IOD_DEC),
+
+ PLAIN_COMMENT(__("Data segment: length in bytes"))
+
+ },
+
+ {
+ .name = "bssLen",
+
+ .size = MDS_32_BITS,
+ .repeat = 1,
+
+ DISPLAY_RULES(IOD_DEC),
+
+ PLAIN_COMMENT(__("Length of the BSS segment in bytes"))
+
+ },
+
+ {
+ .name = "entry",
+
+ .size = MDS_32_BITS,
+ .repeat = 1,
+
+ PLAIN_COMMENT(__("Virtual start address of service code"))
+
+ },
+
+ {
+ .name = "serviceVersion",
+
+ .size = MDS_32_BITS,
+ .repeat = 1,
+
+ PLAIN_COMMENT(__("Version of the interface the driver exports"))
+
+ }
+
+};
+
+
+
+/******************************************************************************
+* *
+* Paramètres : format = description de l'exécutable à compléter. *
+* info = informations à constituer en avance de phase. *
+* pos = tête de lecture courante. [OUT] *
+* *
+* Description : Charge les symboles d'un en-tête v2.1/2.2 de Mobicore. *
+* *
+* Retour : Bilan de l'opération. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+bool annotate_mobicore_v21_header(GBinFormat *format, GPreloadInfo *info, vmpa2t *pos)
+{
+ bool result; /* Bilan à retourner */
+
+ result = parse_field_definitions(PARSING_DEFS(_mobicore_v21_header), format, info, pos, NULL);
+
+ return result;
+
+}
diff --git a/plugins/readmc/v21.h b/plugins/readmc/v21.h
new file mode 100644
index 0000000..b90a58f
--- /dev/null
+++ b/plugins/readmc/v21.h
@@ -0,0 +1,38 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * v21.h - prototypes pour l'annotation des parties spécifiques à la version 2.1/2.2 de Mobicore
+ *
+ * Copyright (C) 2017 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * Chrysalide is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Chrysalide is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#ifndef _PLUGINS_READMC_V21_H
+#define _PLUGINS_READMC_V21_H
+
+
+#include <format/format.h>
+#include <format/preload.h>
+
+
+
+/* Charge les symboles d'un en-tête v2.1/2.2 de Mobicore. */
+bool annotate_mobicore_v21_header(GBinFormat *, GPreloadInfo *, vmpa2t *);
+
+
+
+#endif /* _PLUGINS_READMC_V21_H */
diff --git a/plugins/readmc/v23.c b/plugins/readmc/v23.c
new file mode 100644
index 0000000..7a3c3e4
--- /dev/null
+++ b/plugins/readmc/v23.c
@@ -0,0 +1,91 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * v23.c - annotation des parties spécifiques à la version 2.3 de Mobicore
+ *
+ * Copyright (C) 2017 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * Chrysalide is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Chrysalide is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#include "v23.h"
+
+
+#include <plugins/fmtp/parser.h>
+
+
+
+/* Définition des champs */
+
+static fmt_field_def _mobicore_v23_header[] = {
+
+ {
+ .name = "permittedSuid_id",
+
+ .size = MDS_32_BITS,
+ .repeat = 1,
+
+ PLAIN_COMMENT(__("SUID (1/2) allowed to execute binary: Silicon Provider identifier"))
+
+ },
+
+ {
+ .name = "permittedSuid_data",
+
+ .size = MDS_32_BITS,
+ .repeat = 3,
+
+ PLAIN_COMMENT(__("SUID (2/2) allowed to execute binary: platform specific device identifier"))
+
+ },
+
+ {
+ .name = "permittedHwCfg",
+
+ .size = MDS_32_BITS,
+ .repeat = 1,
+
+ PLAIN_COMMENT(__("Hardware configuration allowed to execute binary"))
+
+ }
+
+};
+
+
+
+/******************************************************************************
+* *
+* Paramètres : format = description de l'exécutable à compléter. *
+* info = informations à constituer en avance de phase. *
+* pos = tête de lecture courante. [OUT] *
+* *
+* Description : Charge les symboles d'un en-tête v2.3 de Mobicore. *
+* *
+* Retour : Bilan de l'opération. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+bool annotate_mobicore_v23_header(GBinFormat *format, GPreloadInfo *info, vmpa2t *pos)
+{
+ bool result; /* Bilan à retourner */
+
+ result = parse_field_definitions(PARSING_DEFS(_mobicore_v23_header), format, info, pos, NULL);
+
+ return result;
+
+}
diff --git a/plugins/readmc/v23.h b/plugins/readmc/v23.h
new file mode 100644
index 0000000..beae17c
--- /dev/null
+++ b/plugins/readmc/v23.h
@@ -0,0 +1,38 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * v23.h - prototypes pour l'annotation des parties spécifiques à la version 2.4 de Mobicore
+ *
+ * Copyright (C) 2017 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * Chrysalide is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Chrysalide is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#ifndef _PLUGINS_READMC_V23_H
+#define _PLUGINS_READMC_V23_H
+
+
+#include <format/format.h>
+#include <format/preload.h>
+
+
+
+/* Charge les symboles d'un en-tête v2.3 de Mobicore. */
+bool annotate_mobicore_v23_header(GBinFormat *, GPreloadInfo *, vmpa2t *);
+
+
+
+#endif /* _PLUGINS_READMC_V23_H */
diff --git a/plugins/readmc/v24.c b/plugins/readmc/v24.c
new file mode 100644
index 0000000..1cbae98
--- /dev/null
+++ b/plugins/readmc/v24.c
@@ -0,0 +1,90 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * v24.c - annotation des parties spécifiques à la version 2.4 de Mobicore
+ *
+ * Copyright (C) 2017 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * Chrysalide is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Chrysalide is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#include "v24.h"
+
+
+#include <plugins/fmtp/parser.h>
+
+
+
+/* Définition des champs */
+
+static field_desc_switch _v24_mc_level[] = {
+
+ { .fixed = 0, .desc = __("GP level: Legacy MobiCore trustlets") },
+ { .fixed = 1, .desc = __("GP level: Potato TA") }
+
+};
+
+static fmt_field_def _mobicore_v24_header[] = {
+
+ {
+ .name = "gp_level",
+
+ .size = MDS_32_BITS,
+ .repeat = 1,
+
+ DISPLAY_RULES(IOD_DEC),
+
+ SWITCH_COMMENT(_v24_mc_level, __("GP level: unknown"))
+
+ },
+
+ {
+ .name = "attestationOffset",
+
+ .size = MDS_32_BITS,
+ .repeat = 1,
+
+ PLAIN_COMMENT(__("Offset of attestation data area"))
+
+ }
+
+};
+
+
+
+/******************************************************************************
+* *
+* Paramètres : format = description de l'exécutable à compléter. *
+* info = informations à constituer en avance de phase. *
+* pos = tête de lecture courante. [OUT] *
+* *
+* Description : Charge les symboles d'un en-tête v2.4 de Mobicore. *
+* *
+* Retour : Bilan de l'opération. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+bool annotate_mobicore_v24_header(GBinFormat *format, GPreloadInfo *info, vmpa2t *pos)
+{
+ bool result; /* Bilan à retourner */
+
+ result = parse_field_definitions(PARSING_DEFS(_mobicore_v24_header), format, info, pos, NULL);
+
+ return result;
+
+}
diff --git a/plugins/readmc/v24.h b/plugins/readmc/v24.h
new file mode 100644
index 0000000..57d1cd4
--- /dev/null
+++ b/plugins/readmc/v24.h
@@ -0,0 +1,38 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * v24.h - prototypes pour l'annotation des parties spécifiques à la version 2.4 de Mobicore
+ *
+ * Copyright (C) 2017 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * Chrysalide is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Chrysalide is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#ifndef _PLUGINS_READMC_V24_H
+#define _PLUGINS_READMC_V24_H
+
+
+#include <format/format.h>
+#include <format/preload.h>
+
+
+
+/* Charge les symboles d'un en-tête v2.4 de Mobicore. */
+bool annotate_mobicore_v24_header(GBinFormat *, GPreloadInfo *, vmpa2t *);
+
+
+
+#endif /* _PLUGINS_READMC_V24_H */