aboutsummaryrefslogtreecommitdiff
path: root/third_party/abseil-cpp/absl/random/internal/randen_traits.h
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2022-04-13 02:27:30 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2022-04-13 02:27:30 +0000
commit7563023510bf04108a954596ea9393a4c11ac279 (patch)
tree2ce94d7f0804ccb77d1fa9b2a1bca00eecdff1e2 /third_party/abseil-cpp/absl/random/internal/randen_traits.h
parentf60eaea2240ba9e1c508e8e0c91d39ee9fc47be5 (diff)
parenta9167328fc721c9637f0bcd87525cd23ff5ddac1 (diff)
downloadwebrtc-7563023510bf04108a954596ea9393a4c11ac279.tar.gz
Merge changes I0ab600cd,I1e74c64a am: 798f3afdf6 am: 2f9c4b2c3b am: a9167328fct_frc_odp_330442040t_frc_odp_330442000t_frc_ase_330444010android13-frc-odp-releaseandroid13-dev
Original change: https://android-review.googlesource.com/c/platform/external/webrtc/+/2062410 Change-Id: I9a35945cfb943544bbb0f4632fef787ea38c1ad1 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Diffstat (limited to 'third_party/abseil-cpp/absl/random/internal/randen_traits.h')
-rw-r--r--third_party/abseil-cpp/absl/random/internal/randen_traits.h33
1 files changed, 29 insertions, 4 deletions
diff --git a/third_party/abseil-cpp/absl/random/internal/randen_traits.h b/third_party/abseil-cpp/absl/random/internal/randen_traits.h
index 2b8bbe7383..120022c9fb 100644
--- a/third_party/abseil-cpp/absl/random/internal/randen_traits.h
+++ b/third_party/abseil-cpp/absl/random/internal/randen_traits.h
@@ -28,10 +28,29 @@ namespace absl {
ABSL_NAMESPACE_BEGIN
namespace random_internal {
-// RANDen = RANDom generator or beetroots in Swiss German.
+// RANDen = RANDom generator or beetroots in Swiss High German.
// 'Strong' (well-distributed, unpredictable, backtracking-resistant) random
// generator, faster in some benchmarks than std::mt19937_64 and pcg64_c32.
//
+// High-level summary:
+// 1) Reverie (see "A Robust and Sponge-Like PRNG with Improved Efficiency") is
+// a sponge-like random generator that requires a cryptographic permutation.
+// It improves upon "Provably Robust Sponge-Based PRNGs and KDFs" by
+// achieving backtracking resistance with only one Permute() per buffer.
+//
+// 2) "Simpira v2: A Family of Efficient Permutations Using the AES Round
+// Function" constructs up to 1024-bit permutations using an improved
+// Generalized Feistel network with 2-round AES-128 functions. This Feistel
+// block shuffle achieves diffusion faster and is less vulnerable to
+// sliced-biclique attacks than the Type-2 cyclic shuffle.
+//
+// 3) "Improving the Generalized Feistel" and "New criterion for diffusion
+// property" extends the same kind of improved Feistel block shuffle to 16
+// branches, which enables a 2048-bit permutation.
+//
+// Combine these three ideas and also change Simpira's subround keys from
+// structured/low-entropy counters to digits of Pi (or other random source).
+
// RandenTraits contains the basic algorithm traits, such as the size of the
// state, seed, sponge, etc.
struct RandenTraits {
@@ -45,17 +64,23 @@ struct RandenTraits {
// Size of the default seed consumed by the sponge.
static constexpr size_t kSeedBytes = kStateBytes - kCapacityBytes;
+ // Assuming 128-bit blocks, the number of blocks in the state.
// Largest size for which security proofs are known.
static constexpr size_t kFeistelBlocks = 16;
- // Type-2 generalized Feistel => one round function for every two blocks.
- static constexpr size_t kFeistelFunctions = kFeistelBlocks / 2; // = 8
-
// Ensures SPRP security and two full subblock diffusions.
// Must be > 4 * log2(kFeistelBlocks).
static constexpr size_t kFeistelRounds = 16 + 1;
+
+ // Size of the key. A 128-bit key block is used for every-other
+ // feistel block (Type-2 generalized Feistel network) in each round.
+ static constexpr size_t kKeyBytes = 16 * kFeistelRounds * kFeistelBlocks / 2;
};
+// Randen key arrays. In randen_round_keys.cc
+extern const unsigned char kRandenRoundKeys[RandenTraits::kKeyBytes];
+extern const unsigned char kRandenRoundKeysBE[RandenTraits::kKeyBytes];
+
} // namespace random_internal
ABSL_NAMESPACE_END
} // namespace absl