Mercurial > trustbridge
diff common/selftest.h @ 634:80d1a80b3e8d
Factor out selftest for better test and reviewability
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Mon, 23 Jun 2014 16:43:07 +0200 |
parents | |
children | 78798d3af8f0 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/selftest.h Mon Jun 23 16:43:07 2014 +0200 @@ -0,0 +1,36 @@ +#ifndef COMMON_SELFTEST_H +#define COMMON_SELFTEST_H +/* Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik + * Software engineering by Intevation GmbH + * + * This file is Free Software under the GNU GPL (v>=2) + * and comes with ABSOLUTELY NO WARRANTY! + * See LICENSE.txt for details. + */ + +/** @file self test against manipulation + * + * The selftest is intended to detect untargeted manipulation or + * corruption of the executable. Circumvention of the selftest + * by targeted manipulation of the binary can, of course, not + * be detected. + */ + +#include <stdbool.h> + +#ifdef __cplusplus +extern "C" { +#endif +/** @brief check that the current process is signed by the correct certificate + * + * Checks that the certificate is signed with a valid signature and the + * builtin public certificate. + * + * @returns true if the selftest is successful. false on error. + */ +bool selftest(); + +#ifdef __cplusplus +} +#endif +#endif // COMMON_SELFTEST_H