[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Merge remote-tracking branch 'origin/maint-0.2.4'



commit da30adcf0fd048d1f2e7a4b76e2c880cc3824e6e
Merge: 5f035e2 9fec0c1
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Thu Apr 18 11:16:05 2013 -0400

    Merge remote-tracking branch 'origin/maint-0.2.4'
    
    Conflicts:
    	src/common/crypto.c

 changes/less_charbuf_usage |    5 +
 src/common/crypto.c        |   23 ++++
 src/common/crypto.h        |    4 +
 src/or/dirserv.c           |  153 ++++++++++----------------
 src/or/dirserv.h           |   25 +----
 src/or/dirvote.c           |  200 +++++++++++-----------------------
 src/or/networkstatus.c     |    4 +-
 src/or/or.h                |    3 +-
 src/or/router.c            |  148 ++++++++++---------------
 src/or/router.h            |    4 +-
 src/or/routerparse.c       |   74 +++++++++----
 src/or/routerparse.h       |    5 +-
 src/test/test.c            |    3 +-
 src/test/test_dir.c        |  259 ++++++++++++++++++++++++++++++++++++--------
 14 files changed, 492 insertions(+), 418 deletions(-)

diff --cc src/common/crypto.c
index 1b5b558,0ababea..31a0df1
--- a/src/common/crypto.c
+++ b/src/common/crypto.c
@@@ -1614,6 -1614,44 +1614,29 @@@ crypto_digest_assign(crypto_digest_t *i
    memcpy(into,from,sizeof(crypto_digest_t));
  }
  
+ /** Given a list of strings in <b>lst</b>, set the <b>len_out</b>-byte digest
+  * at <b>digest_out</b> to the hash of the concatenation of those strings,
+  * plus the optional string <b>append</b>, computed with the algorithm
+  * <b>alg</b>.
+  * <b>out_len</b> must be \<= DIGEST256_LEN. */
+ void
+ crypto_digest_smartlist(char *digest_out, size_t len_out,
+                         const smartlist_t *lst, const char *append,
+                         digest_algorithm_t alg)
+ {
+   crypto_digest_t *d;
+   if (alg == DIGEST_SHA1)
+     d = crypto_digest_new();
+   else
+     d = crypto_digest256_new(alg);
+   SMARTLIST_FOREACH(lst, const char *, cp,
+                     crypto_digest_add_bytes(d, cp, strlen(cp)));
+   if (append)
+     crypto_digest_add_bytes(d, append, strlen(append));
+   crypto_digest_get_digest(d, digest_out, len_out);
+   crypto_digest_free(d);
+ }
+ 
 -/** Compute the HMAC-SHA-1 of the <b>msg_len</b> bytes in <b>msg</b>, using
 - * the <b>key</b> of length <b>key_len</b>.  Store the DIGEST_LEN-byte result
 - * in <b>hmac_out</b>.
 - */
 -void
 -crypto_hmac_sha1(char *hmac_out,
 -                 const char *key, size_t key_len,
 -                 const char *msg, size_t msg_len)
 -{
 -  tor_assert(key_len < INT_MAX);
 -  tor_assert(msg_len < INT_MAX);
 -  HMAC(EVP_sha1(), key, (int)key_len, (unsigned char*)msg, (int)msg_len,
 -       (unsigned char*)hmac_out, NULL);
 -}
 -
  /** Compute the HMAC-SHA-256 of the <b>msg_len</b> bytes in <b>msg</b>, using
   * the <b>key</b> of length <b>key_len</b>.  Store the DIGEST256_LEN-byte
   * result in <b>hmac_out</b>.

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits