1 /* { dg-additional-options "-fPIC" { target fpic } } */
3 typedef unsigned long word32
;
4 typedef unsigned char byte
;
5 typedef struct cast256_instance
{ word32 l_key
[96];} cast256_key
;
6 word32 cast256_sbox
[4][256] = {};
8 key (cast256_key
*key
, const word32
*in_key
, const int key_len
)
10 word32 i
, j
, t
, u
, cm
, cr
, lk
[8], tm
[8], tr
[8];
11 for (i
= 0; i
< 96; i
+= 8)
13 for (j
= 0; j
< 8; ++j
)
20 t
= (((tm
[0] + lk
[7]) << ((word32
)(tr
[0] & 31)))
21 | ((tm
[0] + lk
[7]) >> (32 - (word32
)(tr
[0] & 31))));
22 u
= cast256_sbox
[0][((byte
)((t
) >> (8 * 3)))];
23 u
^= cast256_sbox
[1][((byte
)((t
) >> (8 * 2)))];
25 for (j
= 0; j
< 8; ++j
)
31 t
= (((tm
[0] + lk
[7]) << ((word32
)(tr
[0] & 31)))
32 | ((tm
[0] + lk
[7]) >> (32 - (word32
)(tr
[0] & 31))));
33 u
= cast256_sbox
[0][((byte
)((t
) >> (8 * 3)))];
34 u
^= cast256_sbox
[1][((byte
)((t
) >> (8 * 2)))];
35 u
-= cast256_sbox
[2][((byte
)((t
) >> (8 * 1)))];
38 key
->l_key
[i
+ 1] = lk
[2];