| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/extensions/install_signer.h" | 5 #include "chrome/browser/extensions/install_signer.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 #include "build/build_config.h" | 27 #include "build/build_config.h" |
| 28 #include "chrome/common/chrome_switches.h" | 28 #include "chrome/common/chrome_switches.h" |
| 29 #include "crypto/random.h" | 29 #include "crypto/random.h" |
| 30 #include "crypto/secure_hash.h" | 30 #include "crypto/secure_hash.h" |
| 31 #include "crypto/sha2.h" | 31 #include "crypto/sha2.h" |
| 32 #include "crypto/signature_verifier.h" | 32 #include "crypto/signature_verifier.h" |
| 33 #include "net/url_request/url_fetcher.h" | 33 #include "net/url_request/url_fetcher.h" |
| 34 #include "net/url_request/url_fetcher_delegate.h" | 34 #include "net/url_request/url_fetcher_delegate.h" |
| 35 #include "net/url_request/url_request_context_getter.h" | 35 #include "net/url_request/url_request_context_getter.h" |
| 36 #include "net/url_request/url_request_status.h" | 36 #include "net/url_request/url_request_status.h" |
| 37 #include "rlz/features/features.h" |
| 37 #include "url/gurl.h" | 38 #include "url/gurl.h" |
| 38 | 39 |
| 39 #if defined(ENABLE_RLZ) | 40 #if BUILDFLAG(ENABLE_RLZ) |
| 40 #include "rlz/lib/machine_id.h" | 41 #include "rlz/lib/machine_id.h" |
| 41 #endif | 42 #endif |
| 42 | 43 |
| 43 namespace { | 44 namespace { |
| 44 | 45 |
| 45 using extensions::ExtensionIdSet; | 46 using extensions::ExtensionIdSet; |
| 46 | 47 |
| 47 const char kExpireDateKey[] = "expire_date"; | 48 const char kExpireDateKey[] = "expire_date"; |
| 48 const char kExpiryKey[] = "expiry"; | 49 const char kExpiryKey[] = "expiry"; |
| 49 const char kHashKey[] = "hash"; | 50 const char kHashKey[] = "hash"; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 77 "-----END PUBLIC KEY-----"; | 78 "-----END PUBLIC KEY-----"; |
| 78 | 79 |
| 79 GURL GetBackendUrl() { | 80 GURL GetBackendUrl() { |
| 80 return GURL(kBackendUrl); | 81 return GURL(kBackendUrl); |
| 81 } | 82 } |
| 82 | 83 |
| 83 // Hashes |salt| with the machine id, base64-encodes it and returns it in | 84 // Hashes |salt| with the machine id, base64-encodes it and returns it in |
| 84 // |result|. | 85 // |result|. |
| 85 bool HashWithMachineId(const std::string& salt, std::string* result) { | 86 bool HashWithMachineId(const std::string& salt, std::string* result) { |
| 86 std::string machine_id; | 87 std::string machine_id; |
| 87 #if defined(ENABLE_RLZ) | 88 #if BUILDFLAG(ENABLE_RLZ) |
| 88 if (!rlz_lib::GetMachineId(&machine_id)) | 89 if (!rlz_lib::GetMachineId(&machine_id)) |
| 89 return false; | 90 return false; |
| 90 #else | 91 #else |
| 91 machine_id = "unknown"; | 92 machine_id = "unknown"; |
| 92 #endif | 93 #endif |
| 93 | 94 |
| 94 std::unique_ptr<crypto::SecureHash> hash( | 95 std::unique_ptr<crypto::SecureHash> hash( |
| 95 crypto::SecureHash::Create(crypto::SecureHash::SHA256)); | 96 crypto::SecureHash::Create(crypto::SecureHash::SHA256)); |
| 96 | 97 |
| 97 hash->Update(machine_id.data(), machine_id.size()); | 98 hash->Update(machine_id.data(), machine_id.size()); |
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 if (!verified) | 505 if (!verified) |
| 505 result.reset(); | 506 result.reset(); |
| 506 } | 507 } |
| 507 | 508 |
| 508 if (!callback_.is_null()) | 509 if (!callback_.is_null()) |
| 509 callback_.Run(std::move(result)); | 510 callback_.Run(std::move(result)); |
| 510 } | 511 } |
| 511 | 512 |
| 512 | 513 |
| 513 } // namespace extensions | 514 } // namespace extensions |
| OLD | NEW |