Commit graph

1247 commits

Author SHA1 Message Date
78387ad904
buffer: remove tail_space argument from fastd_buffer_{alloc,dup}() 2020-09-29 00:04:59 +02:00
bd63837ca4
Remove now unused tailroom fields 2020-09-28 23:48:06 +02:00
b9846a5f85
ghash: move addition of size block from method into MAC implementations 2020-09-28 23:43:42 +02:00
a5d8a00bfd
crypto: allow passing algorithm-specific flags to crypto init functions 2020-09-28 22:52:14 +02:00
a96a1a1a03
Extend clang-format to test directory 2020-09-28 22:34:47 +02:00
6bb0ea0566
send: realign buffers entering the transmit path
Misaligned buffers come from the null method, as it uses a 1-byte header
rather than (16*n+8)-byte like all other methods. When such a buffer enters
the transmit path again through fastd's forward feature, it will violate
the fastd_block128_t alignment (when there are other sessions that do
not use the null method).

Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
2020-09-27 17:29:08 +02:00
84850b5830
build: fix order of preference for crypto implementations
Consider the optimized x86 implementations before the generic ones, so
the optimized versions can actually get selected.

Fixes: c095ce9b4d ("build: switch to Meson build system")
2020-09-27 13:16:21 +02:00
20c51eacf0
status: unlink stale status sockets, add lockfile
By using the lock status instead of the existence of the status socket,
restarting fastd after a crash will no longer fail.
2020-07-04 15:33:29 +02:00
c137199077
doc: fastd.1: update doc links 2020-06-18 21:17:26 +02:00
b0e96e71fa
Zero padding before passing buffers to methods 2020-06-16 22:29:04 +02:00
63a6d4305f
buffer: change fastd_buffer_zero_pad to align blocks relative to base, not data 2020-06-16 22:29:04 +02:00
3a639f810e
buffer: remove useless const 2020-06-16 22:24:39 +02:00
efb13f1d19
buffer: calculate maximum buffer size and check allocations against it 2020-06-16 20:45:09 +02:00
32e861ef68
buffer: move allocation function into separate compilation unit 2020-06-16 00:53:34 +02:00
5ab8c7c154
util: add missing string.h include 2020-06-16 00:52:39 +02:00
89c6444c3a
log: introduce %Z pattern to log size_t values 2020-06-16 00:40:59 +02:00
0550601d3f
handshake: remove support for unset tlv_len handshake field
We already only support handshakes with fastd v11 or newer, so this can
be removed as well.
2020-06-16 00:40:58 +02:00
0f450984e3
Rename decrypt_tailroom to tailroom
The variable gains an additional meaning: In addition to the tailroom
needed in the source buffer for decryption, is also refers to the
tailroom in the destination buffer for encryption.
2020-06-14 15:50:07 +02:00
fc823bc82b
generic-poly1305: remove unneded tailroom in encrypt buffer 2020-06-14 15:50:07 +02:00
cc1f25d94d
composed-umac, generic-umac: remove unnecessary tailroom 2020-06-14 15:50:07 +02:00
16fc6245dd
uhash: reduce padding requirement from 32 to 16 bytes 2020-06-14 15:50:07 +02:00
f96eb7dcc6
methods: rely on automatic allocation round-up where possible 2020-06-14 15:50:07 +02:00
b11c8b1262
buffer: add helpers to zero the padding of a buffer 2020-06-14 15:50:06 +02:00
4036aaffa6
methods: unify and simplify control flow 2020-06-14 15:50:06 +02:00
719d0804c3
cipher-test: zero padding before calling crypt in decrypt 2020-06-14 15:50:06 +02:00
b64d7c821e
config: free conf.pid_file on exit
Avoid valgrind leak warning.
2020-06-14 15:50:06 +02:00
9ddd40e5b6
methods: do not unnecessarily zero padding of input data
We only support stream ciphers, so trailing garbage in the last block
isn't an issue.
2020-06-14 15:50:06 +02:00
4d25d50366
methods: introduce COMMON_HEADROOM define 2020-06-14 15:50:06 +02:00
81c6ffdcf6
cipher-test: remove unneeded tailroom in encrypt buffer 2020-06-14 15:50:06 +02:00
ee3babd60d
receive: always allocate a reasonably sized receive buffer
With a very small MTU and a great number of configured methods, the
receive buffer may be too small for a handshake packet. Always allocate
receive buffers of at least 1232 bytes, even with smaller MTU.

We also check that we never allocate a buffer for a bigger handshakes
and abort otherwise. This could be turned into a soft error in the
future, but so far we have a nice marging until we hit that number
(maximum handshake with all methods is ~640 bytes).
2020-06-14 15:50:06 +02:00
c1d4823851
Include packet type in send/receive buffer 2020-06-14 15:50:05 +02:00
df6b320d1f
handshake: introduce RECORD_LEN macro 2020-06-13 21:37:56 +02:00
a617f7fca3
test: add simple uhash benchmark 2020-06-13 21:37:55 +02:00
9d8e773e0a
Rename method info fields
* max_overhead -> overhead
* min_encrypt_head_space -> encrypt_headroom
* min_decrypt_head_space -> decrypt_headroom
* min_decrypt_tail_space -> decrypt_tailroom
2020-06-13 21:37:55 +02:00
34e23389bc
Remove now unused min_encrypt_tail_space 2020-06-13 21:37:55 +02:00
64b3c11906
buffer: always pad to multiple of 16 bytes
This allows us to specify the required tailroom simplier and more
accurately.
2020-06-13 21:37:55 +02:00
e0a4b406d9
methods: simplify reorder drop handling 2020-06-13 20:11:22 +02:00
d6c50a5487
umac: remove length 0 special cases 2020-06-13 20:11:22 +02:00
9b9ead760f
uhash: add special case for empty input
uhash needs the input padded to a multiple of 32 bytes, with the special
case that an empty input needs to be padded to 32 as well. Handle this
special case in the uhash code itself, so it doesn't need to be handled
by the callers.
2020-06-13 20:11:22 +02:00
8eb768d461
Add uhash unit test 2020-06-13 20:11:22 +02:00
98fee09de8
Build most code as library to allowing linking against unit tests 2020-06-13 20:11:21 +02:00
78342a97b1
generic-poly1305: cleanup poly1305 calls 2020-06-13 20:11:15 +02:00
2e2bc4e5bb
generic-poly1305: zero padding before calling crypt in decrypt
This fixes an uninitialized memory error reported by valgrind for the
method aes128+ctr. It is unclear why only this method is affected, or why
it is even necessary at all - we only support stream cipher, and
crypto_onetimeauth_poly1305_verify does not care about padding.
2020-06-13 20:11:12 +02:00
adda25162f
buffer: switch push and pull meanings
Make the wording match what the Linux kernel uses.
2020-06-11 21:42:30 +02:00
9a4549e6e2
build: fix disabling status socket 2020-06-11 18:56:40 +02:00
ba9264f009
build: disable -Wformat-truncation and -Wstringop-truncation 2020-06-08 23:35:20 +02:00
c095ce9b4d
build: switch to Meson build system 2020-06-07 13:16:44 +02:00
e58b3f89e5
build: remove CMake build system 2020-06-06 18:25:22 +02:00
3196f0a1f6
build: we require Bison 2.6 now
Fixes: 19759b2237 ("config: replace deprecated name-prefix Bison option")
2020-06-04 23:47:28 +02:00
cc790da7f8
Remove obsolete OpenSSL references
With the update to OpenSSL 1.1, only the aes128-ctr cipher references
symbols from the library, so we can remove it from the toplevel
target_link_libraries() and build.h.
2020-05-23 20:49:11 +02:00