From: Niels Möller Date: Sun, 10 Mar 2024 09:32:46 +0000 (+0100) Subject: Test non-block pieces of aead associated data. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=378f2602aee01e0ef45888423070aff875cac6b7;p=thirdparty%2Fnettle.git Test non-block pieces of aead associated data. --- diff --git a/testsuite/testutils.c b/testsuite/testutils.c index 8b4fbd11..24b1c156 100644 --- a/testsuite/testutils.c +++ b/testsuite/testutils.c @@ -20,6 +20,8 @@ # include #endif +#define MIN(a,b) (((a) < (b)) ? (a) : (b)) + void die(const char *format, ...) { @@ -866,7 +868,7 @@ test_aead(const struct nettle_aead *aead, } if (aead->update) { - size_t a_offset = offset <= authtext->length ? offset : authtext->length; + size_t a_offset = MIN(authtext->length, offset / aead->block_size); aead->update(ctx, a_offset, authtext->data); aead->update(ctx, 0, NULL); aead->update(ctx, authtext->length - a_offset, authtext->data + a_offset);