[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] backport bugfix to 0.0.6.x: our integrity-checking digest w...
- To: or-cvs@freehaven.net
- Subject: [or-cvs] backport bugfix to 0.0.6.x: our integrity-checking digest w...
- From: arma@seul.org (Roger Dingledine)
- Date: Sat, 15 May 2004 23:44:55 -0400 (EDT)
- Delivered-to: archiver@seul.org
- Delivered-to: or-cvs-outgoing@seul.org
- Delivered-to: or-cvs@seul.org
- Delivery-date: Sat, 15 May 2004 23:45:15 -0400
- Reply-to: or-dev@freehaven.net
- Sender: owner-or-cvs@freehaven.net
Update of /home2/or/cvsroot/src/common
In directory moria.mit.edu:/home2/arma/work/onion/0062/src/common
Modified Files:
Tag: tor-0_0_6-patches
crypto.c
Log Message:
backport bugfix to 0.0.6.x: our integrity-checking digest was checking
only the most recent cell, not the previous cells like we'd thought.
this change is backward incompatible.
Index: crypto.c
===================================================================
RCS file: /home2/or/cvsroot/src/common/crypto.c,v
retrieving revision 1.89
retrieving revision 1.89.2.1
diff -u -d -r1.89 -r1.89.2.1
--- crypto.c 1 May 2004 23:29:20 -0000 1.89
+++ crypto.c 16 May 2004 03:44:53 -0000 1.89.2.1
@@ -1018,9 +1018,12 @@
char *out, size_t out_len)
{
static char r[DIGEST_LEN];
+ SHA_CTX tmpctx;
tor_assert(digest && out);
tor_assert(out_len <= DIGEST_LEN);
- SHA1_Final(r, &digest->d);
+ /* memcpy into a temporary ctx, since SHA1_Final clears the context */
+ memcpy(&tmpctx, &digest->d, sizeof(SHA_CTX));
+ SHA1_Final(r, &tmpctx);
memcpy(out, r, out_len);
}