Remove now unused tailroom fields

This commit is contained in:
Matthias Schiffer 2020-09-28 23:48:06 +02:00
parent b9846a5f85
commit bd63837ca4
Signed by: neocturne
GPG key ID: 16EF3F64CB201D9C
11 changed files with 3 additions and 16 deletions

View file

@ -470,7 +470,6 @@ static void configure_method_parameters(void) {
conf.overhead = 0;
conf.encrypt_headroom = 0;
conf.decrypt_headroom = 0;
conf.tailroom = 0;
size_t i;
for (i = 0; conf.methods[i].name; i++) {
@ -479,7 +478,6 @@ static void configure_method_parameters(void) {
conf.overhead = max_size_t(conf.overhead, provider->overhead);
conf.encrypt_headroom = max_size_t(conf.encrypt_headroom, provider->encrypt_headroom);
conf.decrypt_headroom = max_size_t(conf.decrypt_headroom, provider->decrypt_headroom);
conf.tailroom = max_size_t(conf.tailroom, provider->tailroom);
}
conf.encrypt_headroom = alignto(conf.encrypt_headroom, 16);
@ -662,9 +660,8 @@ static void configure_peers(bool dirs_only) {
}
size_t headroom = max_size_t(conf.encrypt_headroom, conf.decrypt_headroom + conf.overhead);
ctx.max_buffer =
alignto(max_size_t(headroom + fastd_max_payload(ctx.max_mtu) + conf.tailroom, MAX_HANDSHAKE_SIZE),
sizeof(fastd_block128_t));
ctx.max_buffer = alignto(
max_size_t(headroom + fastd_max_payload(ctx.max_mtu), MAX_HANDSHAKE_SIZE), sizeof(fastd_block128_t));
}
/** Initialized the peers not configured through peer directories */

View file

@ -241,8 +241,6 @@ struct fastd_config {
* encrypt */
size_t decrypt_headroom; /**< The minimum space a configured methods needs a the beginning of a source buffer to
* decrypt */
size_t tailroom; /**< The minimum space a configured methods needs a the end of a source buffer to
* decrypt, or that is allocated in the destination buffer to encrypt */
char *secret; /**< The configured secret key */

View file

@ -28,7 +28,6 @@ struct fastd_method_provider {
size_t overhead; /**< The maximum number of bytes of overhead the methods may add */
size_t encrypt_headroom; /**< The minimum head space needed for encrytion */
size_t decrypt_headroom; /**< The minimum head space needed for decryption */
size_t tailroom; /**< The minimum tail space needed for decryption */
/** Tries to create a method with the given name */
bool (*create_by_name)(const char *name, fastd_method_t **method);

View file

@ -196,7 +196,6 @@ const fastd_method_provider_t fastd_method_cipher_test = {
.overhead = COMMON_HEADBYTES,
.encrypt_headroom = 0,
.decrypt_headroom = 0,
.tailroom = 0,
.create_by_name = method_create_by_name,
.destroy = method_destroy,

View file

@ -294,7 +294,6 @@ const fastd_method_provider_t fastd_method_composed_gmac = {
.overhead = COMMON_HEADBYTES + sizeof(fastd_block128_t),
.encrypt_headroom = 0,
.decrypt_headroom = 0,
.tailroom = 0,
.create_by_name = method_create_by_name,
.destroy = method_destroy,

View file

@ -272,7 +272,6 @@ const fastd_method_provider_t fastd_method_composed_umac = {
.overhead = COMMON_HEADBYTES + sizeof(fastd_block128_t),
.encrypt_headroom = 0,
.decrypt_headroom = 0,
.tailroom = 0,
.create_by_name = method_create_by_name,
.destroy = method_destroy,

View file

@ -248,7 +248,6 @@ const fastd_method_provider_t fastd_method_generic_gmac = {
.overhead = COMMON_HEADBYTES + sizeof(fastd_block128_t),
.encrypt_headroom = sizeof(fastd_block128_t),
.decrypt_headroom = 0,
.tailroom = 0,
.create_by_name = method_create_by_name,
.destroy = method_destroy,

View file

@ -237,7 +237,6 @@ const fastd_method_provider_t fastd_method_generic_poly1305 = {
.overhead = COMMON_HEADBYTES + TAGBYTES,
.encrypt_headroom = KEYBYTES,
.decrypt_headroom = KEYBYTES - TAGBYTES,
.tailroom = 0,
.create_by_name = method_create_by_name,
.destroy = method_destroy,

View file

@ -228,7 +228,6 @@ const fastd_method_provider_t fastd_method_generic_umac = {
.overhead = COMMON_HEADBYTES + sizeof(fastd_block128_t),
.encrypt_headroom = sizeof(fastd_block128_t),
.decrypt_headroom = 0,
.tailroom = 0,
.create_by_name = method_create_by_name,
.destroy = method_destroy,

View file

@ -102,7 +102,6 @@ const fastd_method_provider_t fastd_method_null = {
.overhead = 1,
.encrypt_headroom = 1,
.decrypt_headroom = 0,
.tailroom = 0,
.create_by_name = method_create_by_name,
.destroy = method_destroy,

View file

@ -228,7 +228,7 @@ static inline void handle_socket_receive(
/** Reads a packet from a socket */
void fastd_receive(fastd_socket_t *sock) {
size_t max_len = max_size_t(fastd_max_payload(ctx.max_mtu) + conf.overhead, MAX_HANDSHAKE_SIZE);
fastd_buffer_t buffer = fastd_buffer_alloc(max_len, conf.decrypt_headroom, conf.tailroom);
fastd_buffer_t buffer = fastd_buffer_alloc(max_len, conf.decrypt_headroom, 0);
fastd_peer_address_t local_addr;
fastd_peer_address_t recvaddr;
struct iovec buffer_vec = { .iov_base = buffer.data, .iov_len = buffer.len };