| Code-Review | +1 |
FX_Random::Fill(pdfium::span_from_ref(random_value));Existing: Just fill the 4 bytes of `buf` directly?
// MT_M - `kN` underflows, but this is safe because unsigned underflow isWrap this entire snippet in backticks?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Existing: Just fill the 4 bytes of `buf` directly?
Done with fxcrt::reinterpret_span<>()
// MT_M - `kN` underflows, but this is safe because unsigned underflow isWrap this entire snippet in backticks?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
12 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:
```
The name of the file: core/fxcrt/fx_random.cpp
Insertions: 1, Deletions: 1.
@@ -112,7 +112,7 @@
for (; kk < kN - 1; kk++) {
v = (context_.mt[kk] & MT_Upper_Mask) |
(context_.mt[kk + 1] & MT_Lower_Mask);
- // MT_M - `kN` underflows, but this is safe because unsigned underflow is
+ // `MT_M - kN` underflows, but this is safe because unsigned underflow is
// well-defined.
context_.mt[kk] = context_.mt[kk + (MT_M - kN)] ^ (v >> 1) ^ mag[v & 1];
}
```
```
The name of the file: core/fpdfapi/parser/cpdf_security_handler.cpp
Insertions: 2, Deletions: 4.
@@ -700,10 +700,8 @@
// In ISO 32000 Supplement for ExtensionLevel 3, Algorithm 3.10 says bytes 12
// to 15 should be random data.
- uint32_t random_value;
- FX_Random::Fill(pdfium::span_from_ref(random_value));
- fxcrt::Copy(pdfium::byte_span_from_ref(random_value),
- pdfium::span(buf).subspan<12, 4>());
+ FX_Random::Fill(
+ fxcrt::reinterpret_span<uint32_t>(pdfium::span(buf).subspan<12, 4>()));
CRYPT_aes_context aes = {};
CRYPT_AESSetKey(&aes, encrypt_key_);
```
Replace FX_Random_MT_.* functions with FX_Random class
Replace the legacy C-style FX_Random_MT_.* functions with FX_Random,
which owns its own MTContext, removing the need for callers to manage
opening and closing MTContexts.
Also remove "MT" from the class name to be consistent with the file
name.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |