Nick Mathewson
acb54dee7b
Remove a now-obsolete comment about deadcode_dummy__
2018-07-30 09:09:10 -04:00
Nick Mathewson
70b16bc679
Merge branch 'ticket26890'
2018-07-30 09:08:39 -04:00
Nick Mathewson
13393b2d91
Merge remote-tracking branch 'rl1987/ticket21349_4'
2018-07-30 08:49:49 -04:00
Nick Mathewson
5823e62fa2
Merge branch 'maint-0.3.4'
2018-07-30 08:17:25 -04:00
rl1987
e6c51a056c
Make entry_guards_update_primary() shorter
2018-07-21 18:38:33 +03:00
Nick Mathewson
c515dc8d0d
Remove over-cleverness from our coverity BUG() definition.
...
Our previous definition implied that code would never keep running
if a BUG occurred (which it does), and that BUG(x) might be true
even if x was false (which it can't be).
Closes ticket 26890. Bugfix on 0.3.1.4-alpha.
2018-07-20 11:19:54 -04:00
Nick Mathewson
7253603e6b
Merge branch 'bug26712'
2018-07-19 12:20:13 -04:00
Nick Mathewson
e2b744ce38
Merge branch 'bug25552_ope_squashed'
2018-07-17 16:19:32 -04:00
George Kadianakis
0140052a35
Make the OPE scheme return CRYPTO_OPE_ERROR on error.
...
Instead of UINT64_MAX.
2018-07-17 15:57:46 -04:00
George Kadianakis
34a5eb5904
Increase OPE_INPUT_MAX.
2018-07-17 15:57:46 -04:00
Nick Mathewson
3a45f6ffe9
Implementation for a simple order-preserving encryption scheme.
...
This is meant for use when encrypting the current time within the
period in order to get a monotonically increasing revision counter
without actually revealing our view of the time.
This scheme is far from the most state-of-the-art: don't use it for
anything else without careful analysis by somebody much smarter than
I am.
See ticket #25552 for some rationale for this logic.
2018-07-17 15:57:46 -04:00
Nick Mathewson
d811ce2421
Add postfork support for nss
...
We need this in our unit tests, since otherwise NSS will notice
we've forked and start cussing us out.
I suspect we'll need a different hack for daemonizing, but this
should be enough for tinytest to work.
2018-07-13 12:35:22 -04:00
Nick Mathewson
c317e78dd7
Initialize and shut down NSS.
...
This is largely conjectural, based on online documentation for NSS
and NSPR.
2018-07-13 12:35:22 -04:00
Nick Mathewson
f45107e7de
Rename crypto.c to crypto_cipher.c (since that's all it still has.)
2018-07-11 14:12:36 -04:00
Nick Mathewson
9010797e63
Remove most includes from crypto.c
2018-07-11 14:02:23 -04:00
Nick Mathewson
922208bd2d
Extract and rename crypto_log_errors().
2018-07-11 13:54:47 -04:00
Nick Mathewson
8e2df98860
Move crypto_add_spaces_to_fp() to crypto_rsa.c
2018-07-11 13:51:26 -04:00
Nick Mathewson
12a1ada158
Move the initialization and cleanup parts of crypto.c
...
These are now part of crypto_init.c. The openssl-only parts now
live in crypto_openssl_mgt.c.
I recommend reviewing this patch with -b and --color-moved.
2018-07-11 13:45:49 -04:00
Nick Mathewson
79267bad65
Add a configure switch to build with NSS.
...
When it is set, include the NSS headers and libraries as
appropriate. Doesn't actually use them yet, though.
2018-07-11 13:22:20 -04:00
Nick Mathewson
2b52360448
Only use OpenSSL kdf support if it is present.
...
We have to check for ERR_load_KDF_strings() here, since that's the
only one that's actually a function rather than a macro.
Fixes compilation with LibreSSL. Fixes bug 26712; bug not in
any released Tor.
2018-07-11 10:19:06 -04:00
Nick Mathewson
5aee26ee46
Move all use cases of micro-revision.i to a single place
...
That place is git-revision.c; git-revision.c now lives in lib/log.
Also fix the compilation rules so that all object files that need
micro-revision.i depend on it.
2018-07-11 09:52:39 -04:00
Nick Mathewson
537092cdbb
Merge branch 'ticket26223'
2018-07-10 20:18:28 -04:00
Nick Mathewson
c90961a923
Document compat_getdelim_.
2018-07-10 20:18:20 -04:00
Nick Mathewson
b6d0e7caa4
Rename tm_cvt to time_to_tm
2018-07-10 15:25:53 -04:00
Nick Mathewson
e7f5f48d68
Rename torlog.[ch] to log.[ch]
...
Fun fact: these files used to be called log.[ch] until we ran into
conflicts with systems having a log.h file. But now that we always
include "lib/log/log.h", we should be fine.
2018-07-10 15:20:30 -04:00
Nick Mathewson
41640b6573
Rename util_malloc to malloc.
2018-07-10 15:16:57 -04:00
Nick Mathewson
6711a172c0
Merge remote-tracking branch 'neel/fbsd-cfix'
2018-07-10 14:50:49 -04:00
Nick Mathewson
8de48c111c
Remove addr_port_lookup.
...
This lets us cut the dependency from address.c to resolve.c: the
address.c module now has no paths to the libc resolver in it.
2018-07-10 13:32:37 -04:00
Nick Mathewson
2f657a1416
Remove all users of addr_port_lookup outside of address.c
...
This function has a nasty API, since whether or not it invokes the
resolver depends on whether one of its arguments is NULL. That's a
good way for accidents to happen.
This patch incidentally makes tor-resolve support socks hosts on
IPv6.
2018-07-10 13:23:37 -04:00
Nick Mathewson
c2ddb7b231
Move tor_addr_{,port_}lookup to resolve.c
2018-07-10 13:00:02 -04:00
Nick Mathewson
5d8336c182
Refactor ipv[46].[ch]
...
These are now combined into an inaddr.[ch], since their purpose is
to implement functions for struct in_addr and struct in6_addr.
The definitions for in6_addr and its allies are now in a separate
header, inaddr_st.h.
Closes ticket 26532.
2018-07-10 12:50:38 -04:00
Neel Chauhan
6d58c20d94
Fix build on FreeBSD post-refactor
2018-07-10 12:32:14 -04:00
Nick Mathewson
4f42c923d6
File-level summary documentation for src/lib/*/*.[ch]
2018-07-10 12:22:01 -04:00
Nick Mathewson
b04d719c10
Integrate getdelim() and getline() support into Tor.
2018-07-10 10:36:49 -04:00
Nick Mathewson
19f2057d49
Fix some lingering windows compilation issues from Jenkins.
...
These were caused by the recent refactoring.
2018-07-09 12:54:40 -04:00
Nick Mathewson
eb856a3e51
strcasecmp should not take a size_t argument
2018-07-09 11:17:23 -04:00
Nick Mathewson
03283c00d8
Merge remote-tracking branch 'rl1987/bug26525'
2018-07-09 09:31:12 -04:00
Nick Mathewson
b8554dd880
Make Tor compile with --disable-memory-sentinels again
2018-07-09 08:44:16 -04:00
Nick Mathewson
753b797ca4
Fix up .may_includes for evloop.
2018-07-05 15:50:20 -04:00
Nick Mathewson
2d69c32bb6
Clean up include paths for libtor-evloop (automated)
2018-07-05 15:22:17 -04:00
Nick Mathewson
1e417b7275
All remaining files in src/common belong to the event loop.
2018-07-05 15:22:17 -04:00
Nick Mathewson
947de40d19
Move openbsd-malloc responsibility to lib/malloc
...
(Note that this is not believed to work, but we may as well have it
in the right place till we remove it)
2018-07-05 15:07:08 -04:00
Nick Mathewson
24c0f83185
Move socks5_status.h to src/lib/net
...
There might be a better place for it in the long run, but this is
the best I can think of for now.
2018-07-05 14:48:29 -04:00
Nick Mathewson
0e4b1781f4
Move handles.h to src/lib/container
...
There might be a better place for it in the long run, but this is
the best we can think of for now.
2018-07-05 14:45:34 -04:00
Nick Mathewson
3d610363ef
Include compat_string.h in smartlist.c
...
We need this for strcasecmp on (some) Windows build environments.
Fix from Gisle Vanem.
2018-07-05 13:53:17 -04:00
Nick Mathewson
fecb8214d5
Try to use stricmp variants that MSDN actually recommends
...
Per recommendation by Gisle Vanem
2018-07-05 13:51:50 -04:00
Nick Mathewson
df98582851
Merge remote-tracking branch 'github/ticket26626'
2018-07-03 12:52:43 -04:00
Nick Mathewson
fe8f774820
Merge branch 'bug26522'
2018-07-03 11:34:36 -04:00
rl1987
d0525c38d6
Refrain from potentially insecure usage of strncat()
2018-07-03 11:34:14 -04:00
Nick Mathewson
77e678c20d
Merge remote-tracking branch 'github/shrink_or_h_more'
2018-07-03 11:09:54 -04:00
Nick Mathewson
02a4442524
Fix up some windows compilation issues.
...
These were mostly cases where our previous macros had been casting,
and the values that we were trying to printf were not in fact
uint64_t.
2018-07-03 11:00:18 -04:00
Nick Mathewson
d5a3bb960d
Retire U64_TO_DBL and DBL_TO_U64
...
These were necessary long ago to work around a bug in VC6.
2018-07-03 10:45:43 -04:00
Nick Mathewson
9568c0ce3d
Return U64_PRINTF_ARG and U64_FORMAT
...
The standard is printf("%"PRIu64, x);
2018-07-03 10:40:59 -04:00
Nick Mathewson
52884f56d4
Replace U64_LITERAL with the standard UINT64_C
2018-07-03 10:33:50 -04:00
Nick Mathewson
cf0b07c2e5
Retire some unused (or nearly unused) macros.
2018-07-03 10:31:19 -04:00
Nick Mathewson
4638be5312
Use the standard SHRT_MAX name.
2018-07-03 10:28:10 -04:00
Nick Mathewson
e2a94dc481
Require stdint.h and inttypes.h
...
We've been silently requiring stdint.h for a while now, and nobody
has complained. Closes ticket 26626.
2018-07-03 10:25:31 -04:00
rl1987
439b528f25
Rename sandbox_getaddrinfo() et. al.
2018-07-03 15:53:39 +03:00
rl1987
fedb3e46ec
Remove ATTR_NONNULL macro
2018-07-03 12:33:09 +03:00
Nick Mathewson
c8ccd028a7
Don't redefine str(n)casecmp on windows unless they're missing
...
When we do redefine them, use inline functions instead of #define.
This fixes a latent code problem in our redefinition of these
functions, which was exposed by our refactoring: Previously, we
would #define strcasecmp after string.h was included, so nothing bad
would happen. But when we refactored, we would sometimes #define it
first, which was a problem on mingw, whose headers contain
(approximately):
inline int strcasecmp (const char *a, const char *b)
{ return _stricmp(a,b); }
Our define turned this into:
inline int _stricmp(const char *a, const char *b)
{ return _stricmp(a,b); }
And GCC would correctly infer that this function would loop forever,
rather than actually comparing anything. This caused bug 26594.
Fixes bug 26594; bug not in any released version of Tor.
2018-07-02 11:50:17 -04:00
Nick Mathewson
cb1a3674eb
File-level documentation for some of src/lib.
2018-07-01 20:22:55 -04:00
Nick Mathewson
83a4946e7b
Prune the .may_include files a bit; detect unused lines in them
2018-07-01 18:14:28 -04:00
Nick Mathewson
1743dac078
Minimize headers that include crypto_formats and x25519 stuff
2018-07-01 15:20:37 -04:00
Nick Mathewson
471104eaa5
Remove needless includes from or.h
...
or.h should really include only the minimum of stuff from or/*,
common/*, and lib/*.
2018-07-01 15:20:37 -04:00
Nick Mathewson
7a61a92870
Combine DH_BYTES and DH_KEY_LEN; put them in a lib/defs header.
2018-07-01 11:25:29 -04:00
Nick Mathewson
43dc92441d
Tabify all of the .am files.
2018-07-01 09:37:28 -04:00
Nick Mathewson
5921b23e15
add an include to fix macos, and probably bsd too
2018-06-29 14:03:13 -04:00
Nick Mathewson
714788b195
Remove non-windows system includes from compat.h and util.h
2018-06-29 12:21:52 -04:00
Nick Mathewson
080069c7b3
Move SIO_IDEAL_SEND_BACKLOG_QUERY into socket.h
2018-06-29 12:21:52 -04:00
Nick Mathewson
b21108f839
Remove an errant (and unused) include permission in lib/tls
2018-06-29 12:21:52 -04:00
Nick Mathewson
4e11c2ca6c
Extract getpass to a new lib/term library
...
(Term is short for terminal)
2018-06-29 12:21:52 -04:00
Nick Mathewson
e0957022bd
Extract get_uname to lib/osinfo.
2018-06-29 12:21:52 -04:00
Nick Mathewson
207fc4cffe
Move SUBTYPE_P into compat_compiler.h
2018-06-29 12:21:52 -04:00
Nick Mathewson
77bc65bbc4
Move bool_eq and bool_neq to lib/intmath
2018-06-29 12:21:52 -04:00
Nick Mathewson
0362cdc169
Move fd and memory-info functions.
2018-06-29 12:21:52 -04:00
Nick Mathewson
973afcc40b
Move tor_get_avail_disk_space() to lib/fs
2018-06-29 09:43:00 -04:00
Nick Mathewson
f0319fcbde
Merge remote-tracking branch 'catalyst-github/fix-macos-includes'
2018-06-28 18:19:53 -04:00
Taylor Yu
f9e22c68a0
Fix macOS includes
...
Recent code movement from refactoring missed some includes that seem
to be necessary on macOS.
2018-06-28 17:15:53 -05:00
Nick Mathewson
365179cd16
Fix a bogus n in a comment
2018-06-28 17:21:15 -04:00
Nick Mathewson
c84ab36eff
A couple of includes to make windows compile again
2018-06-28 16:37:59 -04:00
Nick Mathewson
d8b34e0886
Move buffers into container
...
Split the network-only and compression-only parts of buffers into
the appropriate modules.
2018-06-28 16:28:08 -04:00
Nick Mathewson
be40ad51b6
Add sys/capability.h and sys/prctl.h includes in setuid.c
2018-06-28 15:34:51 -04:00
Nick Mathewson
b67754cd64
compat_threads.c needs string.h for memset.
2018-06-28 15:20:26 -04:00
Nick Mathewson
a742a826f6
Remove all include common/ uses in crypto_ops and tls.
2018-06-28 14:40:25 -04:00
Nick Mathewson
0f02d2c041
Fix windows compilation in compat_time
...
We need to use lib/fs/winlib.h here so that we can use
GetTickCount64.
I would love to declare that XP is dead, and everybody has
GetTickCount64.
2018-06-28 13:40:21 -04:00
Nick Mathewson
7d7af19f1b
Use tor_ntohs in compress.c; avoid a winsocks dependency
2018-06-28 13:39:49 -04:00
Nick Mathewson
326c473b79
fixup! Extract time functionality into lib/wallclock and lib/time
2018-06-28 13:39:09 -04:00
Nick Mathewson
02bb701bba
Move DLL support to lib/fs
2018-06-28 13:37:51 -04:00
Nick Mathewson
8fc15e4861
Add ntohs and htons to lib/arch/bytes.h
2018-06-28 13:26:27 -04:00
Nick Mathewson
4dda026f0d
Update lib/compress to not require common/*.h
2018-06-28 13:19:58 -04:00
Nick Mathewson
3d1e99d01b
Move MIN and MAX into lib/intmath/cmp.h
2018-06-28 13:19:42 -04:00
Nick Mathewson
a097ddb4f5
Extract time functionality into lib/wallclock and lib/time
2018-06-28 13:01:54 -04:00
Nick Mathewson
bdea94a665
Move floating-point math functions into a new lib/math
2018-06-28 12:24:45 -04:00
Nick Mathewson
6178a9f758
Move compute_num_cpus to lib/thread
2018-06-28 12:08:18 -04:00
Nick Mathewson
042df08693
Move network_init to lib/net
2018-06-28 11:59:16 -04:00
Nick Mathewson
db1a420c4e
Move tor_gethostname to lib/net
2018-06-28 11:57:01 -04:00
Nick Mathewson
30166261bb
Move string_is_key_value to lib/encoding
2018-06-28 11:46:32 -04:00
Nick Mathewson
48ebd9bf76
Move weakrng into lib/intmath
2018-06-28 11:39:49 -04:00
Nick Mathewson
aa3edfd205
Move lockfile code into lib/fs
2018-06-28 11:33:50 -04:00
Nick Mathewson
84b8dfe635
Move socket-errno code into lib/net
2018-06-28 11:20:31 -04:00