diff options
| author | Dimitri Staessens <dimitri@ouroboros.rocks> | 2026-01-22 21:34:42 +0100 |
|---|---|---|
| committer | Sander Vrijders <sander@ouroboros.rocks> | 2026-01-23 08:29:30 +0100 |
| commit | fb1aeb3ffff2948edeb710e65aef261b589c7403 (patch) | |
| tree | 944843762ff07c6b19d4a7a12170fbe5357d75d0 /src/lib/crypt.c | |
| parent | 47d786fbabe456acb2d89c898185366bc88bebbc (diff) | |
| download | ouroboros-fb1aeb3ffff2948edeb710e65aef261b589c7403.tar.gz ouroboros-fb1aeb3ffff2948edeb710e65aef261b589c7403.zip | |
lib: Fix allocation of IV and tags
The packet buffer was allocating a fixed header for the IV, but did
not account for the tag at all (remnant of the old hardcoded CBC
mode-only proof-of-concept). Never ran into issues because we always
reserved ample space. But it now properly reserves the correct space
for IV and tag.
Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks>
Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
Diffstat (limited to 'src/lib/crypt.c')
| -rw-r--r-- | src/lib/crypt.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/lib/crypt.c b/src/lib/crypt.c index a050fe38..600f8336 100644 --- a/src/lib/crypt.c +++ b/src/lib/crypt.c @@ -619,6 +619,34 @@ void crypt_destroy_ctx(struct crypt_ctx * crypt) free(crypt); } +int crypt_get_ivsz(struct crypt_ctx * ctx) +{ + if (ctx == NULL) + return -EINVAL; + +#ifdef HAVE_OPENSSL + assert(ctx->ctx != NULL); + return openssl_crypt_get_ivsz(ctx->ctx); +#else + assert(ctx->ctx == NULL); + return -ENOTSUP; +#endif +} + +int crypt_get_tagsz(struct crypt_ctx * ctx) +{ + if (ctx == NULL) + return -EINVAL; + +#ifdef HAVE_OPENSSL + assert(ctx->ctx != NULL); + return openssl_crypt_get_tagsz(ctx->ctx); +#else + assert(ctx->ctx == NULL); + return -ENOTSUP; +#endif +} + int crypt_load_privkey_file(const char * path, void ** key) { |
