[tor-commits] [translation/tor-launcher-network-settings] Update translations for tor-launcher-network-settings

2015-11-12 Thread translation
commit 4a0ff8a0e5de6faff84052be5907d6c1c2d4beb4
Author: Translation commit bot 
Date:   Thu Nov 12 08:15:38 2015 +

Update translations for tor-launcher-network-settings
---
 hi/network-settings.dtd |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/hi/network-settings.dtd b/hi/network-settings.dtd
index 95ec84d..f852698 100644
--- a/hi/network-settings.dtd
+++ b/hi/network-settings.dtd
@@ -1,8 +1,8 @@
-
+
 
 
-
-
+
+
 
 
 

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


[tor-commits] [translation/tails-greeter_completed] Update translations for tails-greeter_completed

2015-11-12 Thread translation
commit bf9573d989fd08fd12aa9beae46a4a0421deb25f
Author: Translation commit bot 
Date:   Thu Nov 12 22:45:31 2015 +

Update translations for tails-greeter_completed
---
 el/el.po |   11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/el/el.po b/el/el.po
index ef5f2b0..7ca8865 100644
--- a/el/el.po
+++ b/el/el.po
@@ -8,14 +8,15 @@
 # isv31 <36b04...@anon.leemail.me>, 2014
 # kotkotkot , 2012
 # metamec, 2015
+# Natalia , 2015
 # Wasilis Mandratzis , 2013
 msgid ""
 msgstr ""
 "Project-Id-Version: The Tor Project\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2015-08-05 18:46+0200\n"
-"PO-Revision-Date: 2015-08-23 18:55+\n"
-"Last-Translator: metamec\n"
+"POT-Creation-Date: 2015-11-02 21:29+0100\n"
+"PO-Revision-Date: 2015-11-12 22:33+\n"
+"Last-Translator: Natalia \n"
 "Language-Team: Greek (http://www.transifex.com/otf/torproject/language/el/)\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
@@ -163,6 +164,10 @@ msgid ""
 "need to configure bridge, firewall, or proxy settings."
 msgstr "Η σύνδεση διαδικτύου αυτού του υ
πολογιστή λογοκρίνεται, φιλτράρεται ή 
περνάει από proxy. Πρέπει να ρυθμίσετε τις 
επιλογές για τις γέφυρες, το firewall ή το proxy. "
 
+#: ../glade/optionswindow.glade.h:23
+msgid "Disable all networking"
+msgstr "Απενεργοποιήστε όλα τα δίκτυα"
+
 #: ../glade/langpanel.glade.h:1
 msgid " "
 msgstr " "

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


[tor-commits] [translation/tails-greeter] Update translations for tails-greeter

2015-11-12 Thread translation
commit 1378b55a1d272aa04c53bc99e4c9432b5880cc10
Author: Translation commit bot 
Date:   Thu Nov 12 22:45:25 2015 +

Update translations for tails-greeter
---
 el/el.po |9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/el/el.po b/el/el.po
index ed81f2a..7ca8865 100644
--- a/el/el.po
+++ b/el/el.po
@@ -8,14 +8,15 @@
 # isv31 <36b04...@anon.leemail.me>, 2014
 # kotkotkot , 2012
 # metamec, 2015
+# Natalia , 2015
 # Wasilis Mandratzis , 2013
 msgid ""
 msgstr ""
 "Project-Id-Version: The Tor Project\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2015-10-26 17:51+0100\n"
-"PO-Revision-Date: 2015-10-27 10:10+\n"
-"Last-Translator: carolyn \n"
+"POT-Creation-Date: 2015-11-02 21:29+0100\n"
+"PO-Revision-Date: 2015-11-12 22:33+\n"
+"Last-Translator: Natalia \n"
 "Language-Team: Greek (http://www.transifex.com/otf/torproject/language/el/)\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
@@ -165,7 +166,7 @@ msgstr "Η σύνδεση διαδικτύου αυτού 
του υπολογι
 
 #: ../glade/optionswindow.glade.h:23
 msgid "Disable all networking"
-msgstr ""
+msgstr "Απενεργοποιήστε όλα τα δίκτυα"
 
 #: ../glade/langpanel.glade.h:1
 msgid " "

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


[tor-commits] [webwml/staging] Update amazon button

2015-11-12 Thread sebastian
commit 172fab932427ebd028e83eca6e999073c172b25e
Author: Sebastian Hahn 
Date:   Fri Nov 13 04:07:02 2015 +0100

Update amazon button
---
 donate/en/donate-amazon.wml |   10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/donate/en/donate-amazon.wml b/donate/en/donate-amazon.wml
index bcb96f4..0d4799f 100644
--- a/donate/en/donate-amazon.wml
+++ b/donate/en/donate-amazon.wml
@@ -17,7 +17,7 @@ 
src="https://static-na.payments-amazon.com/OffAmazonPayments/us/js/Widgets.js;><
 data-ap-widget-theme="ap-light"
 data-ap-widget-amount-presets="5,25,50,100"
 data-ap-widget-default-amount="1"
-data-ap-signature="TccqAE9jXn74b3xQgYc5rFG9Y9N3Rbq3ihSQQfF0plg%3D"
+data-ap-signature="%2B6UiARhqtXOPGLHP%2F6DrD3zH68ZHxmA9tBLjfjJ3jYU%3D"
 data-ap-seller-id="A3KD3XX49657E7"
 data-ap-access-key="AKIAISELZYVMUQ7F5M7Q"
 
@@ -26,9 +26,9 @@ 
data-ap-lwa-client-id="amzn1.application-oa2-client.b0b3efe8eb6841ed800ff2cc45b1
 data-ap-currency-code="USD"
 data-ap-amount="0"
 data-ap-note="Thank you for your donation to The Tor Project. The
-Tor Project is a 501c3 organization, and our federal tax ID number is 20
-8096820. Your gift is tax deductible in the United States as allowed by
-law.  The Tor Project respects the confidentiality of its supporters,
+Tor Project is a 501c3 organization, and our federal tax ID number is
+20-8096820. Your gift is tax deductible in the United States as allowed
+by law. The Tor Project respects the confidentiality of its supporters,
 and we do not lend, rent, or sell our lists of donors at any time. Your
 donation enables Tor developers to focus on making Tor better, including
 scalability, user support and better documentation, usability and
@@ -37,7 +37,7 @@ like to keep in touch or get more involved, please visit us at
 www.torproject.org. Our mission is to advance human rights and freedoms
 by creating and deploying free and open anonymity and privacy
 technologies, supporting their unrestricted availability and use, and
-furthering their scientific and popular understanding."
+furthering their scientific and popular understanding. "
 data-ap-shipping-address-required="false"
 data-ap-payment-action="AuthorizeAndCapture"
 >

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


[tor-commits] [webstats/master] Remove two more old scripts

2015-11-12 Thread sebastian
commit bbea5eb7024320157de4358bf162829f82fdf114
Author: Sebastian Hahn 
Date:   Fri Nov 13 06:44:02 2015 +0100

Remove two more old scripts
---
 logarchive.sh |   74 -
 logimport.sh  |   47 
 2 files changed, 121 deletions(-)

diff --git a/logarchive.sh b/logarchive.sh
deleted file mode 100644
index bab17b5..000
--- a/logarchive.sh
+++ /dev/null
@@ -1,74 +0,0 @@
-#!/bin/bash
-#
-# Define a few variables
-logs="/srv/webstats.torproject.org/home/webstats/out"
-archive="/srv/webstats.torproject.org/archive"
-log_archive="/srv/webstats.torproject.org/archive/weblogs"
-data_archive="/srv/webstats.torproject.org/archive/data"
-data_publish="/srv/webstats.torproject.org/htdocs/data"
-record="/srv/webstats.torproject.org/logarchive.log"
-
-# Define the hosts we have logs for
-hosts=(
-metrics.torproject.org-access.log
-)
-
-# See if we actually have logs to process
-if [ ! "$(ls -A $logs)" ];
-then
-echo "`date` - No logs to process" >> $record
-exit 1
-fi
-
-# rsync ALL the logs so that we can delete them from the out/ directory
-# later
-rsync -ar "$logs/" "$log_archive/"
-
-for host in "${hosts[@]}"
-do
-year=`find "$log_archive/" -name $host | cut -d / -f 6 | sort | uniq`
-
-for y in $year; do
-month=`find "$log_archive/$y/" -name $host | cut -d / -f 7 | sort | 
uniq`
-cd "$archive/"
-
-for m in $month; do
-all_the_logs=`find "weblogs/$y/$m" -name $host`
-for i in $all_the_logs; do
-# If we already have a tarball, check to see if the file is 
already a
-# part of it
-if [ -e "$data_archive/$host-$y-$m.tar" ]
-then
-# See if the file is already a part of the tarball
-tar --list --file="$data_archive/$host-$y-$m.tar" $i
-check_exists=`echo $?`
-if [[ $check_exists -eq "1" ]]
-then
-tar --append --file="$host-$y-$m.tar" $i
-fi
-else
-tar --append --file="$host-$y-$m.tar" $i
-fi
-done
-
-# If we did create a new tarball, move it
-if [ -e "$host-$y-$m.tar" ]
-then
-mv "$host-$y-$m.tar" "$data_archive"
-fi
-
-# Pack up the tarball and make it available online
-cd "$data_archive"
-bzip2 -kf1 "$host-$y-$m.tar"
-mv "$host-$y-$m.tar.bz2" "$data_publish"
-
-done
-
-# And remove logs from the out/ directory
-rm -rf "$logs/$y/"
-
-done
-
-# And report back
-echo "`date` - Logs processed for $host" >> $record
-done
diff --git a/logimport.sh b/logimport.sh
deleted file mode 100644
index 438e3dd..000
--- a/logimport.sh
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/bin/bash
-#
-# The sanitized logs are in /srv/webstats.torproject.org/home/webstats/out/,
-# with the following format: year/month/day/$virtualhost-access.log
-#
-# Need to concat the logs in chronological order and import into
-# awstats and webalizer.
-
-# Define a few variables
-logtmp="/srv/webstats.torproject.org/logtmp"
-logs="/srv/webstats.torproject.org/home/webstats/out"
-record="/srv/webstats.torproject.org/logimport.log"
-
-# Define the hosts we have logs for
-hosts=(
-metrics
-)
-
-# See if we actually have logs to process
-if [ ! "$(ls -A $logs)" ];
-then
-echo "`date` - No logs to process" >> $record
-exit 1
-fi
-
-for host in "${hosts[@]}"
-do
-# Concat the logs in chronological order
-mkdir "$logtmp"
-cd "$logtmp"
-find "$logs/" -name "$host.torproject.org-access.log" | sort | xargs -I {} 
cat {} > "$host.torproject.org-access.log"
-
-# Time to run the web log analysis tools
-#
-# Running awstats first
-/srv/webstats.torproject.org/awstats/awstats.pl 
-config=$host.torproject.org -update
-
-# And then webalizer
-webalizer -c 
"/srv/webstats.torproject.org/configs/webalizer.$host.torproject.org.conf"
-
-# Cleanup
-cd "/srv/webstats.torproject.org"
-rm -rf "$logtmp"
-
-# And report back
-echo "`date` - Logs processed for $host" >> $record
-done

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


[tor-commits] [webstats/master] Start script to extract logs

2015-11-12 Thread sebastian
commit fdbbe46210c4499fa8723bd09eddbdaab0ee6080
Author: Sebastian Hahn 
Date:   Fri Nov 13 06:41:57 2015 +0100

Start script to extract logs
---
 bin/receive-log.sh|   47 ---
 bin/send-logs.sh  |   73 
 build.xml |   36 --
 src/org/torproject/webstats/Main.java |  595 -
 src/sanitize.py   |   82 +
 src/treat_new_logs.sh |   45 +++
 6 files changed, 127 insertions(+), 751 deletions(-)

diff --git a/bin/receive-log.sh b/bin/receive-log.sh
deleted file mode 100755
index 6f98eaa..000
--- a/bin/receive-log.sh
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/bin/bash
-
-# Copyright 2011 The Tor Project
-# See LICENSE for licensing information
-#
-# Read a binary file from stdin and store it to disk.
-
-set -e
-set -u
-
-# Read remote host name from local command-line argument.
-rhost="$1"
-if [ -z "$rhost" ]; then
-  echo "Missing or illegal host name in authorized_keys."
-  exit 1
-fi
-
-# Read remote log file name from SSH command-line arguments.
-rfile="${SSH_ORIGINAL_COMMAND:-}"
-if ! [[ "$rfile" =~ ^[a-zA-Z0-9.-]+$ ]]; then
-  echo "Missing or illegal file name in SSH command."
-  exit 1
-fi
-
-# Create directories for this remote host if it doesn't exist.
-ldir="in/$rhost"
-if ! [ -d "in" ]; then
-  mkdir "in"
-fi
-if ! [ -d "$ldir" ]; then
-  mkdir "$ldir"
-fi
-
-# Make sure the file doesn't exist yet.
-lfile="$ldir/$rfile"
-if [[ -f "$lfile" ]]; then
-  echo "File already exists."
-  exit 1
-fi
-
-# Write file from stdin to temporary file.
-tfile="$ldir/.$rfile"
-cat > "$tfile"
-
-# Move file from temp/ to in/ directory.
-mv "$tfile" "$lfile"
-
diff --git a/bin/send-logs.sh b/bin/send-logs.sh
deleted file mode 100755
index 77e7442..000
--- a/bin/send-logs.sh
+++ /dev/null
@@ -1,73 +0,0 @@
-#!/bin/bash
-
-# Copyright 2011 The Tor Project
-# See LICENSE for licensing information
-#
-# Send new gzip'ed Apache web log files via ssh to a remote server.
-
-set -e
-set -u
-
-usage() {
-  echo "Usage: $0 logs-dir ssh-string state-dir"
-  exit 1
-}
-
-# Check command-line arguments.
-if [ "$#" != 3 ]; then
-  usage
-fi
-ldir="$1"
-sshstring="$2"
-tdir="$3"
-if ! [ -d "$ldir" ]; then
-  echo "Directory '$1' does not exist."
-  usage
-fi
-
-# Create the local state directory that has empty files for every log file
-# that we sent to the remote server.
-if ! [ -d "$tdir" ]; then
-  mkdir "$tdir"
-fi
-
-# Iterate over files with file names containing access.log and ending in
-# .gz and send the ones we haven't sent before to the remote server.
-for i in $(find "$ldir" -maxdepth 1 -type f -name '*access.log*.gz'); do
-
-  # Check that the file exists.  This works around issues like filenames
-  # containing spaces.
-  if ! [ -e $i ]; then
-echo "File '$i' does not exist."
-continue
-  fi
-
-  # Extract the file name part to pass it as SSH parameter.
-  fname="$(basename $i)"
-
-  # Warn if file names contain illegal characters that the receiver would
-  # not accept.
-  if ! [[ $fname =~ ^[a-zA-Z0-9.-]+$ ]]; then
-echo "Illegal file name '$fname'."
-continue
-  fi
-
-  # Copy the file content to the remote server if we haven't sent it
-  # before.
-  tfile="$tdir/$fname"
-  if ! [ -f "$tfile" ]; then
-ssh -o PreferredAuthentications=publickey $sshstring "$fname" < "$i"
-  fi
-
-  # Add a state file to note that we don't attempt to send this file in
-  # the next execution.
-  touch "$tfile"
-
-done
-
-# Delete all state files for which there are no log files anymore.
-for i in $(find "$tdir" -type f); do
-  fname="$(basename $i)"
-  [ -e "$ldir/$fname" ] || rm -f "$tdir/$fname"
-done
-
diff --git a/build.xml b/build.xml
deleted file mode 100644
index 7f0b430..000
--- a/build.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-
-  
-  
-  
-  
-
-
-  
-  
-
-  
-  
-
-  
-
-  
-
-  
-  
-
-  
-
-  
-
-
diff --git a/src/org/torproject/webstats/Main.java 
b/src/org/torproject/webstats/Main.java
deleted file mode 100644
index 378093e..000
--- a/src/org/torproject/webstats/Main.java
+++ /dev/null
@@ -1,595 +0,0 @@
-package org.torproject.webstats;
-
-import java.io.*;
-import java.text.*;
-import java.util.*;
-import java.util.regex.*;
-
-import org.apache.commons.compress.compressors.gzip.*;
-
-/*
- * Sanitize Apache web logs by removing all potentially sensitive parts.
- *
- * The following sanitizing steps are performed on input web logs:
- *   1. Discard all lines that are not in the Combined Log Format.
- *   2. Discard all lines with other hosts than '0.0.0.0' or '0.0.0.1'.
- *   3. Discard all lines with other methods than GET.
- *   4. Discard all lines with other protocols than HTTP.
- *   5. Discard all lines with status code 404.
- *   6. Override client with '-'.
- *   7. Override user with '-'.
- *   8. Override time with '00:00:00 +'.
- *   9. Override referer (sic!) with '"-"'.
- 

[tor-commits] [webstats/master] Update gitignore

2015-11-12 Thread sebastian
commit 12052deb5b5c7c3e8210363e1996b2a442aa1f2c
Author: Sebastian Hahn 
Date:   Fri Nov 13 06:43:27 2015 +0100

Update gitignore
---
 .gitignore |   12 +---
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/.gitignore b/.gitignore
index 2dbd22e..b69ffdb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,5 @@
-lib/
-classes/
-in/
-out/
-temp/
-hist
-
+incoming
+out
+stamp
+work
+work_awstats



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


[tor-commits] [translation/bridgedb] Update translations for bridgedb

2015-11-12 Thread translation
commit 1fc5590fb5ff2a30ba96a4c926fe94bfe1610d11
Author: Translation commit bot 
Date:   Thu Nov 12 14:15:03 2015 +

Update translations for bridgedb
---
 th/LC_MESSAGES/bridgedb.po |  336 ++--
 1 file changed, 169 insertions(+), 167 deletions(-)

diff --git a/th/LC_MESSAGES/bridgedb.po b/th/LC_MESSAGES/bridgedb.po
index 99fdb6e..f7ffc94 100644
--- a/th/LC_MESSAGES/bridgedb.po
+++ b/th/LC_MESSAGES/bridgedb.po
@@ -4,19 +4,21 @@
 # 
 # Translators:
 # BlackDog ForThai , 2015
+# Ella Rudland , 2015
 # exploiz , 2014
 # lanichita , 2013
 msgid ""
 msgstr ""
 "Project-Id-Version: The Tor Project\n"
-"Report-Msgid-Bugs-To: 
'https://trac.torproject.org/projects/tor/newticket?component=BridgeDB=bridgedb-reported,msgid=isis,sysrqb=isis'POT-Creation-Date:
 2015-03-19 22:13+\n"
-"PO-Revision-Date: 2015-09-28 13:48+\n"
-"Last-Translator: BlackDog ForThai \n"
+"Report-Msgid-Bugs-To: 
'https://trac.torproject.org/projects/tor/newticket?component=BridgeDB=bridgedb-reported,msgid=isis,sysrqb=isis'\n"
+"POT-Creation-Date: 2015-07-25 03:40+\n"
+"PO-Revision-Date: 2015-11-12 14:13+\n"
+"Last-Translator: Ella Rudland \n"
 "Language-Team: Thai (http://www.transifex.com/otf/torproject/language/th/)\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
-"Generated-By: Babel 0.9.6\n"
+"Generated-By: Babel 1.3\n"
 "Language: th\n"
 "Plural-Forms: nplurals=1; plural=0;\n"
 
@@ -31,57 +33,182 @@ msgstr ""
 #. "fteproxy"
 #. "Tor"
 #. "Tor Browser"
-#: lib/bridgedb/HTTPServer.py:107
+#: bridgedb/https/server.py:167
 msgid "Sorry! Something went wrong with your request."
 msgstr "ขออภัย ! 
คำสั่งที่คุณสั่งไปมันผิดปรกติ"
 
-#: lib/bridgedb/strings.py:18
+#: bridgedb/https/templates/base.html:79
+msgid "Report a Bug"
+msgstr "แจ้งบั๊ก"
+
+#: bridgedb/https/templates/base.html:82
+msgid "Source Code"
+msgstr "ซอร์สโค้ด"
+
+#: bridgedb/https/templates/base.html:85
+msgid "Changelog"
+msgstr "สมุดบันทึกสิ่งของใหม่"
+
+#: bridgedb/https/templates/base.html:88
+msgid "Contact"
+msgstr "ติดต่อ"
+
+#: bridgedb/https/templates/bridges.html:35
+msgid "Select All"
+msgstr "เลือกทั้งหมด"
+
+#: bridgedb/https/templates/bridges.html:40
+msgid "Show QRCode"
+msgstr "แสดงรหัส QR"
+
+#: bridgedb/https/templates/bridges.html:52
+msgid "QRCode for your bridge lines"
+msgstr "รหัส QR ของบริดจ์ท่าน"
+
+#. TRANSLATORS: Please translate this into some silly way to say
+#. "There was a problem!" in your language. For example,
+#. for Italian, you might translate this into "Mama mia!",
+#. or for French: "Sacrebleu!". :)
+#: bridgedb/https/templates/bridges.html:67
+#: bridgedb/https/templates/bridges.html:125
+msgid "Uh oh, spaghettios!"
+msgstr "อะ โอ ก๋วยเตี๋ยว!"
+
+#: bridgedb/https/templates/bridges.html:68
+msgid "It seems there was an error getting your QRCode."
+msgstr ""
+
+#: bridgedb/https/templates/bridges.html:73
+msgid ""
+"This QRCode contains your bridge lines. Scan it with a QRCode reader to copy"
+" your bridge lines onto mobile and other devices."
+msgstr ""
+
+#: bridgedb/https/templates/bridges.html:131
+msgid "There currently aren't any bridges available..."
+msgstr ""
+
+#: bridgedb/https/templates/bridges.html:132
+#, python-format
+msgid ""
+" Perhaps you should try %s going back %s and choosing a different bridge "
+"type!"
+msgstr ""
+
+#: bridgedb/https/templates/index.html:11
+#, python-format
+msgid "Step %s1%s"
+msgstr ""
+
+#: bridgedb/https/templates/index.html:13
+#, python-format
+msgid "Download %s Tor Browser %s"
+msgstr ""
+
+#: bridgedb/https/templates/index.html:25
+#, python-format
+msgid "Step %s2%s"
+msgstr ""
+
+#: bridgedb/https/templates/index.html:27
+#, python-format
+msgid "Get %s bridges %s"
+msgstr "ได้ %s สะพาน %s"
+
+#: bridgedb/https/templates/index.html:36
+#, python-format
+msgid "Step %s3%s"
+msgstr ""
+
+#: bridgedb/https/templates/index.html:38
+#, python-format
+msgid "Now %s add the bridges to Tor Browser %s"
+msgstr ""
+
+#. TRANSLATORS: Please make sure the '%s' surrounding single letters at the
+#. beginning of words are present in your final translation. Thanks!
+#. (These are used to insert HTML5 underlining tags, to mark accesskeys
+#. for disabled users.)
+#: bridgedb/https/templates/options.html:38
+#, python-format
+msgid "%sJ%sust give me bridges!"
+msgstr ""
+
+#: bridgedb/https/templates/options.html:51
+msgid "Advanced Options"
+msgstr ""
+
+#: bridgedb/https/templates/options.html:86
+msgid "No"
+msgstr "ไม่"
+
+#: 

[tor-commits] [torspec/master] Fold in changes to the shared randomness proposal (prop250).

2015-11-12 Thread asn
commit 11bfee42b4e860524ba6c8941089ae5dfed5932a
Author: George Kadianakis 
Date:   Thu Nov 12 15:46:38 2015 +0200

Fold in changes to the shared randomness proposal (prop250).

- Remove majority requirement for commitments.
- Remove conflict detection.
- Remove the need for SR keys.
- Don't use signatures in commits.
- Simplify persistent state logic.
- Change the protocol starting time from 12:00UTC to 00:00UTC.
---
 proposals/250-commit-reveal-consensus.txt |  759 +
 1 file changed, 334 insertions(+), 425 deletions(-)

diff --git a/proposals/250-commit-reveal-consensus.txt 
b/proposals/250-commit-reveal-consensus.txt
index 0415bd8..526372d 100644
--- a/proposals/250-commit-reveal-consensus.txt
+++ b/proposals/250-commit-reveal-consensus.txt
@@ -5,6 +5,50 @@ Created: 2015-08-03
 Status: Draft
 Supersedes: 225
 
+
+   Table Of Contents:
+
+  1. Introduction
+ 1.1. Motivation
+ 1.2. Previous work
+  2. Overview
+ 2.1. Ten thousand feet view
+ 2.2. Commit & Reveal
+ 2.3. Consensus [CONS]
+ 2.4. Persistent State of the Protocol [STATE]
+  3. Protocol
+ 3.1 Commitment Phase [COMMITMENTPHASE]
+3.1.1. Voting During Commitment Phase
+3.1.2. Persistent State During Commitment Phase [STATECOMMIT]
+ 3.2 Reveal Phase
+3.2.1. Voting During Reveal Phase
+3.2.2. Persistent State During Reveal Phase [STATEREVEAL]
+ 3.3. Shared Random Value Calculation At 00:00UTC
+3.3.1. Shared Randomness Calculation [SRCALC]
+ 3.4. Bootstrapping Procedure
+ 3.5. Rebooting Directory Authorities [REBOOT]
+ 3.6. Shared Randomness Disaster Recovery [SRDISASTER]
+  4. Specification [SPEC]
+ 4.1 Voting
+4.1.1. Computing commitments and reveals [COMMITREVEAL]
+4.1.2. Validating commitments and reveals [VALIDATEVALUES]
+4.1.4. Encoding commit/reveal values in votes [COMMITVOTE]
+4.1.5. Shared Random Value [SRVOTE]
+4.1.6. Including the ed25519 identity key in votes [SRKEY]
+ 4.2. Persistent state format [STATEFORMAT]
+ 4.3. Shared Random Value in Consensus [SRCONSENSUS]
+  5. Security Analysis
+ 5.1. Security of commit-and-reveal and future directions
+ 5.2. Predicting the shared random value during reveal phase
+ 5.3. Partition Attack
+5.3.1 During commit phase
+5.3.2 During reveal phase
+  6. Discussion
+ 6.1. Why the added complexity from proposal 225?
+ 6.2. Why do you do a commit-and-reveal protocol in 24 rounds?
+ 6.3. Why can't we recover if we fail to do a consensus at 00:00UTC?
+
+
 1. Introduction
 
 1.1. Motivation
@@ -16,9 +60,10 @@ Supersedes: 225
Currently we need this random value to make the HSDir hash ring
unpredictable (#8244), which should resolve a wide class of hidden service
DoS attacks and should make it harder for people to gauge the popularity
-   and activity of target hidden services. Furthermore, this random value can
-   be used by other Tor-related protocols (or even non-Tor-related) like
-   OnioNS to introduce unpredictability to the protocol.
+   and activity of target hidden services. Furthermore this random value can
+   be used by other systems in need of fresh global randomness like
+   Tor-related protocols (e.g. OnioNS) or even non-Tor-related (e.g. warrant
+   canaries).
 
 1.2. Previous work
 
@@ -35,9 +80,9 @@ Supersedes: 225
 
 2. Overview
 
-   This proposal alters the Tor consensus protocol such that a random number
-   is generated by the directory authorities during the regular voting
-   process. The distributed random generator scheme is based on a
+   This proposal alters the Tor consensus protocol such that a random number is
+   generated every midnight by the directory authorities during the regular 
voting
+   process. The distributed random generator scheme is based on the
commit-and-reveal technique.
 
The proposal also specifies how the final shared random value is embedded
@@ -46,14 +91,8 @@ Supersedes: 225
 2.1. Ten thousand feet view
 
Our commit-and-reveal protocol aims to produce a fresh shared random value
-   everyday at 12:00UTC. The final fresh random value is embedded in the
-   microdescriptor consensus document at that time.
-
-   Our protocol uses a *new* consensus flavor document called "shared
-   randomness document" (SR doc). We use a new consensus document as a way to
-   keep ground truth state and also as a way to apply the majority (see
-   section [MAJORITY]) rule on commit and reveal values. It also allows
-   rebooting authorities to rejoin the protocol in some cases.
+   everyday at 00:00UTC. The final fresh random value is embedded in the
+   consensus document at that time.
 
Our protocol has two phases and uses the hourly 

[tor-commits] [translation/bridgedb] Update translations for bridgedb

2015-11-12 Thread translation
commit 9c0ab05ffee875d2423cafb2d5b5316a5e657622
Author: Translation commit bot 
Date:   Thu Nov 12 14:45:02 2015 +

Update translations for bridgedb
---
 th/LC_MESSAGES/bridgedb.po |   10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/th/LC_MESSAGES/bridgedb.po b/th/LC_MESSAGES/bridgedb.po
index f7ffc94..5af5d77 100644
--- a/th/LC_MESSAGES/bridgedb.po
+++ b/th/LC_MESSAGES/bridgedb.po
@@ -12,7 +12,7 @@ msgstr ""
 "Project-Id-Version: The Tor Project\n"
 "Report-Msgid-Bugs-To: 
'https://trac.torproject.org/projects/tor/newticket?component=BridgeDB=bridgedb-reported,msgid=isis,sysrqb=isis'\n"
 "POT-Creation-Date: 2015-07-25 03:40+\n"
-"PO-Revision-Date: 2015-11-12 14:13+\n"
+"PO-Revision-Date: 2015-11-12 14:38+\n"
 "Last-Translator: Ella Rudland \n"
 "Language-Team: Thai (http://www.transifex.com/otf/torproject/language/th/)\n"
 "MIME-Version: 1.0\n"
@@ -63,7 +63,7 @@ msgstr "แสดงรหัส QR"
 
 #: bridgedb/https/templates/bridges.html:52
 msgid "QRCode for your bridge lines"
-msgstr "รหัส QR ของบริดจ์ท่าน"
+msgstr "รหัส QR 
ของบริดจ์ไลนฺส์ท่าน"
 
 #. TRANSLATORS: Please translate this into some silly way to say
 #. "There was a problem!" in your language. For example,
@@ -72,11 +72,11 @@ msgstr "รหัส QR 
ของบริดจ์ท่าน"
 #: bridgedb/https/templates/bridges.html:67
 #: bridgedb/https/templates/bridges.html:125
 msgid "Uh oh, spaghettios!"
-msgstr "อะ โอ ก๋วยเตี๋ยว!"
+msgstr "อ้าว 
ก๋วยเตี๋ยว!\nบางสิ่งบางอย่างผิดปรกติ"
 
 #: bridgedb/https/templates/bridges.html:68
 msgid "It seems there was an error getting your QRCode."
-msgstr ""
+msgstr "มีความผิดในการรับรหัส QR"
 
 #: bridgedb/https/templates/bridges.html:73
 msgid ""
@@ -366,7 +366,7 @@ msgstr ""
 #. "plain-ol'-vanilla" bridges.
 #: bridgedb/strings.py:171
 msgid "Request vanilla bridges."
-msgstr ""
+msgstr "ขอร้องบริดจ์มาตรฐาน"
 
 #: bridgedb/strings.py:172
 msgid "Request IPv6 bridges."

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


[tor-commits] [tor/master] Experimentally decouple the main body of circuit_mark_for_close

2015-11-12 Thread nickm
commit 8b4e5b7ee902fb7fa07767410a18433d752c7aef
Author: Nick Mathewson 
Date:   Fri Oct 2 17:55:25 2015 +0200

Experimentally decouple the main body of circuit_mark_for_close
---
 changes/decouple_circuit_mark |6 
 src/or/circuitlist.c  |   77 ++---
 src/or/or.h   |8 +
 3 files changed, 71 insertions(+), 20 deletions(-)

diff --git a/changes/decouple_circuit_mark b/changes/decouple_circuit_mark
new file mode 100644
index 000..4b7ed77
--- /dev/null
+++ b/changes/decouple_circuit_mark
@@ -0,0 +1,6 @@
+  o Code simplification and refactoring:
+ - Extract the more complicated parts of circuit_mark_for_close into
+   a new function run periodically before connections are freed.
+   This change removes more than half of the functions currently
+   in the "blob".
+   Closes ticket #17218.
diff --git a/src/or/circuitlist.c b/src/or/circuitlist.c
index 716024d..324f9f3 100644
--- a/src/or/circuitlist.c
+++ b/src/or/circuitlist.c
@@ -44,11 +44,16 @@ static smartlist_t *global_circuitlist = NULL;
 /** A list of all the circuits in CIRCUIT_STATE_CHAN_WAIT. */
 static smartlist_t *circuits_pending_chans = NULL;
 
+/** A list of all the circuits that have been marked with 
circuit_mark_for_close
+ * and which are waiting for circuit_about_to_free(). */
+static smartlist_t *circuits_pending_close = NULL;
+
 static void circuit_free_cpath_node(crypt_path_t *victim);
 static void cpath_ref_decref(crypt_path_reference_t *cpath_ref);
 //static void circuit_set_rend_token(or_circuit_t *circ, int is_rend_circ,
 //   const uint8_t *token);
 static void circuit_clear_rend_token(or_circuit_t *circ);
+static void circuit_about_to_free(circuit_t *circ);
 
 /* END VARIABLES /
 
@@ -451,16 +456,27 @@ circuit_count_pending_on_channel(channel_t *chan)
 void
 circuit_close_all_marked(void)
 {
+  if (circuits_pending_close == NULL)
+return;
+
   smartlist_t *lst = circuit_get_global_list();
-  SMARTLIST_FOREACH_BEGIN(lst, circuit_t *, circ) {
-/* Fix up index if SMARTLIST_DEL_CURRENT just moved this one. */
-circ->global_circuitlist_idx = circ_sl_idx;
-if (circ->marked_for_close) {
-  circ->global_circuitlist_idx = -1;
-  circuit_free(circ);
-  SMARTLIST_DEL_CURRENT(lst, circ);
+  SMARTLIST_FOREACH_BEGIN(circuits_pending_close, circuit_t *, circ) {
+tor_assert(circ->marked_for_close);
+
+/* Remove it from the circuit list. */
+int idx = circ->global_circuitlist_idx;
+smartlist_del(lst, idx);
+if (idx < smartlist_len(lst)) {
+  circuit_t *replacement = smartlist_get(lst, idx);
+  replacement->global_circuitlist_idx = idx;
 }
+circ->global_circuitlist_idx = -1;
+
+circuit_about_to_free(circ);
+circuit_free(circ);
   } SMARTLIST_FOREACH_END(circ);
+
+  smartlist_clear(circuits_pending_close);
 }
 
 /** Return the head of the global linked list of circuits. */
@@ -1703,6 +1719,39 @@ circuit_mark_for_close_, (circuit_t *circ, int reason, 
int line,
 reason = END_CIRC_REASON_NONE;
   }
 
+  circ->marked_for_close = line;
+  circ->marked_for_close_file = file;
+  circ->marked_for_close_reason = reason;
+  circ->marked_for_close_orig_reason = orig_reason;
+
+  if (!CIRCUIT_IS_ORIGIN(circ)) {
+or_circuit_t *or_circ = TO_OR_CIRCUIT(circ);
+if (or_circ->rend_splice) {
+  if (!or_circ->rend_splice->base_.marked_for_close) {
+/* do this after marking this circuit, to avoid infinite recursion. */
+circuit_mark_for_close(TO_CIRCUIT(or_circ->rend_splice), reason);
+  }
+  or_circ->rend_splice = NULL;
+}
+  }
+
+  if (circuits_pending_close == NULL)
+circuits_pending_close = smartlist_new();
+
+  smartlist_add(circuits_pending_close, circ);
+}
+
+/** Called immediately before freeing a marked circuit circ.
+ * Disconnects the circuit from other data structures, launches events
+ * as appropriate, and performs other housekeeping.
+ */
+static void
+circuit_about_to_free(circuit_t *circ)
+{
+
+  int reason = circ->marked_for_close_reason;
+  int orig_reason = circ->marked_for_close_orig_reason;
+
   if (circ->state == CIRCUIT_STATE_ONIONSKIN_PENDING) {
 onion_pending_remove(TO_OR_CIRCUIT(circ));
   }
@@ -1726,6 +1775,7 @@ circuit_mark_for_close_, (circuit_t *circ, int reason, 
int line,
  (circ->state == CIRCUIT_STATE_OPEN)?CIRC_EVENT_CLOSED:CIRC_EVENT_FAILED,
  orig_reason);
   }
+
   if (circ->purpose == CIRCUIT_PURPOSE_C_INTRODUCE_ACK_WAIT) {
 origin_circuit_t *ocirc = TO_ORIGIN_CIRCUIT(circ);
 int timed_out = (reason == END_CIRC_REASON_TIMEOUT);
@@ -1811,19 +1861,6 @@ circuit_mark_for_close_, (circuit_t *circ, int reason, 
int line,
 ocirc->p_streams = NULL;
   }
 
-  circ->marked_for_close = line;
-  circ->marked_for_close_file = file;
-
-  if (!CIRCUIT_IS_ORIGIN(circ)) {
-or_circuit_t *or_circ = TO_OR_CIRCUIT(circ);
-if 

[tor-commits] [tor/master] Merge branch 'decouple_circuit_mark_squashed'

2015-11-12 Thread nickm
commit f7ccc9b975ae3e6531767c1a56cd85c906292aff
Merge: b370052 8b4e5b7
Author: Nick Mathewson 
Date:   Thu Nov 12 14:20:24 2015 -0500

Merge branch 'decouple_circuit_mark_squashed'

 changes/decouple_circuit_mark |6 
 src/or/circuitlist.c  |   77 ++---
 src/or/or.h   |8 +
 3 files changed, 71 insertions(+), 20 deletions(-)

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


[tor-commits] [translation/tails-persistence-setup] Update translations for tails-persistence-setup

2015-11-12 Thread translation
commit 985edc5e4a55004e9a743f345a4bee9c7a98bb6b
Author: Translation commit bot 
Date:   Fri Nov 13 04:15:23 2015 +

Update translations for tails-persistence-setup
---
 id/id.po |7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/id/id.po b/id/id.po
index 5a3ec6d..fa032c0 100644
--- a/id/id.po
+++ b/id/id.po
@@ -4,6 +4,7 @@
 # 
 # Translators:
 # cholif yulian , 2015
+# Dwi Cahyono , 2015
 # hermawan , 2014
 # Lucas Susanto , 2015
 # km242saya , 2014
@@ -15,8 +16,8 @@ msgstr ""
 "Project-Id-Version: The Tor Project\n"
 "Report-Msgid-Bugs-To: Tails developers \n"
 "POT-Creation-Date: 2015-10-26 14:15+0100\n"
-"PO-Revision-Date: 2015-10-27 08:44+\n"
-"Last-Translator: carolyn \n"
+"PO-Revision-Date: 2015-11-13 03:47+\n"
+"Last-Translator: Dwi Cahyono \n"
 "Language-Team: Indonesian 
(http://www.transifex.com/otf/torproject/language/id/)\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
@@ -26,7 +27,7 @@ msgstr ""
 
 #: ../lib/Tails/Persistence/Configuration/Presets.pm:48
 msgid "Personal Data"
-msgstr "Data Personal"
+msgstr "Data Pribadi"
 
 #: ../lib/Tails/Persistence/Configuration/Presets.pm:50
 msgid "Keep files stored in the `Persistent' directory"

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


[tor-commits] [translation/bridgedb] Update translations for bridgedb

2015-11-12 Thread translation
commit 3ab4eb45b34efbde6a9cb28fe1aef21f7f8ba321
Author: Translation commit bot 
Date:   Thu Nov 12 15:45:03 2015 +

Update translations for bridgedb
---
 th/LC_MESSAGES/bridgedb.po |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/th/LC_MESSAGES/bridgedb.po b/th/LC_MESSAGES/bridgedb.po
index 5af5d77..18b4d49 100644
--- a/th/LC_MESSAGES/bridgedb.po
+++ b/th/LC_MESSAGES/bridgedb.po
@@ -12,7 +12,7 @@ msgstr ""
 "Project-Id-Version: The Tor Project\n"
 "Report-Msgid-Bugs-To: 
'https://trac.torproject.org/projects/tor/newticket?component=BridgeDB=bridgedb-reported,msgid=isis,sysrqb=isis'\n"
 "POT-Creation-Date: 2015-07-25 03:40+\n"
-"PO-Revision-Date: 2015-11-12 14:38+\n"
+"PO-Revision-Date: 2015-11-12 15:24+\n"
 "Last-Translator: Ella Rudland \n"
 "Language-Team: Thai (http://www.transifex.com/otf/torproject/language/th/)\n"
 "MIME-Version: 1.0\n"
@@ -82,7 +82,7 @@ msgstr 
"มีความผิดในการรับรหัส QR"
 msgid ""
 "This QRCode contains your bridge lines. Scan it with a QRCode reader to copy"
 " your bridge lines onto mobile and other devices."
-msgstr ""
+msgstr "รหัส QR 
นี่มีบริดจ์ไลนฺส์ท่าน 
สแกนด้วยเครื่องอ่านรหัส QR 
เพื่อที่จะทำสำเนาบริดจ์ไลนฺส์ท่าน
 ไปถึงโมบายและเครื่องอื่นๆ"
 
 #: bridgedb/https/templates/bridges.html:131
 msgid "There currently aren't any bridges available..."

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


[tor-commits] [tor-launcher/master] fixup! Bug 11199: Improve behavior if tor exits.

2015-11-12 Thread brade
commit f2aee156c2ca846b0220109051e22cab96ad6404
Author: Kathy Brade 
Date:   Thu Nov 12 10:33:55 2015 -0500

fixup! Bug 11199: Improve behavior if tor exits.

Remove leftover strings and code for restarting the browser.
---
 src/chrome/locale/af-ZA/torlauncher.properties|3 +--
 src/chrome/locale/bg-BG/torlauncher.properties|3 +--
 src/chrome/locale/bn-BD/torlauncher.properties|3 +--
 src/chrome/locale/ca-ES/torlauncher.properties|3 +--
 src/chrome/locale/cs-CZ/torlauncher.properties|3 +--
 src/chrome/locale/el-GR/torlauncher.properties|3 +--
 src/chrome/locale/es-NI/torlauncher.properties|3 +--
 src/chrome/locale/ms/torlauncher.properties   |3 +--
 src/chrome/locale/pl-PL/torlauncher.properties|3 +--
 src/chrome/locale/sv-SE/torlauncher.properties|3 +--
 src/chrome/locale/zh-CN.GB2312/torlauncher.properties |3 +--
 src/chrome/locale/zh/torlauncher.properties   |3 +--
 src/components/tl-process.js  |6 --
 13 files changed, 12 insertions(+), 30 deletions(-)

diff --git a/src/chrome/locale/af-ZA/torlauncher.properties 
b/src/chrome/locale/af-ZA/torlauncher.properties
index a2550db..12a2dc9 100644
--- a/src/chrome/locale/af-ZA/torlauncher.properties
+++ b/src/chrome/locale/af-ZA/torlauncher.properties
@@ -1,10 +1,9 @@
-### Copyright (c) 2014, The Tor Project, Inc.
+### Copyright (c) 2015, The Tor Project, Inc.
 ### See LICENSE for licensing information.
 
 torlauncher.error_title=Tor Launcher
 
 torlauncher.tor_exited=Tor unexpectedly exited.
-torlauncher.please_restart_app=Please restart this application.
 torlauncher.tor_controlconn_failed=Could not connect to Tor control port.
 torlauncher.tor_failed_to_start=Tor failed to start.
 torlauncher.tor_control_failed=Failed to take control of Tor.
diff --git a/src/chrome/locale/bg-BG/torlauncher.properties 
b/src/chrome/locale/bg-BG/torlauncher.properties
index a2550db..12a2dc9 100644
--- a/src/chrome/locale/bg-BG/torlauncher.properties
+++ b/src/chrome/locale/bg-BG/torlauncher.properties
@@ -1,10 +1,9 @@
-### Copyright (c) 2014, The Tor Project, Inc.
+### Copyright (c) 2015, The Tor Project, Inc.
 ### See LICENSE for licensing information.
 
 torlauncher.error_title=Tor Launcher
 
 torlauncher.tor_exited=Tor unexpectedly exited.
-torlauncher.please_restart_app=Please restart this application.
 torlauncher.tor_controlconn_failed=Could not connect to Tor control port.
 torlauncher.tor_failed_to_start=Tor failed to start.
 torlauncher.tor_control_failed=Failed to take control of Tor.
diff --git a/src/chrome/locale/bn-BD/torlauncher.properties 
b/src/chrome/locale/bn-BD/torlauncher.properties
index a2550db..12a2dc9 100644
--- a/src/chrome/locale/bn-BD/torlauncher.properties
+++ b/src/chrome/locale/bn-BD/torlauncher.properties
@@ -1,10 +1,9 @@
-### Copyright (c) 2014, The Tor Project, Inc.
+### Copyright (c) 2015, The Tor Project, Inc.
 ### See LICENSE for licensing information.
 
 torlauncher.error_title=Tor Launcher
 
 torlauncher.tor_exited=Tor unexpectedly exited.
-torlauncher.please_restart_app=Please restart this application.
 torlauncher.tor_controlconn_failed=Could not connect to Tor control port.
 torlauncher.tor_failed_to_start=Tor failed to start.
 torlauncher.tor_control_failed=Failed to take control of Tor.
diff --git a/src/chrome/locale/ca-ES/torlauncher.properties 
b/src/chrome/locale/ca-ES/torlauncher.properties
index d82d688..38a81f0 100644
--- a/src/chrome/locale/ca-ES/torlauncher.properties
+++ b/src/chrome/locale/ca-ES/torlauncher.properties
@@ -1,10 +1,9 @@
-### Copyright (c) 2014, The Tor Project, Inc.
+### Copyright (c) 2015, The Tor Project, Inc.
 ### See LICENSE for licensing information.
 
 # torlauncher.error_title=Tor Launcher
 
 # torlauncher.tor_exited=Tor unexpectedly exited.
-# torlauncher.please_restart_app=Please restart this application.
 # torlauncher.tor_controlconn_failed=Could not connect to Tor control port.
 # torlauncher.tor_failed_to_start=Tor failed to start.
 # torlauncher.tor_bootstrap_failed=Tor failed to establish a Tor network 
connection.
diff --git a/src/chrome/locale/cs-CZ/torlauncher.properties 
b/src/chrome/locale/cs-CZ/torlauncher.properties
index a2550db..12a2dc9 100644
--- a/src/chrome/locale/cs-CZ/torlauncher.properties
+++ b/src/chrome/locale/cs-CZ/torlauncher.properties
@@ -1,10 +1,9 @@
-### Copyright (c) 2014, The Tor Project, Inc.
+### Copyright (c) 2015, The Tor Project, Inc.
 ### See LICENSE for licensing information.
 
 torlauncher.error_title=Tor Launcher
 
 torlauncher.tor_exited=Tor unexpectedly exited.
-torlauncher.please_restart_app=Please restart this application.
 torlauncher.tor_controlconn_failed=Could not connect to Tor control port.
 torlauncher.tor_failed_to_start=Tor failed to start.
 torlauncher.tor_control_failed=Failed to take control of Tor.
diff --git 

[tor-commits] [tor/master] Tweak teor's and dgoulet's #13192 patches.

2015-11-12 Thread nickm
commit dad5eb7e1f3c92974c7bcaaea325a05233a27494
Author: Karsten Loesing 
Date:   Fri Feb 13 11:32:35 2015 +0100

Tweak teor's and dgoulet's #13192 patches.

 - Rewrite changes file.
 - Avoid float comparison with == and use <= instead.
 - Add teor's tor_llround(trunc(...)) back to silence clang warnings.
 - Replace tt_assert() with tt_i64_op() and friends.
 - Fix whitespace and a comment.
---
 changes/laplace-edge-cases |   19 +-
 src/common/util.c  |   10 +++---
 src/test/test_util.c   |   86 ++--
 3 files changed, 56 insertions(+), 59 deletions(-)

diff --git a/changes/laplace-edge-cases b/changes/laplace-edge-cases
index 266b119..6c8c77b 100644
--- a/changes/laplace-edge-cases
+++ b/changes/laplace-edge-cases
@@ -1,11 +1,8 @@
-  o Minor bugfixes:
-- Handle edge cases in the laplace functions:
-   * avoid division by zero
-   * avoid taking the log of zero
-   * silence clang type conversion warnings using round and trunc
-   * consistently check for overflow in round_*_to_next_multiple_of
-- Add tests for laplace edge cases:
-   * check add_laplace_noise with maximal values
-   * check round_*_to_next_multiple_of with additional values
-   * check round_*_to_next_multiple_of with maximal values
-  Related to HS stats in #13192.
+  o Code simplifications and unit tests:
+- Handle edge cases in the laplace functions: avoid division by zero,
+  avoid taking the log of zero, and silence clang type conversion
+  warnings using round and trunc.  Add unit tests for edge cases with
+  maximal values.
+- Consistently check for overflow in round_*_to_next_multiple_of
+  functions, and add unit tests with additional and maximal values.
+
diff --git a/src/common/util.c b/src/common/util.c
index 3e680d2..d8da8b1 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -546,26 +546,26 @@ sample_laplace_distribution(double mu, double b, double p)
 
   /* This is the "inverse cumulative distribution function" from:
* http://en.wikipedia.org/wiki/Laplace_distribution */
-  if (p == 0.0) {
+  if (p <= 0.0) {
 /* Avoid taking log(0.0) == -INFINITY, as some processors or compiler
  * options can cause the program to trap. */
 return INT64_MIN;
   }
 
-  result =  mu - b * (p > 0.5 ? 1.0 : -1.0)
-   * tor_mathlog(1.0 - 2.0 * fabs(p - 0.5));
+  result = mu - b * (p > 0.5 ? 1.0 : -1.0)
+  * tor_mathlog(1.0 - 2.0 * fabs(p - 0.5));
   if (result >= INT64_MAX)
 return INT64_MAX;
   else if (result <= INT64_MIN)
 return INT64_MIN;
   else
-return (int64_t) result;
+return tor_llround(trunc(result));
 }
 
 /** Add random noise between INT64_MIN and INT64_MAX coming from a Laplace
  * distribution with mu = 0 and b = delta_f/epsilon to
  * signal based on the provided random value in [0.0, 1.0[.
- * The epislon value must be between ]0.0, 1.0]. delta_f must be greater
+ * The epsilon value must be between ]0.0, 1.0]. delta_f must be greater
  * than 0. */
 int64_t
 add_laplace_noise(int64_t signal, double random, double delta_f,
diff --git a/src/test/test_util.c b/src/test/test_util.c
index 2f05ce8..3310316 100644
--- a/src/test/test_util.c
+++ b/src/test/test_util.c
@@ -4055,11 +4055,11 @@ test_util_round_to_next_multiple_of(void *arg)
   tt_u64_op(round_uint64_to_next_multiple_of(99,7), ==, 105);
   tt_u64_op(round_uint64_to_next_multiple_of(99,9), ==, 99);
 
-  tt_assert(round_uint64_to_next_multiple_of(UINT64_MAX,2) ==
+  tt_u64_op(round_uint64_to_next_multiple_of(UINT64_MAX,2), ==,
 UINT64_MAX-UINT64_MAX%2);
 
-  tt_assert(round_int64_to_next_multiple_of(0,1) == 0);
-  tt_assert(round_int64_to_next_multiple_of(0,7) == 0);
+  tt_i64_op(round_int64_to_next_multiple_of(0,1), ==, 0);
+  tt_i64_op(round_int64_to_next_multiple_of(0,7), ==, 0);
 
   tt_i64_op(round_int64_to_next_multiple_of(99,1), ==, 99);
   tt_i64_op(round_int64_to_next_multiple_of(99,7), ==, 105);
@@ -4073,24 +4073,24 @@ test_util_round_to_next_multiple_of(void *arg)
   tt_i64_op(round_int64_to_next_multiple_of(INT64_MAX,2), ==,
 INT64_MAX-INT64_MAX%2);
 
-  tt_assert(round_uint32_to_next_multiple_of(0,1) == 0);
-  tt_assert(round_uint32_to_next_multiple_of(0,7) == 0);
+  tt_int_op(round_uint32_to_next_multiple_of(0,1), ==, 0);
+  tt_int_op(round_uint32_to_next_multiple_of(0,7), ==, 0);
 
-  tt_assert(round_uint32_to_next_multiple_of(99,1) == 99);
-  tt_assert(round_uint32_to_next_multiple_of(99,7) == 105);
-  tt_assert(round_uint32_to_next_multiple_of(99,9) == 99);
+  tt_int_op(round_uint32_to_next_multiple_of(99,1), ==, 99);
+  tt_int_op(round_uint32_to_next_multiple_of(99,7), ==, 105);
+  tt_int_op(round_uint32_to_next_multiple_of(99,9), ==, 99);
 
-  tt_assert(round_uint32_to_next_multiple_of(UINT32_MAX,2) ==
+  

[tor-commits] [tor/master] Test: change INT64_MAX to DBL_MAX in laplace test

2015-11-12 Thread nickm
commit dcf0f808c0bd9b20a0a7d4f3e52155a83cdce2a4
Author: David Goulet 
Date:   Thu Feb 12 11:36:35 2015 -0500

Test: change INT64_MAX to DBL_MAX in laplace test

Signed-off-by: David Goulet 
---
 src/test/test_util.c |   15 ---
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/test/test_util.c b/src/test/test_util.c
index 21737f6..2f05ce8 100644
--- a/src/test/test_util.c
+++ b/src/test/test_util.c
@@ -19,6 +19,7 @@
 #endif
 #include 
 #include 
+#include 
 
 /*  this is a minimal wrapper to make the unit tests compile with the
  * changed tor_timegm interface. */
@@ -4156,10 +4157,10 @@ test_util_laplace(void *arg)
 add_laplace_noise(0, 0.0, delta_f, epsilon));
   tt_assert(INT64_MIN ==
 add_laplace_noise(0, 0.0,
-  INT64_MAX, 1));
+  DBL_MAX, 1));
   tt_assert(INT64_MIN ==
 add_laplace_noise(INT64_MIN, 0.0,
-  INT64_MAX, 1));
+  DBL_MAX, 1));
 
   /* does it play nice with INT64_MAX? */
   tt_assert((INT64_MIN + INT64_MAX) ==
@@ -4180,13 +4181,13 @@ test_util_laplace(void *arg)
   noscale_df, noscale_eps));
   tt_assert(INT64_MIN ==
 add_laplace_noise(0, min_dbl_error,
-  INT64_MAX, 1));
+  DBL_MAX, 1));
   tt_assert((INT64_MAX + INT64_MIN) ==
 add_laplace_noise(INT64_MAX, min_dbl_error,
-  INT64_MAX, 1));
+  DBL_MAX, 1));
   tt_assert(INT64_MIN ==
 add_laplace_noise(INT64_MIN, min_dbl_error,
-  INT64_MAX, 1));
+  DBL_MAX, 1));
 
   /* does it play nice with INT64_MAX? */
   tt_assert((INT64_MAX - 35) ==
@@ -4223,10 +4224,10 @@ test_util_laplace(void *arg)
   delta_f, epsilon));
   tt_assert((INT64_MIN + INT64_MAX) ==
 add_laplace_noise(INT64_MIN, max_dbl_lt_one,
-  INT64_MAX, 1));
+  DBL_MAX, 1));
   tt_assert(INT64_MAX ==
 add_laplace_noise(INT64_MAX, max_dbl_lt_one,
-  INT64_MAX, 1));
+  DBL_MAX, 1));
   /* does it play nice with INT64_MIN? */
   tt_assert((INT64_MIN + 35) ==
 add_laplace_noise(INT64_MIN, max_dbl_lt_one,



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


[tor-commits] [tor/master] Add unit tests for cast_double_to_int64().

2015-11-12 Thread nickm
commit 0fcd150959c82add23e82532a29e874ce9e84468
Author: teor 
Date:   Wed May 6 18:08:18 2015 +1000

Add unit tests for cast_double_to_int64().
---
 src/test/test_util.c |   58 ++
 1 file changed, 58 insertions(+)

diff --git a/src/test/test_util.c b/src/test/test_util.c
index 3310316..3580493 100644
--- a/src/test/test_util.c
+++ b/src/test/test_util.c
@@ -4237,6 +4237,62 @@ test_util_laplace(void *arg)
   ;
 }
 
+static void
+test_util_cast_double_to_int64(void *arg)
+{
+  (void)arg;
+
+  tt_i64_op(INT64_MIN, ==, cast_double_to_int64(-INFINITY));
+  tt_i64_op(INT64_MIN, ==,
+cast_double_to_int64(-1.0 * pow(2.0, 64.0) - 1.0));
+  tt_i64_op(INT64_MIN, ==,
+cast_double_to_int64(-1.0 * pow(2.0, 63.0) - 1.0));
+  tt_i64_op(((int64_t) -1) << 53, ==,
+cast_double_to_int64(-1.0 * pow(2.0, 53.0)));
+  tt_i64_opint64_t) -1) << 53) + 1, ==,
+cast_double_to_int64(-1.0 * pow(2.0, 53.0) + 1.0));
+  tt_i64_op(-1, ==, cast_double_to_int64(-1.0));
+  tt_i64_op(0, ==, cast_double_to_int64(-0.9));
+  tt_i64_op(0, ==, cast_double_to_int64(-0.1));
+  tt_i64_op(0, ==, cast_double_to_int64(0.0));
+  tt_i64_op(0, ==, cast_double_to_int64(NAN));
+  tt_i64_op(0, ==, cast_double_to_int64(0.1));
+  tt_i64_op(0, ==, cast_double_to_int64(0.9));
+  tt_i64_op(1, ==, cast_double_to_int64(1.0));
+  tt_i64_opint64_t) 1) << 53) - 1, ==,
+cast_double_to_int64(pow(2.0, 53.0) - 1.0));
+  tt_i64_op(((int64_t) 1) << 53, ==,
+cast_double_to_int64(pow(2.0, 53.0)));
+  tt_i64_op(INT64_MAX, ==,
+cast_double_to_int64(pow(2.0, 63.0)));
+  tt_i64_op(INT64_MAX, ==,
+cast_double_to_int64(pow(2.0, 64.0)));
+  tt_i64_op(INT64_MAX, ==, cast_double_to_int64(INFINITY));
+
+ done:
+  ;
+}
+
+static void
+test_util_strclear(void *arg)
+{
+  static const char *vals[] = { "", "a", "abcdef", "abcdefgh", NULL };
+  int i;
+  char *v = NULL;
+  (void)arg;
+
+  for (i = 0; vals[i]; ++i) {
+size_t n;
+v = tor_strdup(vals[i]);
+n = strlen(v);
+tor_strclear(v);
+tt_assert(tor_mem_is_zero(v, n+1));
+tor_free(v);
+  }
+ done:
+  tor_free(v);
+}
+
 #define UTIL_LEGACY(name)   \
   { #name, test_util_ ## name , 0, NULL, NULL }
 
@@ -4454,6 +4510,8 @@ struct testcase_t util_tests[] = {
   UTIL_LEGACY(di_ops),
   UTIL_TEST(round_to_next_multiple_of, 0),
   UTIL_TEST(laplace, 0),
+  UTIL_TEST(cast_double_to_int64, 0),
+  UTIL_TEST(strclear, 0),
   UTIL_TEST(find_str_at_start_of_line, 0),
   UTIL_TEST(string_is_C_identifier, 0),
   UTIL_TEST(asprintf, 0),



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


[tor-commits] [tor/master] Make round_to_next_multiple_of always round upwards.

2015-11-12 Thread nickm
commit 0694263b7533ba000d3d95a2936115b21b806a5d
Author: Nick Mathewson 
Date:   Thu Nov 12 11:32:14 2015 -0500

Make round_to_next_multiple_of always round upwards.

Yes, even if it has to return a non-multiple.  This prevents us from
ever having a bug where we try to use it for allocation, and under-allocate.
---
 src/common/util.c|   32 +---
 src/test/test_util.c |8 
 2 files changed, 25 insertions(+), 15 deletions(-)

diff --git a/src/common/util.c b/src/common/util.c
index cc7760b..63bd1cc 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -487,48 +487,58 @@ round_to_power_of_2(uint64_t u64)
 }
 
 /** Return the lowest x such that x is at least number, and x modulo
- * divisor == 0. */
+ * divisor == 0.  If no such x can be expressed as an unsigned, return
+ * UINT_MAX */
 unsigned
 round_to_next_multiple_of(unsigned number, unsigned divisor)
 {
   tor_assert(divisor > 0);
-  if (UINT_MAX - divisor + 1 >= number)
-number += divisor - 1;
+  if (UINT_MAX - divisor + 1 < number)
+return UINT_MAX;
+  number += divisor - 1;
   number -= number % divisor;
   return number;
 }
 
 /** Return the lowest x such that x is at least number, and x modulo
- * divisor == 0. */
+ * divisor == 0. If no such x can be expressed as a uint32_t, return
+ * UINT32_MAX */
 uint32_t
 round_uint32_to_next_multiple_of(uint32_t number, uint32_t divisor)
 {
   tor_assert(divisor > 0);
-  if (UINT32_MAX - divisor + 1 >= number)
-number += divisor - 1;
+  if (UINT32_MAX - divisor + 1 < number)
+return UINT32_MAX;
+
+  number += divisor - 1;
   number -= number % divisor;
   return number;
 }
 
 /** Return the lowest x such that x is at least number, and x modulo
- * divisor == 0. */
+ * divisor == 0. If no such x can be expressed as a uint64_t, return
+ * UINT64_MAX */
 uint64_t
 round_uint64_to_next_multiple_of(uint64_t number, uint64_t divisor)
 {
   tor_assert(divisor > 0);
-  if (UINT64_MAX - divisor + 1 >= number)
-number += divisor - 1;
+  if (UINT64_MAX - divisor + 1 < number)
+return UINT64_MAX;
+  number += divisor - 1;
   number -= number % divisor;
   return number;
 }
 
 /** Return the lowest x in [INT64_MIN, INT64_MAX] such that x is at least
- * number, and x modulo divisor == 0. */
+ * number, and x modulo divisor == 0. If no such x can be
+ * expressed as an int64_t, return INT64_MAX */
 int64_t
 round_int64_to_next_multiple_of(int64_t number, int64_t divisor)
 {
   tor_assert(divisor > 0);
-  if (number >= 0 && INT64_MAX - divisor + 1 >= number)
+  if (INT64_MAX - divisor + 1 < number)
+return INT64_MAX;
+  if (number >= 0)
 number += divisor - 1;
   number -= number % divisor;
   return number;
diff --git a/src/test/test_util.c b/src/test/test_util.c
index d23ce5f..8ae5bb3 100644
--- a/src/test/test_util.c
+++ b/src/test/test_util.c
@@ -4056,7 +4056,7 @@ test_util_round_to_next_multiple_of(void *arg)
   tt_u64_op(round_uint64_to_next_multiple_of(99,9), ==, 99);
 
   tt_u64_op(round_uint64_to_next_multiple_of(UINT64_MAX,2), ==,
-UINT64_MAX-UINT64_MAX%2);
+UINT64_MAX);
 
   tt_i64_op(round_int64_to_next_multiple_of(0,1), ==, 0);
   tt_i64_op(round_int64_to_next_multiple_of(0,7), ==, 0);
@@ -4071,7 +4071,7 @@ test_util_round_to_next_multiple_of(void *arg)
 
   tt_i64_op(round_int64_to_next_multiple_of(INT64_MIN,2), ==, INT64_MIN);
   tt_i64_op(round_int64_to_next_multiple_of(INT64_MAX,2), ==,
-INT64_MAX-INT64_MAX%2);
+INT64_MAX);
 
   tt_int_op(round_uint32_to_next_multiple_of(0,1), ==, 0);
   tt_int_op(round_uint32_to_next_multiple_of(0,7), ==, 0);
@@ -4081,7 +4081,7 @@ test_util_round_to_next_multiple_of(void *arg)
   tt_int_op(round_uint32_to_next_multiple_of(99,9), ==, 99);
 
   tt_int_op(round_uint32_to_next_multiple_of(UINT32_MAX,2), ==,
-UINT32_MAX-UINT32_MAX%2);
+UINT32_MAX);
 
   tt_uint_op(round_to_next_multiple_of(0,1), ==, 0);
   tt_uint_op(round_to_next_multiple_of(0,7), ==, 0);
@@ -4091,7 +4091,7 @@ test_util_round_to_next_multiple_of(void *arg)
   tt_uint_op(round_to_next_multiple_of(99,9), ==, 99);
 
   tt_uint_op(round_to_next_multiple_of(UINT_MAX,2), ==,
-UINT_MAX-UINT_MAX%2);
+UINT_MAX);
  done:
   ;
 }



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


[tor-commits] [tor/master] Handle edge cases in the round_*_to_next_multiple_of functions

2015-11-12 Thread nickm
commit 09cac24373e5a13cc527bf2f32132a9479d4ae1e
Author: teor 
Date:   Thu Dec 25 20:52:10 2014 +1100

Handle edge cases in the round_*_to_next_multiple_of functions

Consistently check for overflow in round_*_to_next_multiple_of.

Check all round_*_to_next_multiple_of functions with expected values.
Check all round_*_to_next_multiple_of functions with maximal values.

Related to HS stats in #13192.
---
 changes/laplace-edge-cases |6 +-
 src/common/util.c  |   12 +---
 src/test/test_util.c   |   27 +--
 3 files changed, 39 insertions(+), 6 deletions(-)

diff --git a/changes/laplace-edge-cases b/changes/laplace-edge-cases
index f8a36e1..266b119 100644
--- a/changes/laplace-edge-cases
+++ b/changes/laplace-edge-cases
@@ -3,5 +3,9 @@
* avoid division by zero
* avoid taking the log of zero
* silence clang type conversion warnings using round and trunc
-- Add tests for laplace edge cases.
+   * consistently check for overflow in round_*_to_next_multiple_of
+- Add tests for laplace edge cases:
+   * check add_laplace_noise with maximal values
+   * check round_*_to_next_multiple_of with additional values
+   * check round_*_to_next_multiple_of with maximal values
   Related to HS stats in #13192.
diff --git a/src/common/util.c b/src/common/util.c
index 52b3e04..3e680d2 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -491,7 +491,9 @@ round_to_power_of_2(uint64_t u64)
 unsigned
 round_to_next_multiple_of(unsigned number, unsigned divisor)
 {
-  number += divisor - 1;
+  tor_assert(divisor > 0);
+  if (UINT_MAX - divisor + 1 >= number)
+number += divisor - 1;
   number -= number % divisor;
   return number;
 }
@@ -501,7 +503,9 @@ round_to_next_multiple_of(unsigned number, unsigned divisor)
 uint32_t
 round_uint32_to_next_multiple_of(uint32_t number, uint32_t divisor)
 {
-  number += divisor - 1;
+  tor_assert(divisor > 0);
+  if (UINT32_MAX - divisor + 1 >= number)
+number += divisor - 1;
   number -= number % divisor;
   return number;
 }
@@ -511,7 +515,9 @@ round_uint32_to_next_multiple_of(uint32_t number, uint32_t 
divisor)
 uint64_t
 round_uint64_to_next_multiple_of(uint64_t number, uint64_t divisor)
 {
-  number += divisor - 1;
+  tor_assert(divisor > 0);
+  if (UINT64_MAX - divisor + 1 >= number)
+number += divisor - 1;
   number -= number % divisor;
   return number;
 }
diff --git a/src/test/test_util.c b/src/test/test_util.c
index 940f9bd..74d7227 100644
--- a/src/test/test_util.c
+++ b/src/test/test_util.c
@@ -4054,8 +4054,11 @@ test_util_round_to_next_multiple_of(void *arg)
   tt_u64_op(round_uint64_to_next_multiple_of(99,7), ==, 105);
   tt_u64_op(round_uint64_to_next_multiple_of(99,9), ==, 99);
 
-  tt_i64_op(round_int64_to_next_multiple_of(0,1), ==, 0);
-  tt_i64_op(round_int64_to_next_multiple_of(0,7), ==, 0);
+  tt_assert(round_uint64_to_next_multiple_of(UINT64_MAX,2) ==
+UINT64_MAX-UINT64_MAX%2);
+
+  tt_assert(round_int64_to_next_multiple_of(0,1) == 0);
+  tt_assert(round_int64_to_next_multiple_of(0,7) == 0);
 
   tt_i64_op(round_int64_to_next_multiple_of(99,1), ==, 99);
   tt_i64_op(round_int64_to_next_multiple_of(99,7), ==, 105);
@@ -4068,6 +4071,26 @@ test_util_round_to_next_multiple_of(void *arg)
   tt_i64_op(round_int64_to_next_multiple_of(INT64_MIN,2), ==, INT64_MIN);
   tt_i64_op(round_int64_to_next_multiple_of(INT64_MAX,2), ==,
 INT64_MAX-INT64_MAX%2);
+
+  tt_assert(round_uint32_to_next_multiple_of(0,1) == 0);
+  tt_assert(round_uint32_to_next_multiple_of(0,7) == 0);
+
+  tt_assert(round_uint32_to_next_multiple_of(99,1) == 99);
+  tt_assert(round_uint32_to_next_multiple_of(99,7) == 105);
+  tt_assert(round_uint32_to_next_multiple_of(99,9) == 99);
+
+  tt_assert(round_uint32_to_next_multiple_of(UINT32_MAX,2) ==
+UINT32_MAX-UINT32_MAX%2);
+
+  tt_assert(round_to_next_multiple_of(0,1) == 0);
+  tt_assert(round_to_next_multiple_of(0,7) == 0);
+
+  tt_assert(round_to_next_multiple_of(99,1) == 99);
+  tt_assert(round_to_next_multiple_of(99,7) == 105);
+  tt_assert(round_to_next_multiple_of(99,9) == 99);
+
+  tt_assert(round_to_next_multiple_of(UINT_MAX,2) ==
+UINT_MAX-UINT_MAX%2);
  done:
   ;
 }



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


[tor-commits] [tor/master] Handle edge cases in laplace functions

2015-11-12 Thread nickm
commit 6d54bdbdcf076167c1b73bfb5bef9fd1c3921796
Author: teor 
Date:   Thu Dec 25 20:30:18 2014 +1100

Handle edge cases in laplace functions

Avoid division by zero.
Avoid taking the log of zero.
Silence clang type conversion warnings using round and trunc.
The existing values returned by the laplace functions do not change.

Add tests for laplace edge cases.
These changes pass the existing unit tests without modification.

Related to HS stats in #13192.
---
 changes/laplace-edge-cases |7 ++
 src/common/util.c  |   33 ++--
 src/test/test_util.c   |  201 ++--
 3 files changed, 226 insertions(+), 15 deletions(-)

diff --git a/changes/laplace-edge-cases b/changes/laplace-edge-cases
new file mode 100644
index 000..f8a36e1
--- /dev/null
+++ b/changes/laplace-edge-cases
@@ -0,0 +1,7 @@
+  o Minor bugfixes:
+- Handle edge cases in the laplace functions:
+   * avoid division by zero
+   * avoid taking the log of zero
+   * silence clang type conversion warnings using round and trunc
+- Add tests for laplace edge cases.
+  Related to HS stats in #13192.
diff --git a/src/common/util.c b/src/common/util.c
index f8d1b7b..52b3e04 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -536,13 +536,18 @@ int64_t
 sample_laplace_distribution(double mu, double b, double p)
 {
   double result;
-
   tor_assert(p >= 0.0 && p < 1.0);
+
   /* This is the "inverse cumulative distribution function" from:
* http://en.wikipedia.org/wiki/Laplace_distribution */
+  if (p == 0.0) {
+/* Avoid taking log(0.0) == -INFINITY, as some processors or compiler
+ * options can cause the program to trap. */
+return INT64_MIN;
+  }
+
   result =  mu - b * (p > 0.5 ? 1.0 : -1.0)
* tor_mathlog(1.0 - 2.0 * fabs(p - 0.5));
-
   if (result >= INT64_MAX)
 return INT64_MAX;
   else if (result <= INT64_MIN)
@@ -551,18 +556,28 @@ sample_laplace_distribution(double mu, double b, double p)
 return (int64_t) result;
 }
 
-/** Add random noise between INT64_MIN and INT64_MAX coming from a
- * Laplace distribution with mu = 0 and b = delta_f/epsilon
- * to signal based on the provided random value in
- * [0.0, 1.0[. */
+/** Add random noise between INT64_MIN and INT64_MAX coming from a Laplace
+ * distribution with mu = 0 and b = delta_f/epsilon to
+ * signal based on the provided random value in [0.0, 1.0[.
+ * The epislon value must be between ]0.0, 1.0]. delta_f must be greater
+ * than 0. */
 int64_t
 add_laplace_noise(int64_t signal, double random, double delta_f,
   double epsilon)
 {
-  int64_t noise = sample_laplace_distribution(
-   0.0, /* just add noise, no further signal */
-   delta_f / epsilon, random);
+  int64_t noise;
+
+  /* epsilon MUST be between ]0.0, 1.0] */
+  tor_assert(epsilon > 0.0 && epsilon <= 1.0);
+  /* delta_f MUST be greater than 0. */
+  tor_assert(delta_f > 0.0);
+
+  /* Just add noise, no further signal */
+  noise = sample_laplace_distribution(0.0,
+  delta_f / epsilon,
+  random);
 
+  /* Clip (signal + noise) to [INT64_MIN, INT64_MAX] */
   if (noise > 0 && INT64_MAX - noise < signal)
 return INT64_MAX;
   else if (noise < 0 && INT64_MIN - noise > signal)
diff --git a/src/test/test_util.c b/src/test/test_util.c
index 6a4c3ec..940f9bd 100644
--- a/src/test/test_util.c
+++ b/src/test/test_util.c
@@ -4100,12 +4100,201 @@ test_util_laplace(void *arg)
*/
   tt_i64_op(INT64_MIN + 20, ==,
 add_laplace_noise(20, 0.0, delta_f, epsilon));
-  tt_i64_op(-60, ==, add_laplace_noise(20, 0.1, delta_f, epsilon));
-  tt_i64_op(-14, ==, add_laplace_noise(20, 0.25, delta_f, epsilon));
-  tt_i64_op(20, ==, add_laplace_noise(20, 0.5, delta_f, epsilon));
-  tt_i64_op(54, ==, add_laplace_noise(20, 0.75, delta_f, epsilon));
-  tt_i64_op(100, ==, add_laplace_noise(20, 0.9, delta_f, epsilon));
-  tt_i64_op(215, ==, add_laplace_noise(20, 0.99, delta_f, epsilon));
+
+  tt_assert(-60 == add_laplace_noise(20, 0.1, delta_f, epsilon));
+  tt_assert(-14 == add_laplace_noise(20, 0.25, delta_f, epsilon));
+  tt_assert(20 == add_laplace_noise(20, 0.5, delta_f, epsilon));
+  tt_assert(54 == add_laplace_noise(20, 0.75, delta_f, epsilon));
+  tt_assert(100 == add_laplace_noise(20, 0.9, delta_f, epsilon));
+  tt_assert(215 == add_laplace_noise(20, 0.99, delta_f, epsilon));
+
+  /* Test extreme values of signal with maximally negative values of noise
+   * 1.0002 is the smallest number > 1
+   * 0.0002 is the double epsilon (error when calculating near 1)
+   * this is approximately 1/(2^52)
+   * per https://en.wikipedia.org/wiki/Double_precision
+   * (let's not descend into the world of subnormals)
+   * >>> laplace.ppf([0, 0.0002], loc = 0, scale = 1)
+   * array([-inf, -35.45506713])
+   

[tor-commits] [tor/master] Add an util function to cast double to int64_t

2015-11-12 Thread nickm
commit 8acccdbeac69b066be805f711133e188a7b04f28
Author: David Goulet 
Date:   Mon Feb 16 15:55:30 2015 -0500

Add an util function to cast double to int64_t

Use it in the sample_laplace_distribution function to make sure we return
the correct converted value after math operations are done on the input
values.

Thanks to Yawning for proposing a solution.

Signed-off-by: David Goulet 
---
 src/common/util.c |   41 +++--
 src/common/util.h |1 +
 2 files changed, 36 insertions(+), 6 deletions(-)

diff --git a/src/common/util.c b/src/common/util.c
index d8da8b1..cc7760b 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -554,12 +554,8 @@ sample_laplace_distribution(double mu, double b, double p)
 
   result = mu - b * (p > 0.5 ? 1.0 : -1.0)
   * tor_mathlog(1.0 - 2.0 * fabs(p - 0.5));
-  if (result >= INT64_MAX)
-return INT64_MAX;
-  else if (result <= INT64_MIN)
-return INT64_MIN;
-  else
-return tor_llround(trunc(result));
+
+  return cast_double_to_int64(result);
 }
 
 /** Add random noise between INT64_MIN and INT64_MAX coming from a Laplace
@@ -5500,3 +5496,36 @@ tor_weak_random_range(tor_weak_rng_t *rng, int32_t top)
   return result;
 }
 
+/** Cast a given double value to a int64_t. Return 0 if number is NaN.
+ * Returns either INT64_MIN or INT64_MAX if number is outside of the int64_t
+ * range. */
+int64_t cast_double_to_int64(double number)
+{
+  int exp;
+
+  /* NaN is a special case that can't be used with the logic below. */
+  if (isnan(number)) {
+return 0;
+  }
+
+  /* Time to validate if result can overflows a int64_t value. Fun with
+   * float! Find that exponent exp such that
+   *number == x * 2^exp
+   * for some x with abs(x) in [0.5, 1.0). Note that this implies that the
+   * magnitude of number is strictly less than 2^exp.
+   *
+   * If number is infinite, the call to frexp is legal but the contents of
+   * exp are unspecified. */
+  frexp(number, );
+
+  /* If the magnitude of number is strictly less than 2^63, the truncated
+   * version of number is guaranteed to be representable. The only
+   * representable integer for which this is not the case is INT64_MIN, but
+   * it is covered by the logic below. */
+  if (isfinite(number) && exp <= 63) {
+return number;
+  }
+
+  /* Handle infinities and finite numbers with magnitude >= 2^63. */
+  return signbit(number) ? INT64_MIN : INT64_MAX;
+}
diff --git a/src/common/util.h b/src/common/util.h
index 30ac248..e303da2 100644
--- a/src/common/util.h
+++ b/src/common/util.h
@@ -185,6 +185,7 @@ int64_t sample_laplace_distribution(double mu, double b, 
double p);
 int64_t add_laplace_noise(int64_t signal, double random, double delta_f,
   double epsilon);
 int n_bits_set_u8(uint8_t v);
+int64_t cast_double_to_int64(double number);
 
 /* Compute the CEIL of a divided by b, for nonnegative a
  * and positive b.  Works on integer types only. Not defined if a+b can



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


[tor-commits] [tor/master] Merge branch 'karsten_bug13192_026_03_teor'

2015-11-12 Thread nickm
commit d20a3d07e3904d777b5395ad7e52930138634257
Merge: 0a3eed5 1f7ba11
Author: Nick Mathewson 
Date:   Thu Nov 12 11:40:58 2015 -0500

Merge branch 'karsten_bug13192_026_03_teor'

 changes/laplace-edge-cases |8 +++
 src/common/util.c  |  102 +--
 src/common/util.h  |1 +
 src/or/rephist.c   |   12 ++--
 src/test/test_util.c   |  165 +++-
 5 files changed, 260 insertions(+), 28 deletions(-)

diff --cc src/test/test_util.c
index 0a5783e,f96a362..208186c
--- a/src/test/test_util.c
+++ b/src/test/test_util.c
@@@ -4438,9 -4488,9 +4600,10 @@@ struct testcase_t util_tests[] = 
UTIL_LEGACY(path_is_relative),
UTIL_LEGACY(strtok),
UTIL_LEGACY(di_ops),
 +  UTIL_TEST(di_map, 0),
UTIL_TEST(round_to_next_multiple_of, 0),
UTIL_TEST(laplace, 0),
+   UTIL_TEST(clamp_double_to_int64, 0),
UTIL_TEST(find_str_at_start_of_line, 0),
UTIL_TEST(string_is_C_identifier, 0),
UTIL_TEST(asprintf, 0),

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


[tor-commits] [tor/master] Rename cast_double_to_int64 to clamp_double_to_int64

2015-11-12 Thread nickm
commit 1f7ba115a46743ea09402a30a7b11e4b6d2ee52e
Author: Nick Mathewson 
Date:   Thu Jul 9 16:54:17 2015 -0400

Rename cast_double_to_int64 to clamp_double_to_int64
---
 src/common/util.c|4 ++--
 src/common/util.h|2 +-
 src/test/test_util.c |   40 
 3 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/src/common/util.c b/src/common/util.c
index 63bd1cc..f642c6a 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -565,7 +565,7 @@ sample_laplace_distribution(double mu, double b, double p)
   result = mu - b * (p > 0.5 ? 1.0 : -1.0)
   * tor_mathlog(1.0 - 2.0 * fabs(p - 0.5));
 
-  return cast_double_to_int64(result);
+  return clamp_double_to_int64(result);
 }
 
 /** Add random noise between INT64_MIN and INT64_MAX coming from a Laplace
@@ -5509,7 +5509,7 @@ tor_weak_random_range(tor_weak_rng_t *rng, int32_t top)
 /** Cast a given double value to a int64_t. Return 0 if number is NaN.
  * Returns either INT64_MIN or INT64_MAX if number is outside of the int64_t
  * range. */
-int64_t cast_double_to_int64(double number)
+int64_t clamp_double_to_int64(double number)
 {
   int exp;
 
diff --git a/src/common/util.h b/src/common/util.h
index e303da2..8e18e05 100644
--- a/src/common/util.h
+++ b/src/common/util.h
@@ -185,7 +185,7 @@ int64_t sample_laplace_distribution(double mu, double b, 
double p);
 int64_t add_laplace_noise(int64_t signal, double random, double delta_f,
   double epsilon);
 int n_bits_set_u8(uint8_t v);
-int64_t cast_double_to_int64(double number);
+int64_t clamp_double_to_int64(double number);
 
 /* Compute the CEIL of a divided by b, for nonnegative a
  * and positive b.  Works on integer types only. Not defined if a+b can
diff --git a/src/test/test_util.c b/src/test/test_util.c
index 8ae5bb3..f96a362 100644
--- a/src/test/test_util.c
+++ b/src/test/test_util.c
@@ -4238,36 +4238,36 @@ test_util_laplace(void *arg)
 }
 
 static void
-test_util_cast_double_to_int64(void *arg)
+test_util_clamp_double_to_int64(void *arg)
 {
   (void)arg;
 
-  tt_i64_op(INT64_MIN, ==, cast_double_to_int64(-INFINITY));
+  tt_i64_op(INT64_MIN, ==, clamp_double_to_int64(-INFINITY));
   tt_i64_op(INT64_MIN, ==,
-cast_double_to_int64(-1.0 * pow(2.0, 64.0) - 1.0));
+clamp_double_to_int64(-1.0 * pow(2.0, 64.0) - 1.0));
   tt_i64_op(INT64_MIN, ==,
-cast_double_to_int64(-1.0 * pow(2.0, 63.0) - 1.0));
+clamp_double_to_int64(-1.0 * pow(2.0, 63.0) - 1.0));
   tt_i64_op(((uint64_t) -1) << 53, ==,
-cast_double_to_int64(-1.0 * pow(2.0, 53.0)));
+clamp_double_to_int64(-1.0 * pow(2.0, 53.0)));
   tt_i64_opuint64_t) -1) << 53) + 1, ==,
-cast_double_to_int64(-1.0 * pow(2.0, 53.0) + 1.0));
-  tt_i64_op(-1, ==, cast_double_to_int64(-1.0));
-  tt_i64_op(0, ==, cast_double_to_int64(-0.9));
-  tt_i64_op(0, ==, cast_double_to_int64(-0.1));
-  tt_i64_op(0, ==, cast_double_to_int64(0.0));
-  tt_i64_op(0, ==, cast_double_to_int64(NAN));
-  tt_i64_op(0, ==, cast_double_to_int64(0.1));
-  tt_i64_op(0, ==, cast_double_to_int64(0.9));
-  tt_i64_op(1, ==, cast_double_to_int64(1.0));
+clamp_double_to_int64(-1.0 * pow(2.0, 53.0) + 1.0));
+  tt_i64_op(-1, ==, clamp_double_to_int64(-1.0));
+  tt_i64_op(0, ==, clamp_double_to_int64(-0.9));
+  tt_i64_op(0, ==, clamp_double_to_int64(-0.1));
+  tt_i64_op(0, ==, clamp_double_to_int64(0.0));
+  tt_i64_op(0, ==, clamp_double_to_int64(NAN));
+  tt_i64_op(0, ==, clamp_double_to_int64(0.1));
+  tt_i64_op(0, ==, clamp_double_to_int64(0.9));
+  tt_i64_op(1, ==, clamp_double_to_int64(1.0));
   tt_i64_opint64_t) 1) << 53) - 1, ==,
-cast_double_to_int64(pow(2.0, 53.0) - 1.0));
+clamp_double_to_int64(pow(2.0, 53.0) - 1.0));
   tt_i64_op(((int64_t) 1) << 53, ==,
-cast_double_to_int64(pow(2.0, 53.0)));
+clamp_double_to_int64(pow(2.0, 53.0)));
   tt_i64_op(INT64_MAX, ==,
-cast_double_to_int64(pow(2.0, 63.0)));
+clamp_double_to_int64(pow(2.0, 63.0)));
   tt_i64_op(INT64_MAX, ==,
-cast_double_to_int64(pow(2.0, 64.0)));
-  tt_i64_op(INT64_MAX, ==, cast_double_to_int64(INFINITY));
+clamp_double_to_int64(pow(2.0, 64.0)));
+  tt_i64_op(INT64_MAX, ==, clamp_double_to_int64(INFINITY));
 
  done:
   ;
@@ -4490,7 +4490,7 @@ struct testcase_t util_tests[] = {
   UTIL_LEGACY(di_ops),
   UTIL_TEST(round_to_next_multiple_of, 0),
   UTIL_TEST(laplace, 0),
-  UTIL_TEST(cast_double_to_int64, 0),
+  UTIL_TEST(clamp_double_to_int64, 0),
   UTIL_TEST(find_str_at_start_of_line, 0),
   UTIL_TEST(string_is_C_identifier, 0),
   UTIL_TEST(asprintf, 0),



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


[tor-commits] [tor/master] Remove test for strclear as it no longer exists in the codebase

2015-11-12 Thread nickm
commit 75fc4d551174b712a0468ae7a8be821b566ef1f9
Author: teor 
Date:   Wed May 6 18:27:26 2015 +1000

Remove test for strclear as it no longer exists in the codebase
---
 src/test/test_util.c |   21 -
 1 file changed, 21 deletions(-)

diff --git a/src/test/test_util.c b/src/test/test_util.c
index d3a2bc2..d23ce5f 100644
--- a/src/test/test_util.c
+++ b/src/test/test_util.c
@@ -4273,26 +4273,6 @@ test_util_cast_double_to_int64(void *arg)
   ;
 }
 
-static void
-test_util_strclear(void *arg)
-{
-  static const char *vals[] = { "", "a", "abcdef", "abcdefgh", NULL };
-  int i;
-  char *v = NULL;
-  (void)arg;
-
-  for (i = 0; vals[i]; ++i) {
-size_t n;
-v = tor_strdup(vals[i]);
-n = strlen(v);
-tor_strclear(v);
-tt_assert(tor_mem_is_zero(v, n+1));
-tor_free(v);
-  }
- done:
-  tor_free(v);
-}
-
 #define UTIL_LEGACY(name)   \
   { #name, test_util_ ## name , 0, NULL, NULL }
 
@@ -4511,7 +4491,6 @@ struct testcase_t util_tests[] = {
   UTIL_TEST(round_to_next_multiple_of, 0),
   UTIL_TEST(laplace, 0),
   UTIL_TEST(cast_double_to_int64, 0),
-  UTIL_TEST(strclear, 0),
   UTIL_TEST(find_str_at_start_of_line, 0),
   UTIL_TEST(string_is_C_identifier, 0),
   UTIL_TEST(asprintf, 0),



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


[tor-commits] [tor/master] Use standard float.h header and resolve undefined left shift behaviour

2015-11-12 Thread nickm
commit e60c612447d376ad07be5e950cce087abcf8f491
Author: teor 
Date:   Fri Mar 27 20:37:07 2015 +1100

Use standard float.h header and resolve undefined left shift behaviour
---
 src/test/test_util.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/test/test_util.c b/src/test/test_util.c
index 3580493..d3a2bc2 100644
--- a/src/test/test_util.c
+++ b/src/test/test_util.c
@@ -19,7 +19,7 @@
 #endif
 #include 
 #include 
-#include 
+#include 
 
 /*  this is a minimal wrapper to make the unit tests compile with the
  * changed tor_timegm interface. */
@@ -4247,9 +4247,9 @@ test_util_cast_double_to_int64(void *arg)
 cast_double_to_int64(-1.0 * pow(2.0, 64.0) - 1.0));
   tt_i64_op(INT64_MIN, ==,
 cast_double_to_int64(-1.0 * pow(2.0, 63.0) - 1.0));
-  tt_i64_op(((int64_t) -1) << 53, ==,
+  tt_i64_op(((uint64_t) -1) << 53, ==,
 cast_double_to_int64(-1.0 * pow(2.0, 53.0)));
-  tt_i64_opint64_t) -1) << 53) + 1, ==,
+  tt_i64_opuint64_t) -1) << 53) + 1, ==,
 cast_double_to_int64(-1.0 * pow(2.0, 53.0) + 1.0));
   tt_i64_op(-1, ==, cast_double_to_int64(-1.0));
   tt_i64_op(0, ==, cast_double_to_int64(-0.9));



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


[tor-commits] [tor/master] Test: remove edge cases that assert in laplace test

2015-11-12 Thread nickm
commit aecc354ee77f2e94d084c4e5bd19b57125db9e07
Author: David Goulet 
Date:   Thu Feb 12 11:31:08 2015 -0500

Test: remove edge cases that assert in laplace test

Signed-off-by: David Goulet 
---
 src/test/test_util.c |   87 --
 1 file changed, 87 deletions(-)

diff --git a/src/test/test_util.c b/src/test/test_util.c
index 74d7227..21737f6 100644
--- a/src/test/test_util.c
+++ b/src/test/test_util.c
@@ -4178,29 +4178,6 @@ test_util_laplace(void *arg)
   tt_assert((-35 + INT64_MAX) ==
 add_laplace_noise(INT64_MAX, min_dbl_error,
   noscale_df, noscale_eps));
-  /* ... even when scaled? */
-  tt_assert(INT64_MIN ==
-add_laplace_noise(0, min_dbl_error,
-  INT64_MIN, -35));
-  tt_assert(INT64_MIN ==
-add_laplace_noise(0, min_dbl_error,
-  INT64_MIN, -34));
-  tt_assert(INT64_MAX ==
-add_laplace_noise(0, min_dbl_error,
-  INT64_MIN, 1));
-  tt_assert((INT64_MIN + INT64_MAX) ==
-add_laplace_noise(INT64_MIN, min_dbl_error,
-  INT64_MIN, 1));
-  tt_assert(INT64_MAX ==
-add_laplace_noise(INT64_MAX, min_dbl_error,
-  INT64_MIN, 1));
-
-  tt_assert(INT64_MAX ==
-add_laplace_noise(0, min_dbl_error,
-  INT64_MAX, -35));
-  tt_assert(INT64_MAX ==
-add_laplace_noise(0, min_dbl_error,
-  INT64_MAX, -34));
   tt_assert(INT64_MIN ==
 add_laplace_noise(0, min_dbl_error,
   INT64_MAX, 1));
@@ -4244,81 +4221,17 @@ test_util_laplace(void *arg)
   tt_assert(INT64_MAX ==
 add_laplace_noise(INT64_MAX, max_dbl_lt_one,
   delta_f, epsilon));
-  tt_assert(INT64_MAX ==
-add_laplace_noise(0, max_dbl_lt_one,
-  INT64_MAX, 35));
-  tt_assert(INT64_MAX ==
-add_laplace_noise(0, max_dbl_lt_one,
-  INT64_MAX, 34));
   tt_assert((INT64_MIN + INT64_MAX) ==
 add_laplace_noise(INT64_MIN, max_dbl_lt_one,
   INT64_MAX, 1));
   tt_assert(INT64_MAX ==
 add_laplace_noise(INT64_MAX, max_dbl_lt_one,
   INT64_MAX, 1));
-  tt_assert((INT64_MAX + INT64_MIN) ==
-add_laplace_noise(INT64_MAX, max_dbl_lt_one,
-  INT64_MIN, 1));
-  tt_assert(INT64_MIN ==
-add_laplace_noise(INT64_MIN, max_dbl_lt_one,
-  INT64_MIN, 1));
-
   /* does it play nice with INT64_MIN? */
   tt_assert((INT64_MIN + 35) ==
 add_laplace_noise(INT64_MIN, max_dbl_lt_one,
   noscale_df, noscale_eps));
 
-  /* Test extreme values of b = delta_f / epsilon
-   * >>> laplace.ppf([0.5], loc = 0, scale = 1)
-   * array([0.])
-   */
-
-  /* Make sure edge cases don't depend on architecture,
-   * optimisation level, or other compiler flags.
-   *  Are these edge cases important enough to make consistent? */
-
-  /* b = positive zero, p yields positive zero */
-  tt_assert(0.0 ==
-add_laplace_noise(0.0, 0.5, 0.0, 1.0))
-  /* b = negative zero, p yields positive zero */
-  tt_assert(0.0 ==
-add_laplace_noise(0.0, 0.5, 0.0, -1.0))
-  /* b = positive infinity, p yields positive zero, result is -NaN -> -Inf */
-  tt_assert(INT64_MIN ==
-add_laplace_noise(0.0, 0.5, 1.0, 0.0))
-  /* b = negative infinity, p yields positive zero, result is -NaN -> -Inf */
-  tt_assert(INT64_MIN ==
-add_laplace_noise(0.0, 0.5, -1.0, 0.0))
-  /* b = positive NaN (rounded to -Inf), p yields positive zero,
-   * result is -NaN -> -Inf */
-  tt_assert(INT64_MIN ==
-add_laplace_noise(0.0, 0.5, -0.0, -0.0))
-  /* b = negative NaN (rounded to -Inf), p yields positive zero,
-   * result is -NaN -> -Inf*/
-  tt_assert(INT64_MIN ==
-add_laplace_noise(0.0, 0.5, -0.0, 0.0))
-
-  /* b = positive zero, p yields negative infinity, result is -NaN -> -Inf */
-  tt_assert(INT64_MIN ==
-add_laplace_noise(0.0, 0.0, 0.0, 1.0))
-  /* b = negative zero, p yields negative infinity, result is -NaN -> -Inf */
-  tt_assert(INT64_MIN ==
-add_laplace_noise(0.0, 0.0, 0.0, -1.0))
-  /* b = positive infinity, p yields negative infinity */
-  tt_assert(INT64_MIN ==
-add_laplace_noise(0.0, 0.0, 1.0, 0.0))
-  /* b = negative infinity, p yields negative infinity */
-  tt_assert(INT64_MAX ==
-add_laplace_noise(0.0, 0.0, -1.0, 0.0))
-  /* b = positive NaN (rounded to -Inf), p yields negative infinity,
-   * result is -NaN -> -Inf */
-  tt_assert(INT64_MIN ==
-add_laplace_noise(0.0, 0.0, -0.0, -0.0))
-  /* b = negative NaN (rounded to -Inf), p yields 

[tor-commits] [tor/master] Fix hs stats comments to be more accurate

2015-11-12 Thread nickm
commit b3832e0b7f95e8082acce1be6505179d38f30d14
Author: David Goulet 
Date:   Thu Feb 12 11:39:49 2015 -0500

Fix hs stats comments to be more accurate

Signed-off-by: David Goulet 
---
 src/or/rephist.c |   12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/or/rephist.c b/src/or/rephist.c
index fe0997c..4f7aaae 100644
--- a/src/or/rephist.c
+++ b/src/or/rephist.c
@@ -3026,21 +3026,21 @@ rep_hist_stored_maybe_new_hs(const crypto_pk_t *pubkey)
 
 /* The number of cells that are supposed to be hidden from the adversary
  * by adding noise from the Laplace distribution.  This value, divided by
- * EPSILON, is Laplace parameter b. */
+ * EPSILON, is Laplace parameter b. It must be greather than 0. */
 #define REND_CELLS_DELTA_F 2048
 /* Security parameter for obfuscating number of cells with a value between
- * 0 and 1.  Smaller values obfuscate observations more, but at the same
+ * ]0.0, 1.0]. Smaller values obfuscate observations more, but at the same
  * time make statistics less usable. */
 #define REND_CELLS_EPSILON 0.3
 /* The number of cells that are supposed to be hidden from the adversary
  * by rounding up to the next multiple of this number. */
 #define REND_CELLS_BIN_SIZE 1024
-/* The number of service identities that are supposed to be hidden from
- * the adversary by adding noise from the Laplace distribution.  This
- * value, divided by EPSILON, is Laplace parameter b. */
+/* The number of service identities that are supposed to be hidden from the
+ * adversary by adding noise from the Laplace distribution. This value,
+ * divided by EPSILON, is Laplace parameter b. It must be greater than 0. */
 #define ONIONS_SEEN_DELTA_F 8
 /* Security parameter for obfuscating number of service identities with a
- * value between 0 and 1.  Smaller values obfuscate observations more, but
+ * value between ]0.0, 1.0]. Smaller values obfuscate observations more, but
  * at the same time make statistics less usable. */
 #define ONIONS_SEEN_EPSILON 0.3
 /* The number of service identities that are supposed to be hidden from



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


[tor-commits] [tor/master] + and / usage clarification - Fixes #13158

2015-11-12 Thread nickm
commit b370052ae418284a6f75a15708d2d0685ec765f4
Author: Joan Queralt 
Date:   Mon Nov 2 01:36:19 2015 +0100

+ and / usage clarification - Fixes #13158
---
 doc/tor.1.txt |   11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/doc/tor.1.txt b/doc/tor.1.txt
index 916433b..04826b3 100644
--- a/doc/tor.1.txt
+++ b/doc/tor.1.txt
@@ -128,13 +128,16 @@ complicated for options that are allowed to occur more 
than once: if you
 specify four SOCKSPorts in your configuration file, and one more SOCKSPort on
 the command line, the option on the command line will replace __all__ of the
 SOCKSPorts in the configuration file.  If this isn't what you want, prefix
-the option name with a plus sign, and it will be appended to the previous set
-of options instead.
+the option name with a plus sign (+), and it will be appended to the previous
+set of options instead.  For example, setting SOCKSPort 9100 will use only
+port 9100, but setting +SOCKSPort 9100 will use ports 9100 and 9050 (because
+this is the default).
 
 Alternatively, you might want to remove every instance of an option in the
 configuration file, and not replace it at all: you might want to say on the
 command line that you want no SOCKSPorts at all.  To do that, prefix the
-option name with a forward slash.
+option name with a forward slash (/).  You can use the plus sign (+) and the
+forward slash (/) in the configuration file and on the command line.
 
 GENERAL OPTIONS
 ---
@@ -2557,7 +2560,7 @@ __DataDirectory__**/control_auth_cookie**::
 overridden by the CookieAuthFile config option. Regenerated on startup. See
 control-spec.txt in https://spec.torproject.org/[torspec] for details.
 Only used when cookie authentication is enabled.
- 
+
 __DataDirectory__**/lock**::
 This file is used to prevent two Tor instances from using same data
 directory. If access to this file is locked, data directory is already

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