Bug 1908539 restrict MacOS platform audio processing to Nightly r=webrtc-reviewers...
[gecko.git] / dom / quota / DummyCipherStrategy.h
blob99f60a5c6edb05efeeaeb7acf647f389e44e4843
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_DummyCipherStrategy_h
8 #define mozilla_dom_quota_DummyCipherStrategy_h
10 #include <algorithm>
11 #include <array>
12 #include <cstddef>
13 #include <cstdint>
14 #include <utility>
15 #include "ErrorList.h"
16 #include "mozilla/Result.h"
17 #include "mozilla/Span.h"
18 #include "mozilla/dom/quota/CipherStrategy.h"
20 namespace mozilla::dom::quota {
22 struct DummyCipherStrategy {
23 struct KeyType {};
25 static constexpr size_t BlockPrefixLength = 8;
26 static constexpr size_t BasicBlockSize = 4;
28 static void DummyTransform(Span<const uint8_t> aIn, Span<uint8_t> aOut) {
29 std::transform(aIn.cbegin(), aIn.cend(), aOut.begin(),
30 [](const uint8_t byte) { return byte ^ 42; });
33 static Result<KeyType, nsresult> GenerateKey() { return KeyType{}; }
35 nsresult Init(CipherMode aCipherMode, Span<const uint8_t> aKey,
36 Span<const uint8_t> aInitialIv = Span<const uint8_t>{}) {
37 return NS_OK;
40 nsresult Cipher(Span<uint8_t> aIv, Span<const uint8_t> aIn,
41 Span<uint8_t> aOut) {
42 DummyTransform(aIn, aOut);
43 return NS_OK;
46 static std::array<uint8_t, BlockPrefixLength> MakeBlockPrefix() {
47 return {{42, 43, 44, 45}};
50 static Span<const uint8_t> SerializeKey(const KeyType&) { return {}; }
52 static Maybe<KeyType> DeserializeKey(const Span<const uint8_t>&) {
53 return Some(KeyType{});
56 } // namespace mozilla::dom::quota
58 #endif