ecjpake_setup: clean up handling of errors
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
This commit is contained in:
parent
d7f6ad7bc8
commit
f15d335f5b
2 changed files with 15 additions and 25 deletions
|
@ -28,7 +28,7 @@ ecjpake_setup:PSA_ALG_JPAKE:PSA_KEY_TYPE_PASSWORD:PSA_KEY_USAGE_DERIVE:PSA_PAKE_
|
|||
|
||||
PSA PAKE: ecjpake setup role
|
||||
depends_on:PSA_WANT_KEY_TYPE_ECC_KEY_PAIR:PSA_WANT_ECC_SECP_R1_256:PSA_WANT_ALG_SHA_256
|
||||
ecjpake_setup:PSA_ALG_JPAKE:PSA_KEY_TYPE_PASSWORD:PSA_KEY_USAGE_DERIVE:PSA_PAKE_PRIMITIVE(PSA_PAKE_PRIMITIVE_TYPE_ECC, PSA_ECC_FAMILY_SECP_R1, 256):PSA_ALG_SHA_256:"client":"server":0:ERR_IN_SET_ROLE:PSA_ERROR_NOT_SUPPORTED
|
||||
ecjpake_setup:PSA_ALG_JPAKE:PSA_KEY_TYPE_PASSWORD:PSA_KEY_USAGE_DERIVE:PSA_PAKE_PRIMITIVE(PSA_PAKE_PRIMITIVE_TYPE_ECC, PSA_ECC_FAMILY_SECP_R1, 256):PSA_ALG_SHA_256:"client":"server":0:ERR_INJECT_SET_ROLE:PSA_ERROR_NOT_SUPPORTED
|
||||
|
||||
PSA PAKE: wrong password key type
|
||||
depends_on:PSA_WANT_KEY_TYPE_ECC_KEY_PAIR:PSA_WANT_ECC_SECP_R1_256:PSA_WANT_ALG_SHA_256
|
||||
|
@ -40,19 +40,19 @@ ecjpake_setup:PSA_ALG_JPAKE:PSA_KEY_TYPE_PASSWORD:PSA_KEY_USAGE_ENCRYPT:PSA_PAKE
|
|||
|
||||
PSA PAKE: set empty user
|
||||
depends_on:PSA_WANT_KEY_TYPE_ECC_KEY_PAIR:PSA_WANT_ECC_SECP_R1_256:PSA_WANT_ALG_SHA_256
|
||||
ecjpake_setup:PSA_ALG_JPAKE:PSA_KEY_TYPE_PASSWORD:PSA_KEY_USAGE_DERIVE:PSA_PAKE_PRIMITIVE(PSA_PAKE_PRIMITIVE_TYPE_ECC, PSA_ECC_FAMILY_SECP_R1, 256):PSA_ALG_SHA_256:"":"server":0:ERR_INJECT_INVALID_USER:PSA_ERROR_INVALID_ARGUMENT
|
||||
ecjpake_setup:PSA_ALG_JPAKE:PSA_KEY_TYPE_PASSWORD:PSA_KEY_USAGE_DERIVE:PSA_PAKE_PRIMITIVE(PSA_PAKE_PRIMITIVE_TYPE_ECC, PSA_ECC_FAMILY_SECP_R1, 256):PSA_ALG_SHA_256:"":"server":0:ERR_IN_SET_USER:PSA_ERROR_INVALID_ARGUMENT
|
||||
|
||||
PSA PAKE: set empty peer
|
||||
depends_on:PSA_WANT_KEY_TYPE_ECC_KEY_PAIR:PSA_WANT_ECC_SECP_R1_256:PSA_WANT_ALG_SHA_256
|
||||
ecjpake_setup:PSA_ALG_JPAKE:PSA_KEY_TYPE_PASSWORD:PSA_KEY_USAGE_DERIVE:PSA_PAKE_PRIMITIVE(PSA_PAKE_PRIMITIVE_TYPE_ECC, PSA_ECC_FAMILY_SECP_R1, 256):PSA_ALG_SHA_256:"client":"":0:ERR_INJECT_INVALID_PEER:PSA_ERROR_INVALID_ARGUMENT
|
||||
ecjpake_setup:PSA_ALG_JPAKE:PSA_KEY_TYPE_PASSWORD:PSA_KEY_USAGE_DERIVE:PSA_PAKE_PRIMITIVE(PSA_PAKE_PRIMITIVE_TYPE_ECC, PSA_ECC_FAMILY_SECP_R1, 256):PSA_ALG_SHA_256:"client":"":0:ERR_IN_SET_PEER:PSA_ERROR_INVALID_ARGUMENT
|
||||
|
||||
PSA PAKE: set invalid user
|
||||
depends_on:PSA_WANT_KEY_TYPE_ECC_KEY_PAIR:PSA_WANT_ECC_SECP_R1_256:PSA_WANT_ALG_SHA_256
|
||||
ecjpake_setup:PSA_ALG_JPAKE:PSA_KEY_TYPE_PASSWORD:PSA_KEY_USAGE_DERIVE:PSA_PAKE_PRIMITIVE(PSA_PAKE_PRIMITIVE_TYPE_ECC, PSA_ECC_FAMILY_SECP_R1, 256):PSA_ALG_SHA_256:"aaaa":"server":0:ERR_INJECT_SET_USER:PSA_ERROR_NOT_SUPPORTED
|
||||
ecjpake_setup:PSA_ALG_JPAKE:PSA_KEY_TYPE_PASSWORD:PSA_KEY_USAGE_DERIVE:PSA_PAKE_PRIMITIVE(PSA_PAKE_PRIMITIVE_TYPE_ECC, PSA_ECC_FAMILY_SECP_R1, 256):PSA_ALG_SHA_256:"aaaa":"server":0:ERR_IN_SET_USER:PSA_ERROR_NOT_SUPPORTED
|
||||
|
||||
PSA PAKE: set invalid peer
|
||||
depends_on:PSA_WANT_KEY_TYPE_ECC_KEY_PAIR:PSA_WANT_ECC_SECP_R1_256:PSA_WANT_ALG_SHA_256
|
||||
ecjpake_setup:PSA_ALG_JPAKE:PSA_KEY_TYPE_PASSWORD:PSA_KEY_USAGE_DERIVE:PSA_PAKE_PRIMITIVE(PSA_PAKE_PRIMITIVE_TYPE_ECC, PSA_ECC_FAMILY_SECP_R1, 256):PSA_ALG_SHA_256:"client":"aaaa":0:ERR_INJECT_SET_PEER:PSA_ERROR_NOT_SUPPORTED
|
||||
ecjpake_setup:PSA_ALG_JPAKE:PSA_KEY_TYPE_PASSWORD:PSA_KEY_USAGE_DERIVE:PSA_PAKE_PRIMITIVE(PSA_PAKE_PRIMITIVE_TYPE_ECC, PSA_ECC_FAMILY_SECP_R1, 256):PSA_ALG_SHA_256:"client":"aaaa":0:ERR_IN_SET_PEER:PSA_ERROR_NOT_SUPPORTED
|
||||
|
||||
PSA PAKE: user already set
|
||||
depends_on:PSA_WANT_KEY_TYPE_ECC_KEY_PAIR:PSA_WANT_ECC_SECP_R1_256:PSA_WANT_ALG_SHA_256
|
||||
|
|
|
@ -8,14 +8,11 @@ typedef enum {
|
|||
/* errors forced internally in the code */
|
||||
ERR_INJECT_UNINITIALIZED_ACCESS,
|
||||
ERR_INJECT_DUPLICATE_SETUP,
|
||||
ERR_INJECT_INVALID_USER,
|
||||
ERR_INJECT_INVALID_PEER,
|
||||
ERR_INJECT_SET_USER,
|
||||
ERR_INJECT_SET_PEER,
|
||||
ERR_INJECT_SET_ROLE,
|
||||
ERR_DUPLICATE_SET_USER,
|
||||
ERR_DUPLICATE_SET_PEER,
|
||||
ERR_SET_USER_PEER_BOTH_SERVERS,
|
||||
ERR_SET_USER_PEER_BOTH_CLIENTS,
|
||||
ERR_INJECT_EMPTY_IO_BUFFER,
|
||||
ERR_INJECT_UNKNOWN_STEP,
|
||||
ERR_INJECT_INVALID_FIRST_STEP,
|
||||
|
@ -43,7 +40,6 @@ typedef enum {
|
|||
ERR_INJECT_ROUND2_SERVER_ZK_PROOF,
|
||||
/* erros issued from the .data file */
|
||||
ERR_IN_SETUP,
|
||||
ERR_IN_SET_ROLE,
|
||||
ERR_IN_SET_USER,
|
||||
ERR_IN_SET_PEER,
|
||||
ERR_IN_SET_PASSWORD_KEY,
|
||||
|
@ -616,25 +612,19 @@ void ecjpake_setup(int alg_arg, int key_type_pw_arg, int key_usage_pw_arg,
|
|||
ERR_INJECT_DUPLICATE_SETUP);
|
||||
|
||||
SETUP_CONDITIONAL_CHECK_STEP(psa_pake_set_role(&operation, PSA_PAKE_ROLE_SERVER),
|
||||
ERR_IN_SET_ROLE);
|
||||
|
||||
SETUP_CONDITIONAL_CHECK_STEP(psa_pake_set_user(&operation, user, user_len),
|
||||
ERR_INJECT_INVALID_USER);
|
||||
|
||||
SETUP_CONDITIONAL_CHECK_STEP(psa_pake_set_peer(&operation, peer, peer_len),
|
||||
ERR_INJECT_INVALID_PEER);
|
||||
|
||||
SETUP_CONDITIONAL_CHECK_STEP(psa_pake_set_user(&operation, user, user_len),
|
||||
ERR_INJECT_SET_USER);
|
||||
|
||||
SETUP_CONDITIONAL_CHECK_STEP(psa_pake_set_peer(&operation, peer, peer_len),
|
||||
ERR_INJECT_SET_PEER);
|
||||
ERR_INJECT_SET_ROLE);
|
||||
|
||||
SETUP_ALWAYS_CHECK_STEP(psa_pake_set_user(&operation, user, user_len),
|
||||
ERR_IN_SET_USER);
|
||||
ERR_IN_SET_USER);
|
||||
|
||||
SETUP_ALWAYS_CHECK_STEP(psa_pake_set_peer(&operation, peer, peer_len),
|
||||
ERR_IN_SET_PEER);
|
||||
ERR_IN_SET_PEER);
|
||||
|
||||
SETUP_CONDITIONAL_CHECK_STEP(psa_pake_set_user(&operation, user, user_len),
|
||||
ERR_DUPLICATE_SET_USER);
|
||||
|
||||
SETUP_CONDITIONAL_CHECK_STEP(psa_pake_set_peer(&operation, peer, peer_len),
|
||||
ERR_DUPLICATE_SET_PEER);
|
||||
|
||||
SETUP_ALWAYS_CHECK_STEP(psa_pake_set_password_key(&operation, key),
|
||||
ERR_IN_SET_PASSWORD_KEY);
|
||||
|
|
Loading…
Reference in a new issue