Lines Matching refs:alg
122 psa_algorithm_t alg, in exercise_mac_key() argument
131 if (alg & PSA_ALG_MAC_AT_LEAST_THIS_LENGTH_FLAG) { in exercise_mac_key()
132 alg = PSA_ALG_TRUNCATED_MAC(alg, PSA_MAC_TRUNCATED_LENGTH(alg)); in exercise_mac_key()
136 status = psa_mac_sign_setup(&operation, key, alg); in exercise_mac_key()
155 status = psa_mac_verify_setup(&operation, key, alg); in exercise_mac_key()
177 psa_algorithm_t alg, in exercise_cipher_key() argument
194 iv_length = PSA_CIPHER_IV_LENGTH(key_type, alg); in exercise_cipher_key()
197 status = psa_cipher_encrypt_setup(&operation, key, alg); in exercise_cipher_key()
223 maybe_invalid_padding = !PSA_ALG_IS_STREAM_CIPHER(alg); in exercise_cipher_key()
225 status = psa_cipher_decrypt_setup(&operation, key, alg); in exercise_cipher_key()
265 psa_algorithm_t alg, in exercise_aead_key() argument
279 if (alg & PSA_ALG_AEAD_AT_LEAST_THIS_LENGTH_FLAG) { in exercise_aead_key()
280 alg = PSA_ALG_AEAD_WITH_SHORTENED_TAG(alg, PSA_ALG_AEAD_GET_TAG_LENGTH(alg)); in exercise_aead_key()
285 nonce_length = PSA_AEAD_NONCE_LENGTH(key_type, alg); in exercise_aead_key()
288 status = psa_aead_encrypt(key, alg, in exercise_aead_key()
306 status = psa_aead_decrypt(key, alg, in exercise_aead_key()
327 psa_algorithm_t alg) in can_sign_or_verify_message() argument
331 if (alg == PSA_ALG_ECDSA_ANY || alg == PSA_ALG_RSA_PKCS1V15_SIGN_RAW) { in can_sign_or_verify_message()
340 psa_algorithm_t alg, in exercise_signature_key() argument
344 psa_algorithm_t hash_alg = PSA_ALG_SIGN_GET_HASH(alg); in exercise_signature_key()
345 if (PSA_ALG_IS_SIGN_HASH(alg) && hash_alg == PSA_ALG_ANY_HASH && in exercise_signature_key()
350 alg ^= PSA_ALG_ANY_HASH ^ hash_alg; in exercise_signature_key()
358 PSA_ALG_IS_SIGN_HASH(alg)) { in exercise_signature_key()
372 status = psa_sign_hash(key, alg, in exercise_signature_key()
388 status = psa_verify_hash(key, alg, in exercise_signature_key()
399 if (can_sign_or_verify_message(usage, alg)) { in exercise_signature_key()
406 status = psa_sign_message(key, alg, in exercise_signature_key()
422 status = psa_verify_message(key, alg, in exercise_signature_key()
441 psa_algorithm_t alg, in exercise_asymmetric_encryption_key() argument
452 status = psa_asymmetric_encrypt(key, alg, in exercise_asymmetric_encryption_key()
465 status = psa_asymmetric_decrypt(key, alg, in exercise_asymmetric_encryption_key()
489 psa_algorithm_t alg, in mbedtls_test_psa_setup_key_derivation_wrap() argument
494 PSA_ASSERT(psa_key_derivation_setup(operation, alg)); in mbedtls_test_psa_setup_key_derivation_wrap()
496 if (PSA_ALG_IS_HKDF(alg)) { in mbedtls_test_psa_setup_key_derivation_wrap()
512 } else if (PSA_ALG_IS_HKDF_EXTRACT(alg)) { in mbedtls_test_psa_setup_key_derivation_wrap()
524 } else if (PSA_ALG_IS_HKDF_EXPAND(alg)) { in mbedtls_test_psa_setup_key_derivation_wrap()
537 } else if (PSA_ALG_IS_TLS12_PRF(alg) || in mbedtls_test_psa_setup_key_derivation_wrap()
538 PSA_ALG_IS_TLS12_PSK_TO_MS(alg)) { in mbedtls_test_psa_setup_key_derivation_wrap()
553 } else if (PSA_ALG_IS_PBKDF2(alg)) { in mbedtls_test_psa_setup_key_derivation_wrap()
569 } else if (alg == PSA_ALG_TLS12_ECJPAKE_TO_PMS) { in mbedtls_test_psa_setup_key_derivation_wrap()
590 psa_algorithm_t alg, in exercise_key_derivation_key() argument
602 if (!mbedtls_test_psa_setup_key_derivation_wrap(&operation, key, alg, in exercise_key_derivation_key()
684 psa_algorithm_t alg, in mbedtls_test_psa_raw_key_agreement_with_self() argument
720 status = psa_raw_key_agreement(alg, key, in mbedtls_test_psa_raw_key_agreement_with_self()
749 psa_algorithm_t alg, in exercise_raw_key_agreement_key() argument
757 PSA_ASSERT(mbedtls_test_psa_raw_key_agreement_with_self(alg, key, in exercise_raw_key_agreement_key()
768 psa_algorithm_t alg, in exercise_key_agreement_key() argument
775 psa_algorithm_t kdf_alg = PSA_ALG_KEY_AGREEMENT_GET_KDF(alg); in exercise_key_agreement_key()
781 PSA_ASSERT(psa_key_derivation_setup(&operation, alg)); in exercise_key_agreement_key()
1121 psa_algorithm_t alg, in mbedtls_test_psa_exercise_key() argument
1130 if (alg == 0) { in mbedtls_test_psa_exercise_key()
1132 } else if (PSA_ALG_IS_MAC(alg)) { in mbedtls_test_psa_exercise_key()
1133 ok = exercise_mac_key(key, usage, alg, key_destroyable); in mbedtls_test_psa_exercise_key()
1134 } else if (PSA_ALG_IS_CIPHER(alg)) { in mbedtls_test_psa_exercise_key()
1135 ok = exercise_cipher_key(key, usage, alg, key_destroyable); in mbedtls_test_psa_exercise_key()
1136 } else if (PSA_ALG_IS_AEAD(alg)) { in mbedtls_test_psa_exercise_key()
1137 ok = exercise_aead_key(key, usage, alg, key_destroyable); in mbedtls_test_psa_exercise_key()
1138 } else if (PSA_ALG_IS_SIGN(alg)) { in mbedtls_test_psa_exercise_key()
1139 ok = exercise_signature_key(key, usage, alg, key_destroyable); in mbedtls_test_psa_exercise_key()
1140 } else if (PSA_ALG_IS_ASYMMETRIC_ENCRYPTION(alg)) { in mbedtls_test_psa_exercise_key()
1141 ok = exercise_asymmetric_encryption_key(key, usage, alg, in mbedtls_test_psa_exercise_key()
1143 } else if (PSA_ALG_IS_KEY_DERIVATION(alg)) { in mbedtls_test_psa_exercise_key()
1144 ok = exercise_key_derivation_key(key, usage, alg, key_destroyable); in mbedtls_test_psa_exercise_key()
1145 } else if (PSA_ALG_IS_RAW_KEY_AGREEMENT(alg)) { in mbedtls_test_psa_exercise_key()
1146 ok = exercise_raw_key_agreement_key(key, usage, alg, key_destroyable); in mbedtls_test_psa_exercise_key()
1147 } else if (PSA_ALG_IS_KEY_AGREEMENT(alg)) { in mbedtls_test_psa_exercise_key()
1148 ok = exercise_key_agreement_key(key, usage, alg, key_destroyable); in mbedtls_test_psa_exercise_key()
1164 psa_algorithm_t alg) in mbedtls_test_psa_usage_to_exercise() argument
1166 if (PSA_ALG_IS_MAC(alg) || PSA_ALG_IS_SIGN(alg)) { in mbedtls_test_psa_usage_to_exercise()
1167 if (PSA_ALG_IS_SIGN_HASH(alg)) { in mbedtls_test_psa_usage_to_exercise()
1168 if (PSA_ALG_SIGN_GET_HASH(alg)) { in mbedtls_test_psa_usage_to_exercise()
1174 } else if (PSA_ALG_IS_SIGN_MESSAGE(alg)) { in mbedtls_test_psa_usage_to_exercise()
1183 } else if (PSA_ALG_IS_CIPHER(alg) || PSA_ALG_IS_AEAD(alg) || in mbedtls_test_psa_usage_to_exercise()
1184 PSA_ALG_IS_ASYMMETRIC_ENCRYPTION(alg)) { in mbedtls_test_psa_usage_to_exercise()
1188 } else if (PSA_ALG_IS_KEY_DERIVATION(alg) || in mbedtls_test_psa_usage_to_exercise()
1189 PSA_ALG_IS_KEY_AGREEMENT(alg)) { in mbedtls_test_psa_usage_to_exercise()
1197 int mbedtls_test_can_exercise_psa_algorithm(psa_algorithm_t alg) in mbedtls_test_can_exercise_psa_algorithm() argument
1204 if (alg == PSA_ALG_RSA_PKCS1V15_CRYPT) { in mbedtls_test_can_exercise_psa_algorithm()
1209 if (PSA_ALG_IS_RSA_PKCS1V15_SIGN(alg)) { in mbedtls_test_can_exercise_psa_algorithm()
1214 if (PSA_ALG_IS_RSA_PSS_STANDARD_SALT(alg)) { in mbedtls_test_can_exercise_psa_algorithm()
1219 if (PSA_ALG_IS_RSA_PSS_ANY_SALT(alg)) { in mbedtls_test_can_exercise_psa_algorithm()
1224 if (PSA_ALG_IS_ECDSA(alg)) { in mbedtls_test_can_exercise_psa_algorithm()
1229 if (PSA_ALG_IS_DETERMINISTIC_ECDSA(alg)) { in mbedtls_test_can_exercise_psa_algorithm()
1234 if (PSA_ALG_IS_ECDH(alg)) { in mbedtls_test_can_exercise_psa_algorithm()
1238 (void) alg; in mbedtls_test_can_exercise_psa_algorithm()