Bug #4320 » sha2.c.diff
| ext/digest/sha2/sha2.c (working copy) | ||
|---|---|---|
|
*
|
||
|
*/
|
||
|
/*
|
||
|
* #if condition from regint.h - XXX there must exist a nicer way
|
||
|
*/
|
||
|
#if defined(__i386) || defined(__i386__) || defined(_M_IX86) || \
|
||
|
(defined(__ppc__) && defined(__APPLE__)) || \
|
||
|
defined(__x86_64) || defined(__x86_64__) || defined(_M_AMD86) || \
|
||
|
defined(__mc68020__)
|
||
|
#define PLATFORM_UNALIGNED_WORD_ACCESS
|
||
|
#endif
|
||
|
/*** SHA-256/384/512 Machine Architecture Definitions *****************/
|
||
|
/*
|
||
|
* BYTE_ORDER NOTE:
|
||
| ... | ... | |
|
}
|
||
|
while (len >= SHA256_BLOCK_LENGTH) {
|
||
|
/* Process as many complete blocks as we can */
|
||
|
#ifdef PLATFORM_UNALIGNED_WORD_ACCESS
|
||
|
SHA256_Transform(context, (sha2_word32*)data);
|
||
|
#else
|
||
|
MEMCPY_BCOPY(context->buffer, data, SHA256_BLOCK_LENGTH);
|
||
|
SHA256_Transform(context, (sha2_word32*)context->buffer);
|
||
|
#endif
|
||
|
context->bitcount += SHA256_BLOCK_LENGTH << 3;
|
||
|
len -= SHA256_BLOCK_LENGTH;
|
||
|
data += SHA256_BLOCK_LENGTH;
|
||
| ... | ... | |
|
}
|
||
|
while (len >= SHA512_BLOCK_LENGTH) {
|
||
|
/* Process as many complete blocks as we can */
|
||
|
#ifdef PLATFORM_UNALIGNED_WORD_ACCESS
|
||
|
SHA512_Transform(context, (sha2_word64*)data);
|
||
|
#else
|
||
|
MEMCPY_BCOPY(context->buffer, data, SHA512_BLOCK_LENGTH);
|
||
|
SHA512_Transform(context, (sha2_word64*)context->buffer);
|
||
|
#endif
|
||
|
ADDINC128(context->bitcount, SHA512_BLOCK_LENGTH << 3);
|
||
|
len -= SHA512_BLOCK_LENGTH;
|
||
|
data += SHA512_BLOCK_LENGTH;
|
||
- « Previous
- 1
- 2
- Next »