aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndreas Steffen <andreas.steffen@strongswan.org>2011-09-11 00:11:04 +0200
committerAndreas Steffen <andreas.steffen@strongswan.org>2011-09-11 00:11:04 +0200
commitb9d61f78d36bac7b731d7b21e0b06d95dc39506e (patch)
tree9720c537c7cb8dd8a9ea4ab8c79989412aa3a096 /src
parent12e065eacdd419a0bd270f4a1f555072e3852b9c (diff)
downloadstrongswan-b9d61f78d36bac7b731d7b21e0b06d95dc39506e.tar.bz2
strongswan-b9d61f78d36bac7b731d7b21e0b06d95dc39506e.tar.xz
added PTS debug class
Diffstat (limited to 'src')
-rw-r--r--src/charon/charon.c3
-rw-r--r--src/libpts/pts/pts.c48
-rw-r--r--src/libpts/pts/pts_creds.c10
-rw-r--r--src/libpts/pts/pts_database.c2
-rw-r--r--src/libpts/pts/pts_file_meas.c6
-rw-r--r--src/libpts/pts/pts_meas_algo.c12
-rw-r--r--src/libstrongswan/debug.c2
-rw-r--r--src/libstrongswan/debug.h2
-rw-r--r--src/stroke/stroke.c2
9 files changed, 46 insertions, 41 deletions
diff --git a/src/charon/charon.c b/src/charon/charon.c
index dcc1c88e5..96cf0c599 100644
--- a/src/charon/charon.c
+++ b/src/charon/charon.c
@@ -425,7 +425,7 @@ static void usage(const char *msg)
" [--version]\n"
" [--use-syslog]\n"
" [--debug-<type> <level>]\n"
- " <type>: log context type (dmn|mgr|ike|chd|job|cfg|knl|net|enc|tnc|tls|lib)\n"
+ " <type>: log context type (dmn|mgr|ike|chd|job|cfg|knl|net|enc|tnc|imc|imv|pts|tls|lib)\n"
" <level>: log verbosity (-1 = silent, 0 = audit, 1 = control,\n"
" 2 = controlmore, 3 = raw, 4 = private)\n"
"\n"
@@ -500,6 +500,7 @@ int main(int argc, char *argv[])
{ "debug-tnc", required_argument, &group, DBG_TNC },
{ "debug-imc", required_argument, &group, DBG_IMC },
{ "debug-imv", required_argument, &group, DBG_IMV },
+ { "debug-pts", required_argument, &group, DBG_PTS },
{ "debug-tls", required_argument, &group, DBG_TLS },
{ "debug-lib", required_argument, &group, DBG_LIB },
{ 0,0,0,0 }
diff --git a/src/libpts/pts/pts.c b/src/libpts/pts/pts.c
index 3cef54555..b27d5ff21 100644
--- a/src/libpts/pts/pts.c
+++ b/src/libpts/pts/pts.c
@@ -82,7 +82,7 @@ METHOD(pts_t, set_proto_caps, void,
private_pts_t *this, pts_proto_caps_flag_t flags)
{
this->proto_caps = flags;
- DBG2(DBG_IMC, "supported PTS protocol capabilities: %s%s%s%s%s",
+ DBG2(DBG_PTS, "supported PTS protocol capabilities: %s%s%s%s%s",
flags & PTS_PROTO_CAPS_C ? "C" : ".",
flags & PTS_PROTO_CAPS_V ? "V" : ".",
flags & PTS_PROTO_CAPS_D ? "D" : ".",
@@ -102,7 +102,7 @@ METHOD(pts_t, set_meas_algorithm, void,
hash_algorithm_t hash_alg;
hash_alg = pts_meas_to_hash_algorithm(algorithm);
- DBG2(DBG_IMC, "selected PTS measurement algorithm is %N",
+ DBG2(DBG_PTS, "selected PTS measurement algorithm is %N",
hash_algorithm_names, hash_alg);
if (hash_alg != HASH_UNKNOWN)
{
@@ -123,12 +123,12 @@ static void print_tpm_version_info(private_pts_t *this)
this->tpm_version_info.ptr, &versionInfo);
if (result != TSS_SUCCESS)
{
- DBG1(DBG_TNC, "could not parse tpm version info: tss error 0x%x",
+ DBG1(DBG_PTS, "could not parse tpm version info: tss error 0x%x",
result);
}
else
{
- DBG2(DBG_TNC, "TPM 1.2 Version Info: Chip Version: %hhu.%hhu.%hhu.%hhu,"
+ DBG2(DBG_PTS, "TPM 1.2 Version Info: Chip Version: %hhu.%hhu.%hhu.%hhu,"
" Spec Level: %hu, Errata Rev: %hhu, Vendor ID: %.4s",
versionInfo.version.major, versionInfo.version.minor,
versionInfo.version.revMajor, versionInfo.version.revMinor,
@@ -189,7 +189,7 @@ static void load_aik(private_pts_t *this)
cert_path, BUILD_END);
if (this->aik)
{
- DBG2(DBG_IMC, "loaded AIK certificate from '%s'", cert_path);
+ DBG2(DBG_PTS, "loaded AIK certificate from '%s'", cert_path);
return;
}
}
@@ -200,11 +200,11 @@ static void load_aik(private_pts_t *this)
key_path, BUILD_END);
if (this->aik)
{
- DBG2(DBG_IMC, "loaded AIK public key from '%s'", key_path);
+ DBG2(DBG_PTS, "loaded AIK public key from '%s'", key_path);
return;
}
}
- DBG1(DBG_IMC, "neither AIK certificate nor public key is available");
+ DBG1(DBG_PTS, "neither AIK certificate nor public key is available");
}
METHOD(pts_t, get_aik, certificate_t*,
@@ -232,7 +232,7 @@ static bool hash_file(hasher_t *hasher, char *pathname, u_char *hash)
file = fopen(pathname, "rb");
if (!file)
{
- DBG1(DBG_IMC," file '%s' can not be opened, %s", pathname,
+ DBG1(DBG_PTS," file '%s' can not be opened, %s", pathname,
strerror(errno));
return FALSE;
}
@@ -284,17 +284,17 @@ METHOD(pts_t, is_path_valid, bool, private_pts_t *this, char *path,
}
else if (error == ENOENT || error == ENOTDIR)
{
- DBG1(DBG_IMC, "file/directory does not exist %s", path);
+ DBG1(DBG_PTS, "file/directory does not exist %s", path);
*error_code = TCG_PTS_FILE_NOT_FOUND;
}
else if (error == EFAULT)
{
- DBG1(DBG_IMC, "bad address %s", path);
+ DBG1(DBG_PTS, "bad address %s", path);
*error_code = TCG_PTS_INVALID_PATH;
}
else
{
- DBG1(DBG_IMC, "error: %s occured while validating path: %s",
+ DBG1(DBG_PTS, "error: %s occured while validating path: %s",
strerror(error), path);
return FALSE;
}
@@ -316,7 +316,7 @@ METHOD(pts_t, do_measurements, pts_file_meas_t*,
hasher = lib->crypto->create_hasher(lib->crypto, hash_alg);
if (!hasher)
{
- DBG1(DBG_IMC, " hasher %N not available", hash_algorithm_names, hash_alg);
+ DBG1(DBG_PTS, " hasher %N not available", hash_algorithm_names, hash_alg);
return NULL;
}
@@ -335,7 +335,7 @@ METHOD(pts_t, do_measurements, pts_file_meas_t*,
enumerator = enumerator_create_directory(pathname);
if (!enumerator)
{
- DBG1(DBG_IMC," directory '%s' can not be opened, %s", pathname,
+ DBG1(DBG_PTS," directory '%s' can not be opened, %s", pathname,
strerror(errno));
hasher->destroy(hasher);
measurements->destroy(measurements);
@@ -353,7 +353,7 @@ METHOD(pts_t, do_measurements, pts_file_meas_t*,
measurements->destroy(measurements);
return NULL;
}
- DBG2(DBG_IMC, " %#B for '%s'", &measurement, rel_name);
+ DBG2(DBG_PTS, " %#B for '%s'", &measurement, rel_name);
measurements->add(measurements, rel_name, measurement);
}
}
@@ -370,7 +370,7 @@ METHOD(pts_t, do_measurements, pts_file_meas_t*,
return NULL;
}
filename = get_filename(pathname);
- DBG2(DBG_IMC, " %#B for '%s'", &measurement, filename);
+ DBG2(DBG_PTS, " %#B for '%s'", &measurement, filename);
measurements->add(measurements, filename, measurement);
}
hasher->destroy(hasher);
@@ -434,7 +434,7 @@ static char* extract_platform_info(void)
buf[len] = '\0';
if (fread(buf, 1, len, file) != len)
{
- DBG1(DBG_IMC, "failed to read file '%s'", releases[i]);
+ DBG1(DBG_PTS, "failed to read file '%s'", releases[i]);
fclose(file);
return NULL;
}
@@ -445,7 +445,7 @@ static char* extract_platform_info(void)
pos = strstr(buf, description);
if (!pos)
{
- DBG1(DBG_IMC, "failed to find begin of lsb-release "
+ DBG1(DBG_PTS, "failed to find begin of lsb-release "
"DESCRIPTION field");
return NULL;
}
@@ -453,7 +453,7 @@ static char* extract_platform_info(void)
pos = strchr(value, '"');
if (!pos)
{
- DBG1(DBG_IMC, "failed to find end of lsb-release "
+ DBG1(DBG_PTS, "failed to find end of lsb-release "
"DESCRIPTION field");
return NULL;
}
@@ -464,7 +464,7 @@ static char* extract_platform_info(void)
pos = strchr(value, '\n');
if (!pos)
{
- DBG1(DBG_IMC, "failed to find end of release string");
+ DBG1(DBG_PTS, "failed to find end of release string");
return NULL;
}
}
@@ -473,13 +473,13 @@ static char* extract_platform_info(void)
if (!value)
{
- DBG1(DBG_IMC, "no distribution release file found");
+ DBG1(DBG_PTS, "no distribution release file found");
return NULL;
}
if (uname(&uninfo) < 0)
{
- DBG1(DBG_IMC, "could not retrieve machine architecture");
+ DBG1(DBG_PTS, "could not retrieve machine architecture");
return NULL;
}
@@ -487,7 +487,7 @@ static char* extract_platform_info(void)
len = sizeof(buf)-1 + (pos - buf);
strncpy(pos, uninfo.machine, len);
- DBG1(DBG_IMC, "platform is '%s'", value);
+ DBG1(DBG_PTS, "platform is '%s'", value);
return strdup(value);
}
@@ -504,7 +504,7 @@ static bool has_tpm(private_pts_t *this)
result = Tspi_Context_Create(&hContext);
if (result != TSS_SUCCESS)
{
- DBG1(DBG_IMC, "TPM context could not be created: tss error 0x%x", result);
+ DBG1(DBG_PTS, "TPM context could not be created: tss error 0x%x", result);
return FALSE;
}
result = Tspi_Context_Connect(hContext, NULL);
@@ -529,7 +529,7 @@ static bool has_tpm(private_pts_t *this)
return TRUE;
err:
- DBG1(DBG_IMC, "TPM not available: tss error 0x%x", result);
+ DBG1(DBG_PTS, "TPM not available: tss error 0x%x", result);
Tspi_Context_Close(hContext);
return FALSE;
}
diff --git a/src/libpts/pts/pts_creds.c b/src/libpts/pts/pts_creds.c
index c1641ca7f..5a6197bdb 100644
--- a/src/libpts/pts/pts_creds.c
+++ b/src/libpts/pts/pts_creds.c
@@ -64,7 +64,7 @@ static void load_cacerts(private_pts_creds_t *this, char *path)
struct stat st;
char *file;
- DBG1(DBG_TNC, "loading PTS ca certificates from '%s'", path);
+ DBG1(DBG_PTS, "loading PTS ca certificates from '%s'", path);
enumerator = enumerator_create_directory(path);
if (!enumerator)
@@ -89,20 +89,20 @@ static void load_cacerts(private_pts_creds_t *this, char *path)
if (!(x509->get_flags(x509) & X509_CA))
{
- DBG1(DBG_TNC, " ca certificate \"%Y\" lacks ca basic constraint"
+ DBG1(DBG_PTS, " ca certificate \"%Y\" lacks ca basic constraint"
", discarded", cert->get_subject(cert));
cert->destroy(cert);
}
else
{
- DBG1(DBG_TNC, " loaded ca certificate \"%Y\" from '%s'",
+ DBG1(DBG_PTS, " loaded ca certificate \"%Y\" from '%s'",
cert->get_subject(cert), file);
this->creds->add_cert(this->creds, TRUE, cert);
}
}
else
{
- DBG1(DBG_TNC, " loading ca certificate from '%s' failed", file);
+ DBG1(DBG_PTS, " loading ca certificate from '%s' failed", file);
}
}
enumerator->destroy(enumerator);
@@ -117,7 +117,7 @@ pts_creds_t *pts_creds_create(char *path)
if (!path)
{
- DBG1(DBG_TNC, "no PTS cacerts directory defined");
+ DBG1(DBG_PTS, "no PTS cacerts directory defined");
return NULL;
}
diff --git a/src/libpts/pts/pts_database.c b/src/libpts/pts/pts_database.c
index d3e4497e3..2706173ab 100644
--- a/src/libpts/pts/pts_database.c
+++ b/src/libpts/pts/pts_database.c
@@ -107,7 +107,7 @@ pts_database_t *pts_database_create(char *uri)
if (!this->db)
{
- DBG1(DBG_TNC, "failed to connect to PTS file measurement database '%s'",
+ DBG1(DBG_PTS, "failed to connect to PTS file measurement database '%s'",
uri);
free(this);
return NULL;
diff --git a/src/libpts/pts/pts_file_meas.c b/src/libpts/pts/pts_file_meas.c
index a8a08ab31..f0e0d4c0a 100644
--- a/src/libpts/pts/pts_file_meas.c
+++ b/src/libpts/pts/pts_file_meas.c
@@ -133,17 +133,17 @@ METHOD(pts_file_meas_t, verify, bool,
if (!found)
{
- DBG1(DBG_TNC, " no measurement found for '%s'", filename);
+ DBG1(DBG_PTS, " no measurement found for '%s'", filename);
success = FALSE;
continue;
}
if (chunk_equals(measurement, entry->measurement))
{
- DBG2(DBG_TNC, " %#B for '%s' is ok", &measurement, filename);
+ DBG2(DBG_PTS, " %#B for '%s' is ok", &measurement, filename);
}
else
{
- DBG1(DBG_TNC, " %#B for '%s' is incorrect", &measurement, filename);
+ DBG1(DBG_PTS, " %#B for '%s' is incorrect", &measurement, filename);
success = FALSE;
}
if (!is_dir)
diff --git a/src/libpts/pts/pts_meas_algo.c b/src/libpts/pts/pts_meas_algo.c
index 75b1bfa95..260c844d8 100644
--- a/src/libpts/pts/pts_meas_algo.c
+++ b/src/libpts/pts/pts_meas_algo.c
@@ -36,19 +36,19 @@ bool pts_meas_probe_algorithms(pts_meas_algorithms_t *algorithms)
if (hash_alg == HASH_SHA1)
{
*algorithms |= PTS_MEAS_ALGO_SHA1;
- DBG2(DBG_TNC, format1, "mandatory", hash_algorithm_names, hash_alg,
+ DBG2(DBG_PTS, format1, "mandatory", hash_algorithm_names, hash_alg,
plugin_name);
}
else if (hash_alg == HASH_SHA256)
{
*algorithms |= PTS_MEAS_ALGO_SHA256;
- DBG2(DBG_TNC, format1, "mandatory", hash_algorithm_names, hash_alg,
+ DBG2(DBG_PTS, format1, "mandatory", hash_algorithm_names, hash_alg,
plugin_name);
}
else if (hash_alg == HASH_SHA384)
{
*algorithms |= PTS_MEAS_ALGO_SHA384;
- DBG2(DBG_TNC, format1, "optional ", hash_algorithm_names, hash_alg,
+ DBG2(DBG_PTS, format1, "optional ", hash_algorithm_names, hash_alg,
plugin_name);
}
}
@@ -56,7 +56,7 @@ bool pts_meas_probe_algorithms(pts_meas_algorithms_t *algorithms)
if (!(*algorithms & PTS_MEAS_ALGO_SHA384))
{
- DBG1(DBG_TNC, format2, "optional ", hash_algorithm_names, HASH_SHA384);
+ DBG1(DBG_PTS, format2, "optional ", hash_algorithm_names, HASH_SHA384);
}
if ((*algorithms & PTS_MEAS_ALGO_SHA1) &&
(*algorithms & PTS_MEAS_ALGO_SHA256))
@@ -65,11 +65,11 @@ bool pts_meas_probe_algorithms(pts_meas_algorithms_t *algorithms)
}
if (!(*algorithms & PTS_MEAS_ALGO_SHA1))
{
- DBG1(DBG_TNC, format2, "mandatory", hash_algorithm_names, HASH_SHA1);
+ DBG1(DBG_PTS, format2, "mandatory", hash_algorithm_names, HASH_SHA1);
}
if (!(*algorithms & PTS_MEAS_ALGO_SHA256))
{
- DBG1(DBG_TNC, format2, "mandatory", hash_algorithm_names, HASH_SHA256);
+ DBG1(DBG_PTS, format2, "mandatory", hash_algorithm_names, HASH_SHA256);
}
return FALSE;
}
diff --git a/src/libstrongswan/debug.c b/src/libstrongswan/debug.c
index ef79dcbbb..608303445 100644
--- a/src/libstrongswan/debug.c
+++ b/src/libstrongswan/debug.c
@@ -30,6 +30,7 @@ ENUM(debug_names, DBG_DMN, DBG_LIB,
"TNC",
"IMC",
"IMV",
+ "PTS",
"TLS",
"LIB",
);
@@ -47,6 +48,7 @@ ENUM(debug_lower_names, DBG_DMN, DBG_LIB,
"tnc",
"imc",
"imv",
+ "pts",
"tls",
"lib",
);
diff --git a/src/libstrongswan/debug.h b/src/libstrongswan/debug.h
index c5a2564a4..849d28f9f 100644
--- a/src/libstrongswan/debug.h
+++ b/src/libstrongswan/debug.h
@@ -56,6 +56,8 @@ enum debug_t {
DBG_IMC,
/** integrity measurement verifier */
DBG_IMV,
+ /** platform trust service */
+ DBG_PTS,
/** libtls */
DBG_TLS,
/** libstrongswan */
diff --git a/src/stroke/stroke.c b/src/stroke/stroke.c
index 2ed6ccbd4..f6176ee06 100644
--- a/src/stroke/stroke.c
+++ b/src/stroke/stroke.c
@@ -389,7 +389,7 @@ static void exit_usage(char *error)
printf(" where: START and optional END define the clients source IP\n");
printf(" Set loglevel for a logging type:\n");
printf(" stroke loglevel TYPE LEVEL\n");
- printf(" where: TYPE is any|dmn|mgr|ike|chd|job|cfg|knl|net|enc|lib\n");
+ printf(" where: TYPE is any|dmn|mgr|ike|chd|job|cfg|knl|net|enc|tnc|imc|imv|pts|tls|lib\n");
printf(" LEVEL is -1|0|1|2|3|4\n");
printf(" Show connection status:\n");
printf(" stroke status\n");