-
Notifications
You must be signed in to change notification settings - Fork 112
/
windows-disable-encryption.patch
68 lines (62 loc) · 2.73 KB
/
windows-disable-encryption.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# Disable encryption of cookies, passwords, settings...
# WARNING! Use ONLY if your hard drive is encrypted or if you know what you are doing.
# See https://github.com/Eloston/ungoogled-chromium/issues/444
--- a/chrome/browser/ungoogled_platform_flag_entries.h
+++ b/chrome/browser/ungoogled_platform_flag_entries.h
@@ -4,4 +4,8 @@
#ifndef CHROME_BROWSER_UNGOOGLED_PLATFORM_FLAG_ENTRIES_H_
#define CHROME_BROWSER_UNGOOGLED_PLATFORM_FLAG_ENTRIES_H_
+ {"disable-encryption",
+ "Disable encryption",
+ "Disable encryption of cookies, passwords, and settings which uses a generated machine-specific encryption key. This is used to enable portable user data directories. ungoogled-chromium flag.",
+ kOsWin, SINGLE_VALUE_TYPE("disable-encryption")},
#endif // CHROME_BROWSER_UNGOOGLED_PLATFORM_FLAG_ENTRIES_H_
--- a/components/os_crypt/async/browser/dpapi_key_provider.cc
+++ b/components/os_crypt/async/browser/dpapi_key_provider.cc
@@ -14,6 +14,7 @@
#include <wincrypt.h>
#include "base/base64.h"
+#include "base/command_line.h"
#include "base/logging.h"
#include "base/metrics/histogram_functions.h"
#include "base/types/expected.h"
@@ -40,6 +41,9 @@ constexpr uint8_t kDPAPIKeyPrefix[] = {'
std::optional<std::vector<uint8_t>> DecryptKeyWithDPAPI(
base::span<const uint8_t> ciphertext) {
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch("disable-encryption")) {
+ return std::vector<uint8_t>(ciphertext.begin(), ciphertext.end());
+ }
DATA_BLOB input = {};
input.pbData = const_cast<BYTE*>(ciphertext.data());
input.cbData = static_cast<DWORD>(ciphertext.size());
--- a/components/os_crypt/sync/os_crypt_win.cc
+++ b/components/os_crypt/sync/os_crypt_win.cc
@@ -9,6 +9,7 @@
#include "base/base64.h"
#include "base/check.h"
#include "base/check_op.h"
+#include "base/command_line.h"
#include "base/containers/span.h"
#include "base/feature_list.h"
#include "base/logging.h"
@@ -49,6 +50,10 @@ constexpr char kDPAPIKeyPrefix[] = "DPAP
bool EncryptStringWithDPAPI(const std::string& plaintext,
std::string* ciphertext) {
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch("disable-encryption")) {
+ *ciphertext = plaintext;
+ return true;
+ }
DATA_BLOB input;
input.pbData =
const_cast<BYTE*>(reinterpret_cast<const BYTE*>(plaintext.data()));
@@ -83,6 +88,11 @@ bool EncryptStringWithDPAPI(const std::s
bool DecryptStringWithDPAPI(const std::string& ciphertext,
std::string* plaintext) {
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch("disable-encryption")) {
+ *plaintext = ciphertext;
+ return true;
+ }
+
DATA_BLOB input;
input.pbData =
const_cast<BYTE*>(reinterpret_cast<const BYTE*>(ciphertext.data()));