@@ -1173,18 +1173,22 @@ int TPM2_Native_TestArgs(void* userCtx, int argc, char *argv[])
11731173 if (rc == TPM_RC_SUCCESS ) {
11741174 /* For the P-256 curve configured above (TPM_ECC_NIST_P256),
11751175 * each Z output is the x-coordinate of the shared point, so
1176- * its size must equal the curve byte length (32). A mutant
1176+ * its size must equal the curve byte length (32). The outer
1177+ * TPM2B_ECC_POINT .size field wraps TPMS_ECC_POINT (x + y),
1178+ * so validate the x-coordinate size specifically. A mutant
11771179 * that returns any non-zero-sized output would otherwise
11781180 * slip past a plain non-empty check. */
11791181 const int expectedZSz = 32 ; /* P-256 coordinate size */
1180- printf ("TPM2_ZGen_2Phase: outZ1 %d, outZ2 %d\n" ,
1181- cmdOut .zgen2 .outZ1 .size , cmdOut .zgen2 .outZ2 .size );
1182- if (cmdOut .zgen2 .outZ1 .size != expectedZSz ||
1183- cmdOut .zgen2 .outZ2 .size != expectedZSz ) {
1184- printf ("TPM2_ZGen_2Phase: FAIL (expected Z size %d, "
1185- "got outZ1=%d outZ2=%d)\n" ,
1182+ printf ("TPM2_ZGen_2Phase: outZ1.x %d, outZ2.x %d\n" ,
1183+ cmdOut .zgen2 .outZ1 .point .x .size ,
1184+ cmdOut .zgen2 .outZ2 .point .x .size );
1185+ if (cmdOut .zgen2 .outZ1 .point .x .size != expectedZSz ||
1186+ cmdOut .zgen2 .outZ2 .point .x .size != expectedZSz ) {
1187+ printf ("TPM2_ZGen_2Phase: FAIL (expected Z x size %d, "
1188+ "got outZ1.x=%d outZ2.x=%d)\n" ,
11861189 expectedZSz ,
1187- cmdOut .zgen2 .outZ1 .size , cmdOut .zgen2 .outZ2 .size );
1190+ cmdOut .zgen2 .outZ1 .point .x .size ,
1191+ cmdOut .zgen2 .outZ2 .point .x .size );
11881192 rc = -1 ;
11891193 goto exit ;
11901194 }
0 commit comments