Bug 1874684 - Part 6: Limit day length calculations to safe integers. r=mgaudet
[gecko.git] / dom / quota / CipherStrategy.h
blob0a5edd3ae47bd4b9cc5cfea3b7677cf255590186
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/. */
7 #ifndef mozilla_dom_quota_CipherStrategy_h
8 #define mozilla_dom_quota_CipherStrategy_h
10 namespace mozilla::dom::quota {
12 enum class CipherMode { Encrypt, Decrypt };
14 // An implementation of the CipherStrategy concept must provide the following
15 // data members:
17 // static constexpr size_t BlockPrefixLength;
18 // static constexpr size_t BasicBlockSize;
20 // It must provide the following member types:
22 // KeyType
23 // BlockPrefixType, which must be an InputRange of type uint8_t and a
24 // SizedRange of size BlockPrefixLength
26 // It must provide the following member functions with compatible signatures:
28 // static Result<KeyType, nsresult> GenerateKey();
30 // nsresult Cipher(const CipherMode aMode, const KeyType& aKey,
31 // Span<uint8_t> aIv, Span<const uint8_t> aIn,
32 // Span<uint8_t> aOut);
34 // BlockPrefixType MakeBlockPrefix();
36 // Span<const uint8_t> SerializeKey(const KeyType& aKey);
38 // Maybe<KeyType> DeserializeKey(const Span<const uint8_t>& aSerializedKey);
40 } // namespace mozilla::dom::quota
42 #endif