Skip to content

Commit

Permalink
libutee: TEE_AllocateOperation(): maxKeySize of digests may take any …
Browse files Browse the repository at this point in the history
…value

Commit [1] introduced a check to enforce the "maxKeySize" parameter of
digest operations to always be zero. This is a violation of the Global
Platform specification [2].

Revert commit [1] to allow maxKeySize to take any value for digest
operations.

[1] commit cf5c060 ("libutee: TEE_AllocateOperation(): digest
    operations must have 0 max key size")
Link: cf5c060cec76

[2] TEE Internal Core API Specification – Public Release v1.3.1,
    §6.2.1 TEE_AllocateOperation:

      The parameter maxKeySize SHALL be a valid value as defined in
      Table 5-9 for the algorithm, for algorithms referenced in Table
      5-9. For all other algorithms, the maxKeySize parameter may have
      any value.

CC: Jens Wiklander <jens.wiklander@linaro.org>
Fixes: cf5c060 ("libutee: TEE_AllocateOperation(): digest operations must have 0 max key size")
Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Acked-by: Etienne Carriere <etienne.carriere@foss.st.com>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
  • Loading branch information
vincent-mailhol authored and jforissier committed Nov 9, 2023
1 parent 8bf1002 commit b291c8e
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions lib/libutee/tee_api_operations.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ TEE_Result TEE_AllocateOperation(TEE_OperationHandle *operation,
break;
}

/* Check algorithm mode (and maxKeySize for digests) */
/* Check algorithm mode */
switch (algorithm) {
case TEE_ALG_AES_CTS:
case TEE_ALG_AES_XTS:
Expand Down Expand Up @@ -277,8 +277,6 @@ 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;
Expand Down

0 comments on commit b291c8e

Please sign in to comment.