| /optee_os/lib/libmbedtls/mbedtls/library/ |
| H A D | ecdh.c | 30 const mbedtls_ecdh_context *ctx) in mbedtls_ecdh_grp_id() argument 33 return ctx->grp.id; in mbedtls_ecdh_grp_id() 35 return ctx->grp_id; in mbedtls_ecdh_grp_id() 134 static void ecdh_init_internal(mbedtls_ecdh_context_mbed *ctx) in ecdh_init_internal() argument 136 mbedtls_ecp_group_init(&ctx->grp); in ecdh_init_internal() 137 mbedtls_mpi_init(&ctx->d); in ecdh_init_internal() 138 mbedtls_ecp_point_init(&ctx->Q); in ecdh_init_internal() 139 mbedtls_ecp_point_init(&ctx->Qp); in ecdh_init_internal() 140 mbedtls_mpi_init(&ctx->z); in ecdh_init_internal() 143 mbedtls_ecp_restart_init(&ctx->rs); in ecdh_init_internal() [all …]
|
| H A D | ccm.c | 47 void mbedtls_ccm_init(mbedtls_ccm_context *ctx) in mbedtls_ccm_init() argument 49 memset(ctx, 0, sizeof(mbedtls_ccm_context)); in mbedtls_ccm_init() 52 int mbedtls_ccm_setkey(mbedtls_ccm_context *ctx, in mbedtls_ccm_setkey() argument 60 mbedtls_block_cipher_free(&ctx->block_cipher_ctx); in mbedtls_ccm_setkey() 62 if ((ret = mbedtls_block_cipher_setup(&ctx->block_cipher_ctx, cipher)) != 0) { in mbedtls_ccm_setkey() 66 if ((ret = mbedtls_block_cipher_setkey(&ctx->block_cipher_ctx, key, keybits)) != 0) { in mbedtls_ccm_setkey() 82 mbedtls_cipher_free(&ctx->cipher_ctx); in mbedtls_ccm_setkey() 84 if ((ret = mbedtls_cipher_setup(&ctx->cipher_ctx, cipher_info)) != 0) { in mbedtls_ccm_setkey() 88 if ((ret = mbedtls_cipher_setkey(&ctx->cipher_ctx, key, keybits, in mbedtls_ccm_setkey() 100 void mbedtls_ccm_free(mbedtls_ccm_context *ctx) in mbedtls_ccm_free() argument [all …]
|
| H A D | hmac_drbg.c | 33 void mbedtls_hmac_drbg_init(mbedtls_hmac_drbg_context *ctx) in mbedtls_hmac_drbg_init() argument 35 memset(ctx, 0, sizeof(mbedtls_hmac_drbg_context)); in mbedtls_hmac_drbg_init() 37 ctx->reseed_interval = MBEDTLS_HMAC_DRBG_RESEED_INTERVAL; in mbedtls_hmac_drbg_init() 43 int mbedtls_hmac_drbg_update(mbedtls_hmac_drbg_context *ctx, in mbedtls_hmac_drbg_update() argument 47 size_t md_len = mbedtls_md_get_size(ctx->md_ctx.md_info); in mbedtls_hmac_drbg_update() 55 if ((ret = mbedtls_md_hmac_reset(&ctx->md_ctx)) != 0) { in mbedtls_hmac_drbg_update() 58 if ((ret = mbedtls_md_hmac_update(&ctx->md_ctx, in mbedtls_hmac_drbg_update() 59 ctx->V, md_len)) != 0) { in mbedtls_hmac_drbg_update() 62 if ((ret = mbedtls_md_hmac_update(&ctx->md_ctx, in mbedtls_hmac_drbg_update() 67 if ((ret = mbedtls_md_hmac_update(&ctx->md_ctx, in mbedtls_hmac_drbg_update() [all …]
|
| H A D | block_cipher.c | 52 void mbedtls_block_cipher_free(mbedtls_block_cipher_context_t *ctx) in mbedtls_block_cipher_free() argument 54 if (ctx == NULL) { in mbedtls_block_cipher_free() 59 if (ctx->engine == MBEDTLS_BLOCK_CIPHER_ENGINE_PSA) { in mbedtls_block_cipher_free() 60 psa_destroy_key(ctx->psa_key_id); in mbedtls_block_cipher_free() 64 switch (ctx->id) { in mbedtls_block_cipher_free() 67 mbedtls_aes_free(&ctx->ctx.aes); in mbedtls_block_cipher_free() 72 mbedtls_aria_free(&ctx->ctx.aria); in mbedtls_block_cipher_free() 77 mbedtls_camellia_free(&ctx->ctx.camellia); in mbedtls_block_cipher_free() 83 ctx->id = MBEDTLS_BLOCK_CIPHER_ID_NONE; in mbedtls_block_cipher_free() 86 int mbedtls_block_cipher_setup(mbedtls_block_cipher_context_t *ctx, in mbedtls_block_cipher_setup() argument [all …]
|
| H A D | dhm.c | 98 void mbedtls_dhm_init(mbedtls_dhm_context *ctx) in mbedtls_dhm_init() argument 100 memset(ctx, 0, sizeof(mbedtls_dhm_context)); in mbedtls_dhm_init() 103 size_t mbedtls_dhm_get_bitlen(const mbedtls_dhm_context *ctx) in mbedtls_dhm_get_bitlen() argument 105 return mbedtls_mpi_bitlen(&ctx->P); in mbedtls_dhm_get_bitlen() 108 size_t mbedtls_dhm_get_len(const mbedtls_dhm_context *ctx) in mbedtls_dhm_get_len() argument 110 return mbedtls_mpi_size(&ctx->P); in mbedtls_dhm_get_len() 113 int mbedtls_dhm_get_value(const mbedtls_dhm_context *ctx, in mbedtls_dhm_get_value() argument 120 src = &ctx->P; in mbedtls_dhm_get_value() 123 src = &ctx->G; in mbedtls_dhm_get_value() 126 src = &ctx->X; in mbedtls_dhm_get_value() [all …]
|
| H A D | cipher.c | 202 void mbedtls_cipher_init(mbedtls_cipher_context_t *ctx) in mbedtls_cipher_init() argument 204 memset(ctx, 0, sizeof(mbedtls_cipher_context_t)); in mbedtls_cipher_init() 207 void mbedtls_cipher_free(mbedtls_cipher_context_t *ctx) in mbedtls_cipher_free() argument 209 if (ctx == NULL) { in mbedtls_cipher_free() 214 if (ctx->psa_enabled == 1) { in mbedtls_cipher_free() 215 if (ctx->cipher_ctx != NULL) { in mbedtls_cipher_free() 217 (mbedtls_cipher_context_psa *) ctx->cipher_ctx; in mbedtls_cipher_free() 227 mbedtls_platform_zeroize(ctx, sizeof(mbedtls_cipher_context_t)); in mbedtls_cipher_free() 233 if (ctx->cmac_ctx) { in mbedtls_cipher_free() 234 mbedtls_zeroize_and_free(ctx->cmac_ctx, in mbedtls_cipher_free() [all …]
|
| H A D | chachapoly.c | 34 static int chachapoly_pad_aad(mbedtls_chachapoly_context *ctx) in chachapoly_pad_aad() argument 36 uint32_t partial_block_len = (uint32_t) (ctx->aad_len % 16U); in chachapoly_pad_aad() 45 return mbedtls_poly1305_update(&ctx->poly1305_ctx, in chachapoly_pad_aad() 55 static int chachapoly_pad_ciphertext(mbedtls_chachapoly_context *ctx) in chachapoly_pad_ciphertext() argument 57 uint32_t partial_block_len = (uint32_t) (ctx->ciphertext_len % 16U); in chachapoly_pad_ciphertext() 65 return mbedtls_poly1305_update(&ctx->poly1305_ctx, in chachapoly_pad_ciphertext() 70 void mbedtls_chachapoly_init(mbedtls_chachapoly_context *ctx) in mbedtls_chachapoly_init() argument 72 mbedtls_chacha20_init(&ctx->chacha20_ctx); in mbedtls_chachapoly_init() 73 mbedtls_poly1305_init(&ctx->poly1305_ctx); in mbedtls_chachapoly_init() 74 ctx->aad_len = 0U; in mbedtls_chachapoly_init() [all …]
|
| H A D | lms.c | 228 void mbedtls_lms_public_init(mbedtls_lms_public_t *ctx) in mbedtls_lms_public_init() argument 230 memset(ctx, 0, sizeof(*ctx)); in mbedtls_lms_public_init() 233 void mbedtls_lms_public_free(mbedtls_lms_public_t *ctx) in mbedtls_lms_public_free() argument 235 if (ctx == NULL) { in mbedtls_lms_public_free() 239 mbedtls_platform_zeroize(ctx, sizeof(*ctx)); in mbedtls_lms_public_free() 242 int mbedtls_lms_import_public_key(mbedtls_lms_public_t *ctx, in mbedtls_lms_import_public_key() argument 253 ctx->params.type = (mbedtls_lms_algorithm_type_t) type; in mbedtls_lms_import_public_key() 255 if (key_size != MBEDTLS_LMS_PUBLIC_KEY_LEN(ctx->params.type)) { in mbedtls_lms_import_public_key() 263 ctx->params.otstype = (mbedtls_lmots_algorithm_type_t) otstype; in mbedtls_lms_import_public_key() 265 memcpy(ctx->params.I_key_identifier, in mbedtls_lms_import_public_key() [all …]
|
| H A D | gcm.c | 53 void mbedtls_gcm_init(mbedtls_gcm_context *ctx) in mbedtls_gcm_init() argument 55 memset(ctx, 0, sizeof(mbedtls_gcm_context)); in mbedtls_gcm_init() 58 static inline void gcm_set_acceleration(mbedtls_gcm_context *ctx) in gcm_set_acceleration() argument 61 ctx->acceleration = MBEDTLS_GCM_ACC_LARGETABLE; in gcm_set_acceleration() 63 ctx->acceleration = MBEDTLS_GCM_ACC_SMALLTABLE; in gcm_set_acceleration() 69 ctx->acceleration = MBEDTLS_GCM_ACC_AESNI; in gcm_set_acceleration() 75 ctx->acceleration = MBEDTLS_GCM_ACC_AESCE; in gcm_set_acceleration() 99 static int gcm_gen_table(mbedtls_gcm_context *ctx) in gcm_gen_table() argument 106 ret = mbedtls_block_cipher_encrypt(&ctx->block_cipher_ctx, h, h); in gcm_gen_table() 109 ret = mbedtls_cipher_update(&ctx->cipher_ctx, h, 16, h, &olen); in gcm_gen_table() [all …]
|
| H A D | md.c | 255 void mbedtls_md_init(mbedtls_md_context_t *ctx) in mbedtls_md_init() argument 258 memset(ctx, 0, sizeof(mbedtls_md_context_t)); in mbedtls_md_init() 261 void mbedtls_md_free(mbedtls_md_context_t *ctx) in mbedtls_md_free() argument 263 if (ctx == NULL || ctx->md_info == NULL) { in mbedtls_md_free() 267 if (ctx->md_ctx != NULL) { in mbedtls_md_free() 269 if (ctx->engine == MBEDTLS_MD_ENGINE_PSA) { in mbedtls_md_free() 270 psa_hash_abort(ctx->md_ctx); in mbedtls_md_free() 273 switch (ctx->md_info->type) { in mbedtls_md_free() 276 mbedtls_md5_free(ctx->md_ctx); in mbedtls_md_free() 281 mbedtls_ripemd160_free(ctx->md_ctx); in mbedtls_md_free() [all …]
|
| H A D | entropy.c | 27 void mbedtls_entropy_init(mbedtls_entropy_context *ctx) in mbedtls_entropy_init() argument 29 ctx->source_count = 0; in mbedtls_entropy_init() 30 memset(ctx->source, 0, sizeof(ctx->source)); in mbedtls_entropy_init() 33 mbedtls_mutex_init(&ctx->mutex); in mbedtls_entropy_init() 36 ctx->accumulator_started = 0; in mbedtls_entropy_init() 37 mbedtls_md_init(&ctx->accumulator); in mbedtls_entropy_init() 44 mbedtls_entropy_add_source(ctx, mbedtls_platform_entropy_poll, NULL, in mbedtls_entropy_init() 49 mbedtls_entropy_add_source(ctx, mbedtls_hardware_poll, NULL, in mbedtls_entropy_init() 54 mbedtls_entropy_add_source(ctx, mbedtls_nv_seed_poll, NULL, in mbedtls_entropy_init() 57 ctx->initial_entropy_run = 0; in mbedtls_entropy_init() [all …]
|
| H A D | poly1305.c | 64 static void poly1305_process(mbedtls_poly1305_context *ctx, in poly1305_process() argument 76 r0 = ctx->r[0]; in poly1305_process() 77 r1 = ctx->r[1]; in poly1305_process() 78 r2 = ctx->r[2]; in poly1305_process() 79 r3 = ctx->r[3]; in poly1305_process() 85 acc0 = ctx->acc[0]; in poly1305_process() 86 acc1 = ctx->acc[1]; in poly1305_process() 87 acc2 = ctx->acc[2]; in poly1305_process() 88 acc3 = ctx->acc[3]; in poly1305_process() 89 acc4 = ctx->acc[4]; in poly1305_process() [all …]
|
| H A D | psa_crypto_hash.c | 32 mbedtls_md5_free(&operation->ctx.md5); in mbedtls_psa_hash_abort() 37 mbedtls_ripemd160_free(&operation->ctx.ripemd160); in mbedtls_psa_hash_abort() 42 mbedtls_sha1_free(&operation->ctx.sha1); in mbedtls_psa_hash_abort() 47 mbedtls_sha256_free(&operation->ctx.sha256); in mbedtls_psa_hash_abort() 52 mbedtls_sha256_free(&operation->ctx.sha256); in mbedtls_psa_hash_abort() 57 mbedtls_sha512_free(&operation->ctx.sha512); in mbedtls_psa_hash_abort() 62 mbedtls_sha512_free(&operation->ctx.sha512); in mbedtls_psa_hash_abort() 81 mbedtls_sha3_free(&operation->ctx.sha3); in mbedtls_psa_hash_abort() 105 mbedtls_md5_init(&operation->ctx.md5); in mbedtls_psa_hash_setup() 106 ret = mbedtls_md5_starts(&operation->ctx.md5); in mbedtls_psa_hash_setup() [all …]
|
| H A D | chacha20.c | 143 void mbedtls_chacha20_init(mbedtls_chacha20_context *ctx) in mbedtls_chacha20_init() argument 145 mbedtls_platform_zeroize(ctx->state, sizeof(ctx->state)); in mbedtls_chacha20_init() 146 mbedtls_platform_zeroize(ctx->keystream8, sizeof(ctx->keystream8)); in mbedtls_chacha20_init() 149 ctx->keystream_bytes_used = CHACHA20_BLOCK_SIZE_BYTES; in mbedtls_chacha20_init() 152 void mbedtls_chacha20_free(mbedtls_chacha20_context *ctx) in mbedtls_chacha20_free() argument 154 if (ctx != NULL) { in mbedtls_chacha20_free() 155 mbedtls_platform_zeroize(ctx, sizeof(mbedtls_chacha20_context)); in mbedtls_chacha20_free() 159 int mbedtls_chacha20_setkey(mbedtls_chacha20_context *ctx, in mbedtls_chacha20_setkey() argument 163 ctx->state[0] = 0x61707865; in mbedtls_chacha20_setkey() 164 ctx->state[1] = 0x3320646e; in mbedtls_chacha20_setkey() [all …]
|
| H A D | ssl_ticket.c | 36 void mbedtls_ssl_ticket_init(mbedtls_ssl_ticket_context *ctx) in mbedtls_ssl_ticket_init() argument 38 memset(ctx, 0, sizeof(mbedtls_ssl_ticket_context)); in mbedtls_ssl_ticket_init() 41 mbedtls_mutex_init(&ctx->mutex); in mbedtls_ssl_ticket_init() 64 static int ssl_ticket_gen_key(mbedtls_ssl_ticket_context *ctx, in ssl_ticket_gen_key() argument 69 mbedtls_ssl_ticket_key *key = ctx->keys + index; in ssl_ticket_gen_key() 81 key->lifetime = ctx->ticket_lifetime; in ssl_ticket_gen_key() 83 if ((ret = ctx->f_rng(ctx->p_rng, key->name, sizeof(key->name))) != 0) { in ssl_ticket_gen_key() 87 if ((ret = ctx->f_rng(ctx->p_rng, buf, sizeof(buf))) != 0) { in ssl_ticket_gen_key() 104 ret = mbedtls_cipher_setkey(&key->ctx, buf, in ssl_ticket_gen_key() 105 mbedtls_cipher_get_key_bitlen(&key->ctx), in ssl_ticket_gen_key() [all …]
|
| H A D | ctr_drbg.c | 73 void mbedtls_ctr_drbg_init(mbedtls_ctr_drbg_context *ctx) in mbedtls_ctr_drbg_init() argument 75 memset(ctx, 0, sizeof(mbedtls_ctr_drbg_context)); in mbedtls_ctr_drbg_init() 77 ctx->psa_ctx.key_id = MBEDTLS_SVC_KEY_ID_INIT; in mbedtls_ctr_drbg_init() 78 ctx->psa_ctx.operation = psa_cipher_operation_init(); in mbedtls_ctr_drbg_init() 80 mbedtls_aes_init(&ctx->aes_ctx); in mbedtls_ctr_drbg_init() 84 ctx->reseed_counter = -1; in mbedtls_ctr_drbg_init() 86 ctx->reseed_interval = MBEDTLS_CTR_DRBG_RESEED_INTERVAL; in mbedtls_ctr_drbg_init() 93 void mbedtls_ctr_drbg_free(mbedtls_ctr_drbg_context *ctx) in mbedtls_ctr_drbg_free() argument 95 if (ctx == NULL) { in mbedtls_ctr_drbg_free() 101 if (ctx->f_entropy != NULL) { in mbedtls_ctr_drbg_free() [all …]
|
| /optee_os/core/drivers/crypto/stm32/ |
| H A D | stm32_cryp.c | 259 static TEE_Result __must_check write_align_block(struct stm32_cryp_context *ctx, in write_align_block() argument 265 res = wait_sr_bits(ctx->base, _CRYP_SR_IFNF); in write_align_block() 269 for (i = 0; i < ctx->block_u32; i++) { in write_align_block() 271 io_write32(ctx->base + _CRYP_DIN, data[i]); in write_align_block() 277 static TEE_Result __must_check write_block(struct stm32_cryp_context *ctx, in write_block() argument 283 memcpy(data_u32, data, ctx->block_u32 * sizeof(uint32_t)); in write_block() 284 return write_align_block(ctx, data_u32); in write_block() 287 return write_align_block(ctx, (void *)data); in write_block() 290 static TEE_Result __must_check read_align_block(struct stm32_cryp_context *ctx, in read_align_block() argument 296 res = wait_sr_bits(ctx->base, _CRYP_SR_OFNE); in read_align_block() [all …]
|
| H A D | stm32_saes.c | 258 static TEE_Result saes_start(struct stm32_saes_context *ctx) in saes_start() argument 263 io_setbits32(ctx->base + _SAES_CR, _SAES_CR_IPRST); in saes_start() 264 io_clrbits32(ctx->base + _SAES_CR, _SAES_CR_IPRST); in saes_start() 267 while (io_read32(ctx->base + _SAES_SR) & _SAES_SR_BUSY) in saes_start() 271 if (io_read32(ctx->base + _SAES_SR) & _SAES_SR_BUSY) { in saes_start() 279 static void saes_end(struct stm32_saes_context *ctx, int prev_error) in saes_end() argument 283 io_setbits32(ctx->base + _SAES_CR, _SAES_CR_IPRST); in saes_end() 284 io_clrbits32(ctx->base + _SAES_CR, _SAES_CR_IPRST); in saes_end() 288 io_clrbits32(ctx->base + _SAES_CR, _SAES_CR_EN); in saes_end() 291 static void saes_write_iv(struct stm32_saes_context *ctx) in saes_write_iv() argument [all …]
|
| /optee_os/core/drivers/crypto/caam/hash/ |
| H A D | caam_hash.c | 90 struct hashctx *ctx; /* Hash Context */ member 105 static struct crypto_hash *to_hash_ctx(struct crypto_hash_ctx *ctx) in to_hash_ctx() argument 107 assert(ctx && ctx->ops == &hash_ops); in to_hash_ctx() 109 return container_of(ctx, struct crypto_hash, hash_ctx); in to_hash_ctx() 132 static void do_free_intern(struct hashctx *ctx) in do_free_intern() argument 134 HASH_TRACE("Free Context (%p)", ctx); in do_free_intern() 136 if (ctx) { in do_free_intern() 138 caam_free_desc(&ctx->descriptor); in do_free_intern() 141 caam_free_buf(&ctx->blockbuf.buf); in do_free_intern() 144 caam_free_buf(&ctx->ctx); in do_free_intern() [all …]
|
| /optee_os/core/lib/libtomcrypt/ |
| H A D | hmac.c | 17 struct crypto_mac_ctx ctx; member 24 static struct ltc_hmac_ctx *to_hmac_ctx(struct crypto_mac_ctx *ctx) in to_hmac_ctx() argument 26 assert(ctx && ctx->ops == <c_hmac_ops); in to_hmac_ctx() 28 return container_of(ctx, struct ltc_hmac_ctx, ctx); in to_hmac_ctx() 31 static TEE_Result ltc_hmac_init(struct crypto_mac_ctx *ctx, const uint8_t *key, in ltc_hmac_init() argument 34 struct ltc_hmac_ctx *hc = to_hmac_ctx(ctx); in ltc_hmac_init() 42 static TEE_Result ltc_hmac_update(struct crypto_mac_ctx *ctx, in ltc_hmac_update() argument 45 if (hmac_process(&to_hmac_ctx(ctx)->state, data, len) == CRYPT_OK) in ltc_hmac_update() 51 static TEE_Result ltc_hmac_final(struct crypto_mac_ctx *ctx, uint8_t *digest, in ltc_hmac_final() argument 56 if (hmac_done(&to_hmac_ctx(ctx)->state, digest, &l) == CRYPT_OK) in ltc_hmac_final() [all …]
|
| H A D | shake.c | 14 struct crypto_hash_ctx ctx; member 18 static struct shake_ctx *to_shake_ctx(struct crypto_hash_ctx *ctx) in to_shake_ctx() argument 20 return container_of(ctx, struct shake_ctx, ctx); in to_shake_ctx() 23 static TEE_Result do_shake_init(struct crypto_hash_ctx *ctx, unsigned int num) in do_shake_init() argument 25 struct shake_ctx *c = to_shake_ctx(ctx); in do_shake_init() 33 static TEE_Result do_sha3_update(struct crypto_hash_ctx *ctx, in do_sha3_update() argument 36 struct shake_ctx *c = to_shake_ctx(ctx); in do_sha3_update() 44 static TEE_Result do_shake_final(struct crypto_hash_ctx *ctx, in do_shake_final() argument 47 struct shake_ctx *c = to_shake_ctx(ctx); in do_shake_final() 58 struct shake_ctx *ctx = calloc(1, sizeof(*ctx)); in do_shake_alloc_ctx() local [all …]
|
| H A D | hash.c | 22 struct crypto_hash_ctx ctx; member 29 static struct ltc_hash_ctx *to_hash_ctx(struct crypto_hash_ctx *ctx) in to_hash_ctx() argument 31 assert(ctx && ctx->ops == <c_hash_ops); in to_hash_ctx() 33 return container_of(ctx, struct ltc_hash_ctx, ctx); in to_hash_ctx() 36 static TEE_Result ltc_hash_init(struct crypto_hash_ctx *ctx) in ltc_hash_init() argument 38 struct ltc_hash_ctx *hc = to_hash_ctx(ctx); in ltc_hash_init() 46 static TEE_Result ltc_hash_update(struct crypto_hash_ctx *ctx, in ltc_hash_update() argument 49 struct ltc_hash_ctx *hc = to_hash_ctx(ctx); in ltc_hash_update() 57 static TEE_Result ltc_hash_final(struct crypto_hash_ctx *ctx, uint8_t *digest, in ltc_hash_final() argument 60 struct ltc_hash_ctx *hc = to_hash_ctx(ctx); in ltc_hash_final() [all …]
|
| /optee_os/core/crypto/ |
| H A D | sm3.c | 38 void sm3_init(struct sm3_context *ctx) in sm3_init() argument 40 ctx->total[0] = 0; in sm3_init() 41 ctx->total[1] = 0; in sm3_init() 43 ctx->state[0] = 0x7380166F; in sm3_init() 44 ctx->state[1] = 0x4914B2B9; in sm3_init() 45 ctx->state[2] = 0x172442D7; in sm3_init() 46 ctx->state[3] = 0xDA8A0600; in sm3_init() 47 ctx->state[4] = 0xA96F30BC; in sm3_init() 48 ctx->state[5] = 0x163138AA; in sm3_init() 49 ctx->state[6] = 0xE38DEE4D; in sm3_init() [all …]
|
| /optee_os/lib/libmbedtls/core/ |
| H A D | aes.c | 17 void mbedtls_aes_init(mbedtls_aes_context *ctx) in mbedtls_aes_init() argument 19 assert(ctx); in mbedtls_aes_init() 20 memset(ctx, 0, sizeof(*ctx)); in mbedtls_aes_init() 23 void mbedtls_aes_free( mbedtls_aes_context *ctx ) in mbedtls_aes_free() argument 25 if (ctx) in mbedtls_aes_free() 26 mbedtls_platform_zeroize(ctx, sizeof(*ctx)); in mbedtls_aes_free() 29 int mbedtls_aes_setkey_enc(mbedtls_aes_context *ctx, const unsigned char *key, in mbedtls_aes_setkey_enc() argument 32 assert(ctx && key); in mbedtls_aes_setkey_enc() 37 if (crypto_accel_aes_expand_keys(key, keybits / 8, ctx->key, NULL, in mbedtls_aes_setkey_enc() 38 sizeof(ctx->key), &ctx->round_count)) in mbedtls_aes_setkey_enc() [all …]
|
| /optee_os/ta/pkcs11/src/ |
| H A D | processing_aes.c | 65 static enum pkcs11_rc init_ae_aes_context(struct ae_aes_context *ctx) in init_ae_aes_context() argument 70 assert(!ctx->out_data && !ctx->out_count && in init_ae_aes_context() 71 !ctx->pending_tag && !ctx->pending_size); in init_ae_aes_context() 74 pending_tag = TEE_Malloc(ctx->tag_byte_len, TEE_MALLOC_FILL_ZERO); in init_ae_aes_context() 82 ctx->pending_tag = pending_tag; in init_ae_aes_context() 83 ctx->out_data = out_data; in init_ae_aes_context() 88 static void release_ae_aes_context(struct ae_aes_context *ctx) in release_ae_aes_context() argument 92 for (n = 0; n < ctx->out_count; n++) in release_ae_aes_context() 93 TEE_Free(ctx->out_data[n].data); in release_ae_aes_context() 95 TEE_Free(ctx->out_data); in release_ae_aes_context() [all …]
|