wycheproof_aead: divide by 8 at parse time

This commit is contained in:
Lucas Gabriel Vuotto 2024-05-31 11:47:42 +00:00
parent 7bc527c769
commit eedaa46831

View File

@ -201,6 +201,7 @@ main(int argc, char *argv[])
ivlenarg = strtonum(optarg, 0, LLONG_MAX, &errstr);
if (errstr != NULL)
errx(1, "ivlen is %s: %s", errstr, optarg);
ivlenarg /= 8;
break;
case 'i':
iflag = 1;
@ -221,6 +222,7 @@ main(int argc, char *argv[])
errx(1, "keylen is %s: %s", errstr, optarg);
if (keylenarg % 8 != 0)
errx(1, "unsupport K value: %zu", keylenarg);
keylenarg /= 8;
break;
case 'k':
kflag = 1;
@ -251,6 +253,7 @@ main(int argc, char *argv[])
taglenarg = strtonum(optarg, 0, LLONG_MAX, &errstr);
if (errstr != NULL)
errx(1, "taglen is %s: %s", errstr, optarg);
taglenarg /= 8;
break;
case 't':
tflag = 1;
@ -282,10 +285,6 @@ main(int argc, char *argv[])
return 1;
}
ivlenarg /= 8;
keylenarg /= 8;
taglenarg /= 8;
out = malloc(outlen);
if (out == NULL)
err(1, "out of memory");