From: Magnus Damm <[email protected]> This patch modifies the sha1 applet to fix a name clash issue triggered when building with an older sh7722 tool chain.
Signed-off-by: Magnus Damm <[email protected]> --- CC libbb/sha1.o libbb/sha1.c:176:1: error: "R0" redefined In file included from /home/damm/build/cross/mobiler/usr/share/gnush4-nofpu_linux_v0701-1/bin/../sh3-linux/sys-root/usr/include/signal.h:351, from include/libbb.h:22, from libbb/sha1.c:31: /home/damm/build/cross/mobiler/usr/share/gnush4-nofpu_linux_v0701-1/bin/../sh3-linux/sys-root/usr/include/sys/ucontext.h:45:1: error: this is the location of the previous definition libbb/sha1.c:177:1: error: "R1" redefined /home/damm/build/cross/mobiler/usr/share/gnush4-nofpu_linux_v0701-1/bin/../sh3-linux/sys-root/usr/include/sys/ucontext.h:47:1: error: this is the location of the previous definition make[1]: *** [libbb/sha1.o] Error 1 make: *** [libbb] Error 2 d...@rx1 ~/build/busybox/20090805/busybox-1.14.2 $ d...@rx1 ~/build/busybox/20090805/busybox-1.14.2 $ _gcc --version sh3-linux-gcc (GCC) 4.2-SH4-LINUX_v0701 Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. libbb/sha1.c | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) --- 0001/libbb/sha1.c +++ work/libbb/sha1.c 2009-07-24 12:29:01.000000000 +0900 @@ -171,10 +171,10 @@ static void FAST_FUNC sha256_process_blo /* Operators defined in FIPS 180-2:4.1.2. */ #define Ch(x, y, z) ((x & y) ^ (~x & z)) #define Maj(x, y, z) ((x & y) ^ (x & z) ^ (y & z)) -#define S0(x) (rotr32(x, 2) ^ rotr32(x, 13) ^ rotr32(x, 22)) -#define S1(x) (rotr32(x, 6) ^ rotr32(x, 11) ^ rotr32(x, 25)) -#define R0(x) (rotr32(x, 7) ^ rotr32(x, 18) ^ (x >> 3)) -#define R1(x) (rotr32(x, 17) ^ rotr32(x, 19) ^ (x >> 10)) +#define _S0(x) (rotr32(x, 2) ^ rotr32(x, 13) ^ rotr32(x, 22)) +#define _S1(x) (rotr32(x, 6) ^ rotr32(x, 11) ^ rotr32(x, 25)) +#define _R0(x) (rotr32(x, 7) ^ rotr32(x, 18) ^ (x >> 3)) +#define _R1(x) (rotr32(x, 17) ^ rotr32(x, 19) ^ (x >> 10)) /* Compute the message schedule according to FIPS 180-2:6.2.2 step 2. */ for (t = 0; t < 16; ++t) { @@ -183,7 +183,7 @@ static void FAST_FUNC sha256_process_blo } for (/*t = 16*/; t < 64; ++t) - W[t] = R1(W[t - 2]) + W[t - 7] + R0(W[t - 15]) + W[t - 16]; + W[t] = _R1(W[t - 2]) + W[t - 7] + _R0(W[t - 15]) + W[t - 16]; a = ctx->hash[0]; b = ctx->hash[1]; @@ -201,8 +201,8 @@ static void FAST_FUNC sha256_process_blo * upper half) */ uint32_t K_t = sha_K[t] >> 32; - uint32_t T1 = h + S1(e) + Ch(e, f, g) + K_t + W[t]; - uint32_t T2 = S0(a) + Maj(a, b, c); + uint32_t T1 = h + _S1(e) + Ch(e, f, g) + K_t + W[t]; + uint32_t T2 = _S0(a) + Maj(a, b, c); h = g; g = f; f = e; @@ -214,10 +214,10 @@ static void FAST_FUNC sha256_process_blo } #undef Ch #undef Maj -#undef S0 -#undef S1 -#undef R0 -#undef R1 +#undef _S0 +#undef _S1 +#undef _R0 +#undef _R1 /* Add the starting values of the context according to FIPS 180-2:6.2.2 step 4. */ ctx->hash[0] += a; @@ -250,10 +250,10 @@ static void FAST_FUNC sha512_process_blo /* Operators defined in FIPS 180-2:4.1.2. */ #define Ch(x, y, z) ((x & y) ^ (~x & z)) #define Maj(x, y, z) ((x & y) ^ (x & z) ^ (y & z)) -#define S0(x) (rotr64(x, 28) ^ rotr64(x, 34) ^ rotr64(x, 39)) -#define S1(x) (rotr64(x, 14) ^ rotr64(x, 18) ^ rotr64(x, 41)) -#define R0(x) (rotr64(x, 1) ^ rotr64(x, 8) ^ (x >> 7)) -#define R1(x) (rotr64(x, 19) ^ rotr64(x, 61) ^ (x >> 6)) +#define _S0(x) (rotr64(x, 28) ^ rotr64(x, 34) ^ rotr64(x, 39)) +#define _S1(x) (rotr64(x, 14) ^ rotr64(x, 18) ^ rotr64(x, 41)) +#define _R0(x) (rotr64(x, 1) ^ rotr64(x, 8) ^ (x >> 7)) +#define _R1(x) (rotr64(x, 19) ^ rotr64(x, 61) ^ (x >> 6)) /* Compute the message schedule according to FIPS 180-2:6.3.2 step 2. */ for (t = 0; t < 16; ++t) { @@ -261,12 +261,12 @@ static void FAST_FUNC sha512_process_blo words++; } for (/*t = 16*/; t < 80; ++t) - W[t] = R1(W[t - 2]) + W[t - 7] + R0(W[t - 15]) + W[t - 16]; + W[t] = _R1(W[t - 2]) + W[t - 7] + _R0(W[t - 15]) + W[t - 16]; /* The actual computation according to FIPS 180-2:6.3.2 step 3. */ for (t = 0; t < 80; ++t) { - uint64_t T1 = h + S1(e) + Ch(e, f, g) + sha_K[t] + W[t]; - uint64_t T2 = S0(a) + Maj(a, b, c); + uint64_t T1 = h + +_S1(e) + Ch(e, f, g) + sha_K[t] + W[t]; + uint64_t T2 = _S0(a) + Maj(a, b, c); h = g; g = f; f = e; @@ -278,10 +278,10 @@ static void FAST_FUNC sha512_process_blo } #undef Ch #undef Maj -#undef S0 -#undef S1 -#undef R0 -#undef R1 +#undef _S0 +#undef _S1 +#undef _R0 +#undef _R1 /* Add the starting values of the context according to FIPS 180-2:6.3.2 step 4. */ ctx->hash[0] += a; _______________________________________________ busybox mailing list [email protected] http://lists.busybox.net/mailman/listinfo/busybox
