entropy: Avoid volatile post-increment under C++20 C++20 deprecated pre- and post-increment on volatile lvalues, causing the JITTER_APT FIPS break test path in MemoryAccessSampler::Next to fail compilation with -Wdeprecated-volatile (Clang) and -Wvolatile (GCC) when building BoringSSL consumers as C++20. Use compound assignment (which C++20 defect report P2327R1 un-deprecated when its result is discarded) to match the existing volatile memory access in the same function. Bug: b/333039464, b/491765858 Change-Id: I2e233ce91c922441d744fb8ac084b9c35c4250e6 Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/103828 Auto-Submit: Tom Hughes <tomhughes@chromium.org> Reviewed-by: David Benjamin <davidben@google.com> Commit-Queue: David Benjamin <davidben@google.com> Presubmit-BoringSSL-Verified: boringssl-scoped@luci-project-accounts.iam.gserviceaccount.com <boringssl-scoped@luci-project-accounts.iam.gserviceaccount.com>
diff --git a/crypto/fipsmodule/entropy/jitter.cc.inc b/crypto/fipsmodule/entropy/jitter.cc.inc index f4767a8..8c75166 100644 --- a/crypto/fipsmodule/entropy/jitter.cc.inc +++ b/crypto/fipsmodule/entropy/jitter.cc.inc
@@ -119,7 +119,7 @@ // processed by `DeltaSampler`, the tests see 0,0,0,1,... which exceeds // the APT cutoff (348/512) without tripping the RCT (26). *out = array_[0] >> 2; - array_[0]++; + array_[0] += 1; } else { // Perform some memory accesses and measure how long it took. The LCG is // intended to defeat any CPU predictors and thus expose this code to as