diff --git a/aead.h b/aead.h index b8f150d..aa5b51c 100644 --- a/aead.h +++ b/aead.h @@ -23,4 +23,6 @@ struct lc_aead_impl { const uint8_t *, size_t); int (*open)(uint8_t *, size_t *, void *, const uint8_t *, size_t, const uint8_t *, size_t); + + size_t blocklen; }; diff --git a/aead_chacha20_poly1305.c b/aead_chacha20_poly1305.c index a02552f..6875e21 100644 --- a/aead_chacha20_poly1305.c +++ b/aead_chacha20_poly1305.c @@ -419,11 +419,15 @@ xchacha20_poly1305_open(uint8_t *out, size_t *outlen, void *initparams, static struct lc_aead_impl chacha20_poly1305_impl = { .seal = &chacha20_poly1305_seal, .open = &chacha20_poly1305_open, + + .blocklen = LC_CHACHA20_BLOCKLEN, }; static struct lc_aead_impl xchacha20_poly1305_impl = { .seal = &xchacha20_poly1305_seal, .open = &xchacha20_poly1305_open, + + .blocklen = LC_XCHACHA20_BLOCKLEN, }; const struct lc_aead_impl * diff --git a/auth.h b/auth.h index 945cdd1..35924b7 100644 --- a/auth.h +++ b/auth.h @@ -26,6 +26,9 @@ struct lc_auth_impl { void *(*ctx_new)(void); void (*ctx_free)(void *); + + size_t blocklen; + size_t taglen; }; struct lc_auth_ctx { diff --git a/auth_poly1305.c b/auth_poly1305.c index dff2c72..ce4c4c8 100644 --- a/auth_poly1305.c +++ b/auth_poly1305.c @@ -165,6 +165,9 @@ static struct lc_auth_impl poly1305_impl = { .ctx_new = &poly1305_ctx_new, .ctx_free = NULL, + + .blocklen = LC_POLY1305_BLOCKLEN, + .taglen = LC_POLY1305_TAGLEN, }; const struct lc_auth_impl * diff --git a/cipher.h b/cipher.h index 321f40b..497de0a 100644 --- a/cipher.h +++ b/cipher.h @@ -35,6 +35,8 @@ struct lc_cipher_impl { void *(*ctx_new)(void); void (*ctx_free)(void *); + + size_t blocklen; }; struct lc_cipher_ctx { diff --git a/cipher_chacha20.c b/cipher_chacha20.c index fcd2aaa..d8e9b83 100644 --- a/cipher_chacha20.c +++ b/cipher_chacha20.c @@ -229,6 +229,8 @@ static struct lc_cipher_impl chacha20_impl = { .ctx_new = &chacha20_ctx_new, .ctx_free = NULL, + + .blocklen = LC_CHACHA20_BLOCKLEN, }; static struct lc_cipher_impl xchacha20_impl = { @@ -244,6 +246,8 @@ static struct lc_cipher_impl xchacha20_impl = { .ctx_new = &chacha20_ctx_new, .ctx_free = NULL, + + .blocklen = LC_XCHACHA20_BLOCKLEN, }; const struct lc_cipher_impl *