tor-browser

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

CipherStrategy.h (1426B)


      1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
      3 /* This Source Code Form is subject to the terms of the Mozilla Public
      4 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
      5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
      6 
      7 #ifndef mozilla_dom_quota_CipherStrategy_h
      8 #define mozilla_dom_quota_CipherStrategy_h
      9 
     10 namespace mozilla::dom::quota {
     11 
     12 enum class CipherMode { Encrypt, Decrypt };
     13 
     14 // An implementation of the CipherStrategy concept must provide the following
     15 // data members:
     16 //
     17 //   static constexpr size_t BlockPrefixLength;
     18 //   static constexpr size_t BasicBlockSize;
     19 //
     20 // It must provide the following member types:
     21 //
     22 //   KeyType
     23 //   BlockPrefixType, which must be an InputRange of type uint8_t and a
     24 //                    SizedRange of size BlockPrefixLength
     25 //
     26 // It must provide the following member functions with compatible signatures:
     27 //
     28 //   static Result<KeyType, nsresult> GenerateKey();
     29 //
     30 //   nsresult Cipher(const CipherMode aMode, const KeyType& aKey,
     31 //                   Span<uint8_t> aIv, Span<const uint8_t> aIn,
     32 //                   Span<uint8_t> aOut);
     33 //
     34 //   BlockPrefixType MakeBlockPrefix();
     35 //
     36 //   Span<const uint8_t> SerializeKey(const KeyType& aKey);
     37 //
     38 //   Maybe<KeyType> DeserializeKey(const Span<const uint8_t>& aSerializedKey);
     39 
     40 }  // namespace mozilla::dom::quota
     41 
     42 #endif