Lines Matching refs:omac
22 Process data through OMAC
23 @param omac The OMAC state
24 @param in The input data to send through OMAC
28 int omac_process(omac_state *omac, const unsigned char *in, unsigned long inlen)
33 LTC_ARGCHK(omac != NULL);
35 if ((err = cipher_is_valid(omac->cipher_idx)) != CRYPT_OK) {
39 if ((omac->buflen > (int)sizeof(omac->block)) || (omac->buflen < 0) ||
40 (omac->blklen > (int)sizeof(omac->block)) || (omac->buflen > omac->blklen)) {
45 if (omac->buflen == 0 && inlen > 16) {
49 *((LTC_FAST_TYPE*)(&omac->prev[y])) ^= *((LTC_FAST_TYPE*)(&in[y]));
52 if ((err = cipher_descriptor[omac->cipher_idx].ecb_encrypt(omac->prev, omac->prev, &omac->key)) != CRYPT_OK) {
62 if (omac->buflen == omac->blklen) {
63 for (x = 0; x < (unsigned long)omac->blklen; x++) {
64 omac->block[x] ^= omac->prev[x];
66 if ((err = cipher_descriptor[omac->cipher_idx].ecb_encrypt(omac->block, omac->prev, &omac->key)) != CRYPT_OK) {
69 omac->buflen = 0;
73 n = MIN(inlen, (unsigned long)(omac->blklen - omac->buflen));
74 XMEMCPY(omac->block + omac->buflen, in, n);
75 omac->buflen += n;
86 /* $Source: /cvs/libtom/libtomcrypt/src/mac/omac/omac_process.c,v $ */