summaryrefslogtreecommitdiff
path: root/src/common
AgeCommit message (Collapse)Author
2013-01-14Merge branch 'bug7869'Nick Mathewson
2013-01-11Handle EWOULDBLOCK as EAGAIN if they happen to be different.Nick Mathewson
Fixes bug 7935. Reported by 'oftc_must_be_destroyed'.
2013-01-05Make the = at the end of ntor-onion-key optional.Nick Mathewson
Makes bug 7869 more easily fixable if we ever choose to do so.
2013-01-03Merge branch 'ntor-resquashed'Nick Mathewson
Conflicts: src/or/cpuworker.c src/or/or.h src/test/bench.c
2013-01-03Check all crypto_rand return values for ntor.Nick Mathewson
2013-01-03Use safe_mem_is_zero for checking curve25519 output for 0-nessNick Mathewson
This should make the intent more explicit. Probably needless, though.
2013-01-03Implement a constant-time safe_mem_is_zero.Nick Mathewson
2013-01-03Make libcurve25519_donna get built as a .aNick Mathewson
This lets us give it compiler flags differing from the rest of libor-crypto.a
2013-01-02Move curve25519 keypair type to src/common; give it functionsNick Mathewson
This patch moves curve25519_keypair_t from src/or/onion_ntor.h to src/common/crypto_curve25519.h, and adds new functions to generate, load, and store keypairs.
2013-01-02Refactor strong os-RNG into its own functionNick Mathewson
Previously, we only used the strong OS entropy source as part of seeding OpenSSL's RNG. But with curve25519, we'll have occasion to want to generate some keys using extremely-good entopy, as well as the means to do so. So let's! This patch refactors the OS-entropy wrapper into its own crypto_strongest_rand() function, and makes our new curve25519_secret_key_generate function try it as appropriate.
2013-01-02Add a wrapper around, and test and build support for, curve25519.Nick Mathewson
We want to use donna-c64 when we have a GCC with support for 64x64->uint128_t multiplying. If not, we want to use libnacl if we can, unless it's giving us the unsafe "ref" implementation. And if that isn't going to work, we'd like to use the portable-and-safe-but-slow 32-bit "donna" implementation. We might need more library searching for the correct libnacl, especially once the next libnacl release is out -- it's likely to have bunches of better curve25519 implementations. I also define a set of curve25519 wrapper functions, though it really shouldn't be necessary. We should eventually make the -donna*.c files get build with -fomit-frame-pointer, since that can make a difference.
2013-01-02Add a data-invariant linear-search map structureNick Mathewson
I'm going to use this for looking op keys server-side for ntor.
2012-12-31Fix a couple of harmless clang3.2 warningsSebastian Hahn
2012-12-25One last fix for a warning on non-EC systemsNick Mathewson
2012-12-25Be more noncomittal about performance improvement of uint128 backend.Nick Mathewson
2012-12-25Make ECDHE group configurable: 224 for public, 256 for bridges (default)Nick Mathewson
2012-12-25Inform the user if they're passing up a 10x ECDH speedup.Nick Mathewson
2012-12-25Let servers choose better ciphersuites when clients support themNick Mathewson
This implements the server-side of proposal 198 by detecting when clients lack the magic list of ciphersuites that indicates that they're lying faking some ciphers they don't really have. When clients lack this list, we can choose any cipher that we'd actually like. The newly allowed ciphersuites are, currently, "All ECDHE-RSA ciphers that openssl supports, except for ECDHE-RSA-RC4". The code to detect the cipher list relies on on (ab)use of SSL_set_session_secret_cb.
2012-12-25Remove the address argument from client cipher classification fnsNick Mathewson
2012-12-25Cache the type of client cipher list we have in the tor_tls_tNick Mathewson
We already use this classification for deciding whether (as a server) to do a v2/v3 handshake, and we're about to start using it for deciding whether we can use good ciphersuites too.
2012-12-25prop198: Detect the list of ciphersuites we used to lie about havingNick Mathewson
This is less easy than you might think; we can't just look at the client ciphers list, since openssl doesn't remember client ciphers if it doesn't know about them. So we have to keep a list of the "v2" ciphers, with the ones we don't know about removed.
2012-12-25Configure SSL context to know about using P-256 for ECDHE.Nick Mathewson
2012-12-13Nuke uses of memcmp outside of unit testsNick Mathewson
We want to be saying fast_mem{cmp,eq,neq} when we're doing a comparison that's allowed to exit early, or tor_mem{cmp,eq,neq} when we need a data-invariant timing. Direct use of memcmp tends to imply that we haven't thought about the issue.
2012-12-07Merge branch 'win64-7260'Nick Mathewson
Conflicts: src/or/dns.c
2012-12-06Implement HKDF from RFC5869Nick Mathewson
This is a customizable extract-and-expand HMAC-KDF for deriving keys. It derives from RFC5869, which derives its rationale from Krawczyk, H., "Cryptographic Extraction and Key Derivation: The HKDF Scheme", Proceedings of CRYPTO 2010, 2010, <http://eprint.iacr.org/2010/264>. I'm also renaming the existing KDF, now that Tor has two of them. This is the key derivation scheme specified in ntor. There are also unit tests.
2012-12-06Add a crypto_dh_dup, for benchmark supportNick Mathewson
2012-11-27Merge branch 'bug7013_take2_squashed'Nick Mathewson
2012-11-27Introduce tor_addr_port_parse() and use it to parse ServerTransportListenAddr.George Kadianakis
2012-11-23Note limitation of parse_rfc_1123_timeNick Mathewson
RFC1123 suggests that we should handle two-year times, and a full range of time zones, and other stuff too. We don't.
2012-11-23In comments and logs, say "UTC" not "GMT"Nick Mathewson
Fix for #6113. Note that the RFC1123 times we generate still all say 'GMT'. I'm going to suggest this is not worth changing.
2012-11-23Refer to RFC 4648 instead of the obsolete RFC 3548Nick Mathewson
Affects comments only. For ticket 6849.
2012-11-14Add some missing doxygen for ipv6 exit codeNick Mathewson
2012-11-14Add a function to set a tor_addr_t to a null addressNick Mathewson
2012-11-14Add a new family-specific syntax for tor_addr_parse_mask_portsNick Mathewson
By default, "*" means "All IPv4 addresses" with tor_addr_parse_mask_ports, so I won't break anything. But if the new EXTENDED_STAR flag is provided, then * means "any address", *4 means "any IPv4 address" (that is, 0.0.0.0/0), and "*6" means "any IPv6 address" (that is, [::]/0). This is going to let us have a syntax for specifying exit policies in torrc that won't drive people mad. Also, add a bunch of unit tests for tor_addr_parse_mask_ports to test these new features, and to increase coverage.
2012-11-08Merge remote-tracking branch 'origin/maint-0.2.3'Nick Mathewson
2012-11-08Turn a memwipe in tor_process_handle_destroy() back to memsetNick Mathewson
It broke linking on tor-resolve.c, and it's not actually sanitizing anything sensitive. Fix for bug 7420; bug not on ony released Tor.
2012-11-08Merge remote-tracking branch 'origin/maint-0.2.3'Nick Mathewson
Conflicts: src/common/crypto.c src/or/rendservice.c
2012-11-08Add and use and unlikely-to-be-eliminated memwipe()Nick Mathewson
Apparently some compilers like to eliminate memset() operations on data that's about to go out-of-scope. I've gone with the safest possible replacement, which might be a bit slow. I don't think this is critical path in any way that will affect performance, but if it is, we can work on that in 0.2.4. Fixes bug 7352.
2012-11-06Add warning message when a managed proxy dies during configuration.George Kadianakis
2012-11-02Add a TOR_SOCKET_T_FORMAT construction for logging sockets.Nick Mathewson
We need this since win64 has a 64-bit SOCKET type. Based on a patch from yayooo for 7260, forward-ported to 0.2.4.
2012-11-02Add a PID_T_FORMAT for writing pids to logsNick Mathewson
This is based on code by yayooo for 7260, but: - It allows for SIZEOF_PID_T == SIZEOF_SHORT - It addresses some additional cases where we weren't getting any warnings only because we were casting pid_t to int.
2012-11-02Remove an unused variable; part of mingw64 patch from yayoooNick Mathewson
2012-11-02Compile (with warnings) with mingw64Nick Mathewson
Patch from yayooo for bug 7260, forward-ported to 0.2.4.
2012-10-26touch-upsRoger Dingledine
2012-10-24Change changes file and comment for 7189, for making it 0.2.4-only for nowNick Mathewson
2012-10-24Merge remote-tracking branch 'public/bug7189_tentative'Nick Mathewson
2012-10-24Only disable TLS tickets when being/acting as a server.Nick Mathewson
Fix for bug 7189.
2012-10-23Merge remote-tracking branch 'origin/maint-0.2.2' into maint-0.2.3Nick Mathewson
2012-10-23Fix binary search on lists of 0 or 1 element.Nick Mathewson
The implementation we added has a tendency to crash with lists of 0 or one element. That can happen if we get a consensus vote, v2 consensus, consensus, or geoip file with 0 or 1 element. There's a DOS opportunity there that authorities could exploit against one another, and which an evil v2 authority could exploit against anything downloading v2 directory information.. This fix is minimalistic: It just adds a special-case for 0- and 1-element lists. For 0.2.4 (the current alpha series) we'll want a better patch. This is bug 7191; it's a fix on 0.2.0.10-alpha.
2012-10-23Rewrite smartlist_bsearch_idx() to not be broken for lists of length zero or ↵Andrea Shepard
one (fixes bug 7191)