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

Side by Side Diff: crypto/nss_util_internal.h

Issue 53763003: Initialize per-ChromeOS-user NSS slots and provide the functions to access them. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync to r235279 Created 7 years, 1 month 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 | Annotate | Revision Log
« crypto/nss_util.cc ('K') | « crypto/nss_util.cc ('k') | no next file » | 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 "crypto/crypto_export.h" 11 #include "crypto/crypto_export.h"
12 #include "crypto/scoped_nss_types.h"
13
14 namespace base {
15 class FilePath;
16 }
11 17
12 // These functions return a type defined in an NSS header, and so cannot be 18 // These functions return a type defined in an NSS header, and so cannot be
13 // declared in nss_util.h. Hence, they are declared here. 19 // declared in nss_util.h. Hence, they are declared here.
14 20
15 namespace crypto { 21 namespace crypto {
16 22
17 // Returns a reference to the default NSS key slot for storing 23 // Returns a reference to the default NSS key slot for storing
18 // public-key data only (e.g. server certs). Caller must release 24 // public-key data only (e.g. server certs). Caller must release
19 // returned reference with PK11_FreeSlot. 25 // returned reference with PK11_FreeSlot.
20 CRYPTO_EXPORT PK11SlotInfo* GetPublicNSSKeySlot(); 26 CRYPTO_EXPORT PK11SlotInfo* GetPublicNSSKeySlot();
(...skipping 10 matching lines...) Expand all
31 class AutoSECMODListReadLock { 37 class AutoSECMODListReadLock {
32 public: 38 public:
33 AutoSECMODListReadLock(); 39 AutoSECMODListReadLock();
34 ~AutoSECMODListReadLock(); 40 ~AutoSECMODListReadLock();
35 41
36 private: 42 private:
37 SECMODListLock* lock_; 43 SECMODListLock* lock_;
38 DISALLOW_COPY_AND_ASSIGN(AutoSECMODListReadLock); 44 DISALLOW_COPY_AND_ASSIGN(AutoSECMODListReadLock);
39 }; 45 };
40 46
47 #if defined(OS_CHROMEOS)
48 // Prepare per-user NSS slot mapping. It is safe to call this function multiple
49 // times. Returns true if the user was added, or false if it already existed.
50 CRYPTO_EXPORT bool InitializeNSSForChromeOSUser(
51 const std::string& email,
52 const std::string& username_hash,
53 bool is_primary_user,
54 const base::FilePath& path);
55
56 // Use TPM slot |slot_id| for user. InitializeNSSForChromeOSUser must have been
57 // called first.
58 CRYPTO_EXPORT void InitializeTPMForChromeOSUser(
59 const std::string& username_hash,
60 CK_SLOT_ID slot_id);
61
62 // Use the software slot as the private slot for user.
63 // InitializeNSSForChromeOSUser must have been called first.
64 CRYPTO_EXPORT void InitializePrivateSoftwareSlotForChromeOSUser(
65 const std::string& username_hash);
66
67 // Returns a reference to the public slot for user.
68 CRYPTO_EXPORT ScopedPK11Slot
69 GetPublicSlotForChromeOSUser(const std::string& username_hash);
70
71 // Runs |callback| with the private slot handle when the private slot is loaded
72 // for the given user. If the slot is already loaded, the |callback| will be
73 // run synchronously.
74 CRYPTO_EXPORT void OnPrivateSlotReadyForChromeOSUser(
75 const std::string& username_hash,
76 const base::Callback<void(ScopedPK11Slot)>& callback);
77 #endif // defined(OS_CHROMEOS)
78
41 } // namespace crypto 79 } // namespace crypto
42 80
43 #endif // CRYPTO_NSS_UTIL_INTERNAL_H_ 81 #endif // CRYPTO_NSS_UTIL_INTERNAL_H_
OLDNEW
« crypto/nss_util.cc ('K') | « crypto/nss_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698