/optee_os-3.20.0/core/lib/libtomcrypt/src/encauth/ccm/ |
A D | ccm_add_nonce.c | 25 if ((15 - ccm->noncelen) > ccm->L) { in ccm_add_nonce() 26 ccm->L = 15 - ccm->noncelen; 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() 66 …if ((err = cipher_descriptor[ccm->cipher]->ecb_encrypt(ccm->PAD, ccm->PAD, &ccm->K)) != CRYPT_OK) { in ccm_add_nonce() 75 ccm->PAD[ccm->x++] ^= (ccm->aadlen>>8) & 255; in ccm_add_nonce() 76 ccm->PAD[ccm->x++] ^= ccm->aadlen & 255; in ccm_add_nonce() 80 ccm->PAD[ccm->x++] ^= (ccm->aadlen>>24) & 255; in ccm_add_nonce() 81 ccm->PAD[ccm->x++] ^= (ccm->aadlen>>16) & 255; in ccm_add_nonce() 82 ccm->PAD[ccm->x++] ^= (ccm->aadlen>>8) & 255; in ccm_add_nonce() [all …]
|
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() 47 ccm->ctr[z] = (ccm->ctr[z] + 1) & 255; in ccm_process() 50 …if ((err = cipher_descriptor[ccm->cipher]->ecb_encrypt(ccm->ctr, ccm->CTRPAD, &ccm->K)) != CRYPT_O… in ccm_process() 59 ct[y] = b ^ ccm->CTRPAD[ccm->CTRlen++]; in ccm_process() 61 b = ct[y] ^ ccm->CTRPAD[ccm->CTRlen++]; in ccm_process() 66 …if ((err = cipher_descriptor[ccm->cipher]->ecb_encrypt(ccm->PAD, ccm->PAD, &ccm->K)) != CRYPT_OK) { in ccm_process() 69 ccm->x = 0; in ccm_process() [all …]
|
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() 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() 43 …if ((err = cipher_descriptor[ccm->cipher]->ecb_encrypt(ccm->PAD, ccm->PAD, &ccm->K)) != CRYPT_OK) { in ccm_add_aad() [all …]
|
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()
|
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()
|
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() 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() 57 ccm->L = 2; in ccm_init() [all …]
|
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-3.20.0/core/lib/libtomcrypt/ |
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() 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() 168 if (*dst_tag_len < ccm->tag_len) { in crypto_aes_ccm_enc_final() 169 *dst_tag_len = ccm->tag_len; in crypto_aes_ccm_enc_final() 172 *dst_tag_len = ccm->tag_len; in crypto_aes_ccm_enc_final() [all …]
|
A D | sub.mk | 123 srcs-$(_CFG_CORE_LTC_CCM) += ccm.c
|
/optee_os-3.20.0/core/lib/libtomcrypt/src/encauth/ |
A D | sub.mk | 1 subdirs-$(_CFG_CORE_LTC_CCM) += ccm
|
/optee_os-3.20.0/core/lib/libtomcrypt/src/headers/ |
A D | tomcrypt_mac.h | 428 int ccm_init(ccm_state *ccm, int cipher, 431 int ccm_reset(ccm_state *ccm); 433 int ccm_add_nonce(ccm_state *ccm, 436 int ccm_add_aad(ccm_state *ccm, 439 int ccm_process(ccm_state *ccm, 444 int ccm_done(ccm_state *ccm,
|
/optee_os-3.20.0/lib/libmbedtls/ |
A D | sub.mk | 17 SRCS_CRYPTO += ccm.c
|