icepole128v2/ref/icepole.c
void processDataBlockRev(
	ICESTATE S, 
	const unsigned char * source, 
	unsigned char ** dest,
	unsigned long long blocklen, 
	unsigned int frameBit
	)
{
	uint64_t q;
	uint64_t snew;
	uint64_t padding;
	uint64_t bitmask;
	unsigned int qlen; 
	unsigned int i = 0;
	assert(blocklen <= ICEPOLEDATABLOCKLEN);
    
	do {
		qlen = (blocklen < 8 ? (unsigned int) blocklen : 8); 
		q = load64(source, qlen);
		snew = S[i%4][i/4] ^ q;
		bitmask = (qlen==8 ? 0 : 1ULL<< 8*qlen) - 1ULL;
		snew = snew & bitmask;
		if (dest) {
			store64(*dest, snew, qlen);
			*dest += qlen;
		}        
		padding = qlen < 8 ? ((uint64_t)frameBit | 0x02ULL) << (8*qlen) : 0;
		S[i%4][i/4] ^= snew ^ padding;
		++i;
		source += qlen;
		blocklen -= qlen;
	} while (qlen == 8);
}
/* Reads 'blocklen' bytes of encrypted data (ciphertext, encrypted smn)
   from 'source' and absorbs it into the ICEPOLE state S. 
   If dest is not NULL, then it also produces corresponding plaintext
   block and writes it at 'dest' moving the pointer forward by 'blocklen'. 
   'frameBit' becomes part of the block padding.  */
Reads 'blocklen' bytes of encrypted data (ciphertext, encrypted smn)
from 'source' and absorbs it into the ICEPOLE state S.
If dest is not NULL, then it also produces corresponding plaintext
block and writes it at 'dest' moving the pointer forward by 'blocklen'.
'frameBit' becomes part of the block padding.
Reads ' blocklen ' bytes of encrypted data ( ciphertext encrypted smn ) from ' source ' and absorbs it into the ICEPOLE state S . If dest is not NULL then it also produces corresponding plaintext block and writes it at ' dest ' moving the pointer forward by ' blocklen ' . ' frameBit ' becomes part of the block padding .
void processDataBlockRev(
	ICESTATE S, 
	const unsigned char * source, 
	unsigned char ** dest,
	unsigned long long blocklen, 
	unsigned int frameBit
	)
{
	uint64_t q;
	uint64_t snew;
	uint64_t padding;
	uint64_t bitmask;
	unsigned int qlen; 
	unsigned int i = 0;
	assert(blocklen <= ICEPOLEDATABLOCKLEN);
	do {
		qlen = (blocklen < 8 ? (unsigned int) blocklen : 8); 
		q = load64(source, qlen);
		snew = S[i%4][i/4] ^ q;
		bitmask = (qlen==8 ? 0 : 1ULL<< 8*qlen) - 1ULL;
		snew = snew & bitmask;
		if (dest) {
			store64(*dest, snew, qlen);
			*dest += qlen;
		}        
		padding = qlen < 8 ? ((uint64_t)frameBit | 0x02ULL) << (8*qlen) : 0;
		S[i%4][i/4] ^= snew ^ padding;
		++i;
		source += qlen;
		blocklen -= qlen;
	} while (qlen == 8);
}
void processDataBlockRev ( ICESTATE S , const unsigned char * source , unsigned char * * dest , unsigned long long blocklen , unsigned int frameBit ) { uint64_t q ; uint64_t snew ; uint64_t padding ; uint64_t bitmask ; unsigned int qlen ; unsigned int i = 0 ; assert ( blocklen <= ICEPOLEDATABLOCKLEN ) ; do { qlen = ( blocklen < 8 ? ( unsigned int ) blocklen : 8 ) ; q = load64 ( source , qlen ) ; snew = S [ i % 4 ] [ i / 4 ] ^ q ; bitmask = ( qlen == 8 ? 0 : 1ULL << 8 * qlen ) - 1ULL ; snew = snew & bitmask ; if ( dest ) { store64 ( * dest , snew , qlen ) ; * dest += qlen ; } padding = qlen < 8 ? ( ( uint64_t ) frameBit | 0x02ULL ) << ( 8 * qlen ) : 0 ; S [ i % 4 ] [ i / 4 ] ^= snew ^ padding ; ++ i ; source += qlen ; blocklen -= qlen ; } while ( qlen == 8 ) ; }
Reads 'blocklen' bytes of encrypted data (ciphertext, encrypted smn)
from 'source' and absorbs it into the ICEPOLE state S.
If dest is not NULL, then it also produces corresponding plaintext
block and writes it at 'dest' moving the pointer forward by 'blocklen'.
Reads ' blocklen ' bytes of encrypted data ( ciphertext encrypted smn ) from ' source ' and absorbs it into the ICEPOLE state S . If dest is not NULL then it also produces corresponding plaintext block and writes it at ' dest ' moving the pointer forward by ' blocklen ' .