| /optee_os/core/lib/libtomcrypt/src/encauth/ccm/ |
| H A D | ccm_add_nonce.c | 14 int ccm_add_nonce(ccm_state *ccm, in ccm_add_nonce() argument 20 LTC_ARGCHK(ccm != NULL); in ccm_add_nonce() 24 ccm->noncelen = (noncelen > 13) ? 13 : noncelen; in ccm_add_nonce() 25 if ((15 - ccm->noncelen) > ccm->L) { in ccm_add_nonce() 26 ccm->L = 15 - ccm->noncelen; in ccm_add_nonce() 28 if (ccm->L > 8) { in ccm_add_nonce() 33 if ((ccm->noncelen + ccm->L) > 15) { in ccm_add_nonce() 34 ccm->noncelen = 15 - ccm->L; in ccm_add_nonce() 39 ccm->PAD[x++] = (unsigned char)(((ccm->aadlen > 0) ? (1<<6) : 0) | in ccm_add_nonce() 40 (((ccm->taglen - 2)>>1)<<3) | in ccm_add_nonce() [all …]
|
| H A D | ccm_process.c | 16 int ccm_process(ccm_state *ccm, in ccm_process() argument 25 LTC_ARGCHK(ccm != NULL); in ccm_process() 28 if (ccm->aadlen != ccm->current_aadlen) { in ccm_process() 33 if (ccm->ptlen < ccm->current_ptlen + ptlen) { in ccm_process() 36 ccm->current_ptlen += ptlen; in ccm_process() 45 if (ccm->CTRlen == 16) { in ccm_process() 46 for (z = 15; z > 15-ccm->L; z--) { in ccm_process() 47 ccm->ctr[z] = (ccm->ctr[z] + 1) & 255; in ccm_process() 48 if (ccm->ctr[z]) break; in ccm_process() 50 …if ((err = cipher_descriptor[ccm->cipher]->ecb_encrypt(ccm->ctr, ccm->CTRPAD, &ccm->K)) != CRYPT_O… in ccm_process() [all …]
|
| H A D | ccm_add_aad.c | 14 int ccm_add_aad(ccm_state *ccm, in ccm_add_aad() argument 20 LTC_ARGCHK(ccm != NULL); in ccm_add_aad() 23 if (ccm->aadlen < ccm->current_aadlen + adatalen) { in ccm_add_aad() 26 ccm->current_aadlen += adatalen; in ccm_add_aad() 30 if (ccm->x == 16) { in ccm_add_aad() 32 …if ((err = cipher_descriptor[ccm->cipher]->ecb_encrypt(ccm->PAD, ccm->PAD, &ccm->K)) != CRYPT_OK) { in ccm_add_aad() 35 ccm->x = 0; in ccm_add_aad() 37 ccm->PAD[ccm->x++] ^= adata[y]; in ccm_add_aad() 41 if (ccm->aadlen == ccm->current_aadlen) { in ccm_add_aad() 42 if (ccm->x != 0) { in ccm_add_aad() [all …]
|
| H A D | ccm_done.c | 14 int ccm_done(ccm_state *ccm, in ccm_done() argument 20 LTC_ARGCHK(ccm != NULL); in ccm_done() 23 if (ccm->ptlen != ccm->current_ptlen) { in ccm_done() 30 if (ccm->x != 0) { in ccm_done() 31 …if ((err = cipher_descriptor[ccm->cipher]->ecb_encrypt(ccm->PAD, ccm->PAD, &ccm->K)) != CRYPT_OK) { in ccm_done() 37 for (y = 15; y > 15 - ccm->L; y--) { in ccm_done() 38 ccm->ctr[y] = 0x00; in ccm_done() 40 …if ((err = cipher_descriptor[ccm->cipher]->ecb_encrypt(ccm->ctr, ccm->CTRPAD, &ccm->K)) != CRYPT_O… in ccm_done() 44 cipher_descriptor[ccm->cipher]->done(&ccm->K); in ccm_done() 48 tag[x] = ccm->PAD[x] ^ ccm->CTRPAD[x]; in ccm_done()
|
| H A D | ccm_reset.c | 12 int ccm_reset(ccm_state *ccm) in ccm_reset() argument 14 LTC_ARGCHK(ccm != NULL); in ccm_reset() 15 zeromem(ccm->PAD, sizeof(ccm->PAD)); in ccm_reset() 16 zeromem(ccm->ctr, sizeof(ccm->ctr)); in ccm_reset() 17 zeromem(ccm->CTRPAD, sizeof(ccm->CTRPAD)); in ccm_reset() 18 ccm->CTRlen = 0; in ccm_reset() 19 ccm->current_ptlen = 0; in ccm_reset() 20 ccm->current_aadlen = 0; in ccm_reset()
|
| H A D | ccm_init.c | 19 int ccm_init(ccm_state *ccm, int cipher, in ccm_init() argument 24 LTC_ARGCHK(ccm != NULL); in ccm_init() 27 XMEMSET(ccm, 0, sizeof(ccm_state)); in ccm_init() 41 ccm->taglen = taglen; in ccm_init() 44 if ((err = cipher_descriptor[cipher]->setup(key, keylen, 0, &ccm->K)) != CRYPT_OK) { in ccm_init() 47 ccm->cipher = cipher; in ccm_init() 50 ccm->ptlen = ptlen; in ccm_init() 51 ccm->L = 0; in ccm_init() 53 ++ccm->L; in ccm_init() 56 if (ccm->L <= 1) { in ccm_init() [all …]
|
| H A D | ccm_test.c | 112 ccm_state ccm; in ccm_test() 154 …if ((err = ccm_init(&ccm, idx, tests[x].key, 16, tests[x].ptlen, tests[x].taglen, tests[x].headerl… in ccm_test() 157 if ((err = ccm_add_nonce(&ccm, tests[x].nonce, tests[x].noncelen)) != CRYPT_OK) { in ccm_test() 160 if ((err = ccm_add_aad(&ccm, tests[x].header, tests[x].headerlen)) != CRYPT_OK) { in ccm_test() 163 …if ((err = ccm_process(&ccm, (unsigned char*)tests[x].pt, tests[x].ptlen, buf, CCM_ENCRYPT)) != CR… in ccm_test() 166 if ((err = ccm_done(&ccm, tag, &taglen)) != CRYPT_OK) { in ccm_test() 192 …if ((err = ccm_init(&ccm, idx, tests[x].key, 16, tests[x].ptlen, tests[x].taglen, tests[x].headerl… in ccm_test() 195 if ((err = ccm_add_nonce(&ccm, tests[x].nonce, tests[x].noncelen)) != CRYPT_OK) { in ccm_test() 198 if ((err = ccm_add_aad(&ccm, tests[x].header, tests[x].headerlen)) != CRYPT_OK) { in ccm_test() 201 if ((err = ccm_process(&ccm, buf2, tests[x].ptlen, buf, CCM_DECRYPT)) != CRYPT_OK) { in ccm_test() [all …]
|
| /optee_os/core/lib/libtomcrypt/ |
| H A D | ccm.c | 71 struct tee_ccm_state *ccm = to_tee_ccm_state(aectx); in crypto_aes_ccm_init() local 77 memset(&ccm->ctx, 0, sizeof(ccm->ctx)); in crypto_aes_ccm_init() 78 ccm->tag_len = tag_len; in crypto_aes_ccm_init() 97 ltc_res = ccm_init(&ccm->ctx, ltc_cipherindex, key, key_len, in crypto_aes_ccm_init() 103 ltc_res = ccm_add_nonce(&ccm->ctx, nonce, nonce_len); in crypto_aes_ccm_init() 113 struct tee_ccm_state *ccm = to_tee_ccm_state(aectx); in crypto_aes_ccm_update_aad() local 117 ltc_res = ccm_add_aad(&ccm->ctx, data, len); in crypto_aes_ccm_update_aad() 131 struct tee_ccm_state *ccm = to_tee_ccm_state(aectx); in crypto_aes_ccm_update_payload() local 144 ltc_res = ccm_process(&ccm->ctx, pt, len, ct, dir); in crypto_aes_ccm_update_payload() 158 struct tee_ccm_state *ccm = to_tee_ccm_state(aectx); in crypto_aes_ccm_enc_final() local [all …]
|
| H A D | sub.mk | 67 srcs-$(_CFG_CORE_LTC_CCM) += ccm.c 68 srcs-$(_CFG_CORE_LTC_CCM) += src/encauth/ccm/ccm_init.c 69 srcs-$(_CFG_CORE_LTC_CCM) += src/encauth/ccm/ccm_add_nonce.c 70 srcs-$(_CFG_CORE_LTC_CCM) += src/encauth/ccm/ccm_add_aad.c 71 srcs-$(_CFG_CORE_LTC_CCM) += src/encauth/ccm/ccm_process.c 72 srcs-$(_CFG_CORE_LTC_CCM) += src/encauth/ccm/ccm_done.c 73 srcs-$(_CFG_CORE_LTC_CCM) += src/encauth/ccm/ccm_reset.c
|
| /optee_os/lib/libmbedtls/mbedtls/library/ |
| H A D | psa_crypto_aead.c | 56 mbedtls_ccm_init(&operation->ctx.ccm); in psa_aead_setup() 58 mbedtls_ccm_setkey(&operation->ctx.ccm, cipher_id, in psa_aead_setup() 148 mbedtls_ccm_encrypt_and_tag(&operation.ctx.ccm, in mbedtls_psa_aead_encrypt() 259 mbedtls_ccm_auth_decrypt(&operation.ctx.ccm, in mbedtls_psa_aead_decrypt() 382 mbedtls_ccm_starts(&operation->ctx.ccm, in mbedtls_psa_aead_set_nonce() 428 mbedtls_ccm_set_lengths(&operation->ctx.ccm, in mbedtls_psa_aead_set_lengths() 460 mbedtls_ccm_update_ad(&operation->ctx.ccm, input, input_length)); in mbedtls_psa_aead_update_ad() 513 mbedtls_ccm_update(&operation->ctx.ccm, in mbedtls_psa_aead_update() 582 mbedtls_ccm_finish(&operation->ctx.ccm, in mbedtls_psa_aead_finish() 629 mbedtls_ccm_free(&operation->ctx.ccm); in mbedtls_psa_aead_abort()
|
| /optee_os/core/lib/libtomcrypt/src/headers/ |
| H A D | tomcrypt_mac.h | 430 int ccm_init(ccm_state *ccm, int cipher, 433 int ccm_reset(ccm_state *ccm); 435 int ccm_add_nonce(ccm_state *ccm, 438 int ccm_add_aad(ccm_state *ccm, 441 int ccm_process(ccm_state *ccm, 446 int ccm_done(ccm_state *ccm,
|
| /optee_os/lib/libmbedtls/mbedtls/include/psa/ |
| H A D | crypto_builtin_composites.h | 90 mbedtls_ccm_context MBEDTLS_PRIVATE(ccm);
|
| /optee_os/lib/libmbedtls/ |
| H A D | sub.mk | 18 SRCS_CRYPTO += ccm.c
|