|
16 | 16 |
|
17 | 17 | /* |
18 | 18 | Because Little-Endian architectures are most common, |
19 | | - we only set BIGENDIAN if one of these conditions is met. |
| 19 | + we only set SHA1DC_BIGENDIAN if one of these conditions is met. |
20 | 20 | Note that all MSFT platforms are little endian, |
21 | 21 | so none of these will be defined under the MSC compiler. |
22 | 22 | If you are compiling on a big endian platform and your compiler does not define one of these, |
23 | 23 | you will have to add whatever macros your tool chain defines to indicate Big-Endianness. |
24 | 24 | */ |
25 | | -#if (defined(__BYTE_ORDER) && (__BYTE_ORDER==__BIG_ENDIAN)) || \ |
| 25 | +#ifdefSHA1DC_BIGENDIAN |
| 26 | +#undef SHA1DC_BIGENDIAN |
| 27 | +#endif |
| 28 | +#if (!defined SHA1DC_FORCE_LITTLEENDIAN) && \ |
| 29 | + ((defined(__BYTE_ORDER) && (__BYTE_ORDER==__BIG_ENDIAN)) || \ |
26 | 30 | (defined(__BYTE_ORDER__) && (__BYTE_ORDER__==__BIG_ENDIAN__)) || \ |
27 | 31 | defined(__BIG_ENDIAN__) || defined(__ARMEB__) || defined(__THUMBEB__) || defined(__AARCH64EB__) || \ |
28 | | - defined(_MIPSEB) || defined(__MIPSEB) || defined(__MIPSEB__) |
| 32 | + defined(_MIPSEB) || defined(__MIPSEB) || defined(__MIPSEB__)|| defined(SHA1DC_FORCE_BIGENDIAN)) |
29 | 33 |
|
30 | | -#defineBIGENDIAN (1) |
| 34 | +#defineSHA1DC_BIGENDIAN |
31 | 35 |
|
32 | 36 | #endif/*ENDIANNESS SELECTION*/ |
33 | 37 |
|
|
39 | 43 |
|
40 | 44 | #definesha1_mix(W, t) (rotate_left(W[t - 3] ^ W[t - 8] ^ W[t - 14] ^ W[t - 16], 1)) |
41 | 45 |
|
42 | | -#if defined(BIGENDIAN) |
| 46 | +#ifdefSHA1DC_BIGENDIAN |
43 | 47 | #definesha1_load(m, t, temp){temp = m[t]} |
44 | 48 | #else |
45 | 49 | #definesha1_load(m, t, temp){temp = m[t]; sha1_bswap32(temp)} |
46 | | -#endif/*define(BIGENDIAN)*/ |
| 50 | +#endif |
47 | 51 |
|
48 | 52 | #definesha1_store(W, t, x) *(volatile uint32_t *)&W[t] = x |
49 | 53 |
|
|
0 commit comments