| /optee_os/core/lib/libtomcrypt/src/encauth/gcm/ |
| H A D | gcm_add_aad.c | 19 int gcm_add_aad(gcm_state *gcm, in gcm_add_aad() argument 28 LTC_ARGCHK(gcm != NULL); in gcm_add_aad() 33 if (gcm->buflen > 16 || gcm->buflen < 0) { in gcm_add_aad() 37 if ((err = cipher_is_valid(gcm->cipher)) != CRYPT_OK) { in gcm_add_aad() 42 if (gcm->mode == LTC_GCM_MODE_IV) { in gcm_add_aad() 44 if (gcm->buflen == 0 && gcm->totlen == 0) return CRYPT_ERROR; in gcm_add_aad() 46 if (gcm->ivmode || gcm->buflen != 12) { in gcm_add_aad() 47 for (x = 0; x < (unsigned long)gcm->buflen; x++) { in gcm_add_aad() 48 gcm->X[x] ^= gcm->buf[x]; in gcm_add_aad() 50 if (gcm->buflen) { in gcm_add_aad() [all …]
|
| H A D | gcm_process.c | 21 int gcm_process(gcm_state *gcm, in gcm_process() argument 30 LTC_ARGCHK(gcm != NULL); in gcm_process() 36 if (gcm->buflen > 16 || gcm->buflen < 0) { in gcm_process() 40 if ((err = cipher_is_valid(gcm->cipher)) != CRYPT_OK) { in gcm_process() 45 if (gcm->pttotlen / 8 + (ulong64)gcm->buflen + (ulong64)ptlen >= CONST64(0xFFFFFFFE0)) { in gcm_process() 49 if (gcm->mode == LTC_GCM_MODE_IV) { in gcm_process() 51 if ((err = gcm_add_aad(gcm, NULL, 0)) != CRYPT_OK) return err; in gcm_process() 55 if (gcm->mode == LTC_GCM_MODE_AAD) { in gcm_process() 57 if (gcm->buflen) { in gcm_process() 58 gcm->totlen += gcm->buflen * CONST64(8); in gcm_process() [all …]
|
| H A D | gcm_done.c | 19 int gcm_done(gcm_state *gcm, in gcm_done() argument 25 LTC_ARGCHK(gcm != NULL); in gcm_done() 29 if (gcm->buflen > 16 || gcm->buflen < 0) { in gcm_done() 33 if ((err = cipher_is_valid(gcm->cipher)) != CRYPT_OK) { in gcm_done() 37 if (gcm->mode == LTC_GCM_MODE_IV) { in gcm_done() 39 if ((err = gcm_add_aad(gcm, NULL, 0)) != CRYPT_OK) return err; in gcm_done() 42 if (gcm->mode == LTC_GCM_MODE_AAD) { in gcm_done() 44 if ((err = gcm_process(gcm, NULL, 0, NULL, 0)) != CRYPT_OK) return err; in gcm_done() 47 if (gcm->mode != LTC_GCM_MODE_TEXT) { in gcm_done() 52 if (gcm->buflen) { in gcm_done() [all …]
|
| H A D | gcm_add_iv.c | 19 int gcm_add_iv(gcm_state *gcm, in gcm_add_iv() argument 25 LTC_ARGCHK(gcm != NULL); in gcm_add_iv() 31 if (gcm->mode != LTC_GCM_MODE_IV) { in gcm_add_iv() 35 if (gcm->buflen >= 16 || gcm->buflen < 0) { in gcm_add_iv() 39 if ((err = cipher_is_valid(gcm->cipher)) != CRYPT_OK) { in gcm_add_iv() 45 if (IVlen + gcm->buflen > 12) { in gcm_add_iv() 46 gcm->ivmode |= 1; in gcm_add_iv() 51 if (gcm->buflen == 0) { in gcm_add_iv() 54 *(LTC_FAST_TYPE_PTR_CAST(&gcm->X[y])) ^= *(LTC_FAST_TYPE_PTR_CAST(&IV[x + y])); in gcm_add_iv() 56 gcm_mult_h(gcm, gcm->X); in gcm_add_iv() [all …]
|
| H A D | gcm_init.c | 20 int gcm_init(gcm_state *gcm, int cipher, in gcm_init() argument 29 LTC_ARGCHK(gcm != NULL); in gcm_init() 47 if ((err = cipher_descriptor[cipher]->setup(key, keylen, 0, &gcm->K)) != CRYPT_OK) { in gcm_init() 53 if ((err = cipher_descriptor[cipher]->ecb_encrypt(B, gcm->H, &gcm->K)) != CRYPT_OK) { in gcm_init() 58 zeromem(gcm->buf, sizeof(gcm->buf)); in gcm_init() 59 zeromem(gcm->X, sizeof(gcm->X)); in gcm_init() 60 gcm->cipher = cipher; in gcm_init() 61 gcm->mode = LTC_GCM_MODE_IV; in gcm_init() 62 gcm->ivmode = 0; in gcm_init() 63 gcm->buflen = 0; in gcm_init() [all …]
|
| H A D | gcm_reset.c | 17 int gcm_reset(gcm_state *gcm) in gcm_reset() argument 19 LTC_ARGCHK(gcm != NULL); in gcm_reset() 21 zeromem(gcm->buf, sizeof(gcm->buf)); in gcm_reset() 22 zeromem(gcm->X, sizeof(gcm->X)); in gcm_reset() 23 gcm->mode = LTC_GCM_MODE_IV; in gcm_reset() 24 gcm->ivmode = 0; in gcm_reset() 25 gcm->buflen = 0; in gcm_reset() 26 gcm->totlen = 0; in gcm_reset() 27 gcm->pttotlen = 0; in gcm_reset()
|
| H A D | gcm_memory.c | 39 gcm_state *gcm; in gcm_memory() local 60 orig = gcm = XMALLOC(sizeof(*gcm)); in gcm_memory() 62 orig = gcm = XMALLOC(sizeof(*gcm) + 16); in gcm_memory() 64 if (gcm == NULL) { in gcm_memory() 73 gcm = LTC_ALIGN_BUF(gcm, 16); in gcm_memory() 76 if ((err = gcm_init(gcm, cipher, key, keylen)) != CRYPT_OK) { in gcm_memory() 79 if ((err = gcm_add_iv(gcm, IV, IVlen)) != CRYPT_OK) { in gcm_memory() 82 if ((err = gcm_add_aad(gcm, adata, adatalen)) != CRYPT_OK) { in gcm_memory() 85 if ((err = gcm_process(gcm, pt, ptlen, ct, direction)) != CRYPT_OK) { in gcm_memory() 89 if ((err = gcm_done(gcm, tag, taglen)) != CRYPT_OK) { in gcm_memory() [all …]
|
| H A D | gcm_mult_h.c | 16 void gcm_mult_h(const gcm_state *gcm, unsigned char *I) in gcm_mult_h() argument 22 asm("movdqa (%0),%%xmm0"::"r"(&gcm->PC[0][I[0]][0])); in gcm_mult_h() 24 asm("pxor (%0),%%xmm0"::"r"(&gcm->PC[x][I[x]][0])); in gcm_mult_h() 29 XMEMCPY(T, &gcm->PC[0][I[0]][0], 16); in gcm_mult_h() 33 *(LTC_FAST_TYPE_PTR_CAST(T + y)) ^= *(LTC_FAST_TYPE_PTR_CAST(&gcm->PC[x][I[x]][y])); in gcm_mult_h() 37 T[y] ^= gcm->PC[x][I[x]][y]; in gcm_mult_h() 43 gcm_gf_mult(gcm->H, I, T); in gcm_mult_h()
|
| H A D | gcm_mult_h_arm_ce.c | 17 void gcm_mult_h(gcm_state *gcm, unsigned char *I) in gcm_mult_h() argument 26 b = get_be64(gcm->H); in gcm_mult_h() 27 a = get_be64(gcm->H + 8); in gcm_mult_h()
|
| H A D | gcm_test.c | 322 gcm_state gcm; in gcm_test() 335 if ((err = gcm_init(&gcm, idx, tests[0].K, tests[0].keylen)) != CRYPT_OK) return err; in gcm_test() 336 if ((err = gcm_add_iv(&gcm, tests[0].IV, tests[0].IVlen)) != CRYPT_OK) return err; in gcm_test() 338 if ((err = gcm_done(&gcm, T[0], &y)) != CRYPT_OK) return err; in gcm_test()
|
| /optee_os/core/lib/libtomcrypt/ |
| H A D | gcm.c | 70 struct tee_gcm_state *gcm = to_tee_gcm_state(aectx); in crypto_aes_gcm_init() local 76 memset(&gcm->ctx, 0, sizeof(gcm->ctx)); in crypto_aes_gcm_init() 77 gcm->tag_len = tag_len; in crypto_aes_gcm_init() 79 ltc_res = gcm_init(&gcm->ctx, ltc_cipherindex, key, key_len); in crypto_aes_gcm_init() 84 ltc_res = gcm_add_iv(&gcm->ctx, nonce, nonce_len); in crypto_aes_gcm_init() 94 struct tee_gcm_state *gcm = to_tee_gcm_state(aectx); in crypto_aes_gcm_update_aad() local 98 ltc_res = gcm_add_aad(&gcm->ctx, data, len); in crypto_aes_gcm_update_aad() 113 struct tee_gcm_state *gcm = to_tee_gcm_state(aectx); in crypto_aes_gcm_update_payload() local 128 if (gcm->ctx.mode == LTC_GCM_MODE_IV) { in crypto_aes_gcm_update_payload() 135 ltc_res = gcm_process(&gcm->ctx, pt, len, ct, dir); in crypto_aes_gcm_update_payload() [all …]
|
| H A D | sub.mk | 76 srcs-$(_CFG_CORE_LTC_GCM) += gcm.c 77 srcs-$(_CFG_CORE_LTC_GCM) += src/encauth/gcm/gcm_add_aad.c 78 srcs-$(_CFG_CORE_LTC_GCM) += src/encauth/gcm/gcm_add_iv.c 79 srcs-$(_CFG_CORE_LTC_GCM) += src/encauth/gcm/gcm_done.c 80 srcs-$(_CFG_CORE_LTC_GCM) += src/encauth/gcm/gcm_gf_mult.c 81 srcs-$(_CFG_CORE_LTC_GCM) += src/encauth/gcm/gcm_init.c 82 srcs-$(_CFG_CORE_LTC_GCM) += src/encauth/gcm/gcm_memory.c 84 srcs-$(_CFG_CORE_LTC_GCM) += src/encauth/gcm/gcm_mult_h_arm_ce.c 86 srcs-$(_CFG_CORE_LTC_GCM) += src/encauth/gcm/gcm_mult_h.c 88 srcs-$(_CFG_CORE_LTC_GCM) += src/encauth/gcm/gcm_process.c [all …]
|
| /optee_os/core/crypto/ |
| H A D | sub.mk | 4 srcs-y += aes-gcm.c 6 srcs-y += aes-gcm-sw.c 8 srcs-y += aes-gcm-ghash-tbl.c
|
| /optee_os/lib/libmbedtls/mbedtls/library/ |
| H A D | psa_crypto_aead.c | 76 mbedtls_gcm_init(&operation->ctx.gcm); in psa_aead_setup() 78 mbedtls_gcm_setkey(&operation->ctx.gcm, cipher_id, in psa_aead_setup() 160 mbedtls_gcm_crypt_and_tag(&operation.ctx.gcm, in mbedtls_psa_aead_encrypt() 271 mbedtls_gcm_auth_decrypt(&operation.ctx.gcm, in mbedtls_psa_aead_decrypt() 372 mbedtls_gcm_starts(&operation->ctx.gcm, in mbedtls_psa_aead_set_nonce() 454 mbedtls_gcm_update_ad(&operation->ctx.gcm, input, input_length)); in mbedtls_psa_aead_update_ad() 500 mbedtls_gcm_update(&operation->ctx.gcm, in mbedtls_psa_aead_update() 568 mbedtls_gcm_finish(&operation->ctx.gcm, in mbedtls_psa_aead_finish() 634 mbedtls_gcm_free(&operation->ctx.gcm); in mbedtls_psa_aead_abort()
|
| /optee_os/core/lib/libtomcrypt/src/headers/ |
| H A D | tomcrypt_mac.h | 504 void gcm_mult_h(const gcm_state *gcm, unsigned char *I); 506 int gcm_init(gcm_state *gcm, int cipher, 509 int gcm_reset(gcm_state *gcm); 511 int gcm_add_iv(gcm_state *gcm, 514 int gcm_add_aad(gcm_state *gcm, 517 int gcm_process(gcm_state *gcm, 522 int gcm_done(gcm_state *gcm,
|
| /optee_os/core/arch/arm/crypto/ |
| H A D | sub.mk | 4 srcs-y += aes-gcm-ce.c
|
| /optee_os/lib/libmbedtls/mbedtls/include/psa/ |
| H A D | crypto_builtin_composites.h | 93 mbedtls_gcm_context MBEDTLS_PRIVATE(gcm);
|
| /optee_os/lib/libmbedtls/ |
| H A D | sub.mk | 38 SRCS_CRYPTO += gcm.c
|
| /optee_os/lib/libmbedtls/mbedtls/ |
| H A D | ChangeLog | 260 cipher.h, cmac.h, gcm.h, poly1305.h;
|