[or-cvs] backport bugfix to 0.0.6.x: our integrity-checking digest w...

Roger Dingledine arma at seul.org
Sun May 16 03:44:55 UTC 2004


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);
 }
 



More information about the tor-commits mailing list