Home
last modified time | relevance | path

Searched full:ccm (Results 1 – 25 of 54) sorted by relevance

123

/optee_os/core/lib/libtomcrypt/src/encauth/ccm/
H A Dccm_add_nonce.c8 Add nonce data to the CCM state
9 @param ccm The CCM state
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()
[all …]
H A Dccm_process.c8 Process plaintext/ciphertext through CCM
9 @param ccm The CCM state
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()
[all …]
H A Dccm_add_aad.c8 Add AAD to the CCM state
9 @param ccm The CCM state
10 @param adata The additional authentication data to add to the CCM state
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()
[all …]
H A Dccm_done.c8 Terminate a CCM stream
9 @param ccm The CCM state
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()
[all …]
H A Dccm_reset.c8 Reset a CCM state to as if you just called ccm_init(). This saves the initialization time.
9 @param ccm The CCM state to reset
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 Dccm_init.c8 Initialize a CCM state
9 @param ccm The CCM state to initialize
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()
[all …]
H A Dccm_test.c7 CCM support, process a block of memory, Tom St Denis
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()
171 … if (compare_testvector(buf, tests[x].ptlen, tests[x].ct, tests[x].ptlen, "CCM encrypt data", x)) { in ccm_test()
174 if (compare_testvector(tag, taglen, tests[x].tag, tests[x].taglen, "CCM encrypt tag", x)) { 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()
[all …]
/optee_os/core/lib/libtomcrypt/
H A Dccm.c22 ccm_state ctx; /* the ccm state as defined by LTC */
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()
[all …]
H A Dsub.mk67 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/include/mbedtls/
H A Dccm.h2 * \file ccm.h
4 * \brief This file provides an API for the CCM authenticated encryption
7 * CCM combines Counter mode encryption with CBC-MAC authentication
10 * Input to CCM includes the following elements:
17 * Definition of CCM:
19 * RFC 3610 "Counter with CBC-MAC (CCM)"
24 * Definition of CCM*:
66 * \brief The CCM context-type definition. The CCM context is passed
102 * \brief This function initializes the specified CCM context,
106 * \param ctx The CCM context to initialize. This must not be \c NULL.
[all …]
H A Dcipher.h123 MBEDTLS_CIPHER_AES_128_CCM, /**< AES cipher with 128-bit CCM mode. */
124 MBEDTLS_CIPHER_AES_192_CCM, /**< AES cipher with 192-bit CCM mode. */
125 MBEDTLS_CIPHER_AES_256_CCM, /**< AES cipher with 256-bit CCM mode. */
129 MBEDTLS_CIPHER_CAMELLIA_128_CCM, /**< Camellia cipher with 128-bit CCM mode. */
130 MBEDTLS_CIPHER_CAMELLIA_192_CCM, /**< Camellia cipher with 192-bit CCM mode. */
131 MBEDTLS_CIPHER_CAMELLIA_256_CCM, /**< Camellia cipher with 256-bit CCM mode. */
150 MBEDTLS_CIPHER_ARIA_128_CCM, /**< Aria cipher with 128-bit key and CCM mode. */
151 MBEDTLS_CIPHER_ARIA_192_CCM, /**< Aria cipher with 192-bit key and CCM mode. */
152 MBEDTLS_CIPHER_ARIA_256_CCM, /**< Aria cipher with 256-bit key and CCM mode. */
181 MBEDTLS_MODE_CCM, /**< The CCM cipher mode. */
[all …]
/optee_os/lib/libmbedtls/mbedtls/library/
H A Dpsa_crypto_aead.c20 #include "mbedtls/ccm.h"
49 /* CCM allows the following tag lengths: 4, 6, 8, 10, 12, 14, 16. in psa_aead_setup()
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()
210 * CCM and GCM. */
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()
[all …]
H A Dssl_ciphersuites.c33 * 3. By cipher mode when relevant GCM > CCM > CBC > CCM_8
301 { MBEDTLS_TLS1_3_AES_128_CCM_SHA256, "TLS1-3-AES-128-CCM-SHA256",
306 { MBEDTLS_TLS1_3_AES_128_CCM_8_SHA256, "TLS1-3-AES-128-CCM-8-SHA256",
428 { MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_CCM, "TLS-ECDHE-ECDSA-WITH-AES-256-CCM",
432 { MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_CCM_8, "TLS-ECDHE-ECDSA-WITH-AES-256-CCM-8",
436 { MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CCM, "TLS-ECDHE-ECDSA-WITH-AES-128-CCM",
440 { MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8, "TLS-ECDHE-ECDSA-WITH-AES-128-CCM-8",
628 { MBEDTLS_TLS_DHE_RSA_WITH_AES_256_CCM, "TLS-DHE-RSA-WITH-AES-256-CCM",
632 { MBEDTLS_TLS_DHE_RSA_WITH_AES_256_CCM_8, "TLS-DHE-RSA-WITH-AES-256-CCM-8",
636 { MBEDTLS_TLS_DHE_RSA_WITH_AES_128_CCM, "TLS-DHE-RSA-WITH-AES-128-CCM",
[all …]
H A Dcipher_wrap.c50 #include "mbedtls/ccm.h"
149 /* shared by all CCM ciphers */
722 "AES-128-CCM",
734 "AES-192-CCM",
745 "AES-256-CCM",
759 "AES-128-CCM*-NO-TAG",
771 "AES-192-CCM*-NO-TAG",
782 "AES-256-CCM*-NO-TAG",
1152 "CAMELLIA-128-CCM",
1163 "CAMELLIA-192-CCM",
[all …]
H A Dccm.c2 * NIST SP800-38C compliant CCM implementation
9 * Definition of CCM:
11 * RFC 3610 "Counter with CBC-MAC (CCM)"
21 #include "mbedtls/ccm.h"
172 /* CCM expects non-empty tag. in ccm_calculate_first_block_if_ready()
173 * CCM* allows empty tag. For CCM* without tag, the tag calculation is skipped. in ccm_calculate_first_block_if_ready()
271 * Also, loosen the requirements to enable support for CCM* (IEEE 802.15.4). in mbedtls_ccm_set_lengths()
699 mbedtls_printf(" CCM: setup failed"); in mbedtls_ccm_self_test()
707 mbedtls_printf(" CCM-AES #%u: ", (unsigned int) i + 1); in mbedtls_ccm_self_test()
H A Dblock_cipher_internal.h5 * for use by the GCM and CCM modules.
/optee_os/core/drivers/crypto/caam/ae/
H A Dlocal.h45 * @initial_ctx: Initial CCM context
103 * Initialization of the AES CCM operation
110 * Finalize the AES CCM operation
H A Dcaam_ae_ccm.c5 * Implementation of Cipher CCM functions
42 * Initialize AES CCM operation context
/optee_os/core/lib/libtomcrypt/src/headers/
H A Dtomcrypt_mac.h430 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 Dcrypto_builtin_composites.h32 #include "mbedtls/ccm.h"
90 mbedtls_ccm_context MBEDTLS_PRIVATE(ccm);
/optee_os/core/drivers/crypto/caam/
H A Dcaam_key.c37 * forged to look like a CCM Black key, the import key will fail (because the
100 [CAAM_KEY_BLACK_CCM] = "Black CCM",
214 * CCM-black key must be a multiple of 8 bytes. The nonce and in caam_key_get_alloc_size()
325 opflag |= PROT_BLOB_INFO(CCM); in caam_key_operation_blob()
/optee_os/core/drivers/crypto/stm32/
H A Dstm32_cryp.c59 /* CRYP context swap GCM-CCM registers */
540 * but CCM RFC defines bytes to update in a BE array. in ccm_first_context()
571 * CCM need a specific restore_context phase for the init phase in do_from_init_to_phase()
775 * associated data (CCM or GCM).
868 * payload data (CCM or GCM).
1000 * @brief Get authentication tag for AES authenticated algorithms (CCM or GCM).
/optee_os/core/drivers/crypto/caam/include/
H A Dcaam_key.h18 CAAM_KEY_BLACK_CCM, /* Black key AES-CCM encrypted */
/optee_os/core/drivers/crypto/caam/blob/
H A Dcaam_dek.c71 * | Length of the payload | AES - 0x55 | CCM - 0x66 | in caam_dek_generate()
/optee_os/core/drivers/crypto/caam/acipher/
H A Dcaam_ecc.c319 caam_desc_add_word(desc, PK_KEYPAIR_GEN(ECC, CCM)); in do_gen_keypair()
555 caam_desc_add_word(desc, DSA_SIGN(ECC, MES_REP, CCM)); in do_sign()
573 caam_desc_add_word(desc, DSA_SIGN(ECC, HASHED, CCM)); in do_sign()
855 caam_desc_add_word(desc, SHARED_SECRET(ECC, CCM)); in do_shared_secret()

123