tpm: Make use of TPM2_ALG_INVAL from enum
Now that the enum includes TPM2_ALG_INVAL, use that name in the
code.
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
diff --git a/cmd/tpm-v2.c b/cmd/tpm-v2.c
index a62862e..346e21d 100644
--- a/cmd/tpm-v2.c
+++ b/cmd/tpm-v2.c
@@ -113,7 +113,7 @@
return CMD_RET_USAGE;
if (argc == 4) {
algo = tpm2_name_to_algorithm(argv[3]);
- if (algo < 0)
+ if (algo == TPM2_ALG_INVAL)
return CMD_RET_FAILURE;
}
algo_len = tpm2_algorithm_to_len(algo);
@@ -157,7 +157,7 @@
return CMD_RET_USAGE;
if (argc == 4) {
algo = tpm2_name_to_algorithm(argv[3]);
- if (algo < 0)
+ if (algo == TPM2_ALG_INVAL)
return CMD_RET_FAILURE;
}
algo_len = tpm2_algorithm_to_len(algo);
@@ -288,7 +288,7 @@
return CMD_RET_USAGE;
algo = tpm2_name_to_algorithm(argv[1]);
- if (algo == -EINVAL)
+ if (algo == TPM2_ALG_INVAL)
return CMD_RET_USAGE;
ret = get_tpm(&dev);
diff --git a/lib/tpm-v2.c b/lib/tpm-v2.c
index 9ca7933..5b21c57 100644
--- a/lib/tpm-v2.c
+++ b/lib/tpm-v2.c
@@ -1141,7 +1141,7 @@
}
printf("%s: unsupported algorithm %s\n", __func__, name);
- return -EINVAL;
+ return TPM2_ALG_INVAL;
}
const char *tpm2_algorithm_name(enum tpm2_algorithms algo)