Skip to content

Commit b0f2bcd

Browse files
robntonyhutter
authored andcommitted
convert_wycheproof: don't check tag len on invalid tests
Sponsored-by: https://despairlabs.com/sponsor/ Signed-off-by: Rob Norris <[email protected]> Reviewed-by: Tony Hutter <[email protected]> Reviewed-by: Tino Reichardt <[email protected]> Reviewed-by: Attila Fülöp <[email protected]>
1 parent a6a2f37 commit b0f2bcd

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

scripts/convert_wycheproof.pl

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,20 @@ sub usage {
143143
my ($id, $comment, $iv, $key, $msg, $ct, $aad, $tag, $result) =
144144
@$test{qw(tcId comment iv key msg ct aad tag result)};
145145

146-
# sanity check; iv, key and tag must have the length declared
147-
# by the group params
146+
# sanity check; iv and key must have the length declared by the
147+
# group params.
148148
unless (
149149
length_check($id, 'iv', $iv, $iv_size) &&
150-
length_check($id, 'key', $key, $key_size) &&
150+
length_check($id, 'key', $key, $key_size)) {
151+
$skipped++;
152+
next;
153+
}
154+
155+
# sanity check; tag must have the length declared by the group
156+
# param, but only for valid tests (invalid tests should be
157+
# rejected, and so can't produce a tag anyway)
158+
unless (
159+
$result eq 'invalid' ||
151160
length_check($id, 'tag', $tag, $tag_size)) {
152161
$skipped++;
153162
next;

0 commit comments

Comments
 (0)