| /optee_os/core/lib/libtomcrypt/src/mac/pmac/ |
| H A D | pmac_done.c | 12 int pmac_done(pmac_state *pmac, unsigned char *out, unsigned long *outlen) in pmac_done() argument 16 LTC_ARGCHK(pmac != NULL); in pmac_done() 18 if ((err = cipher_is_valid(pmac->cipher_idx)) != CRYPT_OK) { in pmac_done() 22 if ((pmac->buflen > (int)sizeof(pmac->block)) || (pmac->buflen < 0) || in pmac_done() 23 (pmac->block_len > (int)sizeof(pmac->block)) || (pmac->buflen > pmac->block_len)) { in pmac_done() 30 if (pmac->buflen == pmac->block_len) { in pmac_done() 32 for (x = 0; x < pmac->block_len; x++) { in pmac_done() 33 pmac->checksum[x] ^= pmac->block[x] ^ pmac->Lr[x]; in pmac_done() 37 for (x = 0; x < pmac->buflen; x++) { in pmac_done() 38 pmac->checksum[x] ^= pmac->block[x]; in pmac_done() [all …]
|
| H A D | pmac_init.c | 38 int pmac_init(pmac_state *pmac, int cipher, const unsigned char *key, unsigned long keylen) in pmac_init() argument 43 LTC_ARGCHK(pmac != NULL); in pmac_init() 52 pmac->block_len = cipher_descriptor[cipher]->block_length; in pmac_init() 54 if (polys[poly].len == pmac->block_len) { in pmac_init() 61 if (polys[poly].len != pmac->block_len) { in pmac_init() 66 if (pmac->block_len % sizeof(LTC_FAST_TYPE)) { in pmac_init() 73 if ((err = cipher_descriptor[cipher]->setup(key, keylen, 0, &pmac->key)) != CRYPT_OK) { in pmac_init() 78 L = XMALLOC(pmac->block_len); in pmac_init() 84 zeromem(L, pmac->block_len); in pmac_init() 85 if ((err = cipher_descriptor[cipher]->ecb_encrypt(L, L, &pmac->key)) != CRYPT_OK) { in pmac_init() [all …]
|
| H A D | pmac_process.c | 20 int pmac_process(pmac_state *pmac, const unsigned char *in, unsigned long inlen) in pmac_process() argument 26 LTC_ARGCHK(pmac != NULL); in pmac_process() 28 if ((err = cipher_is_valid(pmac->cipher_idx)) != CRYPT_OK) { in pmac_process() 32 if ((pmac->buflen > (int)sizeof(pmac->block)) || (pmac->buflen < 0) || in pmac_process() 33 (pmac->block_len > (int)sizeof(pmac->block)) || (pmac->buflen > pmac->block_len)) { in pmac_process() 38 if (pmac->buflen == 0 && inlen > 16) { in pmac_process() 41 pmac_shift_xor(pmac); in pmac_process() 43 …YPE_PTR_CAST(&Z[y])) = *(LTC_FAST_TYPE_PTR_CAST(&in[y])) ^ *(LTC_FAST_TYPE_PTR_CAST(&pmac->Li[y])); in pmac_process() 45 … if ((err = cipher_descriptor[pmac->cipher_idx]->ecb_encrypt(Z, Z, &pmac->key)) != CRYPT_OK) { in pmac_process() 49 *(LTC_FAST_TYPE_PTR_CAST(&pmac->checksum[y])) ^= *(LTC_FAST_TYPE_PTR_CAST(&Z[y])); in pmac_process() [all …]
|
| H A D | pmac_shift_xor.c | 16 void pmac_shift_xor(pmac_state *pmac) in pmac_shift_xor() argument 19 y = pmac_ntz(pmac->block_index++); in pmac_shift_xor() 21 for (x = 0; x < pmac->block_len; x += sizeof(LTC_FAST_TYPE)) { in pmac_shift_xor() 22 *(LTC_FAST_TYPE_PTR_CAST((unsigned char *)pmac->Li + x)) ^= in pmac_shift_xor() 23 *(LTC_FAST_TYPE_PTR_CAST((unsigned char *)pmac->Ls[y] + x)); in pmac_shift_xor() 26 for (x = 0; x < pmac->block_len; x++) { in pmac_shift_xor() 27 pmac->Li[x] ^= pmac->Ls[y][x]; in pmac_shift_xor()
|
| H A D | pmac_memory.c | 29 pmac_state *pmac; in pmac_memory() local 37 pmac = XMALLOC(sizeof(pmac_state)); in pmac_memory() 38 if (pmac == NULL) { in pmac_memory() 42 if ((err = pmac_init(pmac, cipher, key, keylen)) != CRYPT_OK) { in pmac_memory() 45 if ((err = pmac_process(pmac, in, inlen)) != CRYPT_OK) { in pmac_memory() 48 if ((err = pmac_done(pmac, out, outlen)) != CRYPT_OK) { in pmac_memory() 55 zeromem(pmac, sizeof(pmac_state)); in pmac_memory() 58 XFREE(pmac); in pmac_memory()
|
| H A D | pmac_memory_multi.c | 31 pmac_state *pmac; in pmac_memory_multi() local 42 pmac = XMALLOC(sizeof(pmac_state)); in pmac_memory_multi() 43 if (pmac == NULL) { in pmac_memory_multi() 47 if ((err = pmac_init(pmac, cipher, key, keylen)) != CRYPT_OK) { in pmac_memory_multi() 55 if ((err = pmac_process(pmac, curptr, curlen)) != CRYPT_OK) { in pmac_memory_multi() 65 if ((err = pmac_done(pmac, out, outlen)) != CRYPT_OK) { in pmac_memory_multi() 70 zeromem(pmac, sizeof(pmac_state)); in pmac_memory_multi() 72 XFREE(pmac); in pmac_memory_multi()
|
| H A D | pmac_file.c | 38 pmac_state pmac; in pmac_file() 52 if ((err = pmac_init(&pmac, cipher, key, keylen)) != CRYPT_OK) { in pmac_file() 64 if ((err = pmac_process(&pmac, buf, (unsigned long)x)) != CRYPT_OK) { in pmac_file() 75 err = pmac_done(&pmac, out, outlen); in pmac_file() 81 zeromem(&pmac, sizeof(pmac_state)); in pmac_file()
|
| /optee_os/core/lib/libtomcrypt/src/headers/ |
| H A D | tomcrypt_mac.h | 76 int pmac_init(pmac_state *pmac, int cipher, const unsigned char *key, unsigned long keylen); 77 int pmac_process(pmac_state *pmac, const unsigned char *in, unsigned long inlen); 78 int pmac_done(pmac_state *pmac, unsigned char *out, unsigned long *outlen); 100 void pmac_shift_xor(pmac_state *pmac);
|