| /optee_os/core/lib/libtomcrypt/src/mac/omac/ |
| H A D | omac_done.c | 19 int omac_done(omac_state *omac, unsigned char *out, unsigned long *outlen) in omac_done() argument 24 LTC_ARGCHK(omac != NULL); in omac_done() 27 if ((err = cipher_is_valid(omac->cipher_idx)) != CRYPT_OK) { in omac_done() 31 if ((omac->buflen > (int)sizeof(omac->block)) || (omac->buflen < 0) || in omac_done() 32 (omac->blklen > (int)sizeof(omac->block)) || (omac->buflen > omac->blklen)) { in omac_done() 37 if (omac->buflen != omac->blklen) { in omac_done() 39 omac->block[omac->buflen++] = 0x80; in omac_done() 42 while (omac->buflen < omac->blklen) { in omac_done() 43 omac->block[omac->buflen++] = 0x00; in omac_done() 51 for (x = 0; x < (unsigned)omac->blklen; x++) { in omac_done() [all …]
|
| H A D | omac_process.c | 20 int omac_process(omac_state *omac, const unsigned char *in, unsigned long inlen) in omac_process() argument 25 LTC_ARGCHK(omac != NULL); in omac_process() 27 if ((err = cipher_is_valid(omac->cipher_idx)) != CRYPT_OK) { in omac_process() 31 if ((omac->buflen > (int)sizeof(omac->block)) || (omac->buflen < 0) || in omac_process() 32 (omac->blklen > (int)sizeof(omac->block)) || (omac->buflen > omac->blklen)) { in omac_process() 38 unsigned long blklen = cipher_descriptor[omac->cipher_idx]->block_length; in omac_process() 40 if (omac->buflen == 0 && inlen > blklen) { in omac_process() 44 *(LTC_FAST_TYPE_PTR_CAST(&omac->prev[y])) ^= *(LTC_FAST_TYPE_PTR_CAST(&in[y])); in omac_process() 47 …if ((err = cipher_descriptor[omac->cipher_idx]->ecb_encrypt(omac->prev, omac->prev, &omac->key)) !… in omac_process() 58 if (omac->buflen == omac->blklen) { in omac_process() [all …]
|
| H A D | omac_init.c | 21 int omac_init(omac_state *omac, int cipher, const unsigned char *key, unsigned long keylen) in omac_init() argument 25 LTC_ARGCHK(omac != NULL); in omac_init() 50 if ((err = cipher_descriptor[cipher]->setup(key, keylen, 0, &omac->key)) != CRYPT_OK) { in omac_init() 57 zeromem(omac->Lu[0], cipher_descriptor[cipher]->block_length); in omac_init() 58 …if ((err = cipher_descriptor[cipher]->ecb_encrypt(omac->Lu[0], omac->Lu[0], &omac->key)) != CRYPT_… in omac_init() 65 msb = omac->Lu[x][0] >> 7; in omac_init() 69 omac->Lu[x][y] = ((omac->Lu[x][y] << 1) | (omac->Lu[x][y+1] >> 7)) & 255; in omac_init() 71 omac->Lu[x][len - 1] = ((omac->Lu[x][len - 1] << 1) ^ (msb ? mask : 0)) & 255; in omac_init() 75 XMEMCPY(omac->Lu[1], omac->Lu[0], sizeof(omac->Lu[0])); in omac_init() 80 omac->cipher_idx = cipher; in omac_init() [all …]
|
| H A D | omac_memory.c | 29 omac_state *omac; in omac_memory() local 47 omac = XMALLOC(sizeof(omac_state)); in omac_memory() 48 if (omac == NULL) { in omac_memory() 53 if ((err = omac_init(omac, cipher, key, keylen)) != CRYPT_OK) { in omac_memory() 56 if ((err = omac_process(omac, in, inlen)) != CRYPT_OK) { in omac_memory() 59 if ((err = omac_done(omac, out, outlen)) != CRYPT_OK) { in omac_memory() 66 zeromem(omac, sizeof(omac_state)); in omac_memory() 69 XFREE(omac); in omac_memory()
|
| H A D | omac_memory_multi.c | 31 omac_state *omac; in omac_memory_multi() local 42 omac = XMALLOC(sizeof(omac_state)); in omac_memory_multi() 43 if (omac == NULL) { in omac_memory_multi() 48 if ((err = omac_init(omac, cipher, key, keylen)) != CRYPT_OK) { in omac_memory_multi() 56 if ((err = omac_process(omac, curptr, curlen)) != CRYPT_OK) { in omac_memory_multi() 66 if ((err = omac_done(omac, out, outlen)) != CRYPT_OK) { in omac_memory_multi() 71 zeromem(omac, sizeof(omac_state)); in omac_memory_multi() 73 XFREE(omac); in omac_memory_multi()
|
| H A D | omac_file.c | 38 omac_state omac; in omac_file() 51 if ((err = omac_init(&omac, cipher, key, keylen)) != CRYPT_OK) { in omac_file() 63 if ((err = omac_process(&omac, buf, (unsigned long)x)) != CRYPT_OK) { in omac_file() 74 err = omac_done(&omac, out, outlen); in omac_file() 80 zeromem(&omac, sizeof(omac_state)); in omac_file()
|
| /optee_os/core/lib/libtomcrypt/src/encauth/eax/ |
| H A D | eax_init.c | 31 omac_state *omac; in eax_init() local 49 omac = XMALLOC(sizeof(*omac)); in eax_init() 51 if (buf == NULL || omac == NULL) { in eax_init() 55 if (omac != NULL) { in eax_init() 56 XFREE(omac); in eax_init() 63 if ((err = omac_init(omac, cipher, key, keylen)) != CRYPT_OK) { in eax_init() 68 if ((err = omac_process(omac, buf, blklen)) != CRYPT_OK) { in eax_init() 72 if ((err = omac_process(omac, nonce, noncelen)) != CRYPT_OK) { in eax_init() 77 if ((err = omac_done(omac, eax->N, &len)) != CRYPT_OK) { in eax_init() 123 zeromem(omac, sizeof(*omac)); in eax_init() [all …]
|
| /optee_os/core/lib/libtomcrypt/src/headers/ |
| H A D | tomcrypt_mac.h | 41 int omac_init(omac_state *omac, int cipher, const unsigned char *key, unsigned long keylen); 42 int omac_process(omac_state *omac, const unsigned char *in, unsigned long inlen); 43 int omac_done(omac_state *omac, unsigned char *out, unsigned long *outlen);
|
| /optee_os/core/lib/libtomcrypt/ |
| H A D | sub.mk | 147 srcs-$(_CFG_CORE_LTC_CMAC) += src/mac/omac/omac_done.c 148 srcs-$(_CFG_CORE_LTC_CMAC) += src/mac/omac/omac_init.c 149 srcs-$(_CFG_CORE_LTC_CMAC) += src/mac/omac/omac_memory.c 150 srcs-$(_CFG_CORE_LTC_CMAC) += src/mac/omac/omac_memory_multi.c 151 srcs-$(_CFG_CORE_LTC_CMAC) += src/mac/omac/omac_process.c
|