From 14d02a32b2a2a999bf482f9ebc80fb16f6449364 Mon Sep 17 00:00:00 2001 From: aidan garske Date: Mon, 13 Jul 2026 12:54:21 -0700 Subject: [PATCH] F-6842 - Share TPM2_XOR_MASK_MAX via header so test matches impl --- src/tpm2_param_enc.c | 7 ------- tests/unit_tests.c | 3 --- wolftpm/tpm2_param_enc.h | 6 ++++++ 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/tpm2_param_enc.c b/src/tpm2_param_enc.c index 72d8d43d..be593b9e 100644 --- a/src/tpm2_param_enc.c +++ b/src/tpm2_param_enc.c @@ -57,13 +57,6 @@ /* --- Param Enc/Dec Functions -- */ /******************************************************************************/ -/* Maximum XOR mask size. RSA-2048 inSensitive parameter blobs on Create can - * exceed MAX_DIGEST_BUFFER (1024), so leave headroom to ~1250 bytes. Keep - * stack usage bounded by switching to heap under WOLFTPM_SMALL_STACK. */ -#ifndef TPM2_XOR_MASK_MAX -#define TPM2_XOR_MASK_MAX 1280 -#endif - /* XOR parameter encryption/decryption (shared by client and fwTPM). * XOR is symmetric so encrypt and decrypt are the same operation. * nonceA/nonceB order determines direction (caller/TPM or TPM/caller). */ diff --git a/tests/unit_tests.c b/tests/unit_tests.c index 797dfced..45954737 100644 --- a/tests/unit_tests.c +++ b/tests/unit_tests.c @@ -1923,9 +1923,6 @@ static void test_TPM2_ParamEnc_XOR_Vector(void) #endif } -#ifndef TPM2_XOR_MASK_MAX -#define TPM2_XOR_MASK_MAX 1280 -#endif static void test_TPM2_ParamEnc_XOR_MaskBoundary(void) { #ifndef WOLFTPM2_NO_WOLFCRYPT diff --git a/wolftpm/tpm2_param_enc.h b/wolftpm/tpm2_param_enc.h index 95619344..331df6cc 100644 --- a/wolftpm/tpm2_param_enc.h +++ b/wolftpm/tpm2_param_enc.h @@ -30,6 +30,12 @@ extern "C" { #endif +/* Maximum XOR mask size. RSA-2048 inSensitive parameter blobs on Create can + * exceed MAX_DIGEST_BUFFER (1024), so leave headroom to ~1250 bytes. */ +#ifndef TPM2_XOR_MASK_MAX +#define TPM2_XOR_MASK_MAX 1280 +#endif + /* XOR parameter encryption/decryption (raw pointer interface). * XOR is symmetric so encrypt and decrypt are the same operation. */ WOLFTPM_TEST_API int TPM2_ParamEnc_XOR(