diff --git a/ctaocrypt/src/asn.c b/ctaocrypt/src/asn.c index 76939be21..c84bd6ba3 100644 --- a/ctaocrypt/src/asn.c +++ b/ctaocrypt/src/asn.c @@ -1911,7 +1911,7 @@ static word32 BytePrecision(word32 value) { word32 i; for (i = sizeof(value); i; --i) - if (value >> ((i - 1) * BIT_SIZE)) + if (value >> ((i - 1) * CYASSL_BIT_SIZE)) break; return i; @@ -1928,7 +1928,7 @@ static word32 SetLength(word32 length, byte* output) output[i++] = (byte)(BytePrecision(length) | ASN_LONG_LENGTH); for (j = BytePrecision(length); j; --j) { - output[i] = (byte)(length >> ((j - 1) * BIT_SIZE)); + output[i] = (byte)(length >> ((j - 1) * CYASSL_BIT_SIZE)); i++; } } diff --git a/ctaocrypt/src/dh.c b/ctaocrypt/src/dh.c index ff64543b0..d5ad83f4f 100644 --- a/ctaocrypt/src/dh.c +++ b/ctaocrypt/src/dh.c @@ -83,8 +83,8 @@ static word32 DiscreteLogWorkFactor(word32 n) static void GeneratePrivate(DhKey* key, RNG* rng, byte* priv, word32* privSz) { word32 sz = mp_unsigned_bin_size(&key->p); - sz = min(sz, 2 * DiscreteLogWorkFactor(sz * BIT_SIZE) / BIT_SIZE + 1); - + sz = min(sz, 2 * DiscreteLogWorkFactor(sz * CYASSL_BIT_SIZE) / + CYASSL_BIT_SIZE + 1); RNG_GenerateBlock(rng, priv, sz); priv[0] |= 0x0C; diff --git a/ctaocrypt/src/misc.c b/ctaocrypt/src/misc.c index 653be2f3b..1a31b2dca 100644 --- a/ctaocrypt/src/misc.c +++ b/ctaocrypt/src/misc.c @@ -163,8 +163,8 @@ STATIC INLINE void XorWords(word* r, const word* a, word32 n) STATIC INLINE void xorbuf(byte* buf, const byte* mask, word32 count) { - if (((word)buf | (word)mask | count) % WORD_SIZE == 0) - XorWords( (word*)buf, (const word*)mask, count / WORD_SIZE); + if (((word)buf | (word)mask | count) % CYASSL_WORD_SIZE == 0) + XorWords( (word*)buf, (const word*)mask, count / CYASSL_WORD_SIZE); else { word32 i; for (i = 0; i < count; i++) buf[i] ^= mask[i]; diff --git a/cyassl/ctaocrypt/types.h b/cyassl/ctaocrypt/types.h index 6659aac96..adf69fdf1 100644 --- a/cyassl/ctaocrypt/types.h +++ b/cyassl/ctaocrypt/types.h @@ -97,9 +97,9 @@ enum { - WORD_SIZE = sizeof(word), - BIT_SIZE = 8, - WORD_BITS = WORD_SIZE * BIT_SIZE + CYASSL_WORD_SIZE = sizeof(word), + CYASSL_BIT_SIZE = 8, + CYASSL_WORD_BITS = CYASSL_WORD_SIZE * CYASSL_BIT_SIZE }; #define CYASSL_MAX_16BIT 0xffffU