@@ -1991,6 +1991,11 @@ static const char* bench_result_words2[][5] = {
19911991#endif
19921992
19931993
1994+
1995+ #if defined(WOLFSSL_DEVCRYPTO) && defined(WOLFSSL_AUTHSZ_BENCH)
1996+ #warning Large/Unalligned AuthSz could result in errors with /dev/crypto
1997+ #endif
1998+
19941999/* use kB instead of mB for embedded benchmarking */
19952000#ifdef BENCH_EMBEDDED
19962001 #ifndef BENCH_NTIMES
@@ -4798,6 +4803,14 @@ void bench_gmac(int useDeviceID)
47984803 const char* gmacStr = "GMAC Default";
47994804#endif
48004805
4806+ /* Implementations of /Dev/Crypto will error out if the size of Auth in is */
4807+ /* greater than the system's page size */
4808+ #if defined(WOLFSSL_DEVCRYPTO) && defined(WOLFSSL_AUTHSZ_BENCH)
4809+ bench_size = WOLFSSL_AUTHSZ_BENCH;
4810+ #elif defined(WOLFSSL_DEVCRYPTO)
4811+ bench_size = sysconf(_SC_PAGESIZE);
4812+ #endif
4813+
48014814 /* init keys */
48024815 XMEMSET(bench_plain, 0, bench_size);
48034816 XMEMSET(tag, 0, sizeof(tag));
@@ -4828,7 +4841,13 @@ void bench_gmac(int useDeviceID)
48284841#ifdef MULTI_VALUE_STATISTICS
48294842 bench_multi_value_stats(max, min, sum, squareSum, runs);
48304843#endif
4831-
4844+ #if defined(WOLFSSL_DEVCRYPTO)
4845+ if (ret != 0 && (bench_size > sysconf(_SC_PAGESIZE))) {
4846+ printf("authIn Buffer Size[%d] greater than System Page Size[%ld]\n",
4847+ bench_size, sysconf(_SC_PAGESIZE));
4848+ }
4849+ bench_size = BENCH_SIZE;
4850+ #endif
48324851}
48334852
48344853#endif /* HAVE_AESGCM */
0 commit comments