| /optee_os/lib/libutee/include/ |
| H A D | utee_defines.h | 64 static inline uint32_t __tee_alg_get_class(uint32_t algo) in __tee_alg_get_class() argument 66 if (algo == TEE_ALG_SM2_PKE) in __tee_alg_get_class() 68 if (algo == TEE_ALG_SM2_KEP) in __tee_alg_get_class() 70 if (algo == TEE_ALG_RSASSA_PKCS1_V1_5) in __tee_alg_get_class() 72 if (algo == TEE_ALG_DES3_CMAC) in __tee_alg_get_class() 74 if (algo == TEE_ALG_SM4_XTS) in __tee_alg_get_class() 76 if (algo == TEE_ALG_RSASSA_PKCS1_PSS_MGF1_MD5) in __tee_alg_get_class() 78 if (algo == TEE_ALG_RSAES_PKCS1_OAEP_MGF1_MD5) in __tee_alg_get_class() 81 return (algo >> 28) & 0xF; /* Bits [31:28] */ in __tee_alg_get_class() 84 #define TEE_ALG_GET_CLASS(algo) __tee_alg_get_class(algo) argument [all …]
|
| /optee_os/core/pta/tests/ |
| H A D | aes_perf.c | 42 static void free_ctx(void **ctx, uint32_t algo) in free_ctx() argument 44 if (algo == TEE_ALG_AES_GCM) in free_ctx() 52 static TEE_Result init_ctx(void **ctx, uint32_t algo, TEE_OperationMode mode, in init_ctx() argument 69 switch (algo) { in init_ctx() 77 res = crypto_cipher_alloc_ctx(ctx, algo); in init_ctx() 80 res = crypto_authenc_alloc_ctx(ctx, algo); in init_ctx() 89 switch (algo) { in init_ctx() 110 free_ctx(ctx, algo); in init_ctx() 129 static TEE_Result do_update(void *ctx, uint32_t algo, TEE_OperationMode mode, in do_update() argument 140 if (algo == TEE_ALG_AES_GCM) in do_update() [all …]
|
| /optee_os/core/lib/libtomcrypt/ |
| H A D | ecc.c | 31 static TEE_Result ecc_get_curve_info(uint32_t curve, uint32_t algo, in ecc_get_curve_info() argument 54 if ((algo != 0) && (algo != TEE_ALG_ECDSA_SHA1) && in ecc_get_curve_info() 55 (algo != TEE_ALG_ECDH_DERIVE_SHARED_SECRET)) in ecc_get_curve_info() 62 if ((algo != 0) && (algo != TEE_ALG_ECDSA_SHA224) && in ecc_get_curve_info() 63 (algo != TEE_ALG_ECDH_DERIVE_SHARED_SECRET)) in ecc_get_curve_info() 70 if ((algo != 0) && (algo != TEE_ALG_ECDSA_SHA256) && in ecc_get_curve_info() 71 (algo != TEE_ALG_ECDH_DERIVE_SHARED_SECRET)) in ecc_get_curve_info() 78 if ((algo != 0) && (algo != TEE_ALG_ECDSA_SHA384) && in ecc_get_curve_info() 79 (algo != TEE_ALG_ECDH_DERIVE_SHARED_SECRET)) in ecc_get_curve_info() 86 if ((algo != 0) && (algo != TEE_ALG_ECDSA_SHA512) && in ecc_get_curve_info() [all …]
|
| H A D | rsa.c | 29 static TEE_Result tee_algo_to_ltc_hashindex(uint32_t algo, int *ltc_hashindex) in tee_algo_to_ltc_hashindex() argument 31 switch (algo) { in tee_algo_to_ltc_hashindex() 325 TEE_Result crypto_acipher_rsaes_decrypt(uint32_t algo, 335 TEE_Result sw_crypto_acipher_rsaes_decrypt(uint32_t algo, in sw_crypto_acipher_rsaes_decrypt() argument 364 res = tee_algo_to_ltc_hashindex(algo, <c_hashindex); in sw_crypto_acipher_rsaes_decrypt() 369 if (algo != TEE_ALG_RSAES_PKCS1_V1_5) { in sw_crypto_acipher_rsaes_decrypt() 385 if (algo == TEE_ALG_RSAES_PKCS1_V1_5) { in sw_crypto_acipher_rsaes_decrypt() 444 TEE_Result crypto_acipher_rsaes_encrypt(uint32_t algo, 454 TEE_Result sw_crypto_acipher_rsaes_encrypt(uint32_t algo, in sw_crypto_acipher_rsaes_encrypt() argument 481 res = tee_algo_to_ltc_hashindex(algo, <c_hashindex); in sw_crypto_acipher_rsaes_encrypt() [all …]
|
| H A D | acipher_helpers.h | 41 uint32_t algo, size_t *key_size_bytes); 44 uint32_t algo, size_t *key_size_bytes); 55 TEE_Result sm2_ltc_dsa_sign(uint32_t algo, struct ecc_keypair *key, 59 TEE_Result sm2_ltc_dsa_verify(uint32_t algo, struct ecc_public_key *key, 64 sm2_ltc_dsa_sign(uint32_t algo __unused, struct ecc_keypair *key __unused, in sm2_ltc_dsa_sign() 72 sm2_ltc_dsa_verify(uint32_t algo __unused, struct ecc_public_key *key __unused, in sm2_ltc_dsa_verify()
|
| H A D | dsa.c | 95 TEE_Result crypto_acipher_dsa_sign(uint32_t algo, struct dsa_keypair *key, in crypto_acipher_dsa_sign() argument 113 if (algo != TEE_ALG_DSA_SHA1 && in crypto_acipher_dsa_sign() 114 algo != TEE_ALG_DSA_SHA224 && in crypto_acipher_dsa_sign() 115 algo != TEE_ALG_DSA_SHA256) { in crypto_acipher_dsa_sign() 120 res = tee_alg_get_digest_size(TEE_DIGEST_HASH_TO_ALGO(algo), in crypto_acipher_dsa_sign() 164 TEE_Result crypto_acipher_dsa_verify(uint32_t algo, struct dsa_public_key *key, in crypto_acipher_dsa_verify() argument 180 if (algo != TEE_ALG_DSA_SHA1 && in crypto_acipher_dsa_verify() 181 algo != TEE_ALG_DSA_SHA224 && in crypto_acipher_dsa_verify() 182 algo != TEE_ALG_DSA_SHA256) { in crypto_acipher_dsa_verify()
|
| /optee_os/core/tee/ |
| H A D | tee_cryp_utl.c | 19 TEE_Result tee_alg_get_digest_size(uint32_t algo, size_t *size) in tee_alg_get_digest_size() argument 21 size_t digest_size = TEE_ALG_GET_DIGEST_SIZE(algo); in tee_alg_get_digest_size() 31 TEE_Result tee_hash_createdigest(uint32_t algo, const uint8_t *data, in tee_hash_createdigest() argument 38 res = crypto_hash_alloc_ctx(&ctx, algo); in tee_hash_createdigest() 59 TEE_Result tee_cipher_get_block_size(uint32_t algo, size_t *size) in tee_cipher_get_block_size() argument 61 switch (algo) { in tee_cipher_get_block_size() 98 TEE_Result tee_do_cipher_update(void *ctx, uint32_t algo, in tee_do_cipher_update() argument 112 res = tee_cipher_get_block_size(algo, &block_size); in tee_do_cipher_update() 116 if (!last_block && algo != TEE_ALG_AES_CTR) in tee_do_cipher_update() 119 switch (algo) { in tee_do_cipher_update()
|
| /optee_os/core/drivers/crypto/crypto_api/acipher/ |
| H A D | rsa.c | 200 TEE_Result crypto_acipher_rsaes_decrypt(uint32_t algo, struct rsa_keypair *key, in crypto_acipher_rsaes_decrypt() argument 224 if (algo == TEE_ALG_RSAES_PKCS1_V1_5) { in crypto_acipher_rsaes_decrypt() 228 rsa_data.hash_algo = TEE_INTERNAL_HASH_TO_ALGO(algo); in crypto_acipher_rsaes_decrypt() 255 rsa_data.algo = algo; in crypto_acipher_rsaes_decrypt() 268 TEE_Result crypto_acipher_rsaes_encrypt(uint32_t algo, in crypto_acipher_rsaes_encrypt() argument 309 if (algo == TEE_ALG_RSAES_PKCS1_V1_5) { in crypto_acipher_rsaes_encrypt() 318 rsa_data.hash_algo = TEE_INTERNAL_HASH_TO_ALGO(algo); in crypto_acipher_rsaes_encrypt() 348 rsa_data.algo = algo; in crypto_acipher_rsaes_encrypt() 361 TEE_Result crypto_acipher_rsassa_sign(uint32_t algo, struct rsa_keypair *key, in crypto_acipher_rsassa_sign() argument 375 if (algo != TEE_ALG_RSASSA_PKCS1_V1_5) { in crypto_acipher_rsassa_sign() [all …]
|
| H A D | ecc.c | 72 static bool algo_is_valid(uint32_t curve, uint32_t algo) in algo_is_valid() argument 74 unsigned int algo_op = TEE_ALG_GET_CLASS(algo); in algo_is_valid() 75 unsigned int algo_id = TEE_ALG_GET_MAIN_ALG(algo); in algo_is_valid() 76 unsigned int algo_curve = TEE_ALG_GET_DIGEST_HASH(algo); in algo_is_valid() 85 " is valid", algo, curve); in algo_is_valid() 97 algo, curve); in algo_is_valid() 161 static TEE_Result ecc_sign(uint32_t algo, struct ecc_keypair *key, in ecc_sign() argument 176 if (!algo_is_valid(key->curve, algo)) in ecc_sign() 201 sdata.algo = algo; in ecc_sign() 217 CRYPTO_TRACE("Sign algo (0x%" PRIx32 ") returned 0x%" PRIx32, algo, in ecc_sign() [all …]
|
| H A D | dsa.c | 121 TEE_Result crypto_acipher_dsa_sign(uint32_t algo, struct dsa_keypair *key, in crypto_acipher_dsa_sign() argument 159 sdata.algo = algo; in crypto_acipher_dsa_sign() 175 CRYPTO_TRACE("Sign algo (0x%" PRIx32 ") returned 0x%" PRIx32, algo, in crypto_acipher_dsa_sign() 181 TEE_Result crypto_acipher_dsa_verify(uint32_t algo, struct dsa_public_key *key, in crypto_acipher_dsa_verify() argument 213 sdata.algo = algo; in crypto_acipher_dsa_verify() 226 CRYPTO_TRACE("Verify algo (0x%" PRIx32 ") returned 0x%" PRIx32, algo, in crypto_acipher_dsa_verify()
|
| /optee_os/core/drivers/crypto/caam/include/ |
| H A D | caam_desc_helper.h | 304 #define HASH_INIT(algo) \ argument 305 (CMD_OP_TYPE | OP_TYPE(CLASS2) | (algo) | ALGO_AS(INIT) | ALGO_ENCRYPT) 310 #define HASH_UPDATE(algo) \ argument 311 (CMD_OP_TYPE | OP_TYPE(CLASS2) | (algo) | ALGO_AS(UPDATE) | \ 317 #define HASH_FINAL(algo) \ argument 318 (CMD_OP_TYPE | OP_TYPE(CLASS2) | (algo) | ALGO_AS(FINAL) | ALGO_ENCRYPT) 323 #define HASH_INITFINAL(algo) \ argument 324 (CMD_OP_TYPE | OP_TYPE(CLASS2) | (algo) | ALGO_AS(INIT_FINAL) | \ 330 #define HMAC_INIT_DECRYPT(algo) \ argument 331 (CMD_OP_TYPE | OP_TYPE(CLASS2) | (algo) | ALGO_AS(INIT) | \ [all …]
|
| /optee_os/core/drivers/crypto/crypto_api/mac/ |
| H A D | mac.c | 13 TEE_Result drvcrypt_mac_alloc_ctx(struct crypto_mac_ctx **ctx, uint32_t algo) in drvcrypt_mac_alloc_ctx() argument 17 unsigned int algo_id = TEE_ALG_GET_MAIN_ALG(algo); in drvcrypt_mac_alloc_ctx() 19 CRYPTO_TRACE("mac alloc_ctx algo 0x%" PRIX32, algo); in drvcrypt_mac_alloc_ctx() 29 ret = mac_alloc(ctx, algo); in drvcrypt_mac_alloc_ctx()
|
| /optee_os/core/drivers/crypto/stm32/ |
| H A D | cipher.c | 24 enum stm32_cryp_algo_mode algo; member 29 enum stm32_saes_chaining_mode algo; member 73 (ip_ctx->cryp.algo == STM32_CRYP_MODE_TDES_ECB || in cryp_init() 74 ip_ctx->cryp.algo == STM32_CRYP_MODE_TDES_CBC)) { in cryp_init() 82 return stm32_cryp_init(&ip_ctx->cryp.ctx, is_decrypt, ip_ctx->cryp.algo, in cryp_init() 143 return stm32_saes_init(&ip_ctx->saes.ctx, is_decrypt, ip_ctx->saes.algo, in saes_init() 181 dst_ip_ctx->saes.algo = src_ctx->algo; in saes_copy_state() 239 static TEE_Result alloc_cryp_ctx(void **ctx, enum stm32_cryp_algo_mode algo) in alloc_cryp_ctx() argument 246 FMSG("Using CRYP %d", algo); in alloc_cryp_ctx() 247 c->ip_ctx.cryp.algo = algo; in alloc_cryp_ctx() [all …]
|
| H A D | authenc.c | 28 enum stm32_cryp_algo_mode algo; member 213 if (c->algo == STM32_CRYP_MODE_AES_GCM) { in stm32_ae_initialize() 217 } else if (c->algo == STM32_CRYP_MODE_AES_CCM) { in stm32_ae_initialize() 221 res = stm32_cryp_init(&c->cryp, !dinit->encrypt, c->algo, in stm32_ae_initialize() 227 if (c->algo == STM32_CRYP_MODE_AES_CCM) in stm32_ae_initialize() 322 static TEE_Result alloc_ctx(void **ctx, enum stm32_cryp_algo_mode algo) in alloc_ctx() argument 329 c->algo = algo; in alloc_ctx() 341 static TEE_Result stm32_ae_allocate(void **ctx, uint32_t algo) in stm32_ae_allocate() argument 344 switch (algo) { in stm32_ae_allocate()
|
| /optee_os/core/include/tee/ |
| H A D | tee_cryp_utl.h | 12 TEE_Result tee_alg_get_digest_size(uint32_t algo, size_t *size); 13 TEE_Result tee_hash_createdigest(uint32_t algo, const uint8_t *data, 16 TEE_Result tee_cipher_get_block_size(uint32_t algo, size_t *size); 17 TEE_Result tee_do_cipher_update(void *ctx, uint32_t algo,
|
| /optee_os/core/drivers/crypto/se050/core/ |
| H A D | ecc.c | 37 static bool oefid_algo_supported(uint32_t algo) in oefid_algo_supported() argument 41 switch (algo) { in oefid_algo_supported() 55 static uint32_t algo_tee2se050(uint32_t algo) in algo_tee2se050() argument 57 switch (algo) { in algo_tee2se050() 69 EMSG("algorithm %#"PRIx32" not enabled", algo); in algo_tee2se050() 134 static TEE_Result ecc_get_key_size(uint32_t curve, uint32_t algo, in ecc_get_key_size() argument 165 if (!oefid_algo_supported(algo)) in ecc_get_key_size() 171 static TEE_Result ecc_prepare_msg(uint32_t algo, const uint8_t *msg, in ecc_prepare_msg() argument 175 uint32_t algo; in ecc_prepare_msg() member 187 if (algo == map[i].algo) in ecc_prepare_msg() [all …]
|
| /optee_os/core/crypto/ |
| H A D | signed_hdr.c | 52 static bool is_weak_hash_algo(uint32_t algo) in is_weak_hash_algo() argument 54 return algo == TEE_ALG_MD5 || algo == TEE_ALG_SHA1 || in is_weak_hash_algo() 55 algo == TEE_ALG_MD5SHA1 || algo == TEE_ALG_SHA224; in is_weak_hash_algo() 61 static bool is_weak_key_size(uint32_t algo, size_t key_size_bits) in is_weak_key_size() argument 63 if (TEE_ALG_GET_MAIN_ALG(algo) == TEE_MAIN_ALGO_RSA && in is_weak_key_size() 83 if (TEE_ALG_GET_MAIN_ALG(shdr->algo) != TEE_MAIN_ALGO_RSA) in shdr_verify_signature() 86 hash_algo = TEE_DIGEST_HASH_TO_ALGO(shdr->algo); in shdr_verify_signature() 90 if (is_weak_key_size(shdr->algo, ta_pub_key_modulus_size * 8)) in shdr_verify_signature() 113 crypto_acipher_rsassa_verify, shdr->algo, &key, in shdr_verify_signature() 289 if (crypto_hash_alloc_ctx(&ctx, TEE_DIGEST_HASH_TO_ALGO(shdr->algo))) { in shdr_load_pub_key() [all …]
|
| H A D | crypto.c | 16 TEE_Result crypto_hash_alloc_ctx(void **ctx, uint32_t algo) in crypto_hash_alloc_ctx() argument 25 res = drvcrypt_hash_alloc_ctx(&c, algo); in crypto_hash_alloc_ctx() 28 switch (algo) { in crypto_hash_alloc_ctx() 114 TEE_Result crypto_cipher_alloc_ctx(void **ctx, uint32_t algo) in crypto_cipher_alloc_ctx() argument 123 res = drvcrypt_cipher_alloc_ctx(&c, algo); in crypto_cipher_alloc_ctx() 126 switch (algo) { in crypto_cipher_alloc_ctx() 221 TEE_Result crypto_cipher_get_block_size(uint32_t algo, size_t *size) in crypto_cipher_get_block_size() argument 223 uint32_t class = TEE_ALG_GET_CLASS(algo); in crypto_cipher_get_block_size() 229 switch (TEE_ALG_GET_MAIN_ALG(algo)) { in crypto_cipher_get_block_size() 245 TEE_Result crypto_mac_alloc_ctx(void **ctx, uint32_t algo) in crypto_mac_alloc_ctx() argument [all …]
|
| /optee_os/core/drivers/crypto/crypto_api/hash/ |
| H A D | hash.c | 12 TEE_Result drvcrypt_hash_alloc_ctx(struct crypto_hash_ctx **ctx, uint32_t algo) in drvcrypt_hash_alloc_ctx() argument 17 CRYPTO_TRACE("hash alloc_ctx algo 0x%" PRIX32, algo); in drvcrypt_hash_alloc_ctx() 24 ret = hash_alloc(ctx, algo); in drvcrypt_hash_alloc_ctx()
|
| /optee_os/core/drivers/crypto/versal/ |
| H A D | rsa.c | 43 return sw_crypto_acipher_rsaes_encrypt(rsa_data->algo, in do_encrypt() 53 return sw_crypto_acipher_rsaes_encrypt(rsa_data->algo, in do_encrypt() 134 return sw_crypto_acipher_rsaes_decrypt(rsa_data->algo, in do_decrypt() 144 return sw_crypto_acipher_rsaes_decrypt(rsa_data->algo, in do_decrypt() 209 switch (p->algo) { in do_ssa_sign() 219 return sw_crypto_acipher_rsassa_sign(p->algo, in do_ssa_sign() 228 return sw_crypto_acipher_rsassa_sign(p->algo, in do_ssa_sign() 240 return sw_crypto_acipher_rsassa_sign(p->algo, in do_ssa_sign() 256 switch (p->algo) { in do_ssa_verify() 266 return sw_crypto_acipher_rsassa_verify(p->algo, in do_ssa_verify() [all …]
|
| /optee_os/core/include/crypto/ |
| H A D | crypto.h | 31 TEE_Result crypto_hash_alloc_ctx(void **ctx, uint32_t algo); 39 TEE_Result crypto_cipher_alloc_ctx(void **ctx, uint32_t algo); 48 TEE_Result crypto_cipher_get_block_size(uint32_t algo, size_t *size); 53 TEE_Result crypto_mac_alloc_ctx(void **ctx, uint32_t algo); 61 TEE_Result crypto_authenc_alloc_ctx(void **ctx, uint32_t algo); 262 TEE_Result crypto_acipher_rsaes_decrypt(uint32_t algo, struct rsa_keypair *key, 267 TEE_Result crypto_acipher_rsaes_encrypt(uint32_t algo, 274 TEE_Result crypto_acipher_rsassa_sign(uint32_t algo, struct rsa_keypair *key, 278 TEE_Result crypto_acipher_rsassa_verify(uint32_t algo, 283 TEE_Result crypto_acipher_dsa_sign(uint32_t algo, struct dsa_keypair *key, [all …]
|
| H A D | crypto_impl.h | 357 TEE_Result drvcrypt_hash_alloc_ctx(struct crypto_hash_ctx **ctx, uint32_t algo); 361 uint32_t algo __unused) in drvcrypt_hash_alloc_ctx() 369 uint32_t algo); 373 uint32_t algo __unused) in drvcrypt_cipher_alloc_ctx() 381 TEE_Result drvcrypt_mac_alloc_ctx(struct crypto_mac_ctx **ctx, uint32_t algo); 385 uint32_t algo __unused) in drvcrypt_mac_alloc_ctx() 394 uint32_t algo); 398 uint32_t algo __unused) in drvcrypt_authenc_alloc_ctx() 414 TEE_Result (*verify)(uint32_t algo, struct ecc_public_key *key, 433 TEE_Result (*sign)(uint32_t algo, struct ecc_keypair *key, [all …]
|
| /optee_os/lib/libmbedtls/core/ |
| H A D | rsa.c | 41 static uint32_t tee_algo_to_mbedtls_hash_algo(uint32_t algo) in tee_algo_to_mbedtls_hash_algo() argument 43 switch (algo) { in tee_algo_to_mbedtls_hash_algo() 454 TEE_Result crypto_acipher_rsaes_decrypt(uint32_t algo, 463 TEE_Result sw_crypto_acipher_rsaes_decrypt(uint32_t algo, in sw_crypto_acipher_rsaes_decrypt() argument 503 if (algo == TEE_ALG_RSAES_PKCS1_V1_5) { in sw_crypto_acipher_rsaes_decrypt() 523 if (algo != TEE_ALG_RSAES_PKCS1_V1_5) { in sw_crypto_acipher_rsaes_decrypt() 524 md_algo = tee_algo_to_mbedtls_hash_algo(algo); in sw_crypto_acipher_rsaes_decrypt() 562 TEE_Result crypto_acipher_rsaes_encrypt(uint32_t algo, 571 TEE_Result sw_crypto_acipher_rsaes_encrypt(uint32_t algo, in sw_crypto_acipher_rsaes_encrypt() argument 615 if (algo == TEE_ALG_RSAES_PKCS1_V1_5) in sw_crypto_acipher_rsaes_encrypt() [all …]
|
| H A D | sm2-dsa.h | 13 TEE_Result sm2_mbedtls_dsa_sign(uint32_t algo, struct ecc_keypair *key, 17 TEE_Result sm2_mbedtls_dsa_verify(uint32_t algo, struct ecc_public_key *key,
|
| /optee_os/core/drivers/crypto/crypto_api/oid/ |
| H A D | hash_oid.c | 32 const struct drvcrypt_oid *drvcrypt_get_alg_hash_oid(uint32_t algo) in drvcrypt_get_alg_hash_oid() argument 34 uint32_t main_alg = TEE_ALG_GET_MAIN_ALG(algo); in drvcrypt_get_alg_hash_oid()
|