proxygen
fizz::CryptoUtils Struct Reference

#include <Utils.h>

Static Public Member Functions

static bool equal (folly::ByteRange a, folly::ByteRange b)
 
static void clean (folly::MutableByteRange range)
 
static void init ()
 

Detailed Description

Definition at line 15 of file Utils.h.

Member Function Documentation

void fizz::CryptoUtils::clean ( folly::MutableByteRange  range)
static

Overwrites the memory in range.

Definition at line 38 of file Utils.cpp.

References folly::Range< Iter >::data(), and folly::Range< Iter >::size().

Referenced by fizz::server::AeadTokenCipher< AeadType, HkdfType >::clearSecrets().

38  {
39  sodium_memzero(range.data(), range.size());
40 }
constexpr size_type size() const
Definition: Range.h:431
constexpr Iter data() const
Definition: Range.h:446
bool fizz::CryptoUtils::equal ( folly::ByteRange  a,
folly::ByteRange  b 
)
static

Returns true if a and b are identical.

Constant time in terms of the contents of a and b (but not in terms of length).

Definition at line 31 of file Utils.cpp.

References folly::Range< Iter >::data(), and folly::Range< Iter >::size().

Referenced by fizz::sm::generateTicket(), fizz::sm::handleCertMsg(), and fizz::sm::setupSchedulerAndContext().

31  {
32  if (a.size() != b.size()) {
33  return false;
34  }
35  return sodium_memcmp(a.data(), b.data(), a.size()) == 0;
36 }
constexpr size_type size() const
Definition: Range.h:431
constexpr Iter data() const
Definition: Range.h:446
void fizz::CryptoUtils::init ( )
static

Initialize all required crypto libraries.

Definition at line 42 of file Utils.cpp.

Referenced by main().

42  {
43  static InitFizz initFizz;
44 }

The documentation for this struct was generated from the following files: