All,
Here is a patch to mozilla-sha1/sha1.[ch] that makes the files more portable using types from stdint.h. With gcc 4.3.3 I verified that the assembly produced w/ gcc -O2 -S -c sha1.c before and after the change was identical. The patch also contains a couple of extra casts that allow splint to be silent.
In case the webmail botches the patch below; I've also attached the file. I couldn't find a recommended method for sending in a patch; apologies if this doesn't match the preferred method.
Bill
splint -exportlocal -fixedformalarray sha1.c
Splint 3.1.2 --- 08 Nov 2008
Finished checking --- no warnings
diff --git a/mozilla-sha1/sha1.c b/mozilla-sha1/sha1.c
index 95a4ebf..8c6291c 100644
--- a/mozilla-sha1/sha1.c
+++ b/mozilla-sha1/sha1.c
@@ -56,9 +56,9 @@ void moz_SHA1_Init(moz_SHA_CTX *ctx) {
}
-void moz_SHA1_Update(moz_SHA_CTX *ctx, const void *_dataIn, int len) {
+void moz_SHA1_Update(moz_SHA_CTX *ctx, const void *_dataIn, int32_t len) {
const unsigned char *dataIn = _dataIn;
- int i;
+ int32_t i;
/* Read the data into W and process blocks as they get full
*/
@@ -70,14 +70,14 @@ void moz_SHA1_Update(moz_SHA_CTX *ctx, const void *_dataIn, int len) {
ctx->lenW = 0;
}
ctx->sizeLo += 8;
- ctx->sizeHi += (ctx->sizeLo < 8);
+ ctx->sizeHi += (uint32_t) (ctx->sizeLo < 8);
}
}
void moz_SHA1_Final(unsigned char hashout[20], moz_SHA_CTX *ctx) {
- unsigned char pad0x80 = 0x80;
- unsigned char pad0x00 = 0x00;
+ unsigned char pad0x80 = (unsigned char) 0x80;
+ unsigned char pad0x00 = (unsigned char) 0x00;
unsigned char padlen[8];
int i;
@@ -114,7 +114,7 @@ void moz_SHA1_Final(unsigned char hashout[20], moz_SHA_CTX *ctx) {
static void shaHashBlock(moz_SHA_CTX *ctx) {
int t;
- unsigned int A,B,C,D,E,TEMP;
+ uint32_t A,B,C,D,E,TEMP;
for (t = 16; t <= 79; t++)
ctx->W[t] =
diff --git a/mozilla-sha1/sha1.h b/mozilla-sha1/sha1.h
index aa48a46..2cb5e26 100644
--- a/mozilla-sha1/sha1.h
+++ b/mozilla-sha1/sha1.h
@@ -33,15 +33,17 @@
* GPL.
*/
+#include <stdint.h>
+
typedef struct {
- unsigned int H[5];
- unsigned int W[80];
- int lenW;
- unsigned int sizeHi,sizeLo;
+ uint32_t H[5];
+ uint32_t W[80];
+ int32_t lenW;
+ uint32_t sizeHi,sizeLo;
} moz_SHA_CTX;
void moz_SHA1_Init(moz_SHA_CTX *ctx);
-void moz_SHA1_Update(moz_SHA_CTX *ctx, const void *dataIn, int len);
+void moz_SHA1_Update(moz_SHA_CTX *ctx, const void *dataIn, int32_t len);
void moz_SHA1_Final(unsigned char hashout[20], moz_SHA_CTX *ctx);
#define git_SHA_CTX moz_SHA_CTX
--- On Fri, 7/24/09, Bill Priest <priestwilliaml@yahoo.com> wrote:
| Jesse Barnes | Re: [stable] [BUG][PATCH] cpqphp: fix kernel NULL pointer dereference |
| Greg KH | [003/136] p54usb: add Zcomax XG-705A usbid |
| Magnus Damm | [PATCH 03/07] ARM: Use shared GIC entry macros on Realview |
| Oliver Neukum | Re: [Bug #13682] The webcam stopped working when upgrading from 2.6.29 to 2.6.30 |
| Martin Schwidefsky | Re: [PATCH] optimized ktime_get[_ts] for GENERIC_TIME=y |
git: | |
| Junio C Hamano | Re: Some advanced index playing |
| Jeff King | Re: confusion over the new branch and merge config |
| Robin Rosenberg | Re: cvs2svn conversion directly to git ready for experimentation |
| Linus Torvalds | git binary size... |
| Ævar Arnfjörð Bjarmason | Re: Challenge with Git-Bash |
| Linux Kernel Mailing List | md: move allocation of ->queue from mddev_find to md_probe |
| Linux Kernel Mailing List< |
