]>
git.ipfire.org Git - thirdparty/tor.git/log
Nick Mathewson [Thu, 15 May 2025 14:59:01 +0000 (10:59 -0400)]
Use polyvalx in cgo.
Nick Mathewson [Thu, 15 May 2025 14:49:55 +0000 (10:49 -0400)]
Add support for pre-expanded polyval keys with pclmul.
We don't want to do this without pclmul, since it doesn't help in that case.
We don't want to do this unconditionally, since many of our polyval keys
are only used for 16 byte inputs.
(Yes, this makes a difference in practice!)
Nick Mathewson [Thu, 15 May 2025 14:00:21 +0000 (10:00 -0400)]
Speed up polyval through pipelining.
This optimization helps because:
- We're not blocking the computation of each block on the computation of the
previous one, which leads to fewer pipeline stalls.
- We're deferring reduction until the end of handling a bunch of blocks.
Nick Mathewson [Thu, 15 May 2025 13:14:42 +0000 (09:14 -0400)]
Add benchmarks for cgo and polyval.
Nick Mathewson [Thu, 15 May 2025 12:54:42 +0000 (08:54 -0400)]
Improve tor1 encryption benchmarks
Include cell origination (which costs more) and cycles per byte.
Rename benchmark to "tor1", since cgo is coming next.
Nick Mathewson [Sat, 26 Apr 2025 02:04:23 +0000 (22:04 -0400)]
polyval: Detect pclmul presence using cpuid.
Nick Mathewson [Sat, 26 Apr 2025 01:18:19 +0000 (21:18 -0400)]
polyval: Allow PV_DECLARE declare multiple variants.
Nick Mathewson [Sat, 26 Apr 2025 01:04:25 +0000 (21:04 -0400)]
polyval: move declarations into a macro
I'll be using this to implement CPUID-based dispatch, which will require
multiple backends to coexist.
Nick Mathewson [Wed, 21 May 2025 14:15:07 +0000 (10:15 -0400)]
Merge branch '41052_cgo_encryption' into 'main'
CGO: Crypto implementation
Closes #41052
See merge request tpo/core/tor!879
Nick Mathewson [Sat, 26 Apr 2025 00:44:06 +0000 (20:44 -0400)]
polyval: Remove precomputation for ctmul64 case.
In my benchmarks it saved less than 1%, so it really
doesn't make sense to keep it.
Nick Mathewson [Wed, 23 Apr 2025 15:27:07 +0000 (11:27 -0400)]
CGO: Fix authenticated-sendme tag handling.
See discussion at torspec#328: it's important that our
SENDME authentication tag always be taken based on the
_encrypted_ cell.
Nick Mathewson [Wed, 23 Apr 2025 15:19:43 +0000 (11:19 -0400)]
CGO: Split modes into forward and backward variants.
I'll need this for getting tags right wrt torspec!328.
Nick Mathewson [Mon, 21 Apr 2025 21:41:11 +0000 (17:41 -0400)]
Implement the encryption operations for counter galois onion.
Nick Mathewson [Sun, 20 Apr 2025 14:22:54 +0000 (10:22 -0400)]
Implement low-level encryption functions for CGO.
These include a regular LRW2 tweakable block cipher,
a pseudorandom function,
and a UIV+ tweakable wide-block rugged pseudorandom permutation.
Also included are a few test vectors from the reference
implementation.
Nick Mathewson [Sun, 20 Apr 2025 22:49:40 +0000 (18:49 -0400)]
aes: Support for replacing an AES key without free+alloc
Nick Mathewson [Sun, 20 Apr 2025 22:17:22 +0000 (18:17 -0400)]
Support for counter mode with raw AES.
We'll want this for CGO because we want the ability to use the same AES
key several times with multiple different IVs: neither OpenSSL's EVP
interface nor NSS's PK11 API has a good interface to do that.
(This is usually expressed in terms of "seeking" to a new position
on the stream, but there isn't an API for that either.)
Nick Mathewson [Sat, 19 Apr 2025 14:56:25 +0000 (10:56 -0400)]
crypto: Add support for raw (ECB) AES
We'll need this to define the LRW2 tweakable block cipher used in CGO.
Nick Mathewson [Sun, 20 Apr 2025 14:37:38 +0000 (10:37 -0400)]
Polyval: add ability to store key separately.
This will help reduce storage, since we never actually need
to keep a running total outside of a function.
Nick Mathewson [Sat, 19 Apr 2025 13:46:31 +0000 (09:46 -0400)]
Integrate polyval into our build system and give a test
Nick Mathewson [Sat, 19 Apr 2025 13:32:07 +0000 (09:32 -0400)]
polyval: comments throughout.
Nick Mathewson [Sat, 19 Apr 2025 13:10:58 +0000 (09:10 -0400)]
Detect correct polyval implementation (mostly)
I'm saying "mostly" because this will be wrong on really old intel;
we'll need a cpuid workaround if we need to support those.
Nick Mathewson [Sat, 19 Apr 2025 01:09:25 +0000 (21:09 -0400)]
Adapt pclmul.c to work with polyval.c
Nick Mathewson [Sat, 19 Apr 2025 00:43:10 +0000 (20:43 -0400)]
adapt 32-bit ctmul.c to work with polyval.c
Nick Mathewson [Sat, 19 Apr 2025 00:25:29 +0000 (20:25 -0400)]
Adapt ctmul64.c to work with polyval.c.
Nick Mathewson [Sat, 19 Apr 2025 00:14:49 +0000 (20:14 -0400)]
Unfinished polyval implementation, without a multiplier.
Nick Mathewson [Fri, 18 Apr 2025 23:16:17 +0000 (19:16 -0400)]
Rename files so it no longer looks like we are doing ghash
Nick Mathewson [Fri, 18 Apr 2025 23:06:16 +0000 (19:06 -0400)]
Add code from BearSSL's ghash implementation.
Polyval (which we need for CGO) is very similar to ghash,
and most of this code should be reusable with suitable adaptation.
Nick Mathewson [Tue, 22 Apr 2025 13:25:39 +0000 (09:25 -0400)]
Unrelated: fix warnings about NSS kex algorithms.
David Goulet [Wed, 21 May 2025 13:34:36 +0000 (13:34 +0000)]
Merge branch 'bug41077' into 'main'
Fix log message claiming that LibreSSL is OpenSSL
Closes #41077
See merge request tpo/core/tor!897
David Goulet [Wed, 21 May 2025 13:33:57 +0000 (13:33 +0000)]
Merge branch 'bug40176' into 'main'
Fix linking on systems without a working stdatomic.h
See merge request tpo/core/tor!896
David Goulet [Wed, 21 May 2025 13:33:40 +0000 (13:33 +0000)]
Merge branch 'style-tweaks' into 'main'
trivial whitespace formatting fixes
See merge request tpo/core/tor!893
David Goulet [Wed, 21 May 2025 13:29:36 +0000 (09:29 -0400)]
Merge branch 'maint-0.4.8'
David Goulet [Wed, 21 May 2025 13:29:30 +0000 (09:29 -0400)]
Merge branch 'tor-gitlab/mr/894' into maint-0.4.8
David Goulet [Wed, 21 May 2025 12:55:17 +0000 (12:55 +0000)]
Merge branch 'gcc-15-warnings-049' into 'main'
Fix GCC warnings from GCC 15 (0.4.9)
See merge request tpo/core/tor!899
Nick Mathewson [Mon, 19 May 2025 01:22:11 +0000 (21:22 -0400)]
Fix another gcc 15 warning in 0.4.9.
Nick Mathewson [Mon, 19 May 2025 11:52:22 +0000 (07:52 -0400)]
Merge branch 'gcc-15-warnings-048' into gcc-15-warnings-049
Nick Mathewson [Mon, 19 May 2025 01:52:36 +0000 (21:52 -0400)]
Make an exception to one of the NONSTRINGs
Older GCCs accept the attribute but don't believe it can appear
before an array.
Nick Mathewson [Mon, 19 May 2025 01:12:30 +0000 (21:12 -0400)]
Add a changes file for 41079.
Nick Mathewson [Mon, 19 May 2025 01:11:00 +0000 (21:11 -0400)]
Fix a new GCC warning about strings.
When we say something like
```
const char foo[3] = "foo";
```
GCC now complains, because there is no space for the terminating NUL.
But we use this construction in a lot of places in our tests to
initialize test digests, keys, and so on. So to resolve the issue,
we have to mark these strings with a new attribute.
Nick Mathewson [Mon, 19 May 2025 00:54:08 +0000 (20:54 -0400)]
Convince gcc that we will not access an array out of bounds
Nick Mathewson [Wed, 14 May 2025 00:29:41 +0000 (20:29 -0400)]
Fix log message claiming that LibreSSL is OpenSSL
(We only want to check the OpenSSL version when it's actually OpenSSL
we're using.)
Fixes #41077; bug not in any released Tor.
Nick Mathewson [Tue, 13 May 2025 12:39:42 +0000 (08:39 -0400)]
Fix linking on systems without a working stdatomic.h
Static libraries need to be sorted in a dependency order, with the
most low-level libraries last. When we added an atomic counter to
util_bug.c in !760, we introduced a dependency from "log" to
"threads". This didn't show up immediately, since the dependency
only exists when we're emulating atomic operations due to lack of
platform support.
Fixes bug #41076; bugfix on 0.4.9.1-alpha.
Nick Mathewson [Mon, 12 May 2025 12:44:44 +0000 (08:44 -0400)]
reindent code from previous commit
Nick Mathewson [Mon, 12 May 2025 12:27:34 +0000 (08:27 -0400)]
Allow pow-params to appear multiple times.
Relatedly, we only require that a pow-params line has _1_ argument
(since future versions might have nothing but a scheme).
See torspec#272 for discussion;
also see proposal 356 for why the fingerprinting opportunity here
isn't a big deal.
We probably shouldn't merge this until torspec!390 is in,
just in case we decide _not_ to take this approach.
(I haven't reindented some code here yet, to make the diff easier to read.)
Roger Dingledine [Sun, 11 May 2025 21:29:13 +0000 (17:29 -0400)]
trivial whitespace formatting fixes
Nick Mathewson [Tue, 6 May 2025 23:13:02 +0000 (19:13 -0400)]
Merge branch 'openssl_cleanup_part3' into 'main'
Improve various OpenSSL settings
Closes #41067
See merge request tpo/core/tor!889
Nick Mathewson [Tue, 6 May 2025 22:40:39 +0000 (18:40 -0400)]
Define a DH2048_KEY_LEN.
Alexander Hansen Færøy [Tue, 6 May 2025 20:13:24 +0000 (22:13 +0200)]
Merge branch 'ticket41064' into 'main'
Use RELAY_PAYLOAD_SIZE_MIN for some cc calculations
Closes #41064
See merge request tpo/core/tor!890
Alexander Hansen Færøy [Tue, 6 May 2025 20:01:53 +0000 (22:01 +0200)]
Merge branch 'bug41043' into 'main'
Avoid crash on failure to read FamilyKeyDir
See merge request tpo/core/tor!886
Nick Mathewson [Tue, 6 May 2025 16:50:42 +0000 (12:50 -0400)]
Use RELAY_PAYLOAD_SIZE_MIN for some cc calculations
These are for the cases where mikeperry and dgoulet had suggestions
on !878.
Closes #41064.
Nick Mathewson [Tue, 6 May 2025 16:29:13 +0000 (12:29 -0400)]
Merge branch '41051_cell_format' into 'main'
Prop359: Add functions to encode/decode new relay message format for CGO
Closes #41051 and #41056
See merge request tpo/core/tor!878
Nick Mathewson [Tue, 6 May 2025 15:39:32 +0000 (11:39 -0400)]
Fix compilation with NSS.
Nick Mathewson [Tue, 6 May 2025 14:45:00 +0000 (10:45 -0400)]
Remove check for unaccelerated ECC
The "enable-ec_nistp_64_gcc_128" option does not appear to be necessary
in any of our supported versions.
Nick Mathewson [Tue, 6 May 2025 14:35:03 +0000 (10:35 -0400)]
Change our TLS finite-field diffie-hellman group to ffdhe2048.
(We should never actually _use_ finite-field Diffie-Hellman
with TLS.)
Nick Mathewson [Tue, 6 May 2025 14:08:43 +0000 (10:08 -0400)]
Update client cipher list to match current firefox
(Shelikhoo says that this countermeasure is still likely to be
helpful for some users, and so we might as well keep it.)
Nick Mathewson [Tue, 6 May 2025 14:07:12 +0000 (10:07 -0400)]
Update get_mozillia_ciphers to work with current firefox.
This script is _still_ a complete kludge, and I don't currently propose to
un-kludge it. With luck, today will be the last day we run it.
Nick Mathewson [Tue, 6 May 2025 13:01:37 +0000 (09:01 -0400)]
Remove attempt to override TLS 1.3 server ciphersuites
This was unnecessary _and_ broken!
It was unnecessary because the default list of TLS 1.3 ciphersuites
has always been pretty reasonable.
It was broken because:
- SSL_CTX_set_cipher_list only affects the list of TLS 1.2 ciphersuites.
- There have _never_ been a set of macros named TLS1_3_TXT_*
in any openssl version, as far as I can tell.
Nick Mathewson [Tue, 6 May 2025 12:48:07 +0000 (08:48 -0400)]
Remove check and test for SSL_CIPHER_find
Nothing uses it any more.
Nick Mathewson [Tue, 6 May 2025 12:43:34 +0000 (08:43 -0400)]
Stop detecting HKDF: Our supported OpenSSL versions always have it
Nick Mathewson [Tue, 6 May 2025 12:41:14 +0000 (08:41 -0400)]
Stop detecting SSL_get_client_ciphers: we enver use it.
Nick Mathewson [Tue, 6 May 2025 12:36:19 +0000 (08:36 -0400)]
OpenSSL: Require TLS ≥ 1.2
TLS 1.2 was added in OpenSSL version 1.0.1,
which was our minimal supported openssl version for a long time:
so we can be sure that all clients and relays have it.
(I'd like to require TLS 1.3, but that would break everybody
who built with 1.0.1.)
Part of #41067.
Nick Mathewson [Tue, 6 May 2025 12:25:25 +0000 (08:25 -0400)]
openssl: Use TLS_method unconditionally.
Every version of openssl/libressl we support has this.
Nick Mathewson [Tue, 6 May 2025 00:38:55 +0000 (20:38 -0400)]
relay_msg: Document and enforce length invariants.
This takes a slightly different approach from suggested in the MR:
we document that a relay_msg_t must _always_ have a valid length,
and note that this warning still applies for relay_msg_copy.
Nick Mathewson [Mon, 5 May 2025 16:24:38 +0000 (12:24 -0400)]
relay_msg: Use relay_cell_max_payload_size when setting maxlen
Nick Mathewson [Mon, 21 Apr 2025 19:34:00 +0000 (15:34 -0400)]
Fix tests when built with --all-bugs-are-fatal.
Nick Mathewson [Mon, 21 Apr 2025 19:13:36 +0000 (15:13 -0400)]
Use FREE_AND_NULL with conflux_msg_t.
Nick Mathewson [Fri, 18 Apr 2025 01:25:51 +0000 (21:25 -0400)]
Changes file for #41051.
Nick Mathewson [Fri, 18 Apr 2025 01:20:57 +0000 (21:20 -0400)]
Fill in XXXX for relay_msg.c
Nick Mathewson [Fri, 18 Apr 2025 01:19:34 +0000 (21:19 -0400)]
Remove the unused relay_msg_set function
Nick Mathewson [Fri, 18 Apr 2025 01:15:30 +0000 (21:15 -0400)]
Change relay_msg_t to _not_ hold a copy of the message.
Previously we had to memdup every time we parsed a relay_msg_t;
but that's unnecessary, since (most) every time we use it, we have
a longer-lived cell object.
This _did_ require some hacking in relay_msg_copy, but I think the
gain in simplicity is worth it.
Nick Mathewson [Fri, 18 Apr 2025 00:31:44 +0000 (20:31 -0400)]
Remove redundant relay_cell_proto fields
These did not turn out to be useful for anything.
Nick Mathewson [Fri, 18 Apr 2025 00:26:20 +0000 (20:26 -0400)]
Fix a bug in conflux_send_switch_command.
Using RELAY_PAYLOAD_SIZE(_MAX) here would send a relay message that used up
more than the actual length of the cell. Instead, send only the actual
CONFLUX_SWITCH message.
Closes #41056; bugfix on 0.4.8.1-alpha.
Nick Mathewson [Fri, 18 Apr 2025 00:21:06 +0000 (20:21 -0400)]
Rename and hand-audit all users of RELAY_PAYLOAD_SIZE.
Since the maximum number of bytes you can put in a relay message
is no longer constant, it doesn't make sense to have a "size" for this.
Instead, we can only have a "max" or "min" size.
Nick Mathewson [Thu, 17 Apr 2025 23:46:30 +0000 (19:46 -0400)]
Move circuit accessors to relay.c
Nick Mathewson [Thu, 17 Apr 2025 23:39:43 +0000 (19:39 -0400)]
Add a much-needed convenience accessor for max payload len.
Nick Mathewson [Thu, 17 Apr 2025 23:37:15 +0000 (19:37 -0400)]
Rename relay_msg_get_format to circuit_get_relay_format.
Nick Mathewson [Thu, 17 Apr 2025 23:31:36 +0000 (19:31 -0400)]
More tolerance for packaging too-long payloads
(There are _lots_ of places that build a payload that would be long enough
to fit into a V0 cell, then pass it to relay_send_command_from_edge.)
Nick Mathewson [Thu, 17 Apr 2025 23:20:37 +0000 (19:20 -0400)]
relay_msg: use IF_BUG_ONCE
If these bugs are reachable, they're likely to fill up the logs.
Nick Mathewson [Thu, 17 Apr 2025 23:17:26 +0000 (19:17 -0400)]
Abolish RELAY_HEADER_SIZE.
It was frequently used before to index into a cell, which
is never right any more.
Nick Mathewson [Thu, 17 Apr 2025 20:47:39 +0000 (16:47 -0400)]
Fold relay_cell.h into relay_msg.h
It no longer needs an independent existence.
Nick Mathewson [Thu, 17 Apr 2025 20:44:17 +0000 (16:44 -0400)]
Abolish relay_header_t, except for testing.
With this change we no longer have a separate and possibly divergent
encoder for cells.
Also, abolish the accessors in relay_cell.c: It turns out that they
don't make sense with CGO.
David Goulet [Thu, 5 Oct 2023 16:29:54 +0000 (12:29 -0400)]
prop340: Use relay messages accross the code
Author: David Goulet <dgoulet@torproject.org>
(This won't yet compile; for now I am _only_ taking the parts as
dgoulet wrote them, minus a codec-only piece.)
Modified by nickm:
Encode and decode relay messages using our new functions.
In David's original branch, this was done using codec objects,
but since we aren't doing prop340, this is simpler.
David Goulet [Thu, 5 Oct 2023 16:17:16 +0000 (12:17 -0400)]
prop340: Implement useful helper functions
Author: David Goulet <dgoulet@torproject.org>
(modified by nickm: no longer refers to codecs.)
Nick Mathewson [Thu, 17 Apr 2025 17:24:44 +0000 (13:24 -0400)]
Add relay cell format field to circuits
For client circuits, it is a per-hop field;
for OR circuits, it is a per-circuit field.
Nick Mathewson [Thu, 17 Apr 2025 17:15:04 +0000 (13:15 -0400)]
prop359: Implement relay cell encoder/decoders
I decided not to use a codec-based approach here.
Since we aren't implementing prop340, there is exactly one cell
per message, so we don't need to keep any state
in between cells or messages.
Nick Mathewson [Thu, 17 Apr 2025 13:52:40 +0000 (09:52 -0400)]
Function to test whether a relay command is recognized.
Cherry-picked from dgoulet's
8fe1c503
Author: David Goulet <dgoulet@torproject.org>
Nick Mathewson [Thu, 17 Apr 2025 13:50:33 +0000 (09:50 -0400)]
or.h: Extend comment about cell format to include v1 format.
Nick Mathewson [Thu, 17 Apr 2025 13:39:06 +0000 (09:39 -0400)]
prop359: Introduce an enum for cell format.
(Using u8 everywhere makes me nervous.)
David Goulet [Thu, 5 Oct 2023 14:49:59 +0000 (10:49 -0400)]
prop359: Add relay msg basics.
Nick Mathewson [Thu, 17 Apr 2025 13:23:49 +0000 (09:23 -0400)]
Add some TODOs for CGO msg format
David Goulet [Thu, 5 Oct 2023 15:13:35 +0000 (11:13 -0400)]
prop359: Add relay cell access functions
Author: David Goulet <dgoulet@torproject.org>
David Goulet [Mon, 5 May 2025 16:37:41 +0000 (12:37 -0400)]
Merge branch 'maint-0.4.8'
orbea [Thu, 31 Aug 2023 21:35:52 +0000 (14:35 -0700)]
crypt_openssl_mgt: define DISABLE_ENGINES after OPENSSL_NO_ENGINE
With LibreSSL-3.8.1 these engines are no long available causing a build
failure, but LibreSSL correctly defines OPENSSL_NO_ENGINE as part of its
opensslfeatures.h. However Tor includes crypto_openssl_mgt.h before any
of the openssl includes which would define OPENSSL_NO_ENGINE and then
fails to define DISABLE_ENGINES.
As the define is used in only a single .c file it is best to move it
there.
Signed-off-by: orbea <orbea@riseup.net>
orbea [Wed, 30 Apr 2025 18:47:13 +0000 (11:47 -0700)]
compat_openssl: fix for LibreSSL 4.1.0
Starting with LibreSSL 4.1.0 this now causes a build failure:
src/lib/tls/tortls_openssl.c: In function 'tor_tls_setup_session_secret_cb':
src/lib/tls/tortls_openssl.c:1059:39: error: passing argument 2 of 'SSL_set_session_secret_cb' from incompatible pointer type [-Wincompatible-pointer-types]
1059 | SSL_set_session_secret_cb(tls->ssl, tor_tls_session_secret_cb, NULL);
| ^~~~~~~~~~~~~~~~~~~~~~~~~
| |
| int (*)(SSL *, void *, int *, struct stack_st_SSL_CIPHER *, SSL_CIPHER **, void *) {aka int (*)(struct ssl_st *, void *, int *, struct stack_st_SSL_CIPHER *, struct ssl_cipher_st **, void *)}
In file included from src/lib/tls/tortls_openssl.c:48:
/usr/include/openssl/ssl.h:1489:30: note: expected 'tls_session_secret_cb_fn' {aka 'int (*)(struct ssl_st *, void *, int *, struct stack_st_SSL_CIPHER *, const struct ssl_cipher_st **, void *)'} but argument is of type 'int (*)(SSL *, void *, int *, struct stack_st_SSL_CIPHER *, SSL_CIPHER **, void *)' {aka 'int (*)(struct ssl_st *, void *, int *, struct stack_st_SSL_CIPHER *, struct ssl_cipher_st **, void *)'}
1489 | tls_session_secret_cb_fn tls_session_secret_cb, void *arg);
| ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
Signed-off-by: orbea <orbea@riseup.net>
David Goulet [Mon, 5 May 2025 15:40:05 +0000 (15:40 +0000)]
Merge branch 'openssl_cleanup_part2_v2' into 'main'
Require OpenSSL >= 1.1.1 or LibreSSL >= 3.7
See merge request tpo/core/tor!885
David Goulet [Mon, 5 May 2025 14:38:52 +0000 (14:38 +0000)]
Merge branch 'openssl_cleanup_part1' into 'main'
Remove support for clients < 0.2.3.17-beta
Closes #41031
See merge request tpo/core/tor!883
Nick Mathewson [Mon, 28 Apr 2025 16:29:05 +0000 (12:29 -0400)]
Avoid crash on failure to read FamilyKeyDir
Previously we could try to iterate over `files`
even if it were NULL.
Fixes bug #41043; bugfix on 0.4.9.2-alpha.
Nick Mathewson [Mon, 28 Apr 2025 15:32:21 +0000 (11:32 -0400)]
Warn when OpenSSL is older than 3.0
Running with an unsupported version of openssl is not IMO
a very good idea.
Nick Mathewson [Sun, 27 Apr 2025 15:19:29 +0000 (11:19 -0400)]
changes file for new *ssl version requirements.
Nick Mathewson [Sun, 27 Apr 2025 14:51:12 +0000 (10:51 -0400)]
Remove code based on OPENSSL_VERSION_NUMBER
(Except for some code in aes_openssl.c, which has potential to conflict
with CGO-related branches.)