diff options
Diffstat (limited to 'src/ext')
-rw-r--r-- | src/ext/ed25519/ref10/base.py | 19 | ||||
-rw-r--r-- | src/ext/ed25519/ref10/base2.py | 15 | ||||
-rw-r--r-- | src/ext/ed25519/ref10/d.py | 7 | ||||
-rw-r--r-- | src/ext/ed25519/ref10/d2.py | 7 | ||||
-rw-r--r-- | src/ext/ed25519/ref10/sqrtm1.py | 7 | ||||
-rw-r--r-- | src/ext/ht.h | 9 | ||||
-rw-r--r-- | src/ext/siphash.h | 2 | ||||
-rw-r--r-- | src/ext/timeouts/timeout.h | 6 | ||||
-rw-r--r-- | src/ext/tinytest_macros.h | 4 |
9 files changed, 53 insertions, 23 deletions
diff --git a/src/ext/ed25519/ref10/base.py b/src/ext/ed25519/ref10/base.py index 84accc8580..3d477c5c39 100644 --- a/src/ext/ed25519/ref10/base.py +++ b/src/ext/ed25519/ref10/base.py @@ -1,3 +1,8 @@ +# Future imports for Python 2.7, mandatory in 3.0 +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + b = 256 q = 2**255 - 19 l = 2**252 + 27742317777372353535851937790883648493 @@ -51,15 +56,15 @@ def radix255(x): Bi = B for i in range(32): - print "{" + print("{") Bij = Bi for j in range(8): - print " {" - print " {",radix255(Bij[1]+Bij[0]),"}," - print " {",radix255(Bij[1]-Bij[0]),"}," - print " {",radix255(2*d*Bij[0]*Bij[1]),"}," + print(" {") + print(" {",radix255(Bij[1]+Bij[0]),"},") + print(" {",radix255(Bij[1]-Bij[0]),"},") + print(" {",radix255(2*d*Bij[0]*Bij[1]),"},") Bij = edwards(Bij,Bi) - print " }," - print "}," + print(" },") + print("},") for k in range(8): Bi = edwards(Bi,Bi) diff --git a/src/ext/ed25519/ref10/base2.py b/src/ext/ed25519/ref10/base2.py index 5e4e8739d0..3f8e3d25d2 100644 --- a/src/ext/ed25519/ref10/base2.py +++ b/src/ext/ed25519/ref10/base2.py @@ -1,3 +1,8 @@ +# Future imports for Python 2.7, mandatory in 3.0 +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + b = 256 q = 2**255 - 19 l = 2**252 + 27742317777372353535851937790883648493 @@ -52,9 +57,9 @@ def radix255(x): Bi = B for i in range(8): - print " {" - print " {",radix255(Bi[1]+Bi[0]),"}," - print " {",radix255(Bi[1]-Bi[0]),"}," - print " {",radix255(2*d*Bi[0]*Bi[1]),"}," - print " }," + print(" {") + print(" {",radix255(Bi[1]+Bi[0]),"},") + print(" {",radix255(Bi[1]-Bi[0]),"},") + print(" {",radix255(2*d*Bi[0]*Bi[1]),"},") + print(" },") Bi = edwards(B,edwards(B,Bi)) diff --git a/src/ext/ed25519/ref10/d.py b/src/ext/ed25519/ref10/d.py index 8995bb86a3..5b875de666 100644 --- a/src/ext/ed25519/ref10/d.py +++ b/src/ext/ed25519/ref10/d.py @@ -1,3 +1,8 @@ +# Future imports for Python 2.7, mandatory in 3.0 +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + q = 2**255 - 19 def expmod(b,e,m): @@ -25,4 +30,4 @@ def radix255(x): return result d = -121665 * inv(121666) -print radix255(d) +print(radix255(d)) diff --git a/src/ext/ed25519/ref10/d2.py b/src/ext/ed25519/ref10/d2.py index 79841758be..f59a1bc62a 100644 --- a/src/ext/ed25519/ref10/d2.py +++ b/src/ext/ed25519/ref10/d2.py @@ -1,3 +1,8 @@ +# Future imports for Python 2.7, mandatory in 3.0 +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + q = 2**255 - 19 def expmod(b,e,m): @@ -25,4 +30,4 @@ def radix255(x): return result d = -121665 * inv(121666) -print radix255(d*2) +print(radix255(d*2)) diff --git a/src/ext/ed25519/ref10/sqrtm1.py b/src/ext/ed25519/ref10/sqrtm1.py index 9a47fbc12a..df9f26ee1d 100644 --- a/src/ext/ed25519/ref10/sqrtm1.py +++ b/src/ext/ed25519/ref10/sqrtm1.py @@ -1,3 +1,8 @@ +# Future imports for Python 2.7, mandatory in 3.0 +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + q = 2**255 - 19 def expmod(b,e,m): @@ -25,4 +30,4 @@ def radix255(x): return result I = expmod(2,(q-1)/4,q) -print radix255(I) +print(radix255(I)) diff --git a/src/ext/ht.h b/src/ext/ht.h index 54e5eb7cba..9d4add1936 100644 --- a/src/ext/ht.h +++ b/src/ext/ht.h @@ -226,7 +226,8 @@ ht_string_hash(const char *s) (x) = HT_NEXT(name, head, x)) #ifndef HT_NDEBUG -#define HT_ASSERT_(x) tor_assert(x) +#include "lib/err/torerr.h" +#define HT_ASSERT_(x) raw_assert(x) #else #define HT_ASSERT_(x) (void)0 #endif @@ -370,7 +371,8 @@ ht_string_hash(const char *s) /* Return the next element in 'head' after 'elm', under the arbitrary \ * order used by HT_START. If there are no more elements, return \ * NULL. If 'elm' is to be removed from the table, you must call \ - * this function for the next value before you remove it. \ + * this function for the next value before you remove it, or use \ + * HT_NEXT_RMV instead. \ */ \ ATTR_UNUSED static inline struct type ** \ name##_HT_NEXT(struct name *head, struct type **elm) \ @@ -392,6 +394,8 @@ ht_string_hash(const char *s) return NULL; \ } \ } \ + /* As HT_NEXT, but also remove the current element 'elm' from the \ + * table. */ \ ATTR_UNUSED static inline struct type ** \ name##_HT_NEXT_RMV(struct name *head, struct type **elm) \ { \ @@ -617,4 +621,3 @@ ht_string_hash(const char *s) */ #endif - diff --git a/src/ext/siphash.h b/src/ext/siphash.h index 730e49937d..0207a959ff 100644 --- a/src/ext/siphash.h +++ b/src/ext/siphash.h @@ -1,6 +1,8 @@ #ifndef SIPHASH_H #define SIPHASH_H +#include <stdint.h> + struct sipkey { uint64_t k0; uint64_t k1; diff --git a/src/ext/timeouts/timeout.h b/src/ext/timeouts/timeout.h index 1ed309fd08..f1028bfc80 100644 --- a/src/ext/timeouts/timeout.h +++ b/src/ext/timeouts/timeout.h @@ -89,10 +89,10 @@ typedef uint64_t timeout_t; * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #ifndef TIMEOUT_CB_OVERRIDE -struct timeout_cb { +struct timeout_cb_t { void (*fn)(void); void *arg; -}; /* struct timeout_cb */ +}; /* struct timeout_cb_t */ #endif /* @@ -125,7 +125,7 @@ struct timeout { /* entry member for struct timeout_list lists */ #ifndef TIMEOUT_DISABLE_CALLBACKS - struct timeout_cb callback; + struct timeout_cb_t callback; /* optional callback information */ #endif diff --git a/src/ext/tinytest_macros.h b/src/ext/tinytest_macros.h index c3728d1fdd..6fc2cea2da 100644 --- a/src/ext/tinytest_macros.h +++ b/src/ext/tinytest_macros.h @@ -99,11 +99,11 @@ /* Assert b, but do not stop the test if b fails. Log msg on failure. */ #define tt_want_msg(b, msg) \ - tt_want_(b, msg, ); + tt_want_(b, msg, ) /* Assert b and stop the test if b fails. Log msg on failure. */ #define tt_assert_msg(b, msg) \ - tt_want_(b, msg, TT_EXIT_TEST_FUNCTION); + tt_want_(b, msg, TT_EXIT_TEST_FUNCTION) /* Assert b, but do not stop the test if b fails. */ #define tt_want(b) tt_want_msg( (b), "want("#b")") |