diff --git a/crypto/cryptodev.c b/crypto/cryptodev.c index 9ae0bfbe83..5bda3ccf68 100644 --- a/crypto/cryptodev.c +++ b/crypto/cryptodev.c @@ -569,27 +569,66 @@ int cryptodev_key(FAR struct crypt_kop *kop) { case CRK_MOD_EXP: if (in == 3 && out == 1) - break; + { + break; + } + return -EINVAL; case CRK_MOD_EXP_CRT: if (in == 6 && out == 1) - break; + { + break; + } + return -EINVAL; case CRK_DSA_SIGN: if (in == 5 && out == 2) - break; + { + break; + } + return -EINVAL; case CRK_DSA_VERIFY: if (in == 7 && out == 0) - break; + { + break; + } + return -EINVAL; case CRK_DH_COMPUTE_KEY: if (in == 3 && out == 1) - break; + { + break; + } + return -EINVAL; case CRK_RSA_PKCS15_VERIFY: if (in == 5 && out == 0) - break; + { + break; + } + + return -EINVAL; + case CRK_ECDSA_SECP256R1_SIGN: + if (in == 2 && out == 2) + { + break; + } + + return -EINVAL; + case CRK_ECDSA_SECP256R1_VERIFY: + if (in == 6 && out == 0) + { + break; + } + + return -EINVAL; + case CRK_ECDSA_SECP256R1_GENKEY: + if (in == 0 && out == 4) + { + break; + } + return -EINVAL; default: return -EINVAL; diff --git a/include/crypto/cryptodev.h b/include/crypto/cryptodev.h index d3542cd4a9..c742e2cf53 100644 --- a/include/crypto/cryptodev.h +++ b/include/crypto/cryptodev.h @@ -249,20 +249,26 @@ struct crypt_kop struct crparam crk_param[CRK_MAXPARAM]; }; -#define CRK_MOD_EXP 0 -#define CRK_MOD_EXP_CRT 1 -#define CRK_DSA_SIGN 2 -#define CRK_DSA_VERIFY 3 -#define CRK_DH_COMPUTE_KEY 4 -#define CRK_RSA_PKCS15_VERIFY 5 -#define CRK_ALGORITHM_MAX 5 /* Keep updated */ +#define CRK_MOD_EXP 0 +#define CRK_MOD_EXP_CRT 1 +#define CRK_DSA_SIGN 2 +#define CRK_DSA_VERIFY 3 +#define CRK_DH_COMPUTE_KEY 4 +#define CRK_RSA_PKCS15_VERIFY 5 +#define CRK_ECDSA_SECP256R1_SIGN 6 +#define CRK_ECDSA_SECP256R1_VERIFY 7 +#define CRK_ECDSA_SECP256R1_GENKEY 8 +#define CRK_ALGORITHM_MAX 8 /* Keep updated */ -#define CRF_MOD_EXP (1 << CRK_MOD_EXP) -#define CRF_MOD_EXP_CRT (1 << CRK_MOD_EXP_CRT) -#define CRF_DSA_SIGN (1 << CRK_DSA_SIGN) -#define CRF_DSA_VERIFY (1 << CRK_DSA_VERIFY) -#define CRF_DH_COMPUTE_KEY (1 << CRK_DH_COMPUTE_KEY) -#define CRF_RSA_PKCS15_VERIFY (1 << CRK_RSA_PKCS15_VERIFY) +#define CRF_MOD_EXP (1 << CRK_MOD_EXP) +#define CRF_MOD_EXP_CRT (1 << CRK_MOD_EXP_CRT) +#define CRF_DSA_SIGN (1 << CRK_DSA_SIGN) +#define CRF_DSA_VERIFY (1 << CRK_DSA_VERIFY) +#define CRF_DH_COMPUTE_KEY (1 << CRK_DH_COMPUTE_KEY) +#define CRF_RSA_PKCS15_VERIFY (1 << CRK_RSA_PKCS15_VERIFY) +#define CRF_ECDSA_SECP256R1_SIGN (1 << CRK_ECDSA_SECP256R1_SIGN) +#define CRF_ECDSA_SECP256R1_VERIFY (1 << CRK_ECDSA_SECP256R1_VERIFY) +#define CRF_ECDSA_SECP256R1_GENKEY (1 << CRK_ECDSA_SECP256R1_GENKEY) struct cryptkop {