Remove untested, unnecessary big-endian SHA-1/SHA-256 optimizations.

Change-Id: I3939923d297b901719cb3fb4cff20e770f780c7a
Reviewed-on: https://boringssl-review.googlesource.com/6441
Reviewed-by: Adam Langley <agl@google.com>
This commit is contained in:
Brian Smith 2015-11-04 19:26:01 -10:00 committed by Adam Langley
parent 38feb990a1
commit 9d94d5e4ae
2 changed files with 97 additions and 184 deletions

View File

@ -198,49 +198,6 @@ static void sha1_block_data_order(uint32_t *state, const uint8_t *data,
E = state[4];
for (;;) {
const union {
long one;
char little;
} is_endian = {1};
if (!is_endian.little && ((uintptr_t)data % 4) == 0) {
const uint32_t *W = (const uint32_t *)data;
X(0) = W[0];
X(1) = W[1];
BODY_00_15(0, A, B, C, D, E, T, X(0));
X(2) = W[2];
BODY_00_15(1, T, A, B, C, D, E, X(1));
X(3) = W[3];
BODY_00_15(2, E, T, A, B, C, D, X(2));
X(4) = W[4];
BODY_00_15(3, D, E, T, A, B, C, X(3));
X(5) = W[5];
BODY_00_15(4, C, D, E, T, A, B, X(4));
X(6) = W[6];
BODY_00_15(5, B, C, D, E, T, A, X(5));
X(7) = W[7];
BODY_00_15(6, A, B, C, D, E, T, X(6));
X(8) = W[8];
BODY_00_15(7, T, A, B, C, D, E, X(7));
X(9) = W[9];
BODY_00_15(8, E, T, A, B, C, D, X(8));
X(10) = W[10];
BODY_00_15(9, D, E, T, A, B, C, X(9));
X(11) = W[11];
BODY_00_15(10, C, D, E, T, A, B, X(10));
X(12) = W[12];
BODY_00_15(11, B, C, D, E, T, A, X(11));
X(13) = W[13];
BODY_00_15(12, A, B, C, D, E, T, X(12));
X(14) = W[14];
BODY_00_15(13, T, A, B, C, D, E, X(13));
X(15) = W[15];
BODY_00_15(14, E, T, A, B, C, D, X(14));
BODY_00_15(15, D, E, T, A, B, C, X(15));
data += HASH_CBLOCK;
} else {
(void)HOST_c2l(data, l);
X(0) = l;
(void)HOST_c2l(data, l);
@ -289,7 +246,6 @@ static void sha1_block_data_order(uint32_t *state, const uint8_t *data,
X(15) = l;
BODY_00_15(14, E, T, A, B, C, D, X(14));
BODY_00_15(15, D, E, T, A, B, C, X(15));
}
BODY_16_19(16, C, D, E, T, A, B, X(0), X(0), X(2), X(8), X(13));
BODY_16_19(17, B, C, D, E, T, A, X(1), X(1), X(3), X(9), X(14));

View File

@ -238,10 +238,6 @@ static void sha256_block_data_order(uint32_t *state, const uint8_t *data,
uint32_t a, b, c, d, e, f, g, h, s0, s1, T1;
uint32_t X[16];
int i;
const union {
long one;
char little;
} is_endian = {1};
while (num--) {
a = state[0];
@ -253,44 +249,6 @@ static void sha256_block_data_order(uint32_t *state, const uint8_t *data,
g = state[6];
h = state[7];
if (!is_endian.little && ((uintptr_t)data % 4) == 0) {
const uint32_t *W = (const uint32_t *)data;
T1 = X[0] = W[0];
ROUND_00_15(0, a, b, c, d, e, f, g, h);
T1 = X[1] = W[1];
ROUND_00_15(1, h, a, b, c, d, e, f, g);
T1 = X[2] = W[2];
ROUND_00_15(2, g, h, a, b, c, d, e, f);
T1 = X[3] = W[3];
ROUND_00_15(3, f, g, h, a, b, c, d, e);
T1 = X[4] = W[4];
ROUND_00_15(4, e, f, g, h, a, b, c, d);
T1 = X[5] = W[5];
ROUND_00_15(5, d, e, f, g, h, a, b, c);
T1 = X[6] = W[6];
ROUND_00_15(6, c, d, e, f, g, h, a, b);
T1 = X[7] = W[7];
ROUND_00_15(7, b, c, d, e, f, g, h, a);
T1 = X[8] = W[8];
ROUND_00_15(8, a, b, c, d, e, f, g, h);
T1 = X[9] = W[9];
ROUND_00_15(9, h, a, b, c, d, e, f, g);
T1 = X[10] = W[10];
ROUND_00_15(10, g, h, a, b, c, d, e, f);
T1 = X[11] = W[11];
ROUND_00_15(11, f, g, h, a, b, c, d, e);
T1 = X[12] = W[12];
ROUND_00_15(12, e, f, g, h, a, b, c, d);
T1 = X[13] = W[13];
ROUND_00_15(13, d, e, f, g, h, a, b, c);
T1 = X[14] = W[14];
ROUND_00_15(14, c, d, e, f, g, h, a, b);
T1 = X[15] = W[15];
ROUND_00_15(15, b, c, d, e, f, g, h, a);
data += HASH_CBLOCK;
} else {
uint32_t l;
HOST_c2l(data, l);
@ -341,7 +299,6 @@ static void sha256_block_data_order(uint32_t *state, const uint8_t *data,
HOST_c2l(data, l);
T1 = X[15] = l;
ROUND_00_15(15, b, c, d, e, f, g, h, a);
}
for (i = 16; i < 64; i += 8) {
ROUND_16_63(i + 0, a, b, c, d, e, f, g, h, X);