Fix macro names - related to #448

This commit is contained in:
Karel Miko 2018-11-07 10:59:47 +01:00 committed by Steffen Jaeckel
parent 89d991e946
commit cb63d3c074
27 changed files with 319 additions and 331 deletions

View File

@ -80,7 +80,7 @@ const struct ltc_cipher_descriptor aes_enc_desc =
#endif
#define __LTC_AES_TAB_C__
#define LTC_AES_TAB_C
#include "aes_tab.c"
static ulong32 setup_mix(ulong32 temp)

View File

@ -15,7 +15,7 @@ Td3[x] = Si[x].[09, 0d, 0b, 0e];
Td4[x] = Si[x].[01, 01, 01, 01];
*/
#ifdef __LTC_AES_TAB_C__
#ifdef LTC_AES_TAB_C
/**
@file aes_tab.c
@ -1019,4 +1019,4 @@ static const ulong32 rcon[] = {
};
#endif
#endif /* __LTC_AES_TAB_C__ */
#endif /* LTC_AES_TAB_C */

View File

@ -491,13 +491,7 @@ int cast5_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_
}
#endif
#ifdef _MSC_VER
#define INLINE __inline
#else
#define INLINE
#endif
INLINE static ulong32 FI(ulong32 R, ulong32 Km, ulong32 Kr)
LTC_INLINE static ulong32 FI(ulong32 R, ulong32 Km, ulong32 Kr)
{
ulong32 I;
I = (Km + R);
@ -505,7 +499,7 @@ INLINE static ulong32 FI(ulong32 R, ulong32 Km, ulong32 Kr)
return ((S1[LTC_BYTE(I, 3)] ^ S2[LTC_BYTE(I,2)]) - S3[LTC_BYTE(I,1)]) + S4[LTC_BYTE(I,0)];
}
INLINE static ulong32 FII(ulong32 R, ulong32 Km, ulong32 Kr)
LTC_INLINE static ulong32 FII(ulong32 R, ulong32 Km, ulong32 Kr)
{
ulong32 I;
I = (Km ^ R);
@ -513,7 +507,7 @@ INLINE static ulong32 FII(ulong32 R, ulong32 Km, ulong32 Kr)
return ((S1[LTC_BYTE(I, 3)] - S2[LTC_BYTE(I,2)]) + S3[LTC_BYTE(I,1)]) ^ S4[LTC_BYTE(I,0)];
}
INLINE static ulong32 FIII(ulong32 R, ulong32 Km, ulong32 Kr)
LTC_INLINE static ulong32 FIII(ulong32 R, ulong32 Km, ulong32 Kr)
{
ulong32 I;
I = (Km - R);

View File

@ -35,19 +35,19 @@ const struct ltc_cipher_descriptor idea_desc = {
typedef unsigned short int ushort16;
#define _LOW16(x) ((x)&0xffff) /* compiler should be able to optimize this away if x is 16 bits */
#define _HIGH16(x) ((x)>>16)
#define _MUL(a,b) { \
ulong32 p = (ulong32)_LOW16(a) * b; \
#define LOW16(x) ((x)&0xffff) /* compiler should be able to optimize this away if x is 16 bits */
#define HIGH16(x) ((x)>>16)
#define MUL(a,b) { \
ulong32 p = (ulong32)LOW16(a) * b; \
if (p) { \
p = _LOW16(p) - _HIGH16(p); \
a = (ushort16)p - (ushort16)_HIGH16(p); \
p = LOW16(p) - HIGH16(p); \
a = (ushort16)p - (ushort16)HIGH16(p); \
} \
else \
a = 1 - a - b; \
}
#define _STORE16(x,y) { (y)[0] = (unsigned char)(((x)>>8)&255); (y)[1] = (unsigned char)((x)&255); }
#define _LOAD16(x,y) { x = ((ushort16)((y)[0] & 255)<<8) | ((ushort16)((y)[1] & 255)); }
#define STORE16(x,y) { (y)[0] = (unsigned char)(((x)>>8)&255); (y)[1] = (unsigned char)((x)&255); }
#define LOAD16(x,y) { x = ((ushort16)((y)[0] & 255)<<8) | ((ushort16)((y)[1] & 255)); }
static ushort16 _mul_inv(ushort16 x)
{
@ -55,15 +55,15 @@ static ushort16 _mul_inv(ushort16 x)
unsigned i;
for (i = 0; i < 15; i++) {
_MUL(y, _LOW16(y));
_MUL(y, x);
MUL(y, LOW16(y));
MUL(y, x);
}
return _LOW16(y);
return LOW16(y);
}
static ushort16 _add_inv(ushort16 x)
{
return _LOW16(0 - x);
return LOW16(0 - x);
}
static int _setup_key(const unsigned char *key, symmetric_key *skey)
@ -74,11 +74,11 @@ static int _setup_key(const unsigned char *key, symmetric_key *skey)
/* prepare enc key */
for (i = 0; i < 8; i++) {
_LOAD16(e_key[i], key + 2 * i);
LOAD16(e_key[i], key + 2 * i);
}
for (; i < LTC_IDEA_KEYLEN; i++) {
j = (i - i % 8) - 8;
e_key[i] = _LOW16((e_key[j+(i+1)%8] << 9) | (e_key[j+(i+2)%8] >> 7));
e_key[i] = LOW16((e_key[j+(i+1)%8] << 9) | (e_key[j+(i+2)%8] >> 7));
}
/* prepare dec key */
@ -103,20 +103,20 @@ static int _process_block(const unsigned char *in, unsigned char *out, const ush
int i;
ushort16 x0, x1, x2, x3, t0, t1;
_LOAD16(x0, in + 0);
_LOAD16(x1, in + 2);
_LOAD16(x2, in + 4);
_LOAD16(x3, in + 6);
LOAD16(x0, in + 0);
LOAD16(x1, in + 2);
LOAD16(x2, in + 4);
LOAD16(x3, in + 6);
for (i = 0; i < LTC_IDEA_ROUNDS; i++) {
_MUL(x0, m_key[i*6+0]);
MUL(x0, m_key[i*6+0]);
x1 += m_key[i*6+1];
x2 += m_key[i*6+2];
_MUL(x3, m_key[i*6+3]);
MUL(x3, m_key[i*6+3]);
t0 = x0^x2;
_MUL(t0, m_key[i*6+4]);
MUL(t0, m_key[i*6+4]);
t1 = t0 + (x1^x3);
_MUL(t1, m_key[i*6+5]);
MUL(t1, m_key[i*6+5]);
t0 += t1;
x0 ^= t1;
x3 ^= t0;
@ -125,15 +125,15 @@ static int _process_block(const unsigned char *in, unsigned char *out, const ush
x2 = t0;
}
_MUL(x0, m_key[LTC_IDEA_ROUNDS*6+0]);
MUL(x0, m_key[LTC_IDEA_ROUNDS*6+0]);
x2 += m_key[LTC_IDEA_ROUNDS*6+1];
x1 += m_key[LTC_IDEA_ROUNDS*6+2];
_MUL(x3, m_key[LTC_IDEA_ROUNDS*6+3]);
MUL(x3, m_key[LTC_IDEA_ROUNDS*6+3]);
_STORE16(x0, out + 0);
_STORE16(x2, out + 2);
_STORE16(x1, out + 4);
_STORE16(x3, out + 6);
STORE16(x0, out + 0);
STORE16(x2, out + 2);
STORE16(x1, out + 4);
STORE16(x3, out + 6);
return CRYPT_OK;
}

View File

@ -24,7 +24,7 @@
#ifdef LTC_SAFER
#define __LTC_SAFER_TAB_C__
#define LTC_SAFER_TAB_C
#include "safer_tab.c"
const struct ltc_cipher_descriptor safer_k64_desc = {
@ -91,13 +91,13 @@ const struct ltc_cipher_descriptor safer_k64_desc = {
/******************* Types ****************************************************/
#ifdef LTC_CLEAN_STACK
static void _Safer_Expand_Userkey(const unsigned char *userkey_1,
static void _safer_expand_userkey(const unsigned char *userkey_1,
const unsigned char *userkey_2,
unsigned int nof_rounds,
int strengthened,
safer_key_t key)
#else
static void Safer_Expand_Userkey(const unsigned char *userkey_1,
static void safer_expand_userkey(const unsigned char *userkey_1,
const unsigned char *userkey_2,
unsigned int nof_rounds,
int strengthened,
@ -160,13 +160,13 @@ static void Safer_Expand_Userkey(const unsigned char *userkey_1,
}
#ifdef LTC_CLEAN_STACK
static void Safer_Expand_Userkey(const unsigned char *userkey_1,
static void safer_expand_userkey(const unsigned char *userkey_1,
const unsigned char *userkey_2,
unsigned int nof_rounds,
int strengthened,
safer_key_t key)
{
_Safer_Expand_Userkey(userkey_1, userkey_2, nof_rounds, strengthened, key);
_safer_expand_userkey(userkey_1, userkey_2, nof_rounds, strengthened, key);
burn_stack(sizeof(unsigned char) * (2 * (LTC_SAFER_BLOCK_LEN + 1)) + sizeof(unsigned int)*2);
}
#endif
@ -184,7 +184,7 @@ int safer_k64_setup(const unsigned char *key, int keylen, int num_rounds, symmet
return CRYPT_INVALID_KEYSIZE;
}
Safer_Expand_Userkey(key, key, (unsigned int)(num_rounds != 0 ?num_rounds:LTC_SAFER_K64_DEFAULT_NOF_ROUNDS), 0, skey->safer.key);
safer_expand_userkey(key, key, (unsigned int)(num_rounds != 0 ?num_rounds:LTC_SAFER_K64_DEFAULT_NOF_ROUNDS), 0, skey->safer.key);
return CRYPT_OK;
}
@ -201,7 +201,7 @@ int safer_sk64_setup(const unsigned char *key, int keylen, int num_rounds, symme
return CRYPT_INVALID_KEYSIZE;
}
Safer_Expand_Userkey(key, key, (unsigned int)(num_rounds != 0 ?num_rounds:LTC_SAFER_SK64_DEFAULT_NOF_ROUNDS), 1, skey->safer.key);
safer_expand_userkey(key, key, (unsigned int)(num_rounds != 0 ?num_rounds:LTC_SAFER_SK64_DEFAULT_NOF_ROUNDS), 1, skey->safer.key);
return CRYPT_OK;
}
@ -218,7 +218,7 @@ int safer_k128_setup(const unsigned char *key, int keylen, int num_rounds, symme
return CRYPT_INVALID_KEYSIZE;
}
Safer_Expand_Userkey(key, key+8, (unsigned int)(num_rounds != 0 ?num_rounds:LTC_SAFER_K128_DEFAULT_NOF_ROUNDS), 0, skey->safer.key);
safer_expand_userkey(key, key+8, (unsigned int)(num_rounds != 0 ?num_rounds:LTC_SAFER_K128_DEFAULT_NOF_ROUNDS), 0, skey->safer.key);
return CRYPT_OK;
}
@ -235,7 +235,7 @@ int safer_sk128_setup(const unsigned char *key, int keylen, int num_rounds, symm
return CRYPT_INVALID_KEYSIZE;
}
Safer_Expand_Userkey(key, key+8, (unsigned int)(num_rounds != 0?num_rounds:LTC_SAFER_SK128_DEFAULT_NOF_ROUNDS), 1, skey->safer.key);
safer_expand_userkey(key, key+8, (unsigned int)(num_rounds != 0?num_rounds:LTC_SAFER_SK128_DEFAULT_NOF_ROUNDS), 1, skey->safer.key);
return CRYPT_OK;
}

View File

@ -6,7 +6,7 @@
Tables for LTC_SAFER block ciphers
*/
#ifdef __LTC_SAFER_TAB_C__
#ifdef LTC_SAFER_TAB_C
/* This is the box defined by ebox[x] = 45^x mod 257.
* Its assumed that the value "256" corresponds to zero. */
@ -49,6 +49,6 @@ static const unsigned char safer_lbox[256] = {
184, 64, 120, 45, 58, 233, 100, 31, 146, 144, 125, 57, 111, 224, 137, 48
};
#endif /* __LTC_SAFER_TAB_C__ */
#endif /* LTC_SAFER_TAB_C */

View File

@ -9,7 +9,7 @@
#ifdef LTC_SAFERP
#define __LTC_SAFER_TAB_C__
#define LTC_SAFER_TAB_C
#include "safer_tab.c"
const struct ltc_cipher_descriptor saferp_desc =

View File

@ -27,7 +27,7 @@ const struct ltc_cipher_descriptor serpent_desc = {
};
/* linear transformation */
#define _LT(i,a,b,c,d,e) { \
#define _lt(i,a,b,c,d,e) { \
a = ROLc(a, 13); \
c = ROLc(c, 3); \
d = ROLc(d ^ c ^ (a << 3), 7); \
@ -37,7 +37,7 @@ const struct ltc_cipher_descriptor serpent_desc = {
}
/* inverse linear transformation */
#define _ILT(i,a,b,c,d,e) { \
#define _ilt(i,a,b,c,d,e) { \
c = RORc(c, 22); \
a = RORc(a, 5); \
c ^= d ^ (b << 7); \
@ -75,7 +75,7 @@ const struct ltc_cipher_descriptor serpent_desc = {
* come from Dag Arne Osvik's paper "Speeding up Serpent".
*/
#define _S0(i, r0, r1, r2, r3, r4) { \
#define _s0(i, r0, r1, r2, r3, r4) { \
r3 ^= r0; \
r4 = r1; \
r1 &= r3; \
@ -96,7 +96,7 @@ const struct ltc_cipher_descriptor serpent_desc = {
r4 ^= r3; \
}
#define _I0(i, r0, r1, r2, r3, r4) { \
#define _i0(i, r0, r1, r2, r3, r4) { \
r2 = ~r2; \
r4 = r1; \
r1 |= r0; \
@ -118,7 +118,7 @@ const struct ltc_cipher_descriptor serpent_desc = {
r4 ^= r2; \
}
#define _S1(i, r0, r1, r2, r3, r4) { \
#define _s1(i, r0, r1, r2, r3, r4) { \
r0 = ~r0; \
r2 = ~r2; \
r4 = r0; \
@ -139,7 +139,7 @@ const struct ltc_cipher_descriptor serpent_desc = {
r0 ^= r4; \
}
#define _I1(i, r0, r1, r2, r3, r4) { \
#define _i1(i, r0, r1, r2, r3, r4) { \
r4 = r1; \
r1 ^= r3; \
r3 &= r1; \
@ -161,7 +161,7 @@ const struct ltc_cipher_descriptor serpent_desc = {
r3 ^= r1; \
}
#define _S2(i, r0, r1, r2, r3, r4) { \
#define _s2(i, r0, r1, r2, r3, r4) { \
r4 = r0; \
r0 &= r2; \
r0 ^= r3; \
@ -180,7 +180,7 @@ const struct ltc_cipher_descriptor serpent_desc = {
r4 = ~r4; \
}
#define _I2(i, r0, r1, r2, r3, r4) { \
#define _i2(i, r0, r1, r2, r3, r4) { \
r2 ^= r3; \
r3 ^= r0; \
r4 = r3; \
@ -202,7 +202,7 @@ const struct ltc_cipher_descriptor serpent_desc = {
r3 ^= r0; \
}
#define _S3(i, r0, r1, r2, r3, r4) { \
#define _s3(i, r0, r1, r2, r3, r4) { \
r4 = r0; \
r0 |= r3; \
r3 ^= r1; \
@ -224,7 +224,7 @@ const struct ltc_cipher_descriptor serpent_desc = {
r1 ^= r0; \
}
#define _I3(i, r0, r1, r2, r3, r4) { \
#define _i3(i, r0, r1, r2, r3, r4) { \
r4 = r2; \
r2 ^= r1; \
r1 &= r2; \
@ -245,7 +245,7 @@ const struct ltc_cipher_descriptor serpent_desc = {
r2 ^= r4; \
}
#define _S4(i, r0, r1, r2, r3, r4) { \
#define _s4(i, r0, r1, r2, r3, r4) { \
r1 ^= r3; \
r3 = ~r3; \
r2 ^= r3; \
@ -268,7 +268,7 @@ const struct ltc_cipher_descriptor serpent_desc = {
r4 ^= r2; \
}
#define _I4(i, r0, r1, r2, r3, r4) { \
#define _i4(i, r0, r1, r2, r3, r4) { \
r4 = r2; \
r2 &= r3; \
r2 ^= r1; \
@ -291,7 +291,7 @@ const struct ltc_cipher_descriptor serpent_desc = {
r2 ^= r1; \
}
#define _S5(i, r0, r1, r2, r3, r4) { \
#define _s5(i, r0, r1, r2, r3, r4) { \
r0 ^= r1; \
r1 ^= r3; \
r3 = ~r3; \
@ -313,7 +313,7 @@ const struct ltc_cipher_descriptor serpent_desc = {
r2 ^= r4; \
}
#define _I5(i, r0, r1, r2, r3, r4) { \
#define _i5(i, r0, r1, r2, r3, r4) { \
r1 = ~r1; \
r4 = r3; \
r2 ^= r1; \
@ -335,7 +335,7 @@ const struct ltc_cipher_descriptor serpent_desc = {
r4 = ~r4; \
}
#define _S6(i, r0, r1, r2, r3, r4) { \
#define _s6(i, r0, r1, r2, r3, r4) { \
r2 = ~r2; \
r4 = r3; \
r3 &= r0; \
@ -356,7 +356,7 @@ const struct ltc_cipher_descriptor serpent_desc = {
r2 ^= r3; \
}
#define _I6(i, r0, r1, r2, r3, r4) { \
#define _i6(i, r0, r1, r2, r3, r4) { \
r0 ^= r2; \
r4 = r2; \
r2 &= r0; \
@ -376,7 +376,7 @@ const struct ltc_cipher_descriptor serpent_desc = {
r4 ^= r0; \
}
#define _S7(i, r0, r1, r2, r3, r4) { \
#define _s7(i, r0, r1, r2, r3, r4) { \
r4 = r2; \
r2 &= r1; \
r2 ^= r3; \
@ -399,7 +399,7 @@ const struct ltc_cipher_descriptor serpent_desc = {
r4 ^= r1; \
}
#define _I7(i, r0, r1, r2, r3, r4) { \
#define _i7(i, r0, r1, r2, r3, r4) { \
r4 = r2; \
r2 ^= r0; \
r0 &= r3; \
@ -422,21 +422,21 @@ const struct ltc_cipher_descriptor serpent_desc = {
}
/* key xor */
#define _KX(r, a, b, c, d, e) { \
#define _kx(r, a, b, c, d, e) { \
a ^= k[4 * r + 0]; \
b ^= k[4 * r + 1]; \
c ^= k[4 * r + 2]; \
d ^= k[4 * r + 3]; \
}
#define _LK(r, a, b, c, d, e) { \
#define _lk(r, a, b, c, d, e) { \
a = k[(8-r)*4 + 0]; \
b = k[(8-r)*4 + 1]; \
c = k[(8-r)*4 + 2]; \
d = k[(8-r)*4 + 3]; \
}
#define _SK(r, a, b, c, d, e) { \
#define _sk(r, a, b, c, d, e) { \
k[(8-r)*4 + 4] = a; \
k[(8-r)*4 + 5] = b; \
k[(8-r)*4 + 6] = c; \
@ -467,17 +467,17 @@ static int _setup_key(const unsigned char *key, int keylen, int rounds, ulong32
k -= 20;
for (i = 0; i < rounds/8; i++) {
_afterS2(_LK); _afterS2(_S3); _afterS3(_SK);
_afterS1(_LK); _afterS1(_S2); _afterS2(_SK);
_afterS0(_LK); _afterS0(_S1); _afterS1(_SK);
_beforeS0(_LK); _beforeS0(_S0); _afterS0(_SK);
_afterS2(_lk); _afterS2(_s3); _afterS3(_sk);
_afterS1(_lk); _afterS1(_s2); _afterS2(_sk);
_afterS0(_lk); _afterS0(_s1); _afterS1(_sk);
_beforeS0(_lk); _beforeS0(_s0); _afterS0(_sk);
k += 8*4;
_afterS6(_LK); _afterS6(_S7); _afterS7(_SK);
_afterS5(_LK); _afterS5(_S6); _afterS6(_SK);
_afterS4(_LK); _afterS4(_S5); _afterS5(_SK);
_afterS3(_LK); _afterS3(_S4); _afterS4(_SK);
_afterS6(_lk); _afterS6(_s7); _afterS7(_sk);
_afterS5(_lk); _afterS5(_s6); _afterS6(_sk);
_afterS4(_lk); _afterS4(_s5); _afterS5(_sk);
_afterS3(_lk); _afterS3(_s4); _afterS4(_sk);
}
_afterS2(_LK); _afterS2(_S3); _afterS3(_SK);
_afterS2(_lk); _afterS2(_s3); _afterS3(_sk);
return CRYPT_OK;
}
@ -493,14 +493,14 @@ static int _enc_block(const unsigned char *in, unsigned char *out, const ulong32
LOAD32L(d, in + 12);
do {
_beforeS0(_KX); _beforeS0(_S0); _afterS0(_LT);
_afterS0(_KX); _afterS0(_S1); _afterS1(_LT);
_afterS1(_KX); _afterS1(_S2); _afterS2(_LT);
_afterS2(_KX); _afterS2(_S3); _afterS3(_LT);
_afterS3(_KX); _afterS3(_S4); _afterS4(_LT);
_afterS4(_KX); _afterS4(_S5); _afterS5(_LT);
_afterS5(_KX); _afterS5(_S6); _afterS6(_LT);
_afterS6(_KX); _afterS6(_S7);
_beforeS0(_kx); _beforeS0(_s0); _afterS0(_lt);
_afterS0(_kx); _afterS0(_s1); _afterS1(_lt);
_afterS1(_kx); _afterS1(_s2); _afterS2(_lt);
_afterS2(_kx); _afterS2(_s3); _afterS3(_lt);
_afterS3(_kx); _afterS3(_s4); _afterS4(_lt);
_afterS4(_kx); _afterS4(_s5); _afterS5(_lt);
_afterS5(_kx); _afterS5(_s6); _afterS6(_lt);
_afterS6(_kx); _afterS6(_s7);
if (i == 4) break;
@ -511,10 +511,10 @@ static int _enc_block(const unsigned char *in, unsigned char *out, const ulong32
d = a;
a = e;
k += 32;
_beforeS0(_LT);
_beforeS0(_lt);
} while (1);
_afterS7(_KX);
_afterS7(_kx);
STORE32L(d, out + 0);
STORE32L(e, out + 4);
@ -537,7 +537,7 @@ static int _dec_block(const unsigned char *in, unsigned char *out, const ulong32
i = 4;
k += 96;
_beforeI7(_KX);
_beforeI7(_kx);
goto start;
do {
@ -545,16 +545,16 @@ static int _dec_block(const unsigned char *in, unsigned char *out, const ulong32
b = d;
d = e;
k -= 32;
_beforeI7(_ILT);
_beforeI7(_ilt);
start:
_beforeI7(_I7); _afterI7(_KX);
_afterI7(_ILT); _afterI7(_I6); _afterI6(_KX);
_afterI6(_ILT); _afterI6(_I5); _afterI5(_KX);
_afterI5(_ILT); _afterI5(_I4); _afterI4(_KX);
_afterI4(_ILT); _afterI4(_I3); _afterI3(_KX);
_afterI3(_ILT); _afterI3(_I2); _afterI2(_KX);
_afterI2(_ILT); _afterI2(_I1); _afterI1(_KX);
_afterI1(_ILT); _afterI1(_I0); _afterI0(_KX);
_beforeI7(_i7); _afterI7(_kx);
_afterI7(_ilt); _afterI7(_i6); _afterI6(_kx);
_afterI6(_ilt); _afterI6(_i5); _afterI5(_kx);
_afterI5(_ilt); _afterI5(_i4); _afterI4(_kx);
_afterI4(_ilt); _afterI4(_i3); _afterI3(_kx);
_afterI3(_ilt); _afterI3(_i2); _afterI2(_kx);
_afterI2(_ilt); _afterI2(_i1); _afterI1(_kx);
_afterI1(_ilt); _afterI1(_i0); _afterI0(_kx);
} while (--i != 0);
STORE32L(a, out + 0);

View File

@ -58,7 +58,7 @@ static const unsigned char qord[4][5] = {
#ifdef LTC_TWOFISH_TABLES
#define __LTC_TWOFISH_TAB_C__
#define LTC_TWOFISH_TAB_C
#include "twofish_tab.c"
#define sbox(i, x) ((ulong32)SBOX[i][(x)&255])

View File

@ -6,7 +6,7 @@
Twofish tables, Tom St Denis
*/
#ifdef LTC_TWOFISH_TABLES
#ifdef __LTC_TWOFISH_TAB_C__
#ifdef LTC_TWOFISH_TAB_C
/* pre generated 8x8 tables from the four 4x4s */
static const unsigned char SBOX[2][256] = {
@ -482,5 +482,5 @@ static const ulong32 rs_tab7[256] = {
#endif /* LTC_TWOFISH_ALL_TABLES */
#endif /* __LTC_TWOFISH_TAB_C__ */
#endif /* LTC_TWOFISH_TAB_C */
#endif

View File

@ -547,14 +547,8 @@ static const ulong64 table[4*256] = {
CONST64(0xCD56D9430EA8280E) /* 1020 */, CONST64(0xC12591D7535F5065) /* 1021 */,
CONST64(0xC83223F1720AEF96) /* 1022 */, CONST64(0xC3A0396F7363A51F) /* 1023 */};
#ifdef _MSC_VER
#define INLINE __inline
#else
#define INLINE
#endif
/* one round of the hash function */
INLINE static void tiger_round(ulong64 *a, ulong64 *b, ulong64 *c, ulong64 x, int mul)
LTC_INLINE static void tiger_round(ulong64 *a, ulong64 *b, ulong64 *c, ulong64 x, int mul)
{
ulong64 tmp;
tmp = (*c ^= x);

View File

@ -29,7 +29,7 @@ const struct ltc_hash_descriptor whirlpool_desc =
};
/* the sboxes */
#define __LTC_WHIRLTAB_C__
#define LTC_WHIRLTAB_C
#include "whirltab.c"
/* get a_{i,j} */

View File

@ -6,7 +6,7 @@
LTC_WHIRLPOOL tables, Tom St Denis
*/
#ifdef __LTC_WHIRLTAB_C__
#ifdef LTC_WHIRLTAB_C
static const ulong64 sbox0[] = {
CONST64(0x18186018c07830d8), CONST64(0x23238c2305af4626), CONST64(0xc6c63fc67ef991b8), CONST64(0xe8e887e8136fcdfb),
@ -583,4 +583,4 @@ CONST64(0xca2dbf07ad5a8333),
CONST64(0x6302aa71c81949d9),
};
#endif /* __LTC_WHIRLTAB_C__ */
#endif /* LTC_WHIRLTAB_C */

View File

@ -54,8 +54,8 @@ do { x = (((ulong64)((y)[0] & 255))<<56)|(((ulong64)((y)[1] & 255))<<48) | \
#ifdef LTC_HAVE_BSWAP_BUILTIN
#define STORE32H(x, y) \
do { ulong32 __t = __builtin_bswap32 ((x)); \
XMEMCPY ((y), &__t, 4); } while(0)
do { ulong32 ttt = __builtin_bswap32 ((x)); \
XMEMCPY ((y), &ttt, 4); } while(0)
#define LOAD32H(x, y) \
do { XMEMCPY (&(x), (y), 4); \
@ -93,8 +93,8 @@ asm __volatile__ ( \
#ifdef LTC_HAVE_BSWAP_BUILTIN
#define STORE64H(x, y) \
do { ulong64 __t = __builtin_bswap64 ((x)); \
XMEMCPY ((y), &__t, 8); } while(0)
do { ulong64 ttt = __builtin_bswap64 ((x)); \
XMEMCPY ((y), &ttt, 8); } while(0)
#define LOAD64H(x, y) \
do { XMEMCPY (&(x), (y), 8); \
@ -135,7 +135,7 @@ do { x = (((ulong64)((y)[0] & 255))<<56)|(((ulong64)((y)[1] & 255))<<48) | \
#ifdef ENDIAN_32BITWORD
#define STORE32L(x, y) \
do { ulong32 __t = (x); XMEMCPY(y, &__t, 4); } while(0)
do { ulong32 ttt = (x); XMEMCPY(y, &ttt, 4); } while(0)
#define LOAD32L(x, y) \
do { XMEMCPY(&(x), y, 4); } while(0)
@ -155,13 +155,13 @@ do { x = (((ulong64)((y)[0] & 255))<<56)|(((ulong64)((y)[1] & 255))<<48) | \
#else /* 64-bit words then */
#define STORE32L(x, y) \
do { ulong32 __t = (x); XMEMCPY(y, &__t, 4); } while(0)
do { ulong32 ttt = (x); XMEMCPY(y, &ttt, 4); } while(0)
#define LOAD32L(x, y) \
do { XMEMCPY(&(x), y, 4); x &= 0xFFFFFFFF; } while(0)
#define STORE64L(x, y) \
do { ulong64 __t = (x); XMEMCPY(y, &__t, 8); } while(0)
do { ulong64 ttt = (x); XMEMCPY(y, &ttt, 8); } while(0)
#define LOAD64L(x, y) \
do { XMEMCPY(&(x), y, 8); } while(0)
@ -195,7 +195,7 @@ do { x = (((ulong64)((y)[7] & 255))<<56)|(((ulong64)((y)[6] & 255))<<48) | \
#ifdef ENDIAN_32BITWORD
#define STORE32H(x, y) \
do { ulong32 __t = (x); XMEMCPY(y, &__t, 4); } while(0)
do { ulong32 ttt = (x); XMEMCPY(y, &ttt, 4); } while(0)
#define LOAD32H(x, y) \
do { XMEMCPY(&(x), y, 4); } while(0)
@ -215,13 +215,13 @@ do { x = (((ulong64)((y)[7] & 255))<<56)|(((ulong64)((y)[6] & 255))<<48) | \
#else /* 64-bit words then */
#define STORE32H(x, y) \
do { ulong32 __t = (x); XMEMCPY(y, &__t, 4); } while(0)
do { ulong32 ttt = (x); XMEMCPY(y, &ttt, 4); } while(0)
#define LOAD32H(x, y) \
do { XMEMCPY(&(x), y, 4); x &= 0xFFFFFFFF; } while(0)
#define STORE64H(x, y) \
do { ulong64 __t = (x); XMEMCPY(y, &__t, 8); } while(0)
do { ulong64 ttt = (x); XMEMCPY(y, &ttt, 8); } while(0)
#define LOAD64H(x, y) \
do { XMEMCPY(&(x), y, 8); } while(0)
@ -275,20 +275,20 @@ static inline ulong32 ROR(ulong32 word, int i)
#ifndef LTC_NO_ROLC
#define ROLc(word,i) ({ \
ulong32 __ROLc_tmp = (word); \
ulong32 ROLc_tmp = (word); \
__asm__ ("roll %2, %0" : \
"=r" (__ROLc_tmp) : \
"0" (__ROLc_tmp), \
"=r" (ROLc_tmp) : \
"0" (ROLc_tmp), \
"I" (i)); \
__ROLc_tmp; \
ROLc_tmp; \
})
#define RORc(word,i) ({ \
ulong32 __RORc_tmp = (word); \
ulong32 RORc_tmp = (word); \
__asm__ ("rorl %2, %0" : \
"=r" (__RORc_tmp) : \
"0" (__RORc_tmp), \
"=r" (RORc_tmp) : \
"0" (RORc_tmp), \
"I" (i)); \
__RORc_tmp; \
RORc_tmp; \
})
#else
@ -393,20 +393,20 @@ static inline ulong64 ROR64(ulong64 word, int i)
#ifndef LTC_NO_ROLC
#define ROL64c(word,i) ({ \
ulong64 __ROL64c_tmp = word; \
ulong64 ROL64c_tmp = word; \
__asm__ ("rolq %2, %0" : \
"=r" (__ROL64c_tmp) : \
"0" (__ROL64c_tmp), \
"=r" (ROL64c_tmp) : \
"0" (ROL64c_tmp), \
"J" (i)); \
__ROL64c_tmp; \
ROL64c_tmp; \
})
#define ROR64c(word,i) ({ \
ulong64 __ROR64c_tmp = word; \
ulong64 ROR64c_tmp = word; \
__asm__ ("rorq %2, %0" : \
"=r" (__ROR64c_tmp) : \
"0" (__ROR64c_tmp), \
"=r" (ROR64c_tmp) : \
"0" (ROR64c_tmp), \
"J" (i)); \
__ROR64c_tmp; \
ROR64c_tmp; \
})
#else /* LTC_NO_ROLC */

View File

@ -540,7 +540,7 @@ typedef struct ltc_asn1_list_ {
LTC_MACRO_list[LTC_MACRO_temp].tag = 0; \
} while (0)
#define __LTC_SET_ASN1_IDENTIFIER(list, index, Class, Pc, Tag) \
#define LTC_SET_ASN1_IDENTIFIER(list, index, Class, Pc, Tag) \
do { \
int LTC_MACRO_temp = (index); \
ltc_asn1_list *LTC_MACRO_list = (list); \
@ -554,14 +554,14 @@ typedef struct ltc_asn1_list_ {
do { \
int LTC_MACRO_temp##__LINE__ = (index); \
LTC_SET_ASN1(list, LTC_MACRO_temp##__LINE__, LTC_ASN1_CUSTOM_TYPE, Data, 1); \
__LTC_SET_ASN1_IDENTIFIER(list, LTC_MACRO_temp##__LINE__, Class, LTC_ASN1_PC_CONSTRUCTED, Tag); \
LTC_SET_ASN1_IDENTIFIER(list, LTC_MACRO_temp##__LINE__, Class, LTC_ASN1_PC_CONSTRUCTED, Tag); \
} while (0)
#define LTC_SET_ASN1_CUSTOM_PRIMITIVE(list, index, Class, Tag, Type, Data, Size) \
do { \
int LTC_MACRO_temp##__LINE__ = (index); \
LTC_SET_ASN1(list, LTC_MACRO_temp##__LINE__, LTC_ASN1_CUSTOM_TYPE, Data, Size); \
__LTC_SET_ASN1_IDENTIFIER(list, LTC_MACRO_temp##__LINE__, Class, LTC_ASN1_PC_PRIMITIVE, Tag); \
LTC_SET_ASN1_IDENTIFIER(list, LTC_MACRO_temp##__LINE__, Class, LTC_ASN1_PC_PRIMITIVE, Tag); \
list[LTC_MACRO_temp##__LINE__].used = (int)(Type); \
} while (0)

View File

@ -417,7 +417,7 @@ int pkcs12_kdf( int hash_id,
/* tomcrypt_prng.h */
#define _LTC_PRNG_EXPORT(which) \
#define LTC_PRNG_EXPORT(which) \
int which ## _export(unsigned char *out, unsigned long *outlen, prng_state *prng) \
{ \
unsigned long len = which ## _desc.export_size; \

View File

@ -9,7 +9,7 @@
#ifdef LTC_PELICAN
#define __LTC_AES_TAB_C__
#define LTC_AES_TAB_C
#define ENCRYPT_ONLY
#define PELI_TAB
#include "../../ciphers/aes/aes_tab.c"

View File

@ -10,7 +10,7 @@
*/
#ifdef LTC_CRC32
static const ulong32 _CRC32_NEGL = 0xffffffffUL;
static const ulong32 CRC32_NEGL = 0xffffffffUL;
#if defined(ENDIAN_LITTLE)
#define CRC32_INDEX(c) (c & 0xff)
@ -137,7 +137,7 @@ static const ulong32 crc32_m_tab[] =
void crc32_init(crc32_state *ctx)
{
LTC_ARGCHKVD(ctx != NULL);
ctx->crc = _CRC32_NEGL;
ctx->crc = CRC32_NEGL;
}
void crc32_update(crc32_state *ctx, const unsigned char *input, unsigned long length)
@ -164,7 +164,7 @@ void crc32_finish(const crc32_state *ctx, void *hash, unsigned long size)
h = hash;
crc = ctx->crc;
crc ^= _CRC32_NEGL;
crc ^= CRC32_NEGL;
if (size > 4) size = 4;
for (i = 0; i < size; i++) {

View File

@ -17,54 +17,54 @@ typedef struct {
const int value;
} crypt_constant;
#define _C_STRINGIFY(s) { #s, s }
#define C_STRINGIFY(s) { #s, s }
static const crypt_constant _crypt_constants[] = {
_C_STRINGIFY(CRYPT_OK),
_C_STRINGIFY(CRYPT_ERROR),
_C_STRINGIFY(CRYPT_NOP),
_C_STRINGIFY(CRYPT_INVALID_KEYSIZE),
_C_STRINGIFY(CRYPT_INVALID_ROUNDS),
_C_STRINGIFY(CRYPT_FAIL_TESTVECTOR),
_C_STRINGIFY(CRYPT_BUFFER_OVERFLOW),
_C_STRINGIFY(CRYPT_INVALID_PACKET),
_C_STRINGIFY(CRYPT_INVALID_PRNGSIZE),
_C_STRINGIFY(CRYPT_ERROR_READPRNG),
_C_STRINGIFY(CRYPT_INVALID_CIPHER),
_C_STRINGIFY(CRYPT_INVALID_HASH),
_C_STRINGIFY(CRYPT_INVALID_PRNG),
_C_STRINGIFY(CRYPT_MEM),
_C_STRINGIFY(CRYPT_PK_TYPE_MISMATCH),
_C_STRINGIFY(CRYPT_PK_NOT_PRIVATE),
_C_STRINGIFY(CRYPT_INVALID_ARG),
_C_STRINGIFY(CRYPT_FILE_NOTFOUND),
_C_STRINGIFY(CRYPT_PK_INVALID_TYPE),
_C_STRINGIFY(CRYPT_OVERFLOW),
_C_STRINGIFY(CRYPT_PK_ASN1_ERROR),
_C_STRINGIFY(CRYPT_INPUT_TOO_LONG),
_C_STRINGIFY(CRYPT_PK_INVALID_SIZE),
_C_STRINGIFY(CRYPT_INVALID_PRIME_SIZE),
_C_STRINGIFY(CRYPT_PK_INVALID_PADDING),
_C_STRINGIFY(CRYPT_HASH_OVERFLOW),
C_STRINGIFY(CRYPT_OK),
C_STRINGIFY(CRYPT_ERROR),
C_STRINGIFY(CRYPT_NOP),
C_STRINGIFY(CRYPT_INVALID_KEYSIZE),
C_STRINGIFY(CRYPT_INVALID_ROUNDS),
C_STRINGIFY(CRYPT_FAIL_TESTVECTOR),
C_STRINGIFY(CRYPT_BUFFER_OVERFLOW),
C_STRINGIFY(CRYPT_INVALID_PACKET),
C_STRINGIFY(CRYPT_INVALID_PRNGSIZE),
C_STRINGIFY(CRYPT_ERROR_READPRNG),
C_STRINGIFY(CRYPT_INVALID_CIPHER),
C_STRINGIFY(CRYPT_INVALID_HASH),
C_STRINGIFY(CRYPT_INVALID_PRNG),
C_STRINGIFY(CRYPT_MEM),
C_STRINGIFY(CRYPT_PK_TYPE_MISMATCH),
C_STRINGIFY(CRYPT_PK_NOT_PRIVATE),
C_STRINGIFY(CRYPT_INVALID_ARG),
C_STRINGIFY(CRYPT_FILE_NOTFOUND),
C_STRINGIFY(CRYPT_PK_INVALID_TYPE),
C_STRINGIFY(CRYPT_OVERFLOW),
C_STRINGIFY(CRYPT_PK_ASN1_ERROR),
C_STRINGIFY(CRYPT_INPUT_TOO_LONG),
C_STRINGIFY(CRYPT_PK_INVALID_SIZE),
C_STRINGIFY(CRYPT_INVALID_PRIME_SIZE),
C_STRINGIFY(CRYPT_PK_INVALID_PADDING),
C_STRINGIFY(CRYPT_HASH_OVERFLOW),
_C_STRINGIFY(PK_PUBLIC),
_C_STRINGIFY(PK_PRIVATE),
C_STRINGIFY(PK_PUBLIC),
C_STRINGIFY(PK_PRIVATE),
_C_STRINGIFY(LTC_ENCRYPT),
_C_STRINGIFY(LTC_DECRYPT),
C_STRINGIFY(LTC_ENCRYPT),
C_STRINGIFY(LTC_DECRYPT),
#ifdef LTC_PKCS_1
{"LTC_PKCS_1", 1},
/* Block types */
_C_STRINGIFY(LTC_PKCS_1_EMSA),
_C_STRINGIFY(LTC_PKCS_1_EME),
C_STRINGIFY(LTC_PKCS_1_EMSA),
C_STRINGIFY(LTC_PKCS_1_EME),
/* Padding types */
_C_STRINGIFY(LTC_PKCS_1_V1_5),
_C_STRINGIFY(LTC_PKCS_1_OAEP),
_C_STRINGIFY(LTC_PKCS_1_PSS),
_C_STRINGIFY(LTC_PKCS_1_V1_5_NA1),
C_STRINGIFY(LTC_PKCS_1_V1_5),
C_STRINGIFY(LTC_PKCS_1_OAEP),
C_STRINGIFY(LTC_PKCS_1_PSS),
C_STRINGIFY(LTC_PKCS_1_V1_5_NA1),
#else
{"LTC_PKCS_1", 0},
#endif
@ -72,14 +72,14 @@ static const crypt_constant _crypt_constants[] = {
#ifdef LTC_PADDING
{"LTC_PADDING", 1},
_C_STRINGIFY(LTC_PAD_PKCS7),
C_STRINGIFY(LTC_PAD_PKCS7),
#ifdef LTC_RNG_GET_BYTES
_C_STRINGIFY(LTC_PAD_ISO_10126),
C_STRINGIFY(LTC_PAD_ISO_10126),
#endif
_C_STRINGIFY(LTC_PAD_ANSI_X923),
_C_STRINGIFY(LTC_PAD_ONE_AND_ZERO),
_C_STRINGIFY(LTC_PAD_ZERO),
_C_STRINGIFY(LTC_PAD_ZERO_ALWAYS),
C_STRINGIFY(LTC_PAD_ANSI_X923),
C_STRINGIFY(LTC_PAD_ONE_AND_ZERO),
C_STRINGIFY(LTC_PAD_ZERO),
C_STRINGIFY(LTC_PAD_ZERO_ALWAYS),
#else
{"LTC_PADDING", 0},
#endif
@ -92,76 +92,76 @@ static const crypt_constant _crypt_constants[] = {
#ifdef LTC_MECC
{"LTC_MECC", 1},
_C_STRINGIFY(ECC_BUF_SIZE),
_C_STRINGIFY(ECC_MAXSIZE),
C_STRINGIFY(ECC_BUF_SIZE),
C_STRINGIFY(ECC_MAXSIZE),
#else
{"LTC_MECC", 0},
#endif
#ifdef LTC_MDSA
{"LTC_MDSA", 1},
_C_STRINGIFY(LTC_MDSA_DELTA),
_C_STRINGIFY(LTC_MDSA_MAX_GROUP),
C_STRINGIFY(LTC_MDSA_DELTA),
C_STRINGIFY(LTC_MDSA_MAX_GROUP),
#else
{"LTC_MDSA", 0},
#endif
#ifdef LTC_MILLER_RABIN_REPS
_C_STRINGIFY(LTC_MILLER_RABIN_REPS),
C_STRINGIFY(LTC_MILLER_RABIN_REPS),
#endif
#ifdef LTC_DER
/* DER handling */
{"LTC_DER", 1},
_C_STRINGIFY(LTC_ASN1_EOL),
_C_STRINGIFY(LTC_ASN1_BOOLEAN),
_C_STRINGIFY(LTC_ASN1_INTEGER),
_C_STRINGIFY(LTC_ASN1_SHORT_INTEGER),
_C_STRINGIFY(LTC_ASN1_BIT_STRING),
_C_STRINGIFY(LTC_ASN1_OCTET_STRING),
_C_STRINGIFY(LTC_ASN1_NULL),
_C_STRINGIFY(LTC_ASN1_OBJECT_IDENTIFIER),
_C_STRINGIFY(LTC_ASN1_IA5_STRING),
_C_STRINGIFY(LTC_ASN1_PRINTABLE_STRING),
_C_STRINGIFY(LTC_ASN1_UTF8_STRING),
_C_STRINGIFY(LTC_ASN1_UTCTIME),
_C_STRINGIFY(LTC_ASN1_CHOICE),
_C_STRINGIFY(LTC_ASN1_SEQUENCE),
_C_STRINGIFY(LTC_ASN1_SET),
_C_STRINGIFY(LTC_ASN1_SETOF),
_C_STRINGIFY(LTC_ASN1_RAW_BIT_STRING),
_C_STRINGIFY(LTC_ASN1_TELETEX_STRING),
_C_STRINGIFY(LTC_ASN1_GENERALIZEDTIME),
_C_STRINGIFY(LTC_ASN1_CUSTOM_TYPE),
_C_STRINGIFY(LTC_DER_MAX_RECURSION),
C_STRINGIFY(LTC_ASN1_EOL),
C_STRINGIFY(LTC_ASN1_BOOLEAN),
C_STRINGIFY(LTC_ASN1_INTEGER),
C_STRINGIFY(LTC_ASN1_SHORT_INTEGER),
C_STRINGIFY(LTC_ASN1_BIT_STRING),
C_STRINGIFY(LTC_ASN1_OCTET_STRING),
C_STRINGIFY(LTC_ASN1_NULL),
C_STRINGIFY(LTC_ASN1_OBJECT_IDENTIFIER),
C_STRINGIFY(LTC_ASN1_IA5_STRING),
C_STRINGIFY(LTC_ASN1_PRINTABLE_STRING),
C_STRINGIFY(LTC_ASN1_UTF8_STRING),
C_STRINGIFY(LTC_ASN1_UTCTIME),
C_STRINGIFY(LTC_ASN1_CHOICE),
C_STRINGIFY(LTC_ASN1_SEQUENCE),
C_STRINGIFY(LTC_ASN1_SET),
C_STRINGIFY(LTC_ASN1_SETOF),
C_STRINGIFY(LTC_ASN1_RAW_BIT_STRING),
C_STRINGIFY(LTC_ASN1_TELETEX_STRING),
C_STRINGIFY(LTC_ASN1_GENERALIZEDTIME),
C_STRINGIFY(LTC_ASN1_CUSTOM_TYPE),
C_STRINGIFY(LTC_DER_MAX_RECURSION),
#else
{"LTC_DER", 0},
#endif
#ifdef LTC_CTR_MODE
{"LTC_CTR_MODE", 1},
_C_STRINGIFY(CTR_COUNTER_LITTLE_ENDIAN),
_C_STRINGIFY(CTR_COUNTER_BIG_ENDIAN),
_C_STRINGIFY(LTC_CTR_RFC3686),
C_STRINGIFY(CTR_COUNTER_LITTLE_ENDIAN),
C_STRINGIFY(CTR_COUNTER_BIG_ENDIAN),
C_STRINGIFY(LTC_CTR_RFC3686),
#else
{"LTC_CTR_MODE", 0},
#endif
#ifdef LTC_GCM_MODE
_C_STRINGIFY(LTC_GCM_MODE_IV),
_C_STRINGIFY(LTC_GCM_MODE_AAD),
_C_STRINGIFY(LTC_GCM_MODE_TEXT),
C_STRINGIFY(LTC_GCM_MODE_IV),
C_STRINGIFY(LTC_GCM_MODE_AAD),
C_STRINGIFY(LTC_GCM_MODE_TEXT),
#endif
_C_STRINGIFY(LTC_MP_LT),
_C_STRINGIFY(LTC_MP_EQ),
_C_STRINGIFY(LTC_MP_GT),
C_STRINGIFY(LTC_MP_LT),
C_STRINGIFY(LTC_MP_EQ),
C_STRINGIFY(LTC_MP_GT),
_C_STRINGIFY(LTC_MP_NO),
_C_STRINGIFY(LTC_MP_YES),
C_STRINGIFY(LTC_MP_NO),
C_STRINGIFY(LTC_MP_YES),
_C_STRINGIFY(MAXBLOCKSIZE),
_C_STRINGIFY(TAB_SIZE),
_C_STRINGIFY(ARGTYPE),
C_STRINGIFY(MAXBLOCKSIZE),
C_STRINGIFY(TAB_SIZE),
C_STRINGIFY(ARGTYPE),
#ifdef LTM_DESC
{"LTM_DESC", 1},

View File

@ -17,270 +17,270 @@ typedef struct {
const unsigned int size;
} crypt_size;
#define _SZ_STRINGIFY_S(s) { #s, sizeof(struct s) }
#define _SZ_STRINGIFY_T(s) { #s, sizeof(s) }
#define SZ_STRINGIFY_S(s) { #s, sizeof(struct s) }
#define SZ_STRINGIFY_T(s) { #s, sizeof(s) }
static const crypt_size _crypt_sizes[] = {
/* hash state sizes */
_SZ_STRINGIFY_S(ltc_hash_descriptor),
_SZ_STRINGIFY_T(hash_state),
SZ_STRINGIFY_S(ltc_hash_descriptor),
SZ_STRINGIFY_T(hash_state),
#ifdef LTC_CHC_HASH
_SZ_STRINGIFY_S(chc_state),
SZ_STRINGIFY_S(chc_state),
#endif
#ifdef LTC_WHIRLPOOL
_SZ_STRINGIFY_S(whirlpool_state),
SZ_STRINGIFY_S(whirlpool_state),
#endif
#ifdef LTC_SHA3
_SZ_STRINGIFY_S(sha3_state),
SZ_STRINGIFY_S(sha3_state),
#endif
#ifdef LTC_SHA512
_SZ_STRINGIFY_S(sha512_state),
SZ_STRINGIFY_S(sha512_state),
#endif
#ifdef LTC_SHA256
_SZ_STRINGIFY_S(sha256_state),
SZ_STRINGIFY_S(sha256_state),
#endif
#ifdef LTC_SHA1
_SZ_STRINGIFY_S(sha1_state),
SZ_STRINGIFY_S(sha1_state),
#endif
#ifdef LTC_MD5
_SZ_STRINGIFY_S(md5_state),
SZ_STRINGIFY_S(md5_state),
#endif
#ifdef LTC_MD4
_SZ_STRINGIFY_S(md4_state),
SZ_STRINGIFY_S(md4_state),
#endif
#ifdef LTC_MD2
_SZ_STRINGIFY_S(md2_state),
SZ_STRINGIFY_S(md2_state),
#endif
#ifdef LTC_TIGER
_SZ_STRINGIFY_S(tiger_state),
SZ_STRINGIFY_S(tiger_state),
#endif
#ifdef LTC_RIPEMD128
_SZ_STRINGIFY_S(rmd128_state),
SZ_STRINGIFY_S(rmd128_state),
#endif
#ifdef LTC_RIPEMD160
_SZ_STRINGIFY_S(rmd160_state),
SZ_STRINGIFY_S(rmd160_state),
#endif
#ifdef LTC_RIPEMD256
_SZ_STRINGIFY_S(rmd256_state),
SZ_STRINGIFY_S(rmd256_state),
#endif
#ifdef LTC_RIPEMD320
_SZ_STRINGIFY_S(rmd320_state),
SZ_STRINGIFY_S(rmd320_state),
#endif
#ifdef LTC_BLAKE2S
_SZ_STRINGIFY_S(blake2s_state),
SZ_STRINGIFY_S(blake2s_state),
#endif
#ifdef LTC_BLAKE2B
_SZ_STRINGIFY_S(blake2b_state),
SZ_STRINGIFY_S(blake2b_state),
#endif
/* block cipher key sizes */
_SZ_STRINGIFY_S(ltc_cipher_descriptor),
_SZ_STRINGIFY_T(symmetric_key),
SZ_STRINGIFY_S(ltc_cipher_descriptor),
SZ_STRINGIFY_T(symmetric_key),
#ifdef LTC_ANUBIS
_SZ_STRINGIFY_S(anubis_key),
SZ_STRINGIFY_S(anubis_key),
#endif
#ifdef LTC_CAMELLIA
_SZ_STRINGIFY_S(camellia_key),
SZ_STRINGIFY_S(camellia_key),
#endif
#ifdef LTC_BLOWFISH
_SZ_STRINGIFY_S(blowfish_key),
SZ_STRINGIFY_S(blowfish_key),
#endif
#ifdef LTC_CAST5
_SZ_STRINGIFY_S(cast5_key),
SZ_STRINGIFY_S(cast5_key),
#endif
#ifdef LTC_DES
_SZ_STRINGIFY_S(des_key),
_SZ_STRINGIFY_S(des3_key),
SZ_STRINGIFY_S(des_key),
SZ_STRINGIFY_S(des3_key),
#endif
#ifdef LTC_IDEA
_SZ_STRINGIFY_S(idea_key),
SZ_STRINGIFY_S(idea_key),
#endif
#ifdef LTC_KASUMI
_SZ_STRINGIFY_S(kasumi_key),
SZ_STRINGIFY_S(kasumi_key),
#endif
#ifdef LTC_KHAZAD
_SZ_STRINGIFY_S(khazad_key),
SZ_STRINGIFY_S(khazad_key),
#endif
#ifdef LTC_KSEED
_SZ_STRINGIFY_S(kseed_key),
SZ_STRINGIFY_S(kseed_key),
#endif
#ifdef LTC_MULTI2
_SZ_STRINGIFY_S(multi2_key),
SZ_STRINGIFY_S(multi2_key),
#endif
#ifdef LTC_NOEKEON
_SZ_STRINGIFY_S(noekeon_key),
SZ_STRINGIFY_S(noekeon_key),
#endif
#ifdef LTC_RC2
_SZ_STRINGIFY_S(rc2_key),
SZ_STRINGIFY_S(rc2_key),
#endif
#ifdef LTC_RC5
_SZ_STRINGIFY_S(rc5_key),
SZ_STRINGIFY_S(rc5_key),
#endif
#ifdef LTC_RC6
_SZ_STRINGIFY_S(rc6_key),
SZ_STRINGIFY_S(rc6_key),
#endif
#ifdef LTC_SERPENT
_SZ_STRINGIFY_S(serpent_key),
SZ_STRINGIFY_S(serpent_key),
#endif
#ifdef LTC_SKIPJACK
_SZ_STRINGIFY_S(skipjack_key),
SZ_STRINGIFY_S(skipjack_key),
#endif
#ifdef LTC_XTEA
_SZ_STRINGIFY_S(xtea_key),
SZ_STRINGIFY_S(xtea_key),
#endif
#ifdef LTC_RIJNDAEL
_SZ_STRINGIFY_S(rijndael_key),
SZ_STRINGIFY_S(rijndael_key),
#endif
#ifdef LTC_SAFER
_SZ_STRINGIFY_S(safer_key),
SZ_STRINGIFY_S(safer_key),
#endif
#ifdef LTC_SAFERP
_SZ_STRINGIFY_S(saferp_key),
SZ_STRINGIFY_S(saferp_key),
#endif
#ifdef LTC_TWOFISH
_SZ_STRINGIFY_S(twofish_key),
SZ_STRINGIFY_S(twofish_key),
#endif
/* mode sizes */
#ifdef LTC_ECB_MODE
_SZ_STRINGIFY_T(symmetric_ECB),
SZ_STRINGIFY_T(symmetric_ECB),
#endif
#ifdef LTC_CFB_MODE
_SZ_STRINGIFY_T(symmetric_CFB),
SZ_STRINGIFY_T(symmetric_CFB),
#endif
#ifdef LTC_OFB_MODE
_SZ_STRINGIFY_T(symmetric_OFB),
SZ_STRINGIFY_T(symmetric_OFB),
#endif
#ifdef LTC_CBC_MODE
_SZ_STRINGIFY_T(symmetric_CBC),
SZ_STRINGIFY_T(symmetric_CBC),
#endif
#ifdef LTC_CTR_MODE
_SZ_STRINGIFY_T(symmetric_CTR),
SZ_STRINGIFY_T(symmetric_CTR),
#endif
#ifdef LTC_LRW_MODE
_SZ_STRINGIFY_T(symmetric_LRW),
SZ_STRINGIFY_T(symmetric_LRW),
#endif
#ifdef LTC_F8_MODE
_SZ_STRINGIFY_T(symmetric_F8),
SZ_STRINGIFY_T(symmetric_F8),
#endif
#ifdef LTC_XTS_MODE
_SZ_STRINGIFY_T(symmetric_xts),
SZ_STRINGIFY_T(symmetric_xts),
#endif
/* stream cipher sizes */
#ifdef LTC_CHACHA
_SZ_STRINGIFY_T(chacha_state),
SZ_STRINGIFY_T(chacha_state),
#endif
#ifdef LTC_SALSA20
_SZ_STRINGIFY_T(salsa20_state),
SZ_STRINGIFY_T(salsa20_state),
#endif
#ifdef LTC_SOSEMANUK
_SZ_STRINGIFY_T(sosemanuk_state),
SZ_STRINGIFY_T(sosemanuk_state),
#endif
#ifdef LTC_RABBIT
_SZ_STRINGIFY_T(rabbit_state),
SZ_STRINGIFY_T(rabbit_state),
#endif
#ifdef LTC_RC4_STREAM
_SZ_STRINGIFY_T(rc4_state),
SZ_STRINGIFY_T(rc4_state),
#endif
#ifdef LTC_SOBER128_STREAM
_SZ_STRINGIFY_T(sober128_state),
SZ_STRINGIFY_T(sober128_state),
#endif
/* MAC sizes -- no states for ccm, lrw */
#ifdef LTC_HMAC
_SZ_STRINGIFY_T(hmac_state),
SZ_STRINGIFY_T(hmac_state),
#endif
#ifdef LTC_OMAC
_SZ_STRINGIFY_T(omac_state),
SZ_STRINGIFY_T(omac_state),
#endif
#ifdef LTC_PMAC
_SZ_STRINGIFY_T(pmac_state),
SZ_STRINGIFY_T(pmac_state),
#endif
#ifdef LTC_POLY1305
_SZ_STRINGIFY_T(poly1305_state),
SZ_STRINGIFY_T(poly1305_state),
#endif
#ifdef LTC_EAX_MODE
_SZ_STRINGIFY_T(eax_state),
SZ_STRINGIFY_T(eax_state),
#endif
#ifdef LTC_OCB_MODE
_SZ_STRINGIFY_T(ocb_state),
SZ_STRINGIFY_T(ocb_state),
#endif
#ifdef LTC_OCB3_MODE
_SZ_STRINGIFY_T(ocb3_state),
SZ_STRINGIFY_T(ocb3_state),
#endif
#ifdef LTC_CCM_MODE
_SZ_STRINGIFY_T(ccm_state),
SZ_STRINGIFY_T(ccm_state),
#endif
#ifdef LTC_GCM_MODE
_SZ_STRINGIFY_T(gcm_state),
SZ_STRINGIFY_T(gcm_state),
#endif
#ifdef LTC_PELICAN
_SZ_STRINGIFY_T(pelican_state),
SZ_STRINGIFY_T(pelican_state),
#endif
#ifdef LTC_XCBC
_SZ_STRINGIFY_T(xcbc_state),
SZ_STRINGIFY_T(xcbc_state),
#endif
#ifdef LTC_F9_MODE
_SZ_STRINGIFY_T(f9_state),
SZ_STRINGIFY_T(f9_state),
#endif
#ifdef LTC_CHACHA20POLY1305_MODE
_SZ_STRINGIFY_T(chacha20poly1305_state),
SZ_STRINGIFY_T(chacha20poly1305_state),
#endif
/* asymmetric keys */
#ifdef LTC_MRSA
_SZ_STRINGIFY_T(rsa_key),
SZ_STRINGIFY_T(rsa_key),
#endif
#ifdef LTC_MDSA
_SZ_STRINGIFY_T(dsa_key),
SZ_STRINGIFY_T(dsa_key),
#endif
#ifdef LTC_MDH
_SZ_STRINGIFY_T(dh_key),
SZ_STRINGIFY_T(dh_key),
#endif
#ifdef LTC_MECC
_SZ_STRINGIFY_T(ltc_ecc_curve),
_SZ_STRINGIFY_T(ecc_point),
_SZ_STRINGIFY_T(ecc_key),
SZ_STRINGIFY_T(ltc_ecc_curve),
SZ_STRINGIFY_T(ecc_point),
SZ_STRINGIFY_T(ecc_key),
#endif
/* DER handling */
#ifdef LTC_DER
_SZ_STRINGIFY_T(ltc_asn1_list), /* a list entry */
_SZ_STRINGIFY_T(ltc_utctime),
_SZ_STRINGIFY_T(ltc_generalizedtime),
SZ_STRINGIFY_T(ltc_asn1_list), /* a list entry */
SZ_STRINGIFY_T(ltc_utctime),
SZ_STRINGIFY_T(ltc_generalizedtime),
#endif
/* prng state sizes */
_SZ_STRINGIFY_S(ltc_prng_descriptor),
_SZ_STRINGIFY_T(prng_state),
SZ_STRINGIFY_S(ltc_prng_descriptor),
SZ_STRINGIFY_T(prng_state),
#ifdef LTC_FORTUNA
_SZ_STRINGIFY_S(fortuna_prng),
SZ_STRINGIFY_S(fortuna_prng),
#endif
#ifdef LTC_CHACHA20_PRNG
_SZ_STRINGIFY_S(chacha20_prng),
SZ_STRINGIFY_S(chacha20_prng),
#endif
#ifdef LTC_RC4
_SZ_STRINGIFY_S(rc4_prng),
SZ_STRINGIFY_S(rc4_prng),
#endif
#ifdef LTC_SOBER128
_SZ_STRINGIFY_S(sober128_prng),
SZ_STRINGIFY_S(sober128_prng),
#endif
#ifdef LTC_YARROW
_SZ_STRINGIFY_S(yarrow_prng),
SZ_STRINGIFY_S(yarrow_prng),
#endif
/* sprng has no state as it uses other potentially available sources */
/* like /dev/random. See Developers Guide for more info. */
#ifdef LTC_ADLER32
_SZ_STRINGIFY_T(adler32_state),
SZ_STRINGIFY_T(adler32_state),
#endif
#ifdef LTC_CRC32
_SZ_STRINGIFY_T(crc32_state),
SZ_STRINGIFY_T(crc32_state),
#endif
_SZ_STRINGIFY_T(ltc_mp_digit),
_SZ_STRINGIFY_T(ltc_math_descriptor)
SZ_STRINGIFY_T(ltc_mp_digit),
SZ_STRINGIFY_T(ltc_math_descriptor)
};

View File

@ -144,7 +144,7 @@ int chacha20_prng_done(prng_state *prng)
@param prng The PRNG to export
@return CRYPT_OK if successful
*/
_LTC_PRNG_EXPORT(chacha20_prng)
LTC_PRNG_EXPORT(chacha20_prng)
/**
Import a PRNG state

View File

@ -467,7 +467,7 @@ LBL_UNLOCK:
@param prng The PRNG to export
@return CRYPT_OK if successful
*/
_LTC_PRNG_EXPORT(fortuna)
LTC_PRNG_EXPORT(fortuna)
/**
Import a PRNG state

View File

@ -147,7 +147,7 @@ int rc4_done(prng_state *prng)
@param prng The PRNG to export
@return CRYPT_OK if successful
*/
_LTC_PRNG_EXPORT(rc4)
LTC_PRNG_EXPORT(rc4)
/**
Import a PRNG state

View File

@ -146,7 +146,7 @@ int sober128_done(prng_state *prng)
@param prng The PRNG to export
@return CRYPT_OK if successful
*/
_LTC_PRNG_EXPORT(sober128)
LTC_PRNG_EXPORT(sober128)
/**
Import a PRNG state

View File

@ -267,7 +267,7 @@ int yarrow_done(prng_state *prng)
@param prng The PRNG to export
@return CRYPT_OK if successful
*/
_LTC_PRNG_EXPORT(yarrow)
LTC_PRNG_EXPORT(yarrow)
/**
Import a PRNG state

View File

@ -10,7 +10,7 @@
#ifdef LTC_SOBER128
#define __LTC_SOBER128TAB_C__
#define LTC_SOBER128TAB_C
#include "sober128tab.c"
/* don't change these... */

View File

@ -6,7 +6,7 @@
SOBER-128 Tables
*/
#ifdef __LTC_SOBER128TAB_C__
#ifdef LTC_SOBER128TAB_C
/* $ID$ */
/* @(#)TuringMultab.h 1.3 (QUALCOMM) 02/09/03 */
@ -163,4 +163,4 @@ static const ulong32 Sbox[256] = {
0xf9e6053f, 0xa4b0d300, 0xd499cbcc, 0xb95e3d40,
};
#endif /* __LTC_SOBER128TAB_C__ */
#endif /* LTC_SOBER128TAB_C */