Fix all warnings from -Wcast-align
This commit is contained in:
@@ -44,11 +44,11 @@ int f9_process(f9_state *f9, const unsigned char *in, unsigned long inlen)
|
||||
if (f9->buflen == 0) {
|
||||
while (inlen >= (unsigned long)f9->blocksize) {
|
||||
for (x = 0; x < f9->blocksize; x += sizeof(LTC_FAST_TYPE)) {
|
||||
*((LTC_FAST_TYPE*)&(f9->IV[x])) ^= *((LTC_FAST_TYPE*)&(in[x]));
|
||||
*(LTC_FAST_TYPE_PTR_CAST(&(f9->IV[x]))) ^= *(LTC_FAST_TYPE_PTR_CAST(&(in[x])));
|
||||
}
|
||||
cipher_descriptor[f9->cipher].ecb_encrypt(f9->IV, f9->IV, &f9->key);
|
||||
for (x = 0; x < f9->blocksize; x += sizeof(LTC_FAST_TYPE)) {
|
||||
*((LTC_FAST_TYPE*)&(f9->ACC[x])) ^= *((LTC_FAST_TYPE*)&(f9->IV[x]));
|
||||
*(LTC_FAST_TYPE_PTR_CAST(&(f9->ACC[x]))) ^= *(LTC_FAST_TYPE_PTR_CAST(&(f9->IV[x])));
|
||||
}
|
||||
in += f9->blocksize;
|
||||
inlen -= f9->blocksize;
|
||||
|
||||
@@ -49,7 +49,7 @@ int omac_process(omac_state *omac, const unsigned char *in, unsigned long inlen)
|
||||
unsigned long y;
|
||||
for (x = 0; x < (inlen - blklen); x += blklen) {
|
||||
for (y = 0; y < blklen; y += sizeof(LTC_FAST_TYPE)) {
|
||||
*((LTC_FAST_TYPE*)(&omac->prev[y])) ^= *((LTC_FAST_TYPE*)(&in[y]));
|
||||
*(LTC_FAST_TYPE_PTR_CAST(&omac->prev[y])) ^= *(LTC_FAST_TYPE_PTR_CAST(&in[y]));
|
||||
}
|
||||
in += blklen;
|
||||
if ((err = cipher_descriptor[omac->cipher_idx].ecb_encrypt(omac->prev, omac->prev, &omac->key)) != CRYPT_OK) {
|
||||
|
||||
@@ -114,7 +114,7 @@ int pelican_process(pelican_state *pelmac, const unsigned char *in, unsigned lon
|
||||
while (inlen & ~15) {
|
||||
int x;
|
||||
for (x = 0; x < 16; x += sizeof(LTC_FAST_TYPE)) {
|
||||
*((LTC_FAST_TYPE*)((unsigned char *)pelmac->state + x)) ^= *((LTC_FAST_TYPE*)((unsigned char *)in + x));
|
||||
*(LTC_FAST_TYPE_PTR_CAST((unsigned char *)pelmac->state + x)) ^= *(LTC_FAST_TYPE_PTR_CAST((unsigned char *)in + x));
|
||||
}
|
||||
four_rounds(pelmac);
|
||||
in += 16;
|
||||
|
||||
@@ -48,13 +48,13 @@ int pmac_process(pmac_state *pmac, const unsigned char *in, unsigned long inlen)
|
||||
for (x = 0; x < (inlen - 16); x += 16) {
|
||||
pmac_shift_xor(pmac);
|
||||
for (y = 0; y < 16; y += sizeof(LTC_FAST_TYPE)) {
|
||||
*((LTC_FAST_TYPE*)(&Z[y])) = *((LTC_FAST_TYPE*)(&in[y])) ^ *((LTC_FAST_TYPE*)(&pmac->Li[y]));
|
||||
*(LTC_FAST_TYPE_PTR_CAST(&Z[y])) = *(LTC_FAST_TYPE_PTR_CAST(&in[y])) ^ *(LTC_FAST_TYPE_PTR_CAST(&pmac->Li[y]));
|
||||
}
|
||||
if ((err = cipher_descriptor[pmac->cipher_idx].ecb_encrypt(Z, Z, &pmac->key)) != CRYPT_OK) {
|
||||
return err;
|
||||
}
|
||||
for (y = 0; y < 16; y += sizeof(LTC_FAST_TYPE)) {
|
||||
*((LTC_FAST_TYPE*)(&pmac->checksum[y])) ^= *((LTC_FAST_TYPE*)(&Z[y]));
|
||||
*(LTC_FAST_TYPE_PTR_CAST(&pmac->checksum[y])) ^= *(LTC_FAST_TYPE_PTR_CAST(&Z[y]));
|
||||
}
|
||||
in += 16;
|
||||
}
|
||||
|
||||
@@ -27,8 +27,8 @@ void pmac_shift_xor(pmac_state *pmac)
|
||||
y = pmac_ntz(pmac->block_index++);
|
||||
#ifdef LTC_FAST
|
||||
for (x = 0; x < pmac->block_len; x += sizeof(LTC_FAST_TYPE)) {
|
||||
*((LTC_FAST_TYPE*)((unsigned char *)pmac->Li + x)) ^=
|
||||
*((LTC_FAST_TYPE*)((unsigned char *)pmac->Ls[y] + x));
|
||||
*(LTC_FAST_TYPE_PTR_CAST((unsigned char *)pmac->Li + x)) ^=
|
||||
*(LTC_FAST_TYPE_PTR_CAST((unsigned char *)pmac->Ls[y] + x));
|
||||
}
|
||||
#else
|
||||
for (x = 0; x < pmac->block_len; x++) {
|
||||
|
||||
@@ -47,7 +47,7 @@ int xcbc_process(xcbc_state *xcbc, const unsigned char *in, unsigned long inlen)
|
||||
if (xcbc->buflen == 0) {
|
||||
while (inlen > (unsigned long)xcbc->blocksize) {
|
||||
for (x = 0; x < xcbc->blocksize; x += sizeof(LTC_FAST_TYPE)) {
|
||||
*((LTC_FAST_TYPE*)&(xcbc->IV[x])) ^= *((LTC_FAST_TYPE*)&(in[x]));
|
||||
*(LTC_FAST_TYPE_PTR_CAST(&(xcbc->IV[x]))) ^= *(LTC_FAST_TYPE_PTR_CAST(&(in[x])));
|
||||
}
|
||||
cipher_descriptor[xcbc->cipher].ecb_encrypt(xcbc->IV, xcbc->IV, &xcbc->key);
|
||||
in += xcbc->blocksize;
|
||||
|
||||
Reference in New Issue
Block a user