Skip to content

Commit

Permalink
drivers: caam: sm2 operation fallback
Browse files Browse the repository at this point in the history
Fallback to software operations for SM2.

Signed-off-by: Jorge Ramirez-Ortiz <[email protected]>
  • Loading branch information
ldts committed Jan 18, 2024
1 parent 29b4cb6 commit c3e4ffd
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions core/drivers/crypto/caam/acipher/caam_ecc.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,20 @@ static enum caam_ecc_curve get_caam_curve(uint32_t tee_curve)
* @size_bits Key size in bits
*/
static TEE_Result do_allocate_keypair(struct ecc_keypair *key,
uint32_t type __unused,
uint32_t type,
size_t size_bits)
{
ECC_TRACE("Allocate Keypair of %zu bits", size_bits);

switch (type) {
case TEE_TYPE_SM2_PKE_KEYPAIR:
case TEE_TYPE_SM2_DSA_KEYPAIR:
/* Software fallback */
return TEE_ERROR_NOT_IMPLEMENTED;
default:
break;
}

/* Initialize the key fields to NULL */
memset(key, 0, sizeof(*key));

Expand Down Expand Up @@ -184,11 +193,20 @@ static TEE_Result do_allocate_keypair(struct ecc_keypair *key,
* @size_bits Key size in bits
*/
static TEE_Result do_allocate_publickey(struct ecc_public_key *key,
uint32_t type __unused,
uint32_t type,
size_t size_bits)
{
ECC_TRACE("Allocate Public Key of %zu bits", size_bits);

switch (type) {
case TEE_TYPE_SM2_PKE_PUBLIC_KEY:
case TEE_TYPE_SM2_DSA_PUBLIC_KEY:
/* Software fallback */
return TEE_ERROR_NOT_IMPLEMENTED;
default:
break;
}

/* Initialize the key fields to NULL */
memset(key, 0, sizeof(*key));

Expand Down

0 comments on commit c3e4ffd

Please sign in to comment.