summaryrefslogtreecommitdiff
path: root/src/common/crypto_curve25519.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2014-09-25 17:50:13 -0400
committerNick Mathewson <nickm@torproject.org>2014-09-25 17:50:13 -0400
commit9190468246c75051a4dd11ec95342df50ea1dc75 (patch)
tree3aa3847b90ad34426963f1b1c2bae89f1bde8f74 /src/common/crypto_curve25519.c
parent1c5d680b3d6734e989a92deedbcf2bb46f31f7f9 (diff)
downloadtor-9190468246c75051a4dd11ec95342df50ea1dc75.tar.gz
tor-9190468246c75051a4dd11ec95342df50ea1dc75.zip
Fix warnings on 32-bit builds.
When size_t is the most memory you can have, make sure that things referring to real parts of memory are size_t, not uint64_t or off_t. But not on any released Tor.
Diffstat (limited to 'src/common/crypto_curve25519.c')
-rw-r--r--src/common/crypto_curve25519.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/common/crypto_curve25519.c b/src/common/crypto_curve25519.c
index 44b280a346..dcb1e95208 100644
--- a/src/common/crypto_curve25519.c
+++ b/src/common/crypto_curve25519.c
@@ -181,6 +181,7 @@ crypto_read_tagged_contents_from_file(const char *fname,
char *content = NULL;
struct stat st;
ssize_t r = -1;
+ size_t st_size;
*tag_out = NULL;
st.st_size = 0;
@@ -189,6 +190,7 @@ crypto_read_tagged_contents_from_file(const char *fname,
goto end;
if (st.st_size < 32 || st.st_size > 32 + data_out_len)
goto end;
+ st_size = (size_t)st.st_size;
memcpy(prefix, content, 32);
prefix[32] = 0;
@@ -205,12 +207,12 @@ crypto_read_tagged_contents_from_file(const char *fname,
*tag_out = tor_strndup(prefix+5+strlen(typestring),
strlen(prefix)-8-strlen(typestring));
- memcpy(data_out, content+32, st.st_size-32);
- r = st.st_size - 32;
+ memcpy(data_out, content+32, st_size-32);
+ r = st_size - 32;
end:
if (content)
- memwipe(content, 0, st.st_size);
+ memwipe(content, 0, st_size);
tor_free(content);
return r;
}