Commit Graph

279 Commits

Author SHA1 Message Date
Nick Mathewson
f07f7a7a12 r8923@totoro: nickm | 2006-10-07 11:44:33 -0400
More doxygen comments


svn:r8637
2006-10-07 16:25:28 +00:00
Nick Mathewson
93beeac01d Merge in some bsockets calls, all wrapped inside #if defined(USE_BSOCKETS)
svn:r8427
2006-09-19 20:41:31 +00:00
Nick Mathewson
c4ac4bcba3 r8696@Kushana: nickm | 2006-08-31 14:43:44 -0400
Try to appease some warnings with newer gccs that believe that ignoring a return value is okay, but casting a return value and then ignoring it is a sign of madness.


svn:r8312
2006-08-31 18:47:54 +00:00
Roger Dingledine
12cc290a7d ok, i'm not allowed to say that there. oh well.
svn:r6720
2006-07-04 16:11:35 +00:00
Roger Dingledine
579849f600 fix a misleading function comment
svn:r6717
2006-07-04 15:52:22 +00:00
Roger Dingledine
5dc1e6f788 if we're the server-side of the tls and there are problems,
don't yell as loudly.


svn:r6716
2006-07-04 15:51:59 +00:00
Roger Dingledine
8cf45df230 and now the exciting part: there is now no such thing as doing
a client-only tls, that is, one with no certs.


svn:r6558
2006-06-07 06:21:11 +00:00
Roger Dingledine
0bfef523df simplify the tortls api: we only support being a "server", that
is, even tor clients do the same sort of handshake.

this has been true for years, so it's best to get rid of the
stale code.


svn:r6557
2006-06-07 06:10:54 +00:00
Roger Dingledine
7512be0b65 looks like we missed a piece of the 0.1.1.9 paranoia code.
hopefully this change is a no-op.


svn:r6556
2006-06-07 02:57:23 +00:00
Roger Dingledine
7f611f4732 if we're a server and some peer has a broken tls certificate, don't
shout about it unless we want to hear about protocol violations.


svn:r6507
2006-05-26 16:32:16 +00:00
Roger Dingledine
67a885ecac Claim a commonname of Tor, rather than TOR, in tls handshakes.
Maybe this will help us win the war of names.


svn:r6489
2006-05-24 00:21:55 +00:00
Nick Mathewson
5777ee0e1a Add some functions to escape values from the network before sending them to the log. Use them everywhere except for routerinfo->plaftorm, routerinfo->contact_info, and rend*.c. (need sleep now)
svn:r6087
2006-03-05 09:50:26 +00:00
Roger Dingledine
6ce36ead42 Start the process of converting warn to log_warn and so on.
This is needed because Windows already has an err() that we
can't clobber. And we need to be able to make the log functions
a macro so we can print the function's name in the log entry.


svn:r6000
2006-02-13 08:01:59 +00:00
Roger Dingledine
5f051574d5 Happy new year!
svn:r5949
2006-02-09 05:46:49 +00:00
Nick Mathewson
241310bbac Split 0119_PARANOIA into 0119_PARANOIA_[ABC]. A is "this is suspicious, and we have not tried running without this yet". B is "this is suspicious, but the last time we tested, it was okay." C is "How could this possibly be the cause?"
svn:r5840
2006-01-17 23:08:38 +00:00
Nick Mathewson
55ac4f032c Add a (diabled by default) option in crypto.h to disable most of the interesting crypto-related changes made on 0.1.1.9. This will help hunt bug 234.
svn:r5777
2006-01-10 21:12:06 +00:00
Nick Mathewson
1af630d32c Bite the bullet and limit all our source lines to 80 characters, the way IBM intended.
svn:r5582
2005-12-14 20:40:40 +00:00
Nick Mathewson
e022aa73e6 Hm; looks like the callback business was unnecessary, since DHparams_dup() copies dh->length.
svn:r5372
2005-11-14 21:17:38 +00:00
Nick Mathewson
027d0ef18c Use a callback to set our DH parameters; set SSL_OP_SINGLE_DH_USE.
svn:r5371
2005-11-14 19:20:47 +00:00
Nick Mathewson
932106f54c Efficiency hack: call tor_fix_source_file late, not early. Add "BUG" domain. Domains are now bitmasks... just in case. Make some err msgs non-general.
svn:r5309
2005-10-25 07:05:03 +00:00
Nick Mathewson
a20835ac92 Check for even more windows version flags, and note any we do not recognize.
svn:r5297
2005-10-24 18:37:09 +00:00
Nick Mathewson
edf5698474 Start dividing log messages into logging domains. No, LD_ is not the best of identifiers. src/or has not been converted yet. Domains dont do anything yet.
svn:r5284
2005-10-18 21:58:19 +00:00
Peter Palfrader
0d9aedfcea Downgrade a few INFO level logs to DEBUG again. Also add two or three new
logs in cases where a calling function's log was downgraded and we wouldn't
get any log message otherwise.


svn:r5263
2005-10-17 16:21:42 +00:00
Roger Dingledine
03dcef4c78 start the process of reducing clutter in server logs
svn:r5253
2005-10-17 00:35:53 +00:00
Nick Mathewson
ba24193ab5 Make doxygen marginally happier
svn:r5208
2005-10-06 04:33:40 +00:00
Nick Mathewson
de198d800b Never call free() on tor_malloc()d memory. This is unlikely to be our current leak, but it may help dmalloc work.
svn:r5168
2005-09-30 20:47:58 +00:00
Nick Mathewson
92451f74a8 Reformat inconsistent function declarations.
svn:r5160
2005-09-30 01:09:52 +00:00
Nick Mathewson
5c53545d81 Add a bunch more warnings to out warning suite; resolve them; pack structs a little better.
svn:r5150
2005-09-29 22:59:17 +00:00
Roger Dingledine
fa507c63e8 put quotes around user-supplied strings so they are more likely to
realize if they add bad characters (like quotes) to the torrc


svn:r4844
2005-08-26 18:40:44 +00:00
Nick Mathewson
d1c094637d Try to resolve another reported solaris x86 warning
svn:r4771
2005-08-12 17:26:43 +00:00
Nick Mathewson
a37db0da26 Appease the hungry God of GCC: it hates K&R style unspecified args!
svn:r4470
2005-06-21 01:07:32 +00:00
Nick Mathewson
2aff87caae Load hardware acceleration options when/where available. Can anybody test this?
svn:r4467
2005-06-20 18:56:35 +00:00
Roger Dingledine
fcd0fc3364 flesh out the source file descriptions for doxygen
svn:r4404
2005-06-11 05:31:17 +00:00
Nick Mathewson
0831823763 Change end-of-file NLNL convention. It turns out arma I and I agree.
svn:r4382
2005-06-09 19:03:31 +00:00
Nick Mathewson
a6f51001a5 New whitespace normalization rule: no blank line at EOF.
svn:r4378
2005-06-09 16:46:51 +00:00
Nick Mathewson
10b2208d93 Make Tor compile with no warnings with gcc4.0 on OSX
svn:r4184
2005-05-07 05:55:06 +00:00
Nick Mathewson
4fb95f166e Apparently, ASN1 failures are not treated as SSL connection errors, but are just general OpenSSL errors. Or something. Anyway, bulletproof tor_tls_handshake.
svn:r4098
2005-04-23 20:35:38 +00:00
Roger Dingledine
54fd9df23f LOG_ERR is for when you're planning to die.
svn:r4087
2005-04-23 14:35:13 +00:00
Nick Mathewson
5827e2e216 Fix "JAP-client" hideous ASN1 bug, twice. (Fix1: check more thoroughly for TLS errors when handling certs. Fix2: stop assert(0)ing on uncaught TLS errors.)
svn:r4085
2005-04-23 14:26:02 +00:00
Nick Mathewson
0e81265359 update copyright notices.
svn:r3982
2005-04-01 20:15:56 +00:00
Roger Dingledine
4a82ac12b8 add a tor_tls_is_server method to remember if conn->tls
was an initiator or a receiver


svn:r3931
2005-03-31 07:46:38 +00:00
Nick Mathewson
97bc49bd72 Try a little harder to avoid openssl SSL* double-free reports.
svn:r3710
2005-02-28 02:52:51 +00:00
Nick Mathewson
bed6c05453 give a better warning when tor points at an https server.
svn:r3706
2005-02-28 01:55:09 +00:00
Nick Mathewson
2be0508f0d Be specific about which "illegal character" we just saw in the cert.
svn:r3699
2005-02-25 21:05:42 +00:00
Nick Mathewson
70c3580f81 Patch to localtime/gmtime handling: use the _r variants where available. Use mutexes to fake _r where necessary. Make mutexes no-ops where no threading is enabled.
svn:r3653
2005-02-22 07:03:03 +00:00
Nick Mathewson
5d836c8140 Free tls resources on exit too
svn:r3615
2005-02-11 01:41:19 +00:00
Nick Mathewson
fca7ba9777 Resolve task 42: find where 19-char nicknames were getting truncated when read from certs, and fix it. Also audit use of MAX_NICKNAME_LEN; no other badness found, but some docs/code cleaned up a touch.
svn:r3244
2005-01-03 17:53:20 +00:00
Nick Mathewson
a6aa5eebd6 Fix some memory leaks and unlikely segfaults
svn:r3103
2004-12-07 07:48:16 +00:00
Nick Mathewson
0f49fd3bcd Fix leakable rsa key
svn:r3099
2004-12-07 06:48:02 +00:00
Nick Mathewson
7fbd297532 Suggestion from weasel: Make tor --version --version dump the cvs Id of every file.
svn:r3019
2004-11-29 22:25:31 +00:00
Nick Mathewson
6f5dbefa7e Normalize space: add one between every control keyword and control clause.
svn:r3003
2004-11-28 09:05:49 +00:00
Roger Dingledine
7c9a707900 remove emacs droppings, since nick says he doesn't need them anymore
svn:r2989
2004-11-26 04:00:55 +00:00
Nick Mathewson
cd70264377 Clean up some logging and interfaces
svn:r2945
2004-11-23 00:08:26 +00:00
Nick Mathewson
d63d5cb139 Whitespace normalization
svn:r2895
2004-11-15 23:29:24 +00:00
Nick Mathewson
ffe9b01ad7 Split X509 certificate liveness checks into a separate function
svn:r2873
2004-11-14 22:07:48 +00:00
Nick Mathewson
5a5be93f80 Normalize whitespace; add a "tell me about all the unnormalized whitespace" target; fix a braino in dirserv.c
svn:r2758
2004-11-09 20:04:00 +00:00
Nick Mathewson
2fbf31533b Tricksy compiler warnings! We hates them, hates them forever, my precious!
svn:r2615
2004-10-27 21:14:11 +00:00
Nick Mathewson
ce5709184b Pass with -Wstrict-prototypes
svn:r2614
2004-10-27 18:16:37 +00:00
Nick Mathewson
44d4516155 Use tor_snprintf, not snprintf
svn:r2609
2004-10-27 06:37:34 +00:00
Nick Mathewson
bc62f8e983 Replace sprintf with snprintf
svn:r2602
2004-10-27 05:53:07 +00:00
Nick Mathewson
62094ebd32 Tolerate NULL nicknames better
svn:r2567
2004-10-19 18:17:12 +00:00
Roger Dingledine
6d873e5743 don't assert multiple things in the same tor_assert()
svn:r2545
2004-10-16 22:28:11 +00:00
Nick Mathewson
1c9426d6e0 Build without warnings on mac gcc 3.3
svn:r2487
2004-10-14 03:18:14 +00:00
Roger Dingledine
5f4a390b33 oh, and some more in common/
svn:r2483
2004-10-14 02:48:57 +00:00
Roger Dingledine
f91c552af7 fix a seg fault on solaris
svn:r2313
2004-08-25 17:37:00 +00:00
Roger Dingledine
3aaba3b16e tell the user what time _they_ are too, when a cert is expired
svn:r2114
2004-07-22 23:06:28 +00:00
Nick Mathewson
38d8e36919 Make tor_tls_new variant use alternative (certless) context
svn:r2096
2004-07-22 04:53:34 +00:00
Roger Dingledine
cdb98cf04a fix our tls handshake chain cert bug
svn:r2086
2004-07-21 22:11:11 +00:00
Nick Mathewson
c83f0e948f Log certificate lifetime on failure.
svn:r2083
2004-07-21 17:59:24 +00:00
Nick Mathewson
2d514037b7 Log number of certs in wrong-length chains
svn:r2078
2004-07-21 03:32:56 +00:00
Nick Mathewson
334de84cbe Misc small code cleanups; remove exit_server_mode(); change tor_tls_verify behavior
svn:r2073
2004-07-21 00:44:04 +00:00
Roger Dingledine
19deb93c29 more useful warning messages
(fixed because the old ones confused a user)


svn:r2055
2004-07-19 19:49:03 +00:00
Nick Mathewson
7511fbf993 Resolve some XXXs
svn:r1889
2004-05-18 15:35:21 +00:00
Roger Dingledine
3cdf2d67da it's amazing what a bit of punctuation can do for appearances
svn:r1843
2004-05-10 10:27:54 +00:00
Nick Mathewson
c0ea93337d Doxygenate common.
svn:r1829
2004-05-10 03:53:24 +00:00
Nick Mathewson
af08c4f878 Working strerror for windows socket errors, plus some snide comments.
svn:r1775
2004-05-02 20:18:21 +00:00
Roger Dingledine
1558fb7650 some patches on the patches
svn:r1761
2004-05-01 23:29:20 +00:00
Nick Mathewson
908ccb9dcd Handle windows socket errors correctly; comment most of common.
svn:r1756
2004-05-01 20:46:28 +00:00
Nick Mathewson
873564ea9c Some versions of openssl have an SSL_pending function that erroneously
returns bytes when there is a non-application record pending.

I have no idea when/why this would even happen, but let's catch it and
make sure tor_tls_get_pending_bytes stays correct.


svn:r1727
2004-04-26 23:19:21 +00:00
Nick Mathewson
ad07c62938 Add a macro to catch unhandled openssl errors.
svn:r1723
2004-04-26 23:00:07 +00:00
Roger Dingledine
719bb5c0f3 log debug so nick can see it too
svn:r1721
2004-04-26 22:22:11 +00:00
Nick Mathewson
337f7a981f Include strerror(errno) with tls syscall errors
svn:r1718
2004-04-26 18:11:58 +00:00
Nick Mathewson
b410dff6c0 Log pending TLS errors in a couple more places, in case they are possible.
svn:r1716
2004-04-26 16:52:47 +00:00
Nick Mathewson
0355d29e12 Call tls_log_errors at a more appropriate location; we can remove the other calls in tor_tls_verify once we are sure they never happen.
svn:r1709
2004-04-26 03:09:17 +00:00
Nick Mathewson
cb465160da Very blunt debugging code: log pending errors at start and end of tor_tls_verify
svn:r1707
2004-04-26 02:33:12 +00:00
Roger Dingledine
37192bd25e use tor_assert and PUBLIC_KEY_OK
but don't use tor_assert inside log.c, to avoid loops


svn:r1696
2004-04-25 19:59:38 +00:00
Nick Mathewson
c44016e86e Merge flagday into main branch.
svn:r1683
2004-04-24 22:17:50 +00:00
Roger Dingledine
4d380ea902 quiet a -l info that should be -l debug
svn:r1634
2004-04-15 22:08:37 +00:00
Roger Dingledine
47488fa525 allow 90 minutes of clock skew, not 30
svn:r1544
2004-04-08 01:08:56 +00:00
Nick Mathewson
257d509b91 Document stuff, reduce magic numbers, add emacs magic
svn:r1502
2004-04-06 03:44:36 +00:00
Nick Mathewson
b3c2b62a14 Make "common" no longer depend on or.h
svn:r1466
2004-04-03 04:05:12 +00:00
Nick Mathewson
137b577bbd Refactor the heck out of crypto interface: admit that we will stick with one ciphersuite at a time, make const things const, and stop putting openssl in the headers.
svn:r1458
2004-04-03 02:40:30 +00:00
Nick Mathewson
2da54de968 Make tor build on windows again. More work still needed
svn:r1247
2004-03-09 22:01:17 +00:00
Roger Dingledine
5cf0b6224b bugfix: stop trying to write to a stderr that may not be there
also, tell start_daemon our desired cwd


svn:r1170
2004-02-28 23:21:29 +00:00
Roger Dingledine
c12a6f58b5 fix typo
svn:r1007
2004-01-20 02:14:12 +00:00
Nick Mathewson
793c65e60f Note discrepency between N bytes transmitted over TLS and actual bandwidth use; add 2 functions to help resolve.
svn:r986
2004-01-13 01:19:02 +00:00
Roger Dingledine
eb730c41c8 clean tabs, trailing whitespace
svn:r952
2003-12-17 21:14:13 +00:00
Nick Mathewson
dd16a9abcb Stop leaking X509 certs; those things are _nasty_ on the carpet
svn:r833
2003-11-18 06:52:25 +00:00
Roger Dingledine
3d19a9b514 fix a bug in handling clock skew
svn:r785
2003-11-11 04:08:30 +00:00
Nick Mathewson
71e5ad714b resolve warning
svn:r664
2003-10-23 14:27:53 +00:00
Nick Mathewson
6b79d8a7e9 Two-pronged attack at my overzealous skew fixes.
The problem was that the fixes had us generating TLS certs with a
2-day lifetime on the assumption that we'd rotate fairly often.  In
fact, we never rotate our TLS keys.

This patch fixes the situation in 2 ways:
   1. It bumps the default lifetime back up to one year until we get
      rotation in place.
   2. It changes tor_tls_context_new() so that it doesn't leak memory
      when you call it more than once.


svn:r663
2003-10-23 14:20:51 +00:00
Nick Mathewson
7604cfe61b Clock skew fixes.
Allow some slop (currently 3 minutes) when checking certificate validity.

Change certificate lifetime from 1 year to 2 days.  Since we
regenerate regularly (we regenerate regularly, right??), this
shouldn't be a problem.

Have directories reject descriptors published too far in the future
(currently 30 minutes).  If dirservs don't do this:
    0) Today is January 1, 2000.
    1) A very skewed server publishes descriptor X with a declared
       publication time of August 1, 2000.
    2) The directory includes X.
    3) Because of certificate lifetime issues, nobody can use the
       skewed server.
    4) The server fixes its skew, and goes to republish a new descriptor Y
       with publication time of January 1, 2000.
    5) But because the directory already has a "more recent" descriptor X,
       it rejects descriptor "Y" as superseded!

This patch should make step 2 go away.


svn:r658
2003-10-22 16:41:35 +00:00
Roger Dingledine
069227db5b introduce new tor_free() macro
svn:r643
2003-10-21 09:48:58 +00:00
Roger Dingledine
dc85b7af3c warn, not err
svn:r630
2003-10-19 01:15:36 +00:00
Nick Mathewson
0ec2a34a1d Code to get nicknames from peer certs
svn:r627
2003-10-19 00:46:51 +00:00
Roger Dingledine
ec96419109 let tls tolerate reallocing the buf
and also remember the params for ssl_write if it returns wantread.


svn:r626
2003-10-19 00:39:48 +00:00
Roger Dingledine
c627ba2632 first steps toward a WANTWRITE SSL_write tls bug fix
how exactly the same do the arguments need to be? :(


svn:r625
2003-10-18 08:00:19 +00:00
Roger Dingledine
61e180ceb1 start to track down the 'peer has invalid cert' bug
svn:r623
2003-10-18 06:48:46 +00:00
Nick Mathewson
f32c1c3127 Log TLS errors even harder
svn:r604
2003-10-15 23:50:25 +00:00
Nick Mathewson
f81178a312 Add more logging on some ssl errors.
svn:r603
2003-10-15 23:42:44 +00:00
Roger Dingledine
36fb8e839d change WARNING to WARN
svn:r570
2003-10-10 01:48:03 +00:00
Roger Dingledine
677707433e shift read_file_to_str() into util.c
svn:r504
2003-09-28 06:47:29 +00:00
Nick Mathewson
798bb6ab3b Add function to wrap SSL_pending
svn:r501
2003-09-27 20:07:40 +00:00
Roger Dingledine
bf10a3c0f1 finish enforcing the log convention
svn:r494
2003-09-26 22:27:24 +00:00
Roger Dingledine
3b5191d36d various bugfixes and updates
redo all the config files for the new format (we'll redo them again soon)

fix (another! yuck) segfault in log_fn when input is too large
tor_tls_context_new() returns -1 for error, not NULL
fix segfault in check_conn_marked() on conn's that die during tls handshake

make ORs also initialize conn from router when we're the receiving node

make non-dirserver ORs upload descriptor to every dirserver on startup
add our local address to the descriptor
add Content-Length field to POST command
revert the Content-Length search in fetch_from_buf_http() to previous code
fix segfault in memmove in fetch_from_buf_http()
raise maximum allowed headers/body size in directory.c


svn:r484
2003-09-25 10:42:07 +00:00
Nick Mathewson
3d4ccb781a Refactor buffers; implement descriptors.
'buf_t' is now an opaque type defined in buffers.c .

Router descriptors now include all keys; routers generate keys as
needed on startup (in a newly defined "data directory"), and generate
their own descriptors.  Descriptors are now self-signed.

Implementation is not complete: descriptors are never published; and
upon receiving a descriptor, the directory doesn't do anything with
it.

At least "routers.or" and orkeygen are now obsolete, BTW.


svn:r483
2003-09-25 05:17:11 +00:00
Nick Mathewson
5f9ac2bdfd More fine-grained logging messages on ZeroReturn/Syscall error cases
svn:r467
2003-09-16 20:53:09 +00:00
Nick Mathewson
e4dfc3c8fe Cipher lists need to be colon separated. Also make initialization more bulletproof
svn:r459
2003-09-15 19:38:52 +00:00
Nick Mathewson
633a5ffc0b Fix TLS error logging
svn:r458
2003-09-15 18:37:49 +00:00
Nick Mathewson
408bff4a23 Log protocol errors
svn:r457
2003-09-15 18:18:37 +00:00
Roger Dingledine
e585dad887 fix the cpuworker circ-had-vanished bug (maybe)
still several (many) tls-related bugs outstanding.


svn:r454
2003-09-14 02:58:50 +00:00
Nick Mathewson
001cd08b2e Fix bugs in certificate generation and SSL context creation. Both seem to work now.
svn:r447
2003-09-11 23:26:31 +00:00
Nick Mathewson
529d3bc56f Resolve XXXXs in tortls.c
svn:r443
2003-09-11 21:38:57 +00:00
Nick Mathewson
f5b4ef1fa2 Simplify some code paths in TLS; cut down on memory leaks; use
reasonable ciphers if not everyone has OpenSSL 0.9.7.


svn:r442
2003-09-11 21:12:39 +00:00
Roger Dingledine
0761bc7b83 fix typo that's been bugging me
svn:r440
2003-09-11 20:10:39 +00:00
Nick Mathewson
e22b271895 Add certificate verification functions
svn:r438
2003-09-10 00:47:39 +00:00
Roger Dingledine
ace475f01c hide the global tls context inside tortls.c
svn:r431
2003-09-08 06:22:19 +00:00
Roger Dingledine
99d1e4931b move variable declarations to top of function
svn:r425
2003-09-05 05:58:21 +00:00
Nick Mathewson
fd20011c26 Add initial interfaces and code for TLS support. Interfaces are right; code needs work and testing.
svn:r424
2003-09-04 16:05:08 +00:00