git: d8b6a6559070 - stable/13 - cryptocheck: Expand the set of sizes tested by -z.

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Thu, 21 Oct 2021 17:07:04 UTC
The branch stable/13 has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=d8b6a6559070a4d76f8c9e0660fff2ea5a573d65

commit d8b6a6559070a4d76f8c9e0660fff2ea5a573d65
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2021-04-01 22:42:30 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2021-10-21 15:51:24 +0000

    cryptocheck: Expand the set of sizes tested by -z.
    
    Test individual sizes up to the max encryption block length as well as
    a few sizes that include 1 full block and a partial block before
    doubling the size.
    
    Reviewed by:    cem, markj
    Sponsored by:   Netflix
    Differential Revision:  https://reviews.freebsd.org/D29518
    
    (cherry picked from commit c86de1dab8e65bc9d11501ca51f2e152276cb94e)
---
 tools/tools/crypto/cryptocheck.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/tools/tools/crypto/cryptocheck.c b/tools/tools/crypto/cryptocheck.c
index bd075d24e0f5..502ea04cd661 100644
--- a/tools/tools/crypto/cryptocheck.c
+++ b/tools/tools/crypto/cryptocheck.c
@@ -228,7 +228,7 @@ static const struct alg {
 
 static bool verbose;
 static int requested_crid;
-static size_t aad_sizes[48], sizes[128];
+static size_t aad_sizes[48], sizes[EALG_MAX_BLOCK_LEN * 2];
 static u_int naad_sizes, nsizes;
 
 static void
@@ -1729,12 +1729,18 @@ main(int ac, char **av)
 
 	if (nsizes == 0) {
 		if (testall) {
-			for (i = 1; i <= 32; i++) {
+			for (i = 1; i <= EALG_MAX_BLOCK_LEN; i++) {
 				sizes[nsizes] = i;
 				nsizes++;
 			}
 
-			base_size = 32;
+			for (i = EALG_MAX_BLOCK_LEN + 8;
+			     i <= EALG_MAX_BLOCK_LEN * 2; i += 8) {
+				sizes[nsizes] = i;
+				nsizes++;
+			}
+
+			base_size = EALG_MAX_BLOCK_LEN * 2;
 			while (base_size * 2 < 240 * 1024) {
 				base_size *= 2;
 				assert(nsizes < nitems(sizes));