/mbedtls-latest/tests/suites/ |
D | test_suite_psa_crypto_metadata.function | 74 * PSA_##flag(alg) is true. 83 #define TEST_CLASSIFICATION_MACRO(cond, flag, alg, flags) \ 89 TEST_ASSERT(PSA_##flag(alg)); \ 91 TEST_ASSERT(!PSA_##flag(alg)); \ 119 static void algorithm_classification(psa_algorithm_t alg, unsigned flags) 122 TEST_CLASSIFICATION_MACRO(1, ALG_IS_VENDOR_DEFINED, alg, flags); 123 TEST_CLASSIFICATION_MACRO(1, ALG_IS_HMAC, alg, flags); 124 TEST_CLASSIFICATION_MACRO(1, ALG_IS_BLOCK_CIPHER_MAC, alg, flags); 125 TEST_CLASSIFICATION_MACRO(1, ALG_IS_STREAM_CIPHER, alg, flags); 126 TEST_CLASSIFICATION_MACRO(1, ALG_IS_RSA_PKCS1V15_SIGN, alg, flags); [all …]
|
D | test_suite_psa_crypto_op_fail.function | 48 psa_algorithm_t alg = alg_arg; 57 psa_hash_setup(&operation, alg)); 59 psa_hash_compute(alg, input, sizeof(input), 62 psa_hash_compare(alg, input, sizeof(input), 77 psa_algorithm_t alg = alg_arg; 91 psa_set_key_algorithm(&attributes, alg); 97 psa_mac_sign_setup(&operation, key_id, alg)); 99 psa_mac_verify_setup(&operation, key_id, alg)); 101 psa_mac_compute(key_id, alg, 105 psa_mac_verify(key_id, alg, [all …]
|
D | test_suite_psa_crypto.function | 159 psa_algorithm_t alg, 167 psa_set_key_algorithm(&attributes, alg); 171 *status = psa_mac_sign_setup(operation, key, alg); 177 TEST_EQUAL(psa_mac_sign_setup(operation, key, alg), *status); 191 psa_algorithm_t alg, 199 psa_set_key_algorithm(&attributes, alg); 203 *status = psa_cipher_encrypt_setup(operation, key, alg); 209 TEST_EQUAL(psa_cipher_encrypt_setup(operation, key, alg), 345 psa_algorithm_t alg = alg_arg; 378 psa_set_key_algorithm(&attributes, alg); [all …]
|
D | test_suite_psa_crypto_driver_wrappers.function | 16 static void ecjpake_do_round(psa_algorithm_t alg, unsigned int primitive, 24 PSA_PAKE_OUTPUT_SIZE(alg, primitive, PSA_PAKE_STEP_KEY_SHARE) + 25 PSA_PAKE_OUTPUT_SIZE(alg, primitive, PSA_PAKE_STEP_ZK_PUBLIC) + 26 PSA_PAKE_OUTPUT_SIZE(alg, primitive, PSA_PAKE_STEP_ZK_PROOF)) * 2; 29 PSA_PAKE_OUTPUT_SIZE(alg, primitive, PSA_PAKE_STEP_KEY_SHARE); 32 PSA_PAKE_OUTPUT_SIZE(alg, primitive, PSA_PAKE_STEP_ZK_PUBLIC); 35 PSA_PAKE_OUTPUT_SIZE(alg, primitive, PSA_PAKE_STEP_ZK_PROOF); 423 * \param alg An RSA algorithm. 429 psa_algorithm_t alg, 458 if (alg == PSA_ALG_RSA_PKCS1V15_CRYPT) { [all …]
|
D | test_suite_psa_crypto_storage_format.function | 65 static int is_accelerated_rsa(psa_algorithm_t alg) 68 if (PSA_ALG_IS_RSA_PKCS1V15_SIGN(alg)) { 73 if (PSA_ALG_IS_RSA_PSS(alg)) { 78 if (PSA_ALG_IS_RSA_OAEP(alg)) { 82 (void) alg; 92 psa_algorithm_t alg = psa_get_key_algorithm(attributes); 94 PSA_ALG_IS_HASH_AND_SIGN(alg) ? PSA_ALG_SIGN_GET_HASH(alg) : 95 PSA_ALG_IS_RSA_OAEP(alg) ? PSA_ALG_RSA_OAEP_GET_HASH(alg) : 111 if (PSA_ALG_IS_DETERMINISTIC_ECDSA(alg) && 118 if (PSA_ALG_IS_DETERMINISTIC_ECDSA(alg) && [all …]
|
/mbedtls-latest/include/psa/ |
D | crypto_sizes.h | 60 #define PSA_HASH_LENGTH(alg) \ argument 62 PSA_ALG_HMAC_GET_HASH(alg) == PSA_ALG_MD5 ? 16u : \ 63 PSA_ALG_HMAC_GET_HASH(alg) == PSA_ALG_RIPEMD160 ? 20u : \ 64 PSA_ALG_HMAC_GET_HASH(alg) == PSA_ALG_SHA_1 ? 20u : \ 65 PSA_ALG_HMAC_GET_HASH(alg) == PSA_ALG_SHA_224 ? 28u : \ 66 PSA_ALG_HMAC_GET_HASH(alg) == PSA_ALG_SHA_256 ? 32u : \ 67 PSA_ALG_HMAC_GET_HASH(alg) == PSA_ALG_SHA_384 ? 48u : \ 68 PSA_ALG_HMAC_GET_HASH(alg) == PSA_ALG_SHA_512 ? 64u : \ 69 PSA_ALG_HMAC_GET_HASH(alg) == PSA_ALG_SHA_512_224 ? 28u : \ 70 PSA_ALG_HMAC_GET_HASH(alg) == PSA_ALG_SHA_512_256 ? 32u : \ [all …]
|
D | crypto_values.h | 797 #define PSA_ALG_IS_VENDOR_DEFINED(alg) \ argument 798 (((alg) & PSA_ALG_VENDOR_FLAG) != 0) 808 #define PSA_ALG_IS_HASH(alg) \ argument 809 (((alg) & PSA_ALG_CATEGORY_MASK) == PSA_ALG_CATEGORY_HASH) 819 #define PSA_ALG_IS_MAC(alg) \ argument 820 (((alg) & PSA_ALG_CATEGORY_MASK) == PSA_ALG_CATEGORY_MAC) 830 #define PSA_ALG_IS_CIPHER(alg) \ argument 831 (((alg) & PSA_ALG_CATEGORY_MASK) == PSA_ALG_CATEGORY_CIPHER) 842 #define PSA_ALG_IS_AEAD(alg) \ argument 843 (((alg) & PSA_ALG_CATEGORY_MASK) == PSA_ALG_CATEGORY_AEAD) [all …]
|
D | crypto.h | 278 psa_algorithm_t alg); 863 psa_status_t psa_hash_compute(psa_algorithm_t alg, 898 psa_status_t psa_hash_compare(psa_algorithm_t alg, 993 psa_algorithm_t alg); 1215 psa_algorithm_t alg, 1256 psa_algorithm_t alg, 1363 psa_algorithm_t alg); 1425 psa_algorithm_t alg); 1622 psa_algorithm_t alg, 1669 psa_algorithm_t alg, [all …]
|
D | crypto_extra.h | 406 #define PSA_ALG_IS_DSA(alg) \ argument 407 (((alg) & ~PSA_ALG_HASH_MASK & ~PSA_ALG_DSA_DETERMINISTIC_FLAG) == \ 409 #define PSA_ALG_DSA_IS_DETERMINISTIC(alg) \ argument 410 (((alg) & PSA_ALG_DSA_DETERMINISTIC_FLAG) != 0) 411 #define PSA_ALG_IS_DETERMINISTIC_DSA(alg) \ argument 412 (PSA_ALG_IS_DSA(alg) && PSA_ALG_DSA_IS_DETERMINISTIC(alg)) 413 #define PSA_ALG_IS_RANDOMIZED_DSA(alg) \ argument 414 (PSA_ALG_IS_DSA(alg) && !PSA_ALG_DSA_IS_DETERMINISTIC(alg)) 420 #define PSA_ALG_IS_VENDOR_HASH_AND_SIGN(alg) \ argument 421 PSA_ALG_IS_DSA(alg) [all …]
|
/mbedtls-latest/library/ |
D | psa_crypto_cipher.c | 30 psa_algorithm_t alg, in mbedtls_cipher_validate_values() argument 51 MBEDTLS_ASSUME(alg != PSA_ALG_AEAD_WITH_SHORTENED_TAG(PSA_ALG_CCM, 0)); in mbedtls_cipher_validate_values() 54 MBEDTLS_ASSUME(alg != PSA_ALG_AEAD_WITH_SHORTENED_TAG(PSA_ALG_GCM, 0)); in mbedtls_cipher_validate_values() 57 MBEDTLS_ASSUME(alg != PSA_ALG_STREAM_CIPHER); in mbedtls_cipher_validate_values() 60 MBEDTLS_ASSUME(alg != PSA_ALG_AEAD_WITH_SHORTENED_TAG(PSA_ALG_CHACHA20_POLY1305, 0)); in mbedtls_cipher_validate_values() 63 MBEDTLS_ASSUME(alg != PSA_ALG_CCM_STAR_NO_TAG); in mbedtls_cipher_validate_values() 66 MBEDTLS_ASSUME(alg != PSA_ALG_CTR); in mbedtls_cipher_validate_values() 69 MBEDTLS_ASSUME(alg != PSA_ALG_CFB); in mbedtls_cipher_validate_values() 72 MBEDTLS_ASSUME(alg != PSA_ALG_OFB); in mbedtls_cipher_validate_values() 75 MBEDTLS_ASSUME(alg != PSA_ALG_XTS); in mbedtls_cipher_validate_values() [all …]
|
D | psa_crypto_driver_wrappers.h | 160 psa_algorithm_t alg, in psa_driver_wrapper_sign_message() argument 185 alg, in psa_driver_wrapper_sign_message() 200 alg, in psa_driver_wrapper_sign_message() 212 alg, in psa_driver_wrapper_sign_message() 228 alg, in psa_driver_wrapper_sign_message() 250 psa_algorithm_t alg, in psa_driver_wrapper_verify_message() argument 274 alg, in psa_driver_wrapper_verify_message() 288 alg, in psa_driver_wrapper_verify_message() 299 alg, in psa_driver_wrapper_verify_message() 313 alg, in psa_driver_wrapper_verify_message() [all …]
|
D | psa_crypto_mac.c | 43 hmac->alg = hash_alg; in psa_hmac_setup_internal() 117 psa_algorithm_t hash_alg = hmac->alg; in psa_hmac_finish_internal() 204 psa_algorithm_t alg) in mac_init() argument 208 operation->alg = alg; in mac_init() 211 if (PSA_ALG_FULL_LENGTH_MAC(operation->alg) == PSA_ALG_CMAC) { in mac_init() 217 if (PSA_ALG_IS_HMAC(operation->alg)) { in mac_init() 219 operation->ctx.hmac.alg = 0; in mac_init() 236 if (operation->alg == 0) { in mbedtls_psa_mac_abort() 243 if (PSA_ALG_FULL_LENGTH_MAC(operation->alg) == PSA_ALG_CMAC) { in mbedtls_psa_mac_abort() 248 if (PSA_ALG_IS_HMAC(operation->alg)) { in mbedtls_psa_mac_abort() [all …]
|
D | psa_crypto_aead.c | 31 psa_algorithm_t alg) in psa_aead_setup() argument 39 status = mbedtls_cipher_values_from_psa(alg, attributes->type, in psa_aead_setup() 45 switch (PSA_ALG_AEAD_WITH_SHORTENED_TAG(alg, 0)) { in psa_aead_setup() 48 operation->alg = PSA_ALG_CCM; in psa_aead_setup() 68 operation->alg = PSA_ALG_GCM; in psa_aead_setup() 88 operation->alg = PSA_ALG_CHACHA20_POLY1305; in psa_aead_setup() 90 if (alg != PSA_ALG_CHACHA20_POLY1305) { in psa_aead_setup() 112 operation->tag_length = PSA_ALG_AEAD_GET_TAG_LENGTH(alg); in psa_aead_setup() 120 psa_algorithm_t alg, in mbedtls_psa_aead_encrypt() argument 131 key_buffer_size, alg); in mbedtls_psa_aead_encrypt() [all …]
|
D | psa_crypto.c | 1022 psa_algorithm_t alg) in psa_key_policy_permits() argument 1025 if (alg == 0) { in psa_key_policy_permits() 1030 if (PSA_ALG_IS_WILDCARD(alg)) { in psa_key_policy_permits() 1034 if (psa_key_algorithm_permits(key_type, policy->alg, alg) || in psa_key_policy_permits() 1035 psa_key_algorithm_permits(key_type, policy->alg2, alg)) { in psa_key_policy_permits() 1066 psa_key_policy_algorithm_intersection(key_type, policy->alg, in psa_restrict_key_policy() 1067 constraint->alg); in psa_restrict_key_policy() 1071 if (intersection_alg == 0 && policy->alg != 0 && constraint->alg != 0) { in psa_restrict_key_policy() 1078 policy->alg = intersection_alg; in psa_restrict_key_policy() 1106 psa_algorithm_t alg) in psa_get_and_lock_key_slot_with_policy() argument [all …]
|
D | psa_crypto_rsa.c | 287 static psa_status_t psa_rsa_decode_md_type(psa_algorithm_t alg, in psa_rsa_decode_md_type() argument 291 psa_algorithm_t hash_alg = PSA_ALG_SIGN_GET_HASH(alg); in psa_rsa_decode_md_type() 304 if (alg != PSA_ALG_RSA_PKCS1V15_SIGN_RAW) { in psa_rsa_decode_md_type() 319 psa_algorithm_t alg, const uint8_t *hash, size_t hash_length, in mbedtls_psa_rsa_sign_hash() argument 335 status = psa_rsa_decode_md_type(alg, hash_length, &md_alg); in mbedtls_psa_rsa_sign_hash() 346 if (PSA_ALG_IS_RSA_PKCS1V15_SIGN(alg)) { in mbedtls_psa_rsa_sign_hash() 361 if (PSA_ALG_IS_RSA_PSS(alg)) { in mbedtls_psa_rsa_sign_hash() 393 static int rsa_pss_expected_salt_len(psa_algorithm_t alg, in rsa_pss_expected_salt_len() argument 397 if (PSA_ALG_IS_RSA_PSS_ANY_SALT(alg)) { in rsa_pss_expected_salt_len() 418 psa_algorithm_t alg, const uint8_t *hash, size_t hash_length, in mbedtls_psa_rsa_verify_hash() argument [all …]
|
D | psa_crypto_hash.c | 24 switch (operation->alg) { in mbedtls_psa_hash_abort() 87 operation->alg = 0; in mbedtls_psa_hash_abort() 93 psa_algorithm_t alg) in mbedtls_psa_hash_setup() argument 98 if (operation->alg != 0) { in mbedtls_psa_hash_setup() 102 switch (alg) { in mbedtls_psa_hash_setup() 170 return PSA_ALG_IS_HASH(alg) ? in mbedtls_psa_hash_setup() 175 operation->alg = alg; in mbedtls_psa_hash_setup() 186 switch (source_operation->alg) { in mbedtls_psa_hash_clone() 257 target_operation->alg = source_operation->alg; in mbedtls_psa_hash_clone() 268 switch (operation->alg) { in mbedtls_psa_hash_update() [all …]
|
/mbedtls-latest/tests/src/ |
D | psa_exercise_key.c | 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() [all …]
|
/mbedtls-latest/tests/src/drivers/ |
D | test_driver_signature.c | 45 psa_algorithm_t alg, in sign_hash() argument 53 if (PSA_ALG_IS_RSA_PKCS1V15_SIGN(alg) || in sign_hash() 54 PSA_ALG_IS_RSA_PSS(alg)) { in sign_hash() 61 alg, hash, hash_length, in sign_hash() 68 alg, hash, hash_length, in sign_hash() 75 if (PSA_ALG_IS_ECDSA(alg)) { in sign_hash() 82 alg, hash, hash_length, in sign_hash() 89 alg, hash, hash_length, in sign_hash() 100 (void) alg; in sign_hash() 113 psa_algorithm_t alg, in verify_hash() argument [all …]
|
D | test_driver_cipher.c | 34 psa_algorithm_t alg, in mbedtls_test_transparent_cipher_encrypt() argument 71 alg, iv, iv_length, input, input_length, in mbedtls_test_transparent_cipher_encrypt() 76 alg, iv, iv_length, input, input_length, in mbedtls_test_transparent_cipher_encrypt() 87 psa_algorithm_t alg, in mbedtls_test_transparent_cipher_decrypt() argument 118 alg, input, input_length, in mbedtls_test_transparent_cipher_decrypt() 123 alg, input, input_length, in mbedtls_test_transparent_cipher_decrypt() 134 psa_algorithm_t alg) in mbedtls_test_transparent_cipher_encrypt_setup() argument 153 key, key_length, alg); in mbedtls_test_transparent_cipher_encrypt_setup() 156 operation, attributes, key, key_length, alg); in mbedtls_test_transparent_cipher_encrypt_setup() 166 psa_algorithm_t alg) in mbedtls_test_transparent_cipher_decrypt_setup() argument [all …]
|
D | test_driver_mac.c | 26 psa_algorithm_t alg, in mbedtls_test_transparent_mac_compute() argument 44 key_buffer, key_buffer_size, alg, in mbedtls_test_transparent_mac_compute() 50 attributes, key_buffer, key_buffer_size, alg, in mbedtls_test_transparent_mac_compute() 57 (void) alg; in mbedtls_test_transparent_mac_compute() 75 psa_algorithm_t alg) in mbedtls_test_transparent_mac_sign_setup() argument 89 key_buffer, key_buffer_size, alg); in mbedtls_test_transparent_mac_sign_setup() 93 operation, attributes, key_buffer, key_buffer_size, alg); in mbedtls_test_transparent_mac_sign_setup() 99 (void) alg; in mbedtls_test_transparent_mac_sign_setup() 112 psa_algorithm_t alg) in mbedtls_test_transparent_mac_verify_setup() argument 126 key_buffer, key_buffer_size, alg); in mbedtls_test_transparent_mac_verify_setup() [all …]
|
D | test_driver_asymmetric_encryption.c | 30 size_t key_buffer_size, psa_algorithm_t alg, const uint8_t *input, in mbedtls_test_transparent_asymmetric_encrypt() argument 57 alg, input, input_length, salt, salt_length, in mbedtls_test_transparent_asymmetric_encrypt() 62 alg, input, input_length, salt, salt_length, in mbedtls_test_transparent_asymmetric_encrypt() 71 size_t key_buffer_size, psa_algorithm_t alg, const uint8_t *input, in mbedtls_test_transparent_asymmetric_decrypt() argument 98 alg, input, input_length, salt, salt_length, in mbedtls_test_transparent_asymmetric_decrypt() 103 alg, input, input_length, salt, salt_length, in mbedtls_test_transparent_asymmetric_decrypt() 115 size_t key_length, psa_algorithm_t alg, const uint8_t *input, in mbedtls_test_opaque_asymmetric_encrypt() argument 135 alg, input, input_length, salt, salt_length, in mbedtls_test_opaque_asymmetric_encrypt() 140 alg, input, input_length, salt, salt_length, in mbedtls_test_opaque_asymmetric_encrypt() 149 size_t key_length, psa_algorithm_t alg, const uint8_t *input, in mbedtls_test_opaque_asymmetric_decrypt() argument [all …]
|
D | test_driver_aead.c | 28 psa_algorithm_t alg, in mbedtls_test_transparent_aead_encrypt() argument 46 alg, in mbedtls_test_transparent_aead_encrypt() 55 alg, in mbedtls_test_transparent_aead_encrypt() 64 (void) alg; in mbedtls_test_transparent_aead_encrypt() 84 psa_algorithm_t alg, in mbedtls_test_transparent_aead_decrypt() argument 102 alg, in mbedtls_test_transparent_aead_decrypt() 111 alg, in mbedtls_test_transparent_aead_decrypt() 120 (void) alg; in mbedtls_test_transparent_aead_decrypt() 141 psa_algorithm_t alg) in mbedtls_test_transparent_aead_encrypt_setup() argument 156 key_buffer_size, alg); in mbedtls_test_transparent_aead_encrypt_setup() [all …]
|
/mbedtls-latest/programs/psa/ |
D | aead_demo.c | 120 psa_algorithm_t *alg) in aead_prepare() argument 128 *alg = PSA_ALG_GCM; in aead_prepare() 132 *alg = PSA_ALG_GCM; in aead_prepare() 136 *alg = PSA_ALG_AEAD_WITH_SHORTENED_TAG(PSA_ALG_GCM, 8); in aead_prepare() 140 *alg = PSA_ALG_CHACHA20_POLY1305; in aead_prepare() 151 psa_set_key_algorithm(&attributes, *alg); in aead_prepare() 168 static void aead_info(psa_key_id_t key, psa_algorithm_t alg) in aead_info() argument 174 psa_algorithm_t base_alg = PSA_ALG_AEAD_WITH_DEFAULT_LENGTH_TAG(alg); in aead_info() 175 size_t tag_len = PSA_AEAD_TAG_LENGTH(key_type, key_bits, alg); in aead_info() 191 static int aead_encrypt(psa_key_id_t key, psa_algorithm_t alg, in aead_encrypt() argument [all …]
|
D | crypto_examples.c | 85 psa_algorithm_t alg, in cipher_encrypt() argument 100 status = psa_cipher_encrypt_setup(&operation, key, alg); in cipher_encrypt() 116 psa_algorithm_t alg, in cipher_decrypt() argument 130 status = psa_cipher_decrypt_setup(&operation, key, alg); in cipher_decrypt() 153 const psa_algorithm_t alg = PSA_ALG_CBC_NO_PADDING; in cipher_example_encrypt_decrypt_aes_cbc_nopad_1_block() local 169 psa_set_key_algorithm(&attributes, alg); in cipher_example_encrypt_decrypt_aes_cbc_nopad_1_block() 176 status = cipher_encrypt(key, alg, iv, sizeof(iv), in cipher_example_encrypt_decrypt_aes_cbc_nopad_1_block() 181 status = cipher_decrypt(key, alg, iv, sizeof(iv), in cipher_example_encrypt_decrypt_aes_cbc_nopad_1_block() 203 const psa_algorithm_t alg = PSA_ALG_CBC_PKCS7; in cipher_example_encrypt_decrypt_aes_cbc_pkcs7_multi() local 217 psa_set_key_algorithm(&attributes, alg); in cipher_example_encrypt_decrypt_aes_cbc_pkcs7_multi() [all …]
|
/mbedtls-latest/scripts/data_files/driver_templates/ |
D | psa_crypto_driver_wrappers.h.jinja | 116 psa_algorithm_t alg, 138 alg, 159 alg, 179 alg, 191 psa_algorithm_t alg, 212 alg, 232 alg, 251 alg, 261 psa_algorithm_t alg, const uint8_t *hash, size_t hash_length, 279 alg, hash, hash_length, [all …]
|