Browse Source

Converting u_char[] -> u_int[] is easy on little endian machines :-)

OPENBSD_2_2
millert 27 years ago
parent
commit
8e81b80acc
1 changed files with 5 additions and 1 deletions
  1. +5
    -1
      src/lib/libc/hash/rmd160.c

+ 5
- 1
src/lib/libc/hash/rmd160.c View File

@ -320,12 +320,16 @@ void RMD160Update(context, data, nbytes)
{ {
u_int32_t i, j, X[16]; u_int32_t i, j, X[16];
(void)memset(X, 0, 16 * sizeof(u_int32_t));
(void)memset(X, 0, sizeof(X));
/* process all complete blocks */ /* process all complete blocks */
for (i = 0; i < (nbytes >> 6); i++) { for (i = 0; i < (nbytes >> 6); i++) {
#if BYTE_ORDER == LITTLE_ENDIAN
(void)memcpy(X, data, sizeof(X));
#else
for (j=0; j < 16; j++) for (j=0; j < 16; j++)
X[j] = BYTES_TO_DWORD(data + (64 * i) + (4 * j)); X[j] = BYTES_TO_DWORD(data + (64 * i) + (4 * j));
#endif
RMD160Transform(context->state, X); RMD160Transform(context->state, X);
} }


Loading…
Cancel
Save