static char *hash_algo = "sha1";
static int binkey;
static char *keypass;
+static int sigfile;
struct command cmds[];
static void print_usage(struct command *cmd);
if (err < 0)
return err;
+ if (sigfile)
+ bin2file(file, "sig", sig, err + 1);
+
if (xattr) {
err = setxattr(file, "security.ima", sig, err + 1, 0);
if (err < 0) {
{"convert", cmd_convert, 0, "inkey outkey", "Convert PEM public key into IMA/EVM kernel friendly format.\n"},
{"sign", cmd_sign_evm, 0, "[--imahash | --imasig ] file [key]", "Sign file metadata.\n"},
{"verify", cmd_verify_evm, 0, "file", "Verify EVM signature (for debugging).\n"},
- {"ima_sign", cmd_sign_ima, 0, "file [key]", "Sign file content.\n"},
+ {"ima_sign", cmd_sign_ima, 0, "[--sigfile] file [key]", "Sign file content.\n"},
{"ima_hash", cmd_hash_ima, 0, "file", "Hash file content.\n"},
{"hmac", cmd_hmac_evm, 0, "[--imahash | --imasig ] file [key]", "Sign file metadata with HMAC (for debugging).\n"},
{0, 0, 0, NULL}
{"hashalgo", 1, 0, 'a'},
{"bin", 0, 0, 'b'},
{"pass", 1, 0, 'p'},
+ {"sigfile", 0, 0, 'f'},
{}
};
g_argc = argc;
while (1) {
- c = getopt_long(argc, argv, "hk:vnsda:bp:", opts, &lind);
+ c = getopt_long(argc, argv, "hk:vnsda:bp:f", opts, &lind);
if (c == -1)
break;
case 'p':
keypass = optarg;
break;
+ case 'f':
+ sigfile = 1;
+ break;
case '?':
exit(1);
break;