summaryrefslogtreecommitdiff
path: root/src/libpts/plugins/imv_attestation/attest.c
diff options
context:
space:
mode:
authorYves-Alexis Perez <corsac@debian.org>2013-02-07 13:27:27 +0100
committerYves-Alexis Perez <corsac@debian.org>2013-02-07 13:27:27 +0100
commit7585facf05d927eb6df3929ce09ed5e60d905437 (patch)
treee4d14b4dc180db20356b6b01ce0112f3a2d7897e /src/libpts/plugins/imv_attestation/attest.c
parentc1343b3278cdf99533b7902744d15969f9d6fdc1 (diff)
downloadvyos-strongswan-7585facf05d927eb6df3929ce09ed5e60d905437.tar.gz
vyos-strongswan-7585facf05d927eb6df3929ce09ed5e60d905437.zip
Imported Upstream version 5.0.2
Diffstat (limited to 'src/libpts/plugins/imv_attestation/attest.c')
-rw-r--r--src/libpts/plugins/imv_attestation/attest.c51
1 files changed, 50 insertions, 1 deletions
diff --git a/src/libpts/plugins/imv_attestation/attest.c b/src/libpts/plugins/imv_attestation/attest.c
index a202d128f..1cdacaeeb 100644
--- a/src/libpts/plugins/imv_attestation/attest.c
+++ b/src/libpts/plugins/imv_attestation/attest.c
@@ -22,7 +22,7 @@
#include <syslog.h>
#include <library.h>
-#include <debug.h>
+#include <utils/debug.h>
#include <imcv.h>
#include <libpts.h>
@@ -99,9 +99,11 @@ static void do_args(int argc, char *argv[])
OP_USAGE,
OP_KEYS,
OP_COMPONENTS,
+ OP_DEVICES,
OP_FILES,
OP_HASHES,
OP_MEASUREMENTS,
+ OP_PACKAGES,
OP_PRODUCTS,
OP_ADD,
OP_DEL,
@@ -117,8 +119,10 @@ static void do_args(int argc, char *argv[])
struct option long_opts[] = {
{ "help", no_argument, NULL, 'h' },
{ "components", no_argument, NULL, 'c' },
+ { "devices", no_argument, NULL, 'e' },
{ "files", no_argument, NULL, 'f' },
{ "keys", no_argument, NULL, 'k' },
+ { "packages", no_argument, NULL, 'g' },
{ "products", no_argument, NULL, 'p' },
{ "hashes", no_argument, NULL, 'H' },
{ "measurements", no_argument, NULL, 'm' },
@@ -126,12 +130,14 @@ static void do_args(int argc, char *argv[])
{ "delete", no_argument, NULL, 'd' },
{ "del", no_argument, NULL, 'd' },
{ "aik", required_argument, NULL, 'A' },
+ { "blacklist", no_argument, NULL, 'B' },
{ "component", required_argument, NULL, 'C' },
{ "comp", required_argument, NULL, 'C' },
{ "directory", required_argument, NULL, 'D' },
{ "dir", required_argument, NULL, 'D' },
{ "file", required_argument, NULL, 'F' },
{ "sha1-ima", no_argument, NULL, 'I' },
+ { "package", required_argument, NULL, 'G' },
{ "key", required_argument, NULL, 'K' },
{ "owner", required_argument, NULL, 'O' },
{ "product", required_argument, NULL, 'P' },
@@ -139,6 +145,9 @@ static void do_args(int argc, char *argv[])
{ "rel", no_argument, NULL, 'R' },
{ "sequence", required_argument, NULL, 'S' },
{ "seq", required_argument, NULL, 'S' },
+ { "utc", no_argument, NULL, 'U' },
+ { "version", required_argument, NULL, 'V' },
+ { "security", no_argument, NULL, 'Y' },
{ "sha1", no_argument, NULL, '1' },
{ "sha256", no_argument, NULL, '2' },
{ "sha384", no_argument, NULL, '3' },
@@ -147,6 +156,7 @@ static void do_args(int argc, char *argv[])
{ "pid", required_argument, NULL, '6' },
{ "cid", required_argument, NULL, '7' },
{ "kid", required_argument, NULL, '8' },
+ { "gid", required_argument, NULL, '9' },
{ 0,0,0,0 }
};
@@ -161,9 +171,15 @@ static void do_args(int argc, char *argv[])
case 'c':
op = OP_COMPONENTS;
continue;
+ case 'e':
+ op = OP_DEVICES;
+ continue;
case 'f':
op = OP_FILES;
continue;
+ case 'g':
+ op = OP_PACKAGES;
+ continue;
case 'k':
op = OP_KEYS;
continue;
@@ -219,6 +235,9 @@ static void do_args(int argc, char *argv[])
}
continue;
}
+ case 'B':
+ attest->set_security(attest, OS_PACKAGE_STATE_BLACKLIST);
+ continue;
case 'C':
if (!attest->set_component(attest, optarg, op == OP_ADD))
{
@@ -237,6 +256,12 @@ static void do_args(int argc, char *argv[])
exit(EXIT_FAILURE);
}
continue;
+ case 'G':
+ if (!attest->set_package(attest, optarg, op == OP_ADD))
+ {
+ exit(EXIT_FAILURE);
+ }
+ continue;
case 'I':
attest->set_algo(attest, PTS_MEAS_ALGO_SHA1_IMA);
continue;
@@ -266,6 +291,18 @@ static void do_args(int argc, char *argv[])
case 'S':
attest->set_sequence(attest, atoi(optarg));
continue;
+ case 'U':
+ attest->set_utc(attest);
+ continue;
+ case 'V':
+ if (!attest->set_version(attest, optarg))
+ {
+ exit(EXIT_FAILURE);
+ }
+ continue;
+ case 'Y':
+ attest->set_security(attest, OS_PACKAGE_STATE_SECURITY);
+ continue;
case '1':
attest->set_algo(attest, PTS_MEAS_ALGO_SHA1);
continue;
@@ -305,6 +342,12 @@ static void do_args(int argc, char *argv[])
exit(EXIT_FAILURE);
}
continue;
+ case '9':
+ if (!attest->set_gid(attest, atoi(optarg)))
+ {
+ exit(EXIT_FAILURE);
+ }
+ continue;
}
break;
}
@@ -314,6 +357,9 @@ static void do_args(int argc, char *argv[])
case OP_USAGE:
usage();
break;
+ case OP_PACKAGES:
+ attest->list_packages(attest);
+ break;
case OP_PRODUCTS:
attest->list_products(attest);
break;
@@ -323,6 +369,9 @@ static void do_args(int argc, char *argv[])
case OP_COMPONENTS:
attest->list_components(attest);
break;
+ case OP_DEVICES:
+ attest->list_devices(attest);
+ break;
case OP_FILES:
attest->list_files(attest);
break;