| /optee_os/lib/libmbedtls/mbedtls/include/psa/ |
| H A 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 …]
|
| H A 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 …]
|
| H A D | crypto.h | 290 psa_algorithm_t alg); 875 psa_status_t psa_hash_compute(psa_algorithm_t alg, 910 psa_status_t psa_hash_compare(psa_algorithm_t alg, 1005 psa_algorithm_t alg); 1227 psa_algorithm_t alg, 1268 psa_algorithm_t alg, 1375 psa_algorithm_t alg); 1437 psa_algorithm_t alg); 1634 psa_algorithm_t alg, 1681 psa_algorithm_t alg, [all …]
|
| H A 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 …]
|
| H A D | crypto_builtin_composites.h | 47 psa_algorithm_t MBEDTLS_PRIVATE(alg); 58 psa_algorithm_t MBEDTLS_PRIVATE(alg); 80 psa_algorithm_t MBEDTLS_PRIVATE(alg); 118 psa_algorithm_t MBEDTLS_PRIVATE(alg); 192 psa_algorithm_t MBEDTLS_PRIVATE(alg);
|
| /optee_os/lib/libmbedtls/mbedtls/library/ |
| H A 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_ECB_NO_PADDING); in mbedtls_cipher_validate_values() [all …]
|
| H A 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 …]
|
| H A 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 …]
|
| H A D | psa_crypto_driver_wrappers.h | 115 psa_algorithm_t alg, in psa_driver_wrapper_sign_message() argument 137 alg, in psa_driver_wrapper_sign_message() 158 alg, in psa_driver_wrapper_sign_message() 178 alg, in psa_driver_wrapper_sign_message() 190 psa_algorithm_t alg, in psa_driver_wrapper_verify_message() argument 211 alg, in psa_driver_wrapper_verify_message() 231 alg, in psa_driver_wrapper_verify_message() 250 alg, in psa_driver_wrapper_verify_message() 260 psa_algorithm_t alg, const uint8_t *hash, size_t hash_length, in psa_driver_wrapper_sign_hash() argument 278 alg, hash, hash_length, in psa_driver_wrapper_sign_hash() [all …]
|
| H A 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 …]
|
| H A 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 …]
|
| H A D | psa_crypto_cipher.h | 32 psa_status_t mbedtls_cipher_values_from_psa(psa_algorithm_t alg, psa_key_type_t key_type, 50 psa_algorithm_t alg, psa_key_type_t key_type, size_t key_bits, 82 psa_algorithm_t alg); 112 psa_algorithm_t alg); 258 psa_algorithm_t alg, 309 psa_algorithm_t alg,
|
| H A D | psa_crypto.c | 1017 psa_algorithm_t alg) in psa_key_policy_permits() argument 1020 if (alg == 0) { in psa_key_policy_permits() 1025 if (PSA_ALG_IS_WILDCARD(alg)) { in psa_key_policy_permits() 1029 if (psa_key_algorithm_permits(key_type, policy->alg, alg) || in psa_key_policy_permits() 1030 psa_key_algorithm_permits(key_type, policy->alg2, alg)) { in psa_key_policy_permits() 1061 psa_key_policy_algorithm_intersection(key_type, policy->alg, in psa_restrict_key_policy() 1062 constraint->alg); in psa_restrict_key_policy() 1066 if (intersection_alg == 0 && policy->alg != 0 && constraint->alg != 0) { in psa_restrict_key_policy() 1073 policy->alg = intersection_alg; in psa_restrict_key_policy() 1101 psa_algorithm_t alg) in psa_get_and_lock_key_slot_with_policy() argument [all …]
|
| H A D | psa_crypto_aead.h | 70 psa_algorithm_t alg, 133 psa_algorithm_t alg, 180 psa_algorithm_t alg); 223 psa_algorithm_t alg);
|
| H A D | psa_crypto_mac.h | 50 psa_algorithm_t alg, 90 psa_algorithm_t alg); 125 psa_algorithm_t alg);
|
| H A D | psa_crypto_rsa.h | 168 psa_algorithm_t alg, const uint8_t *hash, size_t hash_length, 204 psa_algorithm_t alg, const uint8_t *hash, size_t hash_length, 254 psa_algorithm_t alg, 312 psa_algorithm_t alg,
|
| /optee_os/core/drivers/crypto/caam/cipher/ |
| H A D | caam_cipher_mac.c | 160 if (full_size < ctx->alg->size_block) { in do_update_mac() 163 size_topost = full_size % ctx->alg->size_block; in do_update_mac() 180 MIN(dupdate->dst.length, ctx->alg->size_ctx)); in do_update_mac() 192 ret = caam_dmaobj_prepare(&src, NULL, ctx->alg->size_block); in do_update_mac() 205 if (size_todo > ctx->alg->size_block) in do_update_mac() 206 size_todo -= ctx->alg->size_block; in do_update_mac() 219 size_done = ctx->alg->size_block; in do_update_mac() 226 ctx->alg->size_block); in do_update_mac() 230 if (size_done != ctx->alg->size_block) { in do_update_mac() 249 ctx->alg->size_block); in do_update_mac() [all …]
|
| H A D | caam_cipher_xts.c | 57 for (idx = 0; idx < ctx->alg->size_block; idx++) in do_tweak_block() 68 for (idx = 0; idx < ctx->alg->size_block; idx++) in do_tweak_block() 120 ret = caam_dmaobj_output_sgtbuf(&tmpdst, NULL, 0, ctx->alg->size_block); in caam_cipher_update_xts() 145 lastblk = fullsize % ctx->alg->size_block; in caam_cipher_update_xts() 155 fullsize -= ctx->alg->size_block; in caam_cipher_update_xts() 158 srcbuf.length = ctx->alg->size_block; in caam_cipher_update_xts() 162 dstbuf.length = ctx->alg->size_block; in caam_cipher_update_xts() 165 for (; fullsize > 0; fullsize -= ctx->alg->size_block) { in caam_cipher_update_xts() 178 srcbuf.data += ctx->alg->size_block; in caam_cipher_update_xts() 179 srcbuf.paddr += ctx->alg->size_block; in caam_cipher_update_xts() [all …]
|
| H A D | caam_cipher.c | 159 if (ctx->ctx.length && ctx->alg->size_ctx) { in caam_cipher_block() 162 ctx->alg->ctx_offset)); in caam_cipher_block() 165 caam_desc_add_word(desc, CIPHER_INIT(ctx->alg->type, encrypt)); in caam_cipher_block() 169 CIPHER_INITFINAL(ctx->alg->type, encrypt)); in caam_cipher_block() 184 if (ctx->ctx.length && ctx->alg->size_ctx) { in caam_cipher_block() 190 ctx->alg->ctx_offset)); in caam_cipher_block() 261 const struct cipheralg *alg = NULL; in do_allocate() local 265 alg = get_cipheralgo(algo); in do_allocate() 266 if (!alg) { in do_allocate() 286 cipherdata->alg = alg; in do_allocate() [all …]
|
| /optee_os/core/drivers/crypto/caam/hash/ |
| H A D | caam_hash.c | 249 const struct hashalg *alg = NULL; in caam_hash_allocate() local 256 alg = caam_hash_get_alg(algo); in caam_hash_allocate() 257 if (!alg) in caam_hash_allocate() 270 hash_ctx->alg = alg; in caam_hash_allocate() 308 ctx->blockbuf.max = ctx->alg->size_block; in caam_hash_hmac_allocate() 311 if (caam_calloc_align_buf(&ctx->ctx, ctx->alg->size_ctx) != in caam_hash_hmac_allocate() 319 if (caam_calloc_align_buf(&ctx->key, ctx->alg->size_key) != in caam_hash_hmac_allocate() 373 ctx->blockbuf.max = ctx->alg->size_block; in caam_hash_hmac_init() 396 const struct hashalg *alg = ctx->alg; in do_update_hash() local 407 caam_desc_add_word(desc, HASH_UPDATE(alg->type)); in do_update_hash() [all …]
|
| H A D | caam_hash_mac.c | 67 const struct hashalg *alg, in do_reduce_key() argument 87 caam_desc_add_word(desc, HASH_INITFINAL(alg->type)); in do_reduce_key() 130 const struct hashalg *alg = hmac_ctx->alg; in do_hmac_init() local 149 hmac_ctx->key.length = alg->size_key; in do_hmac_init() 151 if (len > alg->size_block) { in do_hmac_init() 155 alg->size_digest); in do_hmac_init() 161 retstatus = do_reduce_key(&reduce_key, alg, inkey, len); in do_hmac_init() 176 caam_desc_add_word(desc, HMAC_INIT_DECRYPT(alg->type)); in do_hmac_init() 293 const struct hashalg *alg = NULL; in caam_hmac_allocate() local 300 alg = caam_hash_get_alg(algo); in caam_hmac_allocate() [all …]
|
| /optee_os/lib/libutee/ |
| H A D | tee_api_operations.c | 2433 TEE_Result TEE_IsAlgorithmSupported(uint32_t alg, uint32_t element) in TEE_IsAlgorithmSupported() argument 2437 if (alg == TEE_ALG_AES_ECB_NOPAD) in TEE_IsAlgorithmSupported() 2441 if (alg == TEE_ALG_AES_CBC_NOPAD) in TEE_IsAlgorithmSupported() 2445 if (alg == TEE_ALG_AES_CTR) in TEE_IsAlgorithmSupported() 2449 if (alg == TEE_ALG_AES_CTS) in TEE_IsAlgorithmSupported() 2453 if (alg == TEE_ALG_AES_XTS) in TEE_IsAlgorithmSupported() 2457 if (alg == TEE_ALG_AES_CBC_MAC_NOPAD || in TEE_IsAlgorithmSupported() 2458 alg == TEE_ALG_AES_CBC_MAC_PKCS5) in TEE_IsAlgorithmSupported() 2462 if (alg == TEE_ALG_AES_CMAC) in TEE_IsAlgorithmSupported() 2466 if (alg == TEE_ALG_AES_CCM) in TEE_IsAlgorithmSupported() [all …]
|
| /optee_os/core/drivers/crypto/hisilicon/ |
| H A D | sec_pbkdf2.c | 146 static TEE_Result sec_pbkdf2_dk_iteration_check(uint32_t alg, uint32_t c_num, in sec_pbkdf2_dk_iteration_check() argument 167 ret = tee_alg_get_digest_size(alg, &hash_len); in sec_pbkdf2_dk_iteration_check() 175 if (alg < TEE_ALG_HMAC_SHA384 || alg > TEE_ALG_HMAC_SHA512) in sec_pbkdf2_dk_iteration_check() 192 uint32_t alg = TEE_ALG_HMAC_ALGO(hash_id); in sec_pbkdf2_params_check() local 199 if ((alg < TEE_ALG_HMAC_SHA384 || alg > TEE_ALG_HMAC_SHA512) && in sec_pbkdf2_params_check() 202 password_len, alg); in sec_pbkdf2_params_check() 216 return sec_pbkdf2_dk_iteration_check(alg, c_num, derived_key_len); in sec_pbkdf2_params_check() 222 uint32_t alg = TEE_ALG_HMAC_ALGO(hash_id); in sec_pbkdf2_set_derive_type() local 224 switch (alg) { in sec_pbkdf2_set_derive_type() 244 EMSG("Invalid hamc alg type %#"PRIx32, alg); in sec_pbkdf2_set_derive_type()
|
| H A D | sec_cipher.c | 144 switch (c_ctx->alg) { in sec_cipher_set_key() 160 EMSG("Invalid cipher type %#"PRIx8, c_ctx->alg); in sec_cipher_set_key() 222 ecb_ctx.alg = c_ctx->alg; in xts_iv_update() 293 if (c_ctx->alg == C_ALG_DES || c_ctx->alg == C_ALG_3DES) { in sec_cipher_iv_check() 301 if (c_ctx->alg == C_ALG_AES || c_ctx->alg == C_ALG_SM4) { in sec_cipher_iv_check() 356 sqe->type2.c_alg = c_ctx->alg; in sec_cipher_bd_fill() 400 SHIFT_U32(c_ctx->alg, SEC_CALG_OFFSET_V3); in sec_cipher_bd3_fill() 454 static TEE_Result crypto_set_alg(struct sec_cipher_ctx *c_ctx, uint32_t alg) in crypto_set_alg() argument 458 switch (alg) { in crypto_set_alg() 460 c_ctx->alg = C_ALG_DES; in crypto_set_alg() [all …]
|
| /optee_os/core/drivers/crypto/caam/ae/ |
| H A D | caam_ae.c | 91 const struct cipheralg *alg = NULL; in caam_ae_allocate() local 95 alg = get_cipheralgo(algo); in caam_ae_allocate() 96 if (!alg) { in caam_ae_allocate() 112 caam_ctx->alg = alg; in caam_ae_allocate() 114 caam_ctx->blockbuf.max = caam_ctx->alg->size_block; in caam_ae_allocate() 185 ret = caam_ctx->alg->initialize(dinit); in caam_ae_initialize() 277 ret = caam_ctx->alg->final(dfinal); in caam_ae_final() 313 dst->alg = src->alg; in caam_ae_copy_state() 441 caam_ctx->alg->ctx_offset)); in load_context() 461 caam_ctx->alg->ctx_offset)); in store_context() [all …]
|