diff options
author | Jens Wiklander <jens.wiklander@linaro.org> | 2020-09-10 09:07:18 +0200 |
---|---|---|
committer | Jérôme Forissier <jerome@forissier.org> | 2020-09-29 12:48:24 +0200 |
commit | cf5c060cec7688a25271fca6d8bfca4966a03ffa (patch) | |
tree | f95621e1e7b842ca136bc1727366016b1e619021 | |
parent | 46cfd17cf2c68e99f5510eb93e0c40dc11cca713 (diff) |
libutee: TEE_AllocateOperation(): digest operations must have 0 max key size
Make sure that the "maxKeySize" parameter supplied to
TEE_AllocateOperation() is 0 for digest operations since they don't
accept any keys.
Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
-rw-r--r-- | lib/libutee/tee_api_operations.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/libutee/tee_api_operations.c b/lib/libutee/tee_api_operations.c index 1a7e08bb..3a03ad01 100644 --- a/lib/libutee/tee_api_operations.c +++ b/lib/libutee/tee_api_operations.c @@ -109,7 +109,7 @@ TEE_Result TEE_AllocateOperation(TEE_OperationHandle *operation, break; } - /* Check algorithm mode */ + /* Check algorithm mode (and maxKeySize for digests) */ switch (algorithm) { case TEE_ALG_AES_CTS: case TEE_ALG_AES_XTS: @@ -237,6 +237,8 @@ TEE_Result TEE_AllocateOperation(TEE_OperationHandle *operation, case TEE_ALG_SM3: if (mode != TEE_MODE_DIGEST) return TEE_ERROR_NOT_SUPPORTED; + if (maxKeySize) + return TEE_ERROR_NOT_SUPPORTED; /* v1.1: flags always set for digest operations */ handle_state |= TEE_HANDLE_FLAG_KEY_SET; req_key_usage = 0; |