aboutsummaryrefslogtreecommitdiff
path: root/libbb/sha1.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-11-11 01:38:04 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-11-11 01:38:04 +0000
commite9b9a19ad30e004b3532105af417e43575ce7779 (patch)
tree149fe884916ee0be75e384fbcbb908695499c8d7 /libbb/sha1.c
parent6f05874b9dc4623512878566d144b0905700525d (diff)
downloadbusybox-w32-e9b9a19ad30e004b3532105af417e43575ce7779.tar.gz
busybox-w32-e9b9a19ad30e004b3532105af417e43575ce7779.tar.bz2
busybox-w32-e9b9a19ad30e004b3532105af417e43575ce7779.zip
libbb: disable a second md5 implementation which managed to creep in :)
function old new delta sha512_end 239 237 -2 sha256_end 162 160 -2 sha1_end 191 189 -2 md5_end 168 166 -2 __md5__magic 4 - -4 md5_crypt 627 621 -6 static.S 16 - -16 __md5_Init 42 - -42 static.P 64 - -64 __md5_Final 131 - -131 __md5_Update 153 - -153 static.C 268 12 -256 __md5_Transform 293 - -293 ------------------------------------------------------------------------------ (add/remove: 0/7 grow/shrink: 0/6 up/down: 0/-973) Total: -973 bytes
Diffstat (limited to 'libbb/sha1.c')
-rw-r--r--libbb/sha1.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/libbb/sha1.c b/libbb/sha1.c
index fa468a295..76d5c8fbb 100644
--- a/libbb/sha1.c
+++ b/libbb/sha1.c
@@ -546,7 +546,7 @@ void FAST_FUNC sha512_hash(const void *buffer, size_t len, sha512_ctx_t *ctx)
546} 546}
547 547
548 548
549void* FAST_FUNC sha1_end(void *resbuf, sha1_ctx_t *ctx) 549void FAST_FUNC sha1_end(void *resbuf, sha1_ctx_t *ctx)
550{ 550{
551 /* SHA1 Final padding and digest calculation */ 551 /* SHA1 Final padding and digest calculation */
552#if BB_BIG_ENDIAN 552#if BB_BIG_ENDIAN
@@ -593,8 +593,6 @@ void* FAST_FUNC sha1_end(void *resbuf, sha1_ctx_t *ctx)
593 /* misaligned for 32-bit words */ 593 /* misaligned for 32-bit words */
594 for (i = 0; i < SHA1_DIGEST_SIZE; ++i) 594 for (i = 0; i < SHA1_DIGEST_SIZE; ++i)
595 hval[i] = (unsigned char) (ctx->hash[i >> 2] >> 8 * (~i & 3)); 595 hval[i] = (unsigned char) (ctx->hash[i >> 2] >> 8 * (~i & 3));
596
597 return resbuf;
598} 596}
599 597
600 598
@@ -603,7 +601,7 @@ void* FAST_FUNC sha1_end(void *resbuf, sha1_ctx_t *ctx)
603 601
604 IMPORTANT: On some systems it is required that RESBUF is correctly 602 IMPORTANT: On some systems it is required that RESBUF is correctly
605 aligned for a 32 bits value. */ 603 aligned for a 32 bits value. */
606void* FAST_FUNC sha256_end(void *resbuf, sha256_ctx_t *ctx) 604void FAST_FUNC sha256_end(void *resbuf, sha256_ctx_t *ctx)
607{ 605{
608 /* Take yet unprocessed bytes into account. */ 606 /* Take yet unprocessed bytes into account. */
609 uint32_t bytes = ctx->buflen; 607 uint32_t bytes = ctx->buflen;
@@ -630,8 +628,6 @@ void* FAST_FUNC sha256_end(void *resbuf, sha256_ctx_t *ctx)
630 /* Put result from CTX in first 32 bytes following RESBUF. */ 628 /* Put result from CTX in first 32 bytes following RESBUF. */
631 for (unsigned i = 0; i < 8; ++i) 629 for (unsigned i = 0; i < 8; ++i)
632 ((uint32_t *) resbuf)[i] = ntohl(ctx->H[i]); 630 ((uint32_t *) resbuf)[i] = ntohl(ctx->H[i]);
633
634 return resbuf;
635} 631}
636 632
637/* Process the remaining bytes in the internal buffer and the usual 633/* Process the remaining bytes in the internal buffer and the usual
@@ -639,7 +635,7 @@ void* FAST_FUNC sha256_end(void *resbuf, sha256_ctx_t *ctx)
639 635
640 IMPORTANT: On some systems it is required that RESBUF is correctly 636 IMPORTANT: On some systems it is required that RESBUF is correctly
641 aligned for a 64 bits value. */ 637 aligned for a 64 bits value. */
642void* FAST_FUNC sha512_end(void *resbuf, sha512_ctx_t *ctx) 638void FAST_FUNC sha512_end(void *resbuf, sha512_ctx_t *ctx)
643{ 639{
644 /* Take yet unprocessed bytes into account. */ 640 /* Take yet unprocessed bytes into account. */
645 uint64_t bytes = ctx->buflen; 641 uint64_t bytes = ctx->buflen;
@@ -666,6 +662,4 @@ void* FAST_FUNC sha512_end(void *resbuf, sha512_ctx_t *ctx)
666 /* Put result from CTX in first 64 bytes following RESBUF. */ 662 /* Put result from CTX in first 64 bytes following RESBUF. */
667 for (unsigned i = 0; i < 8; ++i) 663 for (unsigned i = 0; i < 8; ++i)
668 ((uint64_t *) resbuf)[i] = hton64(ctx->H[i]); 664 ((uint64_t *) resbuf)[i] = hton64(ctx->H[i]);
669
670 return resbuf;
671} 665}