Fossil SCM
Fix harmless compiler warnings in the new hardened SHA1 implementation.
Commit
ed30b3d6685e93b0a63167e01af9265b96bde07a
Parent
796db898c7c5b2c…
2 files changed
+1
-1
+2
-2
+1
-1
| --- src/sha1.c | ||
| +++ src/sha1.c | ||
| @@ -54,11 +54,11 @@ | ||
| 54 | 54 | uint32_t m2[80]; |
| 55 | 55 | uint32_t states[80][5]; |
| 56 | 56 | }; |
| 57 | 57 | #endif |
| 58 | 58 | void SHA1DCInit(SHA1_CTX*); |
| 59 | -void SHA1DCUpdate(SHA1_CTX*, const char*, unsigned); | |
| 59 | +void SHA1DCUpdate(SHA1_CTX*, const unsigned char*, unsigned); | |
| 60 | 60 | int SHA1DCFinal(unsigned char[20], SHA1_CTX*); |
| 61 | 61 | |
| 62 | 62 | #define SHA1Context SHA1_CTX |
| 63 | 63 | #define SHA1Init SHA1DCInit |
| 64 | 64 | #define SHA1Update SHA1DCUpdate |
| 65 | 65 |
| --- src/sha1.c | |
| +++ src/sha1.c | |
| @@ -54,11 +54,11 @@ | |
| 54 | uint32_t m2[80]; |
| 55 | uint32_t states[80][5]; |
| 56 | }; |
| 57 | #endif |
| 58 | void SHA1DCInit(SHA1_CTX*); |
| 59 | void SHA1DCUpdate(SHA1_CTX*, const char*, unsigned); |
| 60 | int SHA1DCFinal(unsigned char[20], SHA1_CTX*); |
| 61 | |
| 62 | #define SHA1Context SHA1_CTX |
| 63 | #define SHA1Init SHA1DCInit |
| 64 | #define SHA1Update SHA1DCUpdate |
| 65 |
| --- src/sha1.c | |
| +++ src/sha1.c | |
| @@ -54,11 +54,11 @@ | |
| 54 | uint32_t m2[80]; |
| 55 | uint32_t states[80][5]; |
| 56 | }; |
| 57 | #endif |
| 58 | void SHA1DCInit(SHA1_CTX*); |
| 59 | void SHA1DCUpdate(SHA1_CTX*, const unsigned char*, unsigned); |
| 60 | int SHA1DCFinal(unsigned char[20], SHA1_CTX*); |
| 61 | |
| 62 | #define SHA1Context SHA1_CTX |
| 63 | #define SHA1Init SHA1DCInit |
| 64 | #define SHA1Update SHA1DCUpdate |
| 65 |
+2
-2
| --- src/sha1hard.c | ||
| +++ src/sha1hard.c | ||
| @@ -1500,11 +1500,11 @@ | ||
| 1500 | 1500 | void SHA1DCSetCallback(SHA1_CTX* ctx, collision_block_callback callback) |
| 1501 | 1501 | { |
| 1502 | 1502 | ctx->callback = callback; |
| 1503 | 1503 | } |
| 1504 | 1504 | |
| 1505 | -void SHA1DCUpdate(SHA1_CTX* ctx, const char* buf, unsigned len) | |
| 1505 | +void SHA1DCUpdate(SHA1_CTX* ctx, const unsigned char* buf, unsigned len) | |
| 1506 | 1506 | { |
| 1507 | 1507 | unsigned left, fill; |
| 1508 | 1508 | if (len == 0) |
| 1509 | 1509 | return; |
| 1510 | 1510 | |
| @@ -1554,11 +1554,11 @@ | ||
| 1554 | 1554 | int SHA1DCFinal(unsigned char output[20], SHA1_CTX *ctx) |
| 1555 | 1555 | { |
| 1556 | 1556 | uint32_t last = ctx->total & 63; |
| 1557 | 1557 | uint32_t padn = (last < 56) ? (56 - last) : (120 - last); |
| 1558 | 1558 | uint64_t total; |
| 1559 | - SHA1DCUpdate(ctx, (const char*)(sha1_padding), padn); | |
| 1559 | + SHA1DCUpdate(ctx, sha1_padding, padn); | |
| 1560 | 1560 | |
| 1561 | 1561 | total = ctx->total - padn; |
| 1562 | 1562 | total <<= 3; |
| 1563 | 1563 | ctx->buffer[56] = (unsigned char)(total >> 56); |
| 1564 | 1564 | ctx->buffer[57] = (unsigned char)(total >> 48); |
| 1565 | 1565 |
| --- src/sha1hard.c | |
| +++ src/sha1hard.c | |
| @@ -1500,11 +1500,11 @@ | |
| 1500 | void SHA1DCSetCallback(SHA1_CTX* ctx, collision_block_callback callback) |
| 1501 | { |
| 1502 | ctx->callback = callback; |
| 1503 | } |
| 1504 | |
| 1505 | void SHA1DCUpdate(SHA1_CTX* ctx, const char* buf, unsigned len) |
| 1506 | { |
| 1507 | unsigned left, fill; |
| 1508 | if (len == 0) |
| 1509 | return; |
| 1510 | |
| @@ -1554,11 +1554,11 @@ | |
| 1554 | int SHA1DCFinal(unsigned char output[20], SHA1_CTX *ctx) |
| 1555 | { |
| 1556 | uint32_t last = ctx->total & 63; |
| 1557 | uint32_t padn = (last < 56) ? (56 - last) : (120 - last); |
| 1558 | uint64_t total; |
| 1559 | SHA1DCUpdate(ctx, (const char*)(sha1_padding), padn); |
| 1560 | |
| 1561 | total = ctx->total - padn; |
| 1562 | total <<= 3; |
| 1563 | ctx->buffer[56] = (unsigned char)(total >> 56); |
| 1564 | ctx->buffer[57] = (unsigned char)(total >> 48); |
| 1565 |
| --- src/sha1hard.c | |
| +++ src/sha1hard.c | |
| @@ -1500,11 +1500,11 @@ | |
| 1500 | void SHA1DCSetCallback(SHA1_CTX* ctx, collision_block_callback callback) |
| 1501 | { |
| 1502 | ctx->callback = callback; |
| 1503 | } |
| 1504 | |
| 1505 | void SHA1DCUpdate(SHA1_CTX* ctx, const unsigned char* buf, unsigned len) |
| 1506 | { |
| 1507 | unsigned left, fill; |
| 1508 | if (len == 0) |
| 1509 | return; |
| 1510 | |
| @@ -1554,11 +1554,11 @@ | |
| 1554 | int SHA1DCFinal(unsigned char output[20], SHA1_CTX *ctx) |
| 1555 | { |
| 1556 | uint32_t last = ctx->total & 63; |
| 1557 | uint32_t padn = (last < 56) ? (56 - last) : (120 - last); |
| 1558 | uint64_t total; |
| 1559 | SHA1DCUpdate(ctx, sha1_padding, padn); |
| 1560 | |
| 1561 | total = ctx->total - padn; |
| 1562 | total <<= 3; |
| 1563 | ctx->buffer[56] = (unsigned char)(total >> 56); |
| 1564 | ctx->buffer[57] = (unsigned char)(total >> 48); |
| 1565 |