Mercurial > trustbridge
annotate common/selftest.h @ 1382:07bb2bd7a747
Update german translation
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Thu, 15 Jan 2015 15:32:39 +0100 |
parents | 28885e8c891f |
children |
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 |
1053
78798d3af8f0
Fixed doxygen build warnings.
Emanuel Schuetze <emanuel@intevation.de>
parents:
634
diff
changeset
|
11 /** |
78798d3af8f0
Fixed doxygen build warnings.
Emanuel Schuetze <emanuel@intevation.de>
parents:
634
diff
changeset
|
12 * @file selftest.h |
78798d3af8f0
Fixed doxygen build warnings.
Emanuel Schuetze <emanuel@intevation.de>
parents:
634
diff
changeset
|
13 * @brief self test against manipulation |
634
80d1a80b3e8d
Factor out selftest for better test and reviewability
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
14 * |
80d1a80b3e8d
Factor out selftest for better test and reviewability
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
15 * 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
|
16 * 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
|
17 * 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
|
18 * be detected. |
80d1a80b3e8d
Factor out selftest for better test and reviewability
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
19 */ |
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 #include <stdbool.h> |
1364
28885e8c891f
(issue177) Read signature time from PKCS#7 object in selftest and binverify
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1053
diff
changeset
|
22 #include <time.h> |
634
80d1a80b3e8d
Factor out selftest for better test and reviewability
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
23 |
80d1a80b3e8d
Factor out selftest for better test and reviewability
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
24 #ifdef __cplusplus |
80d1a80b3e8d
Factor out selftest for better test and reviewability
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
25 extern "C" { |
80d1a80b3e8d
Factor out selftest for better test and reviewability
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
26 #endif |
80d1a80b3e8d
Factor out selftest for better test and reviewability
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
27 /** @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
|
28 * |
80d1a80b3e8d
Factor out selftest for better test and reviewability
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
29 * 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
|
30 * builtin public certificate. |
80d1a80b3e8d
Factor out selftest for better test and reviewability
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
31 * |
1364
28885e8c891f
(issue177) Read signature time from PKCS#7 object in selftest and binverify
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1053
diff
changeset
|
32 * @param[out] sig_time point this to a time_t to get the signature timestamp |
28885e8c891f
(issue177) Read signature time from PKCS#7 object in selftest and binverify
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1053
diff
changeset
|
33 * |
634
80d1a80b3e8d
Factor out selftest for better test and reviewability
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
34 * @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
|
35 */ |
1364
28885e8c891f
(issue177) Read signature time from PKCS#7 object in selftest and binverify
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1053
diff
changeset
|
36 bool selftest(time_t *sig_time); |
634
80d1a80b3e8d
Factor out selftest for better test and reviewability
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
37 |
80d1a80b3e8d
Factor out selftest for better test and reviewability
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
38 #ifdef __cplusplus |
80d1a80b3e8d
Factor out selftest for better test and reviewability
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
39 } |
80d1a80b3e8d
Factor out selftest for better test and reviewability
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
40 #endif |
80d1a80b3e8d
Factor out selftest for better test and reviewability
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
41 #endif // COMMON_SELFTEST_H |