summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2021-05-28 02:59:18 +0200
committerGravatar Nikias Bassen2021-05-28 02:59:18 +0200
commitab6592861713fcae4d3c3d831ae75394e6262582 (patch)
tree8210eadca38239ada8feccaf21868cb80f9d23ba
parent0a76f61a4ca56a67548ee296695fe39af15862eb (diff)
downloadidevicerestore-ab6592861713fcae4d3c3d831ae75394e6262582.tar.gz
idevicerestore-ab6592861713fcae4d3c3d831ae75394e6262582.tar.bz2
Update internal SHA1 and SHA1Update function prototypes to match OpenSSL's SHA1/SHA1_Update
-rw-r--r--src/sha1.c20
-rw-r--r--src/sha1.h8
2 files changed, 14 insertions, 14 deletions
diff --git a/src/sha1.c b/src/sha1.c
index 09e68fd..02557ff 100644
--- a/src/sha1.c
+++ b/src/sha1.c
@@ -197,12 +197,12 @@ void SHA1Init(
void SHA1Update(
SHA1_CTX * context,
const unsigned char *data,
- uint32_t len
+ size_t len
)
{
- uint32_t i;
+ size_t i;
- uint32_t j;
+ size_t j;
j = context->count[0];
if ((context->count[0] += len << 3) < j)
@@ -279,16 +279,16 @@ void SHA1Final(
}
void SHA1(
- char *hash_out,
- const char *str,
- int len)
+ const unsigned char *str,
+ size_t len,
+ unsigned char *hash_out
+)
{
SHA1_CTX ctx;
- unsigned int ii;
+ size_t ii;
SHA1Init(&ctx);
for (ii=0; ii<len; ii+=1)
- SHA1Update(&ctx, (const unsigned char*)str + ii, 1);
- SHA1Final((unsigned char *)hash_out, &ctx);
- hash_out[20] = '\0';
+ SHA1Update(&ctx, str + ii, 1);
+ SHA1Final(hash_out, &ctx);
}
diff --git a/src/sha1.h b/src/sha1.h
index 96bb008..c8e9f68 100644
--- a/src/sha1.h
+++ b/src/sha1.h
@@ -28,7 +28,7 @@ void SHA1Init(
void SHA1Update(
SHA1_CTX * context,
const unsigned char *data,
- uint32_t len
+ size_t len
);
void SHA1Final(
@@ -37,8 +37,8 @@ void SHA1Final(
);
void SHA1(
- char *hash_out,
- const char *str,
- int len);
+ const unsigned char *str,
+ size_t len,
+ unsigned char *hash_out);
#endif /* SHA1_H */