Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Side by Side Diff: crypto/nss_util_internal.h

Issue 2095523002: Make //crypto factories return std::unique_ptr<>s (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: I'm blind Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « crypto/nss_util.cc ('k') | crypto/secure_hash.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef CRYPTO_NSS_UTIL_INTERNAL_H_ 5 #ifndef CRYPTO_NSS_UTIL_INTERNAL_H_
6 #define CRYPTO_NSS_UTIL_INTERNAL_H_ 6 #define CRYPTO_NSS_UTIL_INTERNAL_H_
7 7
8 #include <secmodt.h> 8 #include <secmodt.h>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "crypto/crypto_export.h" 13 #include "crypto/crypto_export.h"
14 #include "crypto/scoped_nss_types.h" 14 #include "crypto/scoped_nss_types.h"
15 15
16 namespace base { 16 namespace base {
17 class FilePath; 17 class FilePath;
18 } 18 }
19 19
20 // These functions return a type defined in an NSS header, and so cannot be 20 // These functions return a type defined in an NSS header, and so cannot be
21 // declared in nss_util.h. Hence, they are declared here. 21 // declared in nss_util.h. Hence, they are declared here.
22 22
23 namespace crypto { 23 namespace crypto {
24 24
25 // Opens an NSS software database in folder |path|, with the (potentially) 25 // Opens an NSS software database in folder |path|, with the (potentially)
26 // user-visible description |description|. Returns the slot for the opened 26 // user-visible description |description|. Returns the slot for the opened
27 // database, or NULL if the database could not be opened. 27 // database, or nullptr if the database could not be opened.
28 CRYPTO_EXPORT ScopedPK11Slot OpenSoftwareNSSDB(const base::FilePath& path, 28 CRYPTO_EXPORT ScopedPK11Slot OpenSoftwareNSSDB(const base::FilePath& path,
29 const std::string& description); 29 const std::string& description);
30 30
31 #if !defined(OS_CHROMEOS) 31 #if !defined(OS_CHROMEOS)
32 // Returns a reference to the default NSS key slot for storing persistent data. 32 // Returns a reference to the default NSS key slot for storing persistent data.
33 // Caller must release returned reference with PK11_FreeSlot. 33 // Caller must release returned reference with PK11_FreeSlot.
34 CRYPTO_EXPORT PK11SlotInfo* GetPersistentNSSKeySlot() WARN_UNUSED_RESULT; 34 CRYPTO_EXPORT PK11SlotInfo* GetPersistentNSSKeySlot() WARN_UNUSED_RESULT;
35 #endif 35 #endif
36 36
37 // A helper class that acquires the SECMOD list read lock while the 37 // A helper class that acquires the SECMOD list read lock while the
(...skipping 12 matching lines...) Expand all
50 // Returns a reference to the system-wide TPM slot if it is loaded. If it is not 50 // Returns a reference to the system-wide TPM slot if it is loaded. If it is not
51 // loaded and |callback| is non-null, the |callback| will be run once the slot 51 // loaded and |callback| is non-null, the |callback| will be run once the slot
52 // is loaded. 52 // is loaded.
53 CRYPTO_EXPORT ScopedPK11Slot GetSystemNSSKeySlot( 53 CRYPTO_EXPORT ScopedPK11Slot GetSystemNSSKeySlot(
54 const base::Callback<void(ScopedPK11Slot)>& callback) WARN_UNUSED_RESULT; 54 const base::Callback<void(ScopedPK11Slot)>& callback) WARN_UNUSED_RESULT;
55 55
56 // Sets the test system slot to |slot|, which means that |slot| will be exposed 56 // Sets the test system slot to |slot|, which means that |slot| will be exposed
57 // through |GetSystemNSSKeySlot| and |IsTPMTokenReady| will return true. 57 // through |GetSystemNSSKeySlot| and |IsTPMTokenReady| will return true.
58 // |InitializeTPMTokenAndSystemSlot|, which triggers the TPM initialization, 58 // |InitializeTPMTokenAndSystemSlot|, which triggers the TPM initialization,
59 // does not have to be called if the test system slot is set. 59 // does not have to be called if the test system slot is set.
60 // This must must not be called consecutively with a |slot| != NULL. If |slot| 60 // This must must not be called consecutively with a |slot| != nullptr. If
61 // is NULL, the test system slot is unset. 61 // |slot| is nullptr, the test system slot is unset.
62 CRYPTO_EXPORT void SetSystemKeySlotForTesting(ScopedPK11Slot slot); 62 CRYPTO_EXPORT void SetSystemKeySlotForTesting(ScopedPK11Slot slot);
63 63
64 // Prepare per-user NSS slot mapping. It is safe to call this function multiple 64 // Prepare per-user NSS slot mapping. It is safe to call this function multiple
65 // times. Returns true if the user was added, or false if it already existed. 65 // times. Returns true if the user was added, or false if it already existed.
66 CRYPTO_EXPORT bool InitializeNSSForChromeOSUser( 66 CRYPTO_EXPORT bool InitializeNSSForChromeOSUser(
67 const std::string& username_hash, 67 const std::string& username_hash,
68 const base::FilePath& path); 68 const base::FilePath& path);
69 69
70 // Returns whether TPM for ChromeOS user still needs initialization. If 70 // Returns whether TPM for ChromeOS user still needs initialization. If
71 // true is returned, the caller can proceed to initialize TPM slot for the 71 // true is returned, the caller can proceed to initialize TPM slot for the
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 104
105 // Closes the NSS DB for |username_hash| that was previously opened by the 105 // Closes the NSS DB for |username_hash| that was previously opened by the
106 // *Initialize*ForChromeOSUser functions. 106 // *Initialize*ForChromeOSUser functions.
107 CRYPTO_EXPORT void CloseChromeOSUserForTesting( 107 CRYPTO_EXPORT void CloseChromeOSUserForTesting(
108 const std::string& username_hash); 108 const std::string& username_hash);
109 #endif // defined(OS_CHROMEOS) 109 #endif // defined(OS_CHROMEOS)
110 110
111 } // namespace crypto 111 } // namespace crypto
112 112
113 #endif // CRYPTO_NSS_UTIL_INTERNAL_H_ 113 #endif // CRYPTO_NSS_UTIL_INTERNAL_H_
OLDNEW
« no previous file with comments | « crypto/nss_util.cc ('k') | crypto/secure_hash.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698