1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

fixed bug in sha1sum calculation

This commit is contained in:
Steffen Vogel 2017-03-29 04:26:33 +02:00
parent 5f17ed7786
commit 0290fe03f1

View file

@ -437,8 +437,10 @@ int sha1sum(FILE *f, unsigned char *sha1)
SHA_CTX c;
char buf[512];
ssize_t bytes;
long seek;
rewind(f); /* Rewind the file in order to calculate over the whole file. */
seek = ftell(f);
fseek(f, 0, SEEK_SET);
SHA1_Init(&c);
@ -449,6 +451,8 @@ int sha1sum(FILE *f, unsigned char *sha1)
}
SHA1_Final(sha1, &c);
fseek(f, seek, SEEK_SET);
return 0;
}