Mercurial > trustbridge > trustbridge
comparison common/selftest.c @ 1364:28885e8c891f
(issue177) Read signature time from PKCS#7 object in selftest and binverify
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Fri, 21 Nov 2014 18:33:31 +0100 |
parents | a974b61a5cce |
children |
comparison
equal
deleted
inserted
replaced
1363:3d6faded03dd | 1364:28885e8c891f |
---|---|
10 #include "binverify.h" | 10 #include "binverify.h" |
11 #include "strhelp.h" | 11 #include "strhelp.h" |
12 #include "logging.h" | 12 #include "logging.h" |
13 | 13 |
14 bool | 14 bool |
15 selftest() | 15 selftest(time_t *sig_time) |
16 { | 16 { |
17 bin_verify_result res; | 17 bin_verify_result res; |
18 #ifdef WIN32 | 18 #ifdef WIN32 |
19 wchar_t wPath[MAX_PATH]; | 19 wchar_t wPath[MAX_PATH]; |
20 char *utf8path = NULL; | 20 char *utf8path = NULL; |
43 syslog_error_printf ("Integrity check failed."); | 43 syslog_error_printf ("Integrity check failed."); |
44 xfree(utf8path); | 44 xfree(utf8path); |
45 return false; | 45 return false; |
46 } | 46 } |
47 | 47 |
48 if (sig_time) | |
49 { | |
50 *sig_time = res.sig_time; | |
51 } | |
48 fclose(res.fptr); | 52 fclose(res.fptr); |
49 xfree(utf8path); | 53 xfree(utf8path); |
50 return true; | 54 return true; |
51 #else | 55 #else |
52 res = verify_binary ("/proc/self/exe", 14); | 56 res = verify_binary ("/proc/self/exe", 14); |
53 if (res.result != VerifyValid) | 57 if (res.result != VerifyValid) |
54 { | 58 { |
55 syslog_error_printf ("Integrity check failed."); | 59 syslog_error_printf ("Integrity check failed."); |
56 return false; | 60 return false; |
57 } | 61 } |
62 if (sig_time) | |
63 { | |
64 *sig_time = res.sig_time; | |
65 } | |
58 fclose(res.fptr); | 66 fclose(res.fptr); |
59 return true; | 67 return true; |
60 #endif | 68 #endif |
61 } | 69 } |