convert_wycheproof: don't check tag len on invalid tests

Sponsored-by: https://despairlabs.com/sponsor/
Signed-off-by: Rob Norris <robn@despairlabs.com>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Tino Reichardt <milky-zfs@mcmilk.de>
Reviewed-by: Attila Fülöp <attila@fueloep.org>
This commit is contained in:
Rob Norris 2025-02-27 12:10:20 +11:00 committed by Tony Hutter
parent cb4b854838
commit 6e89095873

View File

@ -143,11 +143,20 @@ for my $group (@{$data->{testGroups}}) {
my ($id, $comment, $iv, $key, $msg, $ct, $aad, $tag, $result) =
@$test{qw(tcId comment iv key msg ct aad tag result)};
# sanity check; iv, key and tag must have the length declared
# by the group params
# sanity check; iv and key must have the length declared by the
# group params.
unless (
length_check($id, 'iv', $iv, $iv_size) &&
length_check($id, 'key', $key, $key_size) &&
length_check($id, 'key', $key, $key_size)) {
$skipped++;
next;
}
# sanity check; tag must have the length declared by the group
# param, but only for valid tests (invalid tests should be
# rejected, and so can't produce a tag anyway)
unless (
$result eq 'invalid' ||
length_check($id, 'tag', $tag, $tag_size)) {
$skipped++;
next;