Mercurial > trustbridge
annotate common/selftest.h @ 790:399bc0df073d
(issue60) Make windows smaller and change details buttons to icon only
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Mon, 14 Jul 2014 18:27:46 +0200 |
parents | 80d1a80b3e8d |
children | 78798d3af8f0 |
rev | line source |
---|---|
634
80d1a80b3e8d
Factor out selftest for better test and reviewability
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
1 #ifndef COMMON_SELFTEST_H |
80d1a80b3e8d
Factor out selftest for better test and reviewability
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
2 #define COMMON_SELFTEST_H |
80d1a80b3e8d
Factor out selftest for better test and reviewability
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
3 /* Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik |
80d1a80b3e8d
Factor out selftest for better test and reviewability
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
4 * Software engineering by Intevation GmbH |
80d1a80b3e8d
Factor out selftest for better test and reviewability
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
5 * |
80d1a80b3e8d
Factor out selftest for better test and reviewability
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
6 * This file is Free Software under the GNU GPL (v>=2) |
80d1a80b3e8d
Factor out selftest for better test and reviewability
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
7 * and comes with ABSOLUTELY NO WARRANTY! |
80d1a80b3e8d
Factor out selftest for better test and reviewability
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
8 * See LICENSE.txt for details. |
80d1a80b3e8d
Factor out selftest for better test and reviewability
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
9 */ |
80d1a80b3e8d
Factor out selftest for better test and reviewability
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
10 |
80d1a80b3e8d
Factor out selftest for better test and reviewability
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
11 /** @file self test against manipulation |
80d1a80b3e8d
Factor out selftest for better test and reviewability
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
12 * |
80d1a80b3e8d
Factor out selftest for better test and reviewability
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
13 * The selftest is intended to detect untargeted manipulation or |
80d1a80b3e8d
Factor out selftest for better test and reviewability
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
14 * corruption of the executable. Circumvention of the selftest |
80d1a80b3e8d
Factor out selftest for better test and reviewability
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
15 * by targeted manipulation of the binary can, of course, not |
80d1a80b3e8d
Factor out selftest for better test and reviewability
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
16 * be detected. |
80d1a80b3e8d
Factor out selftest for better test and reviewability
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
17 */ |
80d1a80b3e8d
Factor out selftest for better test and reviewability
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
18 |
80d1a80b3e8d
Factor out selftest for better test and reviewability
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
19 #include <stdbool.h> |
80d1a80b3e8d
Factor out selftest for better test and reviewability
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
20 |
80d1a80b3e8d
Factor out selftest for better test and reviewability
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
21 #ifdef __cplusplus |
80d1a80b3e8d
Factor out selftest for better test and reviewability
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
22 extern "C" { |
80d1a80b3e8d
Factor out selftest for better test and reviewability
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
23 #endif |
80d1a80b3e8d
Factor out selftest for better test and reviewability
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
24 /** @brief check that the current process is signed by the correct certificate |
80d1a80b3e8d
Factor out selftest for better test and reviewability
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
25 * |
80d1a80b3e8d
Factor out selftest for better test and reviewability
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
26 * Checks that the certificate is signed with a valid signature and the |
80d1a80b3e8d
Factor out selftest for better test and reviewability
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
27 * builtin public certificate. |
80d1a80b3e8d
Factor out selftest for better test and reviewability
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
28 * |
80d1a80b3e8d
Factor out selftest for better test and reviewability
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
29 * @returns true if the selftest is successful. false on error. |
80d1a80b3e8d
Factor out selftest for better test and reviewability
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
30 */ |
80d1a80b3e8d
Factor out selftest for better test and reviewability
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
31 bool selftest(); |
80d1a80b3e8d
Factor out selftest for better test and reviewability
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
32 |
80d1a80b3e8d
Factor out selftest for better test and reviewability
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
33 #ifdef __cplusplus |
80d1a80b3e8d
Factor out selftest for better test and reviewability
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
34 } |
80d1a80b3e8d
Factor out selftest for better test and reviewability
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
35 #endif |
80d1a80b3e8d
Factor out selftest for better test and reviewability
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
36 #endif // COMMON_SELFTEST_H |