From eedaa46831edd22953c1167c7b87b6e1030b5437 Mon Sep 17 00:00:00 2001 From: Lucas Gabriel Vuotto Date: Fri, 31 May 2024 11:47:42 +0000 Subject: [PATCH] wycheproof_aead: divide by 8 at parse time --- wycheproof_aead.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/wycheproof_aead.c b/wycheproof_aead.c index fc4819b..f184ec7 100644 --- a/wycheproof_aead.c +++ b/wycheproof_aead.c @@ -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");