aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--src/data.c12
-rw-r--r--src/packets.h4
2 files changed, 8 insertions, 8 deletions
diff --git a/src/data.c b/src/data.c
index 48b2a70..19f4a7f 100644
--- a/src/data.c
+++ b/src/data.c
@@ -48,13 +48,13 @@ out:
}
#include "selftest/counter.h"
-static inline size_t skb_padding(struct sk_buff *skb)
+static inline unsigned int skb_padding(struct sk_buff *skb)
{
/* We do this modulo business with the MTU, just in case the networking layer
* gives us a packet that's bigger than the MTU. Now that we support GSO, this
* shouldn't be a real problem, and this can likely be removed. But, caution! */
- size_t last_unit = skb->len % skb->dev->mtu;
- size_t padded_size = (last_unit + MESSAGE_PADDING_MULTIPLE - 1) & ~(MESSAGE_PADDING_MULTIPLE - 1);
+ unsigned int last_unit = skb->len % skb->dev->mtu;
+ unsigned int padded_size = (last_unit + MESSAGE_PADDING_MULTIPLE - 1) & ~(MESSAGE_PADDING_MULTIPLE - 1);
if (padded_size > skb->dev->mtu)
padded_size = skb->dev->mtu;
return padded_size - last_unit;
@@ -100,7 +100,7 @@ static inline void skb_encrypt(struct sk_buff *skb, struct packet_data_encryptio
noise_keypair_put(ctx->keypair);
}
-static inline bool skb_decrypt(struct sk_buff *skb, unsigned int num_frags, uint64_t nonce, struct noise_symmetric_key *key)
+static inline bool skb_decrypt(struct sk_buff *skb, uint8_t num_frags, uint64_t nonce, struct noise_symmetric_key *key)
{
struct scatterlist sg[num_frags]; /* This should be bound to at most 128 by the caller. */
@@ -188,7 +188,7 @@ int packet_create_data(struct sk_buff *skb, struct wireguard_peer *peer, void(*c
struct packet_data_encryption_ctx *ctx = NULL;
u64 nonce;
struct sk_buff *trailer = NULL;
- size_t plaintext_len, padding_len, trailer_len;
+ unsigned int plaintext_len, padding_len, trailer_len;
unsigned int num_frags;
rcu_read_lock();
@@ -269,7 +269,7 @@ struct packet_data_decryption_ctx {
struct noise_keypair *keypair;
struct sockaddr_storage addr;
uint64_t nonce;
- unsigned int num_frags;
+ uint8_t num_frags;
int ret;
};
diff --git a/src/packets.h b/src/packets.h
index 035c548..a8ecdf1 100644
--- a/src/packets.h
+++ b/src/packets.h
@@ -44,8 +44,8 @@ struct packet_data_encryption_ctx {
struct sk_buff *skb;
void (*callback)(struct sk_buff *, struct wireguard_peer *);
struct wireguard_peer *peer;
- size_t plaintext_len, trailer_len;
- unsigned int num_frags;
+ unsigned int plaintext_len, trailer_len;
+ uint8_t num_frags;
struct sk_buff *trailer;
struct noise_keypair *keypair;
uint64_t nonce;