62
63
(x) = ((uint64_t) __xl << 32) | __xr; \
65
#define CAMELLIA_ROUNDSM(T, x, k, y) do { \
66
uint32_t __il, __ir; \
68
= T->sp1110[(x) & 0xff] \
69
^ T->sp0222[((x) >> 24) & 0xff] \
70
^ T->sp3033[((x) >> 16) & 0xff] \
71
^ T->sp4404[((x) >> 8) & 0xff]; \
72
/* ir == (t6^t7^t8),(t5^t7^t8),(t5^t6^t8),(t5^t6^t7) */ \
74
= T->sp1110[ (x) >> 56] \
75
^ T->sp0222[((x) >> 48) & 0xff] \
76
^ T->sp3033[((x) >> 40) & 0xff] \
77
^ T->sp4404[((x) >> 32) & 0xff]; \
66
#if HAVE_NATIVE_64_BIT
67
#define CAMELLIA_ROUNDSM(T, x, k, y) do { \
68
uint32_t __il, __ir; \
70
= T->sp1110[(x) & 0xff] \
71
^ T->sp0222[((x) >> 24) & 0xff] \
72
^ T->sp3033[((x) >> 16) & 0xff] \
73
^ T->sp4404[((x) >> 8) & 0xff]; \
74
/* ir == (t6^t7^t8),(t5^t7^t8),(t5^t6^t8),(t5^t6^t7) */ \
76
= T->sp1110[ (x) >> 56] \
77
^ T->sp0222[((x) >> 48) & 0xff] \
78
^ T->sp3033[((x) >> 40) & 0xff] \
79
^ T->sp4404[((x) >> 32) & 0xff]; \
80
/* il == (t1^t3^t4),(t1^t2^t4),(t1^t2^t3),(t2^t3^t4) */ \
82
/* ir == (t1^t3^t4^t6^t7^t8),(t1^t2^t4^t5^t7^t8), \
83
(t1^t2^t3^t5^t6^t8),(t2^t3^t4^t5^t6^t7) \
85
__il = ROL32(24, __il); \
86
/* il == (t2^t3^t4),(t1^t3^t4),(t1^t2^t4),(t1^t2^t3) */ \
88
/* il == (t1^t2^t6^t7^t8),(t2^t3^t5^t7^t8), \
89
(t3^t4^t5^t6^t8),(t1^t4^t5^t6^t7) \
92
y ^= ((uint64_t) __ir << 32) | __il; \
94
#else /* !HAVE_NATIVE_64_BIT */
95
#define CAMELLIA_ROUNDSM(T, x, k, y) do { \
96
uint32_t __il, __ir; \
98
= T->sp1110[(x) & 0xff] \
99
^ T->sp0222[((x) >> 24) & 0xff] \
100
^ T->sp3033[((x) >> 16) & 0xff] \
101
^ T->sp4404[((x) >> 8) & 0xff]; \
102
/* ir == (t6^t7^t8),(t5^t7^t8),(t5^t6^t8),(t5^t6^t7) */ \
104
= T->sp1110[ (x) >> 56] \
105
^ T->sp0222[((x) >> 48) & 0xff] \
106
^ T->sp3033[((x) >> 40) & 0xff] \
107
^ T->sp4404[((x) >> 32) & 0xff]; \
78
108
/* il == (t1^t3^t4),(t1^t2^t4),(t1^t2^t3),(t2^t3^t4) */ \
79
109
__il ^= (k) >> 32; \
80
110
__ir ^= (k) & 0xffffffff; \
82
112
/* ir == (t1^t3^t4^t6^t7^t8),(t1^t2^t4^t5^t7^t8), \
83
(t1^t2^t3^t5^t6^t8),(t2^t3^t4^t5^t6^t7) \
113
(t1^t2^t3^t5^t6^t8),(t2^t3^t4^t5^t6^t7) \
85
115
__il = ROL32(24, __il); \
86
116
/* il == (t2^t3^t4),(t1^t3^t4),(t1^t2^t4),(t1^t2^t3) */ \
88
118
/* il == (t1^t2^t6^t7^t8),(t2^t3^t5^t7^t8), \
89
(t3^t4^t5^t6^t8),(t1^t4^t5^t6^t7) \
119
(t3^t4^t5^t6^t8),(t1^t4^t5^t6^t7) \
91
121
y ^= ((uint64_t) __ir << 32) | __il; \
95
126
_camellia_crypt(const struct camellia_ctx *ctx,