summaryrefslogtreecommitdiffstats
path: root/src/methods
diff options
context:
space:
mode:
Diffstat (limited to 'src/methods')
-rw-r--r--src/methods/cipher_test/cipher_test.c7
-rw-r--r--src/methods/generic_gcm/generic_gcm.c7
-rw-r--r--src/methods/generic_gmac/generic_gmac.c7
-rw-r--r--src/methods/generic_poly1305/generic_poly1305.c6
-rw-r--r--src/methods/null/null.c6
-rw-r--r--src/methods/xsalsa20_poly1305/xsalsa20_poly1305.c7
6 files changed, 6 insertions, 34 deletions
diff --git a/src/methods/cipher_test/cipher_test.c b/src/methods/cipher_test/cipher_test.c
index 050e2a5..4891781 100644
--- a/src/methods/cipher_test/cipher_test.c
+++ b/src/methods/cipher_test/cipher_test.c
@@ -64,11 +64,6 @@ static bool method_provides(const char *name) {
return cipher_get(NULL, name, NULL, NULL);
}
-static size_t method_max_packet_size(fastd_context_t *ctx) {
- return (fastd_max_packet_size(ctx) + COMMON_HEADBYTES);
-}
-
-
static size_t method_key_length(fastd_context_t *ctx, const char *name) {
const fastd_cipher_t *cipher = NULL;
const fastd_cipher_context_t *cctx;
@@ -207,7 +202,7 @@ static bool method_decrypt(fastd_context_t *ctx, fastd_peer_t *peer, fastd_metho
const fastd_method_t fastd_method_cipher_test = {
.provides = method_provides,
- .max_packet_size = method_max_packet_size,
+ .max_overhead = COMMON_HEADBYTES,
.min_encrypt_head_space = 0,
.min_decrypt_head_space = 0,
.min_encrypt_tail_space = sizeof(fastd_block128_t)-1,
diff --git a/src/methods/generic_gcm/generic_gcm.c b/src/methods/generic_gcm/generic_gcm.c
index a35a6c9..9738a2d 100644
--- a/src/methods/generic_gcm/generic_gcm.c
+++ b/src/methods/generic_gcm/generic_gcm.c
@@ -71,11 +71,6 @@ static bool method_provides(const char *name) {
return cipher_get(NULL, name, NULL, NULL);
}
-static size_t method_max_packet_size(fastd_context_t *ctx) {
- return (fastd_max_packet_size(ctx) + COMMON_HEADBYTES + sizeof(fastd_block128_t));
-}
-
-
static size_t method_key_length(fastd_context_t *ctx, const char *name) {
const fastd_cipher_t *cipher = NULL;
const fastd_cipher_context_t *cctx;
@@ -270,7 +265,7 @@ static bool method_decrypt(fastd_context_t *ctx, fastd_peer_t *peer, fastd_metho
const fastd_method_t fastd_method_generic_gcm = {
.provides = method_provides,
- .max_packet_size = method_max_packet_size,
+ .max_overhead = COMMON_HEADBYTES + sizeof(fastd_block128_t),
.min_encrypt_head_space = sizeof(fastd_block128_t),
.min_decrypt_head_space = 0,
.min_encrypt_tail_space = sizeof(fastd_block128_t)-1,
diff --git a/src/methods/generic_gmac/generic_gmac.c b/src/methods/generic_gmac/generic_gmac.c
index 71ee898..d6f7f9b 100644
--- a/src/methods/generic_gmac/generic_gmac.c
+++ b/src/methods/generic_gmac/generic_gmac.c
@@ -86,11 +86,6 @@ static bool method_provides(const char *name) {
return cipher_get(NULL, name, NULL, NULL, NULL, NULL);
}
-static size_t method_max_packet_size(fastd_context_t *ctx) {
- return (fastd_max_packet_size(ctx) + COMMON_HEADBYTES + sizeof(fastd_block128_t));
-}
-
-
static size_t method_key_length(fastd_context_t *ctx, const char *name) {
const fastd_cipher_t *cipher = NULL;
const fastd_cipher_context_t *cctx;
@@ -303,7 +298,7 @@ static bool method_decrypt(fastd_context_t *ctx, fastd_peer_t *peer, fastd_metho
const fastd_method_t fastd_method_generic_gmac = {
.provides = method_provides,
- .max_packet_size = method_max_packet_size,
+ .max_overhead = COMMON_HEADBYTES + sizeof(fastd_block128_t),
.min_encrypt_head_space = 0,
.min_decrypt_head_space = 0,
.min_encrypt_tail_space = sizeof(fastd_block128_t)-1,
diff --git a/src/methods/generic_poly1305/generic_poly1305.c b/src/methods/generic_poly1305/generic_poly1305.c
index 588e294..f3d630a 100644
--- a/src/methods/generic_poly1305/generic_poly1305.c
+++ b/src/methods/generic_poly1305/generic_poly1305.c
@@ -69,10 +69,6 @@ static bool method_provides(const char *name) {
return cipher_get(NULL, name, NULL, NULL);
}
-static size_t method_max_packet_size(fastd_context_t *ctx) {
- return (fastd_max_packet_size(ctx) + COMMON_HEADBYTES + crypto_onetimeauth_poly1305_BYTES);
-}
-
static size_t method_key_length(fastd_context_t *ctx, const char *name) {
const fastd_cipher_t *cipher = NULL;
const fastd_cipher_context_t *cctx;
@@ -239,7 +235,7 @@ static bool method_decrypt(fastd_context_t *ctx, fastd_peer_t *peer, fastd_metho
const fastd_method_t fastd_method_generic_poly1305 = {
.provides = method_provides,
- .max_packet_size = method_max_packet_size,
+ .max_overhead = COMMON_HEADBYTES + crypto_onetimeauth_poly1305_BYTES,
.min_encrypt_head_space = AUTHBLOCKS*sizeof(fastd_block128_t),
.min_decrypt_head_space = AUTHBLOCKS*sizeof(fastd_block128_t) - crypto_onetimeauth_poly1305_BYTES,
.min_encrypt_tail_space = sizeof(fastd_block128_t)-1,
diff --git a/src/methods/null/null.c b/src/methods/null/null.c
index 1b50cfb..3f23866 100644
--- a/src/methods/null/null.c
+++ b/src/methods/null/null.c
@@ -37,10 +37,6 @@ static bool method_provides(const char *name) {
return !strcmp(name, "null");
}
-static size_t method_max_packet_size(fastd_context_t *ctx) {
- return fastd_max_packet_size(ctx);
-}
-
static size_t method_key_length(fastd_context_t *ctx UNUSED, const char *name UNUSED) {
return 0;
}
@@ -86,7 +82,7 @@ static bool method_passthrough(fastd_context_t *ctx UNUSED, fastd_peer_t *peer U
const fastd_method_t fastd_method_null = {
.provides = method_provides,
- .max_packet_size = method_max_packet_size,
+ .max_overhead = 0,
.min_encrypt_head_space = 0,
.min_decrypt_head_space = 0,
.min_encrypt_tail_space = 0,
diff --git a/src/methods/xsalsa20_poly1305/xsalsa20_poly1305.c b/src/methods/xsalsa20_poly1305/xsalsa20_poly1305.c
index f55db76..c6e22fb 100644
--- a/src/methods/xsalsa20_poly1305/xsalsa20_poly1305.c
+++ b/src/methods/xsalsa20_poly1305/xsalsa20_poly1305.c
@@ -41,11 +41,6 @@ static bool method_provides(const char *name) {
return !strcmp(name, "xsalsa20-poly1305");
}
-static size_t method_max_packet_size(fastd_context_t *ctx) {
- return (fastd_max_packet_size(ctx) + COMMON_HEADBYTES + crypto_secretbox_xsalsa20poly1305_ZEROBYTES - crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES);
-}
-
-
static size_t method_key_length(fastd_context_t *ctx UNUSED, const char *name UNUSED) {
return crypto_secretbox_xsalsa20poly1305_KEYBYTES;
}
@@ -160,7 +155,7 @@ static bool method_decrypt(fastd_context_t *ctx, fastd_peer_t *peer, fastd_metho
const fastd_method_t fastd_method_xsalsa20_poly1305 = {
.provides = method_provides,
- .max_packet_size = method_max_packet_size,
+ .max_overhead = COMMON_HEADBYTES + crypto_secretbox_xsalsa20poly1305_ZEROBYTES - crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES,
.min_encrypt_head_space = crypto_secretbox_xsalsa20poly1305_ZEROBYTES,
.min_decrypt_head_space = crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES - COMMON_HEADBYTES,
.min_encrypt_tail_space = 0,