tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

randen_hwaes.h (1891B)


      1 // Copyright 2017 The Abseil Authors.
      2 //
      3 // Licensed under the Apache License, Version 2.0 (the "License");
      4 // you may not use this file except in compliance with the License.
      5 // You may obtain a copy of the License at
      6 //
      7 //      https://www.apache.org/licenses/LICENSE-2.0
      8 //
      9 // Unless required by applicable law or agreed to in writing, software
     10 // distributed under the License is distributed on an "AS IS" BASIS,
     11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     12 // See the License for the specific language governing permissions and
     13 // limitations under the License.
     14 
     15 #ifndef ABSL_RANDOM_INTERNAL_RANDEN_HWAES_H_
     16 #define ABSL_RANDOM_INTERNAL_RANDEN_HWAES_H_
     17 
     18 #include "absl/base/config.h"
     19 
     20 // HERMETIC NOTE: The randen_hwaes target must not introduce duplicate
     21 // symbols from arbitrary system and other headers, since it may be built
     22 // with different flags from other targets, using different levels of
     23 // optimization, potentially introducing ODR violations.
     24 
     25 namespace absl {
     26 ABSL_NAMESPACE_BEGIN
     27 namespace random_internal {
     28 
     29 // RANDen = RANDom generator or beetroots in Swiss High German.
     30 // 'Strong' (well-distributed, unpredictable, backtracking-resistant) random
     31 // generator, faster in some benchmarks than std::mt19937_64 and pcg64_c32.
     32 //
     33 // RandenHwAes implements the basic state manipulation methods.
     34 class RandenHwAes {
     35 public:
     36  static void Generate(const void* keys, void* state_void);
     37  static void Absorb(const void* seed_void, void* state_void);
     38  static const void* GetKeys();
     39 };
     40 
     41 // HasRandenHwAesImplementation returns true when there is an accelerated
     42 // implementation, and false otherwise.  If there is no implementation,
     43 // then attempting to use it will abort the program.
     44 bool HasRandenHwAesImplementation();
     45 
     46 }  // namespace random_internal
     47 ABSL_NAMESPACE_END
     48 }  // namespace absl
     49 
     50 #endif  // ABSL_RANDOM_INTERNAL_RANDEN_HWAES_H_