Merge pull request #756 from libtom/fast-type

Fix LTC_FAST_TYPE
This commit is contained in:
Steffen Jaeckel 2026-07-31 23:48:02 +02:00 committed by GitHub
commit 2d16cc7f76
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
24 changed files with 139 additions and 67 deletions

View file

@ -253,8 +253,8 @@ int ccm_memory(int cipher,
/* xor the PT against the pad first */
for (z = 0; z < 16; z += sizeof(LTC_FAST_TYPE)) {
LTC_FAST_TYPE_XOR2(&PAD[z], &pt[y+z]);
LTC_FAST_TYPE_XOR3(&ct[y+z], &pt[y+z], &CTRPAD[z]);
LTC_FAST_XOR2(&PAD[z], &pt[y+z]);
LTC_FAST_XOR3(&ct[y+z], &pt[y+z], &CTRPAD[z]);
}
if ((err = ecb_encrypt_block(PAD, PAD, skey)) != CRYPT_OK) {
goto error;
@ -273,8 +273,8 @@ int ccm_memory(int cipher,
/* xor the PT against the pad last */
for (z = 0; z < 16; z += sizeof(LTC_FAST_TYPE)) {
LTC_FAST_TYPE_XOR3(&pt[y+z], &ct[y+z], &CTRPAD[z]);
LTC_FAST_TYPE_XOR2(&PAD[z], &pt[y+z]);
LTC_FAST_XOR3(&pt[y+z], &ct[y+z], &CTRPAD[z]);
LTC_FAST_XOR2(&PAD[z], &pt[y+z]);
}
if ((err = ecb_encrypt_block(PAD, PAD, skey)) != CRYPT_OK) {
goto error;

View file

@ -81,7 +81,7 @@ int gcm_add_aad(gcm_state *gcm,
if (gcm->buflen == 0 && adatalen > 15) {
for (x = 0; x < (adatalen & ~15); x += 16) {
for (y = 0; y < 16; y += sizeof(LTC_FAST_TYPE)) {
LTC_FAST_TYPE_XOR2(&gcm->X[y], &adata[x + y]);
LTC_FAST_XOR2(&gcm->X[y], &adata[x + y]);
}
gcm_mult_h(gcm, gcm->X);
gcm->totlen += 128;

View file

@ -45,7 +45,7 @@ int gcm_add_iv(gcm_state *gcm,
if (gcm->buflen == 0) {
for (x = 0; x < (IVlen & ~15); x += 16) {
for (y = 0; y < 16; y += sizeof(LTC_FAST_TYPE)) {
LTC_FAST_TYPE_XOR2(&gcm->X[y], &IV[x + y]);
LTC_FAST_XOR2(&gcm->X[y], &IV[x + y]);
}
gcm_mult_h(gcm, gcm->X);
gcm->totlen += 128;

View file

@ -30,7 +30,7 @@ void gcm_mult_h(const gcm_state *gcm, unsigned char *I)
for (x = 1; x < 16; x++) {
#ifdef LTC_FAST
for (y = 0; y < 16; y += sizeof(LTC_FAST_TYPE)) {
LTC_FAST_TYPE_XOR2(T + y, &gcm->PC[x][I[x]][y]);
LTC_FAST_XOR2(T + y, &gcm->PC[x][I[x]][y]);
}
#else
for (y = 0; y < 16; y++) {

View file

@ -79,8 +79,8 @@ int gcm_process(gcm_state *gcm,
for (x = 0; x < (ptlen & ~15); x += 16) {
/* ctr encrypt */
for (y = 0; y < 16; y += sizeof(LTC_FAST_TYPE)) {
LTC_FAST_TYPE_XOR3(&ct[x + y], &pt[x+y], &gcm->buf[y]);
LTC_FAST_TYPE_XOR2(&gcm->X[y], &ct[x+y]);
LTC_FAST_XOR3(&ct[x + y], &pt[x+y], &gcm->buf[y]);
LTC_FAST_XOR2(&gcm->X[y], &ct[x+y]);
}
/* GMAC it */
gcm->pttotlen += 128;
@ -97,8 +97,8 @@ int gcm_process(gcm_state *gcm,
for (x = 0; x < (ptlen & ~15); x += 16) {
/* ctr encrypt */
for (y = 0; y < 16; y += sizeof(LTC_FAST_TYPE)) {
LTC_FAST_TYPE_XOR2(&gcm->X[y], &ct[x+y]);
LTC_FAST_TYPE_XOR3(&pt[x + y], &ct[x+y], &gcm->buf[y]);
LTC_FAST_XOR2(&gcm->X[y], &ct[x+y]);
LTC_FAST_XOR3(&pt[x + y], &ct[x+y], &gcm->buf[y]);
}
/* GMAC it */
gcm->pttotlen += 128;

View file

@ -44,13 +44,19 @@ LTC_EXPORT int LTC_CALL XSTRCMP(const char *s1, const char *s2);
#endif
/* some compilers do not like "inline" (or maybe "static inline"), namely: HP cc, IBM xlc */
#if !defined(LTC_NO_INLINE)
#if defined(__GNUC__) || defined(__xlc__)
#define LTC_INLINE __inline__
#elif defined(_MSC_VER) || defined(__HP_cc)
#define LTC_INLINE __inline
#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
#define LTC_INLINE inline
#else
#endif
#endif
#if !defined(LTC_INLINE)
#if !defined(LTC_NO_INLINE)
#define LTC_NO_INLINE
#endif
#define LTC_INLINE
#endif
@ -261,40 +267,17 @@ typedef unsigned long ltc_mp_digit;
#define LTC_NO_SHA256_X86
#endif
/* No LTC_FAST if: explicitly disabled OR non-gcc/non-clang compiler OR old gcc OR using -ansi -std=c99 */
#if defined(LTC_NO_FAST) || (__GNUC__ < 4) || defined(__STRICT_ANSI__)
/* No LTC_FAST if explicitly disabled */
#if defined(LTC_NO_FAST)
#undef LTC_FAST
#endif
#ifdef LTC_FAST
#ifdef ENDIAN_64BITWORD
typedef ulong64 __attribute__((__may_alias__)) LTC_FAST_TYPE;
typedef ulong64 LTC_FAST_TYPE;
#else
typedef ulong32 __attribute__((__may_alias__)) LTC_FAST_TYPE;
typedef ulong32 LTC_FAST_TYPE;
#endif
#define LTC_FAST_TYPE_XOR3(dst, src1, src2) \
do { \
LTC_FAST_TYPE fast_src1, fast_src2, fast_dst; \
XMEMCPY(&fast_src1, (src1), sizeof(LTC_FAST_TYPE)); \
XMEMCPY(&fast_src2, (src2), sizeof(LTC_FAST_TYPE)); \
fast_dst = fast_src1 ^ fast_src2; \
XMEMCPY((dst), &fast_dst, sizeof(LTC_FAST_TYPE)); \
}while (0)
#define LTC_FAST_TYPE_XOR2(dst, src) LTC_FAST_TYPE_XOR3((dst), (dst), (src))
#define LTC_FAST_TYPE_MASK(dst, src, mask) \
do { \
LTC_FAST_TYPE fast_src, fast_mask, fast_dst; \
XMEMCPY(&fast_src, (src), sizeof(LTC_FAST_TYPE)); \
fast_mask = ((LTC_FAST_TYPE)(mask)); \
fast_dst = fast_src & fast_mask; \
XMEMCPY((dst), &fast_dst, sizeof(LTC_FAST_TYPE)); \
}while (0)
#define LTC_FAST_TYPE_ASSIGN(dst, src) \
do { \
LTC_FAST_TYPE fast_tmp; \
XMEMCPY(&fast_tmp, (src), sizeof(LTC_FAST_TYPE)); \
XMEMCPY((dst), &fast_tmp, sizeof(LTC_FAST_TYPE)); \
}while (0)
#endif
#if !defined(ENDIAN_NEUTRAL) && (defined(ENDIAN_BIG) || defined(ENDIAN_LITTLE)) && !(defined(ENDIAN_32BITWORD) || defined(ENDIAN_64BITWORD))

View file

@ -47,6 +47,90 @@ LTC_STATIC_ASSERT(correct_ltc_uintptr_size, sizeof(ltc_uintptr) == sizeof(void*)
#define LTC_ARRAY_SIZE(arr) (sizeof(arr)/sizeof(arr[0]))
#if defined(LTC_FAST)
#if !defined(LTC_NO_INLINE)
/* The LTC_FAST helpers operate on byte buffers that are not guaranteed to be aligned for LTC_FAST_TYPE.
Use memcpy for loads/stores to avoid undefined behavior from unaligned or aliasing-unsafe typed-pointer dereferences.
On GCC/Clang prefer __builtin_memcpy: it is guaranteed to be inlined for constant sizes regardless of any
user override of XMEMCPY (e.g. embedded builds). Other compilers fall back to XMEMCPY.
*/
static LTC_INLINE LTC_FAST_TYPE LTC_FAST_LOAD(const void *p)
{
LTC_FAST_TYPE v;
#if defined(__GNUC__)
__builtin_memcpy(&v, p, sizeof(v));
#else
XMEMCPY(&v, p, sizeof(v));
#endif
return v;
}
static LTC_INLINE void LTC_FAST_STORE(void *p, LTC_FAST_TYPE v)
{
#if defined(__GNUC__)
__builtin_memcpy(p, &v, sizeof(v));
#else
XMEMCPY(p, &v, sizeof(v));
#endif
}
static LTC_INLINE void LTC_FAST_STOREP(void *dst, void *src)
{
#if defined(__GNUC__)
__builtin_memcpy(dst, src, sizeof(LTC_FAST_TYPE));
#else
XMEMCPY(dst, src, sizeof(LTC_FAST_TYPE));
#endif
}
static LTC_INLINE void LTC_FAST_XOR2(void *dst, const void *src)
{
LTC_FAST_STORE(dst, LTC_FAST_LOAD(dst) ^ LTC_FAST_LOAD(src));
}
static LTC_INLINE void LTC_FAST_XOR3(void *dst, const void *src1, const void *src2)
{
LTC_FAST_STORE(dst, LTC_FAST_LOAD(src1) ^ LTC_FAST_LOAD(src2));
}
static LTC_INLINE void LTC_FAST_MASK(void *dst, const void *src, LTC_FAST_TYPE mask)
{
LTC_FAST_STORE(dst, LTC_FAST_LOAD(src) & mask);
}
#else
#define LTC_FAST_LOAD(src) \
({ \
LTC_FAST_TYPE LTC_TMPVAR(fast_tmp); \
XMEMCPY(&LTC_TMPVAR(fast_tmp), (src), sizeof(LTC_FAST_TYPE)); \
LTC_TMPVAR(fast_tmp); \
})
#define LTC_FAST_STORE(dst, v) \
do { \
XMEMCPY((dst), &(v), sizeof(v)); \
} while (0)
#define LTC_FAST_STOREP(dst, src) \
do { \
XMEMCPY((dst), (src), sizeof(LTC_FAST_TYPE)); \
} while (0)
#define LTC_FAST_XOR3(dst, src1, src2) \
do { \
LTC_FAST_TYPE LTC_TMPVAR(fast_src1), LTC_TMPVAR(fast_src2), LTC_TMPVAR(fast_dst); \
XMEMCPY(&LTC_TMPVAR(fast_src1), (src1), sizeof(LTC_FAST_TYPE)); \
XMEMCPY(&LTC_TMPVAR(fast_src2), (src2), sizeof(LTC_FAST_TYPE)); \
LTC_TMPVAR(fast_dst) = LTC_TMPVAR(fast_src1) ^ LTC_TMPVAR(fast_src2); \
XMEMCPY((dst), &LTC_TMPVAR(fast_dst), sizeof(LTC_FAST_TYPE)); \
} while (0)
#define LTC_FAST_XOR2(dst, src) LTC_FAST_XOR3((dst), (dst), (src))
#define LTC_FAST_MASK(dst, src, mask) \
do { \
LTC_FAST_TYPE LTC_TMPVAR(fast_src), LTC_TMPVAR(fast_dst); \
XMEMCPY(&LTC_TMPVAR(fast_src), (src), sizeof(LTC_FAST_TYPE)); \
LTC_TMPVAR(fast_dst) = LTC_TMPVAR(fast_src) & (mask); \
XMEMCPY((dst), &LTC_TMPVAR(fast_dst), sizeof(LTC_FAST_TYPE)); \
} while (0)
#endif /* if !defined(LTC_NO_INLINE) */
#endif /* #if defined(LTC_FAST) */
/*
* Internal Enums
*/

View file

@ -36,11 +36,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_XOR2(&(f9->IV[x]), &(in[x]));
LTC_FAST_XOR2(&(f9->IV[x]), &(in[x]));
}
ecb_encrypt_block(f9->IV, f9->IV, &f9->key);
for (x = 0; x < f9->blocksize; x += sizeof(LTC_FAST_TYPE)) {
LTC_FAST_TYPE_XOR2(&(f9->ACC[x]), &(f9->IV[x]));
LTC_FAST_XOR2(&(f9->ACC[x]), &(f9->IV[x]));
}
in += f9->blocksize;
inlen -= f9->blocksize;

View file

@ -34,7 +34,7 @@ int omac_process(omac_state *omac, const unsigned char *in, unsigned long inlen)
if (omac->buflen == 0 && inlen > (unsigned long)omac->blklen) {
for (x = 0; x < (inlen - omac->blklen); x += omac->blklen) {
for (n = 0; n < (unsigned long)omac->blklen; n += sizeof(LTC_FAST_TYPE)) {
LTC_FAST_TYPE_XOR2(&omac->prev[n], &in[n]);
LTC_FAST_XOR2(&omac->prev[n], &in[n]);
}
in += omac->blklen;
if ((err = ecb_encrypt_block(omac->prev, omac->prev, &omac->key)) != CRYPT_OK) {

View file

@ -108,7 +108,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_XOR2((unsigned char *)pelmac->state + x, (unsigned char *)in + x);
LTC_FAST_XOR2((unsigned char *)pelmac->state + x, (unsigned char *)in + x);
}
s_four_rounds(pelmac);
in += 16;

View file

@ -37,13 +37,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_XOR3(&Z[y], &in[y], &pmac->Li[y]);
LTC_FAST_XOR3(&Z[y], &in[y], &pmac->Li[y]);
}
if ((err = ecb_encrypt_block(Z, Z, &pmac->key)) != CRYPT_OK) {
return err;
}
for (y = 0; y < 16; y += sizeof(LTC_FAST_TYPE)) {
LTC_FAST_TYPE_XOR2(&pmac->checksum[y], &Z[y]);
LTC_FAST_XOR2(&pmac->checksum[y], &Z[y]);
}
in += 16;
}

View file

@ -19,7 +19,7 @@ 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_XOR2((unsigned char *)pmac->Li + x, (unsigned char *)pmac->Ls[y] + x);
LTC_FAST_XOR2((unsigned char *)pmac->Li + x, (unsigned char *)pmac->Ls[y] + x);
}
#else
for (x = 0; x < pmac->block_len; x++) {

View file

@ -32,7 +32,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_XOR2(&(xcbc->IV[x]), &(in[x]));
LTC_FAST_XOR2(&(xcbc->IV[x]), &(in[x]));
}
ecb_encrypt_block(xcbc->IV, xcbc->IV, &xcbc->key);
in += xcbc->blocksize;

View file

@ -34,7 +34,7 @@ void copy_or_zeromem(const unsigned char* src, unsigned char* dest, unsigned lon
if (len & ~15) {
for (; y < (len & ~15); y += 16) {
for (z = 0; z < 16; z += sizeof(LTC_FAST_TYPE)) {
LTC_FAST_TYPE_MASK(&dest[y+z], &src[y+z], fastMask);
LTC_FAST_MASK(&dest[y+z], &src[y+z], fastMask);
}
}
}

View file

@ -584,6 +584,11 @@ const char *crypt_build_settings =
#if defined(LTC_NO_FAST)
" LTC_NO_FAST "
#endif
#if defined(LTC_NO_INLINE)
" LTC_NO_INLINE "
#else
" " NAME_VALUE(LTC_INLINE) " "
#endif
#if defined(LTC_NO_BSWAP)
" LTC_NO_BSWAP "
#endif

View file

@ -62,9 +62,9 @@ int cbc_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, s
/* xor IV against plaintext */
#if defined(LTC_FAST)
for (x = 0; x < cbc->ecb.blocklen; x += sizeof(LTC_FAST_TYPE)) {
LTC_FAST_TYPE_XOR3(&tmpy, (unsigned char *)cbc->IV + x, (unsigned char *)tmp + x);
LTC_FAST_TYPE_ASSIGN((unsigned char *)cbc->IV + x, (unsigned char *)ct + x);
LTC_FAST_TYPE_ASSIGN((unsigned char *)pt + x, &tmpy);
LTC_FAST_XOR3(&tmpy, (unsigned char *)cbc->IV + x, (unsigned char *)tmp + x);
LTC_FAST_STOREP((unsigned char *)cbc->IV + x, (unsigned char *)ct + x);
LTC_FAST_STOREP((unsigned char *)pt + x, &tmpy);
}
#else
for (x = 0; x < cbc->ecb.blocklen; x++) {

View file

@ -51,7 +51,7 @@ int cbc_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, s
/* xor IV against plaintext */
#if defined(LTC_FAST)
for (x = 0; x < cbc->ecb.blocklen; x += sizeof(LTC_FAST_TYPE)) {
LTC_FAST_TYPE_XOR2((unsigned char *)cbc->IV + x, (unsigned char *)pt + x);
LTC_FAST_XOR2((unsigned char *)cbc->IV + x, (unsigned char *)pt + x);
}
#else
for (x = 0; x < cbc->ecb.blocklen; x++) {
@ -67,7 +67,7 @@ int cbc_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, s
/* store IV [ciphertext] for a future block */
#if defined(LTC_FAST)
for (x = 0; x < cbc->ecb.blocklen; x += sizeof(LTC_FAST_TYPE)) {
LTC_FAST_TYPE_ASSIGN((unsigned char *)cbc->IV + x, (unsigned char *)ct + x);
LTC_FAST_STOREP((unsigned char *)cbc->IV + x, (unsigned char *)ct + x);
}
#else
for (x = 0; x < cbc->ecb.blocklen; x++) {

View file

@ -53,7 +53,7 @@ static int s_ctr_encrypt(const unsigned char *pt, unsigned char *ct, unsigned lo
#ifdef LTC_FAST
if ((ctr->padlen == 0) && (len >= (unsigned long)ctr->ecb.blocklen)) {
for (x = 0; x < ctr->ecb.blocklen; x += sizeof(LTC_FAST_TYPE)) {
LTC_FAST_TYPE_XOR3((unsigned char *)ct + x, (unsigned char *)pt + x, (unsigned char *)ctr->pad + x);
LTC_FAST_XOR3((unsigned char *)ct + x, (unsigned char *)pt + x, (unsigned char *)ctr->pad + x);
}
pt += ctr->ecb.blocklen;
ct += ctr->ecb.blocklen;

View file

@ -57,9 +57,9 @@ int f8_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, sy
++(f8->blockcnt);
for (x = 0; x < f8->ecb.blocklen; x += sizeof(LTC_FAST_TYPE)) {
LTC_FAST_TYPE tmp;
LTC_FAST_TYPE_XOR3(&ct[x], &pt[x], &f8->IV[x]);
LTC_FAST_TYPE_XOR3(&tmp, &f8->MIV[x], &buf[x]);
LTC_FAST_TYPE_XOR2(&f8->IV[x], &tmp);
LTC_FAST_XOR3(&ct[x], &pt[x], &f8->IV[x]);
LTC_FAST_XOR3(&tmp, &f8->MIV[x], &buf[x]);
LTC_FAST_XOR2(&f8->IV[x], &tmp);
}
if ((err = ecb_encrypt_block(f8->IV, f8->IV, &f8->ecb)) != CRYPT_OK) {
return err;

View file

@ -53,8 +53,8 @@ int lrw_process(const unsigned char *pt, unsigned char *ct, unsigned long len, i
#ifdef LTC_FAST
for (y = 0; y < 16; y += sizeof(LTC_FAST_TYPE)) {
LTC_FAST_TYPE tmp;
LTC_FAST_TYPE_XOR3(&tmp, &lrw->PC[x][lrw->IV[x]][y], &lrw->PC[x][(lrw->IV[x]-1)&255][y]);
LTC_FAST_TYPE_XOR2(lrw->pad + y, &tmp);
LTC_FAST_XOR3(&tmp, &lrw->PC[x][lrw->IV[x]][y], &lrw->PC[x][(lrw->IV[x]-1)&255][y]);
LTC_FAST_XOR2(lrw->pad + y, &tmp);
}
#else
for (y = 0; y < 16; y++) {
@ -69,7 +69,7 @@ int lrw_process(const unsigned char *pt, unsigned char *ct, unsigned long len, i
/* xor prod */
#ifdef LTC_FAST
for (x = 0; x < 16; x += sizeof(LTC_FAST_TYPE)) {
LTC_FAST_TYPE_XOR3(ct + x, pt + x, prod + x);
LTC_FAST_XOR3(ct + x, pt + x, prod + x);
}
#else
for (x = 0; x < 16; x++) {
@ -91,7 +91,7 @@ int lrw_process(const unsigned char *pt, unsigned char *ct, unsigned long len, i
/* xor prod */
#ifdef LTC_FAST
for (x = 0; x < 16; x += sizeof(LTC_FAST_TYPE)) {
LTC_FAST_TYPE_XOR3(ct + x, ct + x, prod + x);
LTC_FAST_XOR3(ct + x, ct + x, prod + x);
}
#else
for (x = 0; x < 16; x++) {

View file

@ -48,7 +48,7 @@ int lrw_setiv(const unsigned char *IV, unsigned long len, symmetric_LRW *lrw)
for (x = 1; x < 16; x++) {
#ifdef LTC_FAST
for (y = 0; y < 16; y += sizeof(LTC_FAST_TYPE)) {
LTC_FAST_TYPE_XOR2(T + y, &lrw->PC[x][IV[x]][y]);
LTC_FAST_XOR2(T + y, &lrw->PC[x][IV[x]][y]);
}
#else
for (y = 0; y < 16; y++) {

View file

@ -16,7 +16,7 @@ static int s_tweak_uncrypt(const unsigned char *C, unsigned char *P, unsigned ch
/* tweak encrypt block i */
#ifdef LTC_FAST
for (x = 0; x < 16; x += sizeof(LTC_FAST_TYPE)) {
LTC_FAST_TYPE_XOR3(&P[x], &C[x], &T[x]);
LTC_FAST_XOR3(&P[x], &C[x], &T[x]);
}
#else
for (x = 0; x < 16; x++) {
@ -28,7 +28,7 @@ static int s_tweak_uncrypt(const unsigned char *C, unsigned char *P, unsigned ch
#ifdef LTC_FAST
for (x = 0; x < 16; x += sizeof(LTC_FAST_TYPE)) {
LTC_FAST_TYPE_XOR2(&P[x], &T[x]);
LTC_FAST_XOR2(&P[x], &T[x]);
}
#else
for (x = 0; x < 16; x++) {

View file

@ -16,7 +16,7 @@ static int s_tweak_crypt(const unsigned char *P, unsigned char *C, unsigned char
/* tweak encrypt block i */
#ifdef LTC_FAST
for (x = 0; x < 16; x += sizeof(LTC_FAST_TYPE)) {
LTC_FAST_TYPE_XOR3(&C[x], &P[x], &T[x]);
LTC_FAST_XOR3(&C[x], &P[x], &T[x]);
}
#else
for (x = 0; x < 16; x++) {
@ -30,7 +30,7 @@ static int s_tweak_crypt(const unsigned char *P, unsigned char *C, unsigned char
#ifdef LTC_FAST
for (x = 0; x < 16; x += sizeof(LTC_FAST_TYPE)) {
LTC_FAST_TYPE_XOR2(&C[x], &T[x]);
LTC_FAST_XOR2(&C[x], &T[x]);
}
#else
for (x = 0; x < 16; x++) {

View file

@ -63,7 +63,7 @@ int store_test(void)
/* now XOR it word for word */
for (x = 0; x < y; x += sizeof(LTC_FAST_TYPE)) {
LTC_FAST_TYPE_XOR3(&buf[5*y+z+x], &buf[z+x], &buf[z+y+x+zz]);
LTC_FAST_XOR3(&buf[5*y+z+x], &buf[z+x], &buf[z+y+x+zz]);
}
if (memcmp(&buf[4*y+z], &buf[5*y+z], y)) {