OLD | NEW |
1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium OS 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 "login_manager/owner_key.h" | 5 #include "login_manager/owner_key.h" |
6 | 6 |
7 #include <base/crypto/rsa_private_key.h> | 7 #include <base/crypto/rsa_private_key.h> |
8 #include <base/file_path.h> | 8 #include <base/file_path.h> |
9 #include <base/file_util.h> | 9 #include <base/file_util.h> |
10 #include <base/logging.h> | 10 #include <base/logging.h> |
11 #include <base/scoped_ptr.h> | 11 #include <base/scoped_ptr.h> |
12 | 12 |
| 13 #include "login_manager/child_job.h" |
13 #include "login_manager/nss_util.h" | 14 #include "login_manager/nss_util.h" |
14 #include "login_manager/system_utils.h" | 15 #include "login_manager/system_utils.h" |
15 | 16 |
16 namespace login_manager { | 17 namespace login_manager { |
17 | 18 |
18 // Note: this structure is an ASN.1 which encodes the algorithm used | 19 // Note: this structure is an ASN.1 which encodes the algorithm used |
19 // with its parameters. This is defined in PKCS #1 v2.1 (RFC 3447). | 20 // with its parameters. This is defined in PKCS #1 v2.1 (RFC 3447). |
20 // It is encoding: { OID sha1WithRSAEncryption PARAMETERS NULL } | 21 // It is encoding: { OID sha1WithRSAEncryption PARAMETERS NULL } |
21 // static | 22 // static |
22 const uint8 OwnerKey::kAlgorithm[15] = { | 23 const uint8 OwnerKey::kAlgorithm[15] = { |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 if (!util->Sign(reinterpret_cast<const uint8*>(data), | 133 if (!util->Sign(reinterpret_cast<const uint8*>(data), |
133 data_len, | 134 data_len, |
134 OUT_signature, | 135 OUT_signature, |
135 private_key.get())) { | 136 private_key.get())) { |
136 LOG(ERROR) << "Signing of " << data << " failed"; | 137 LOG(ERROR) << "Signing of " << data << " failed"; |
137 return false; | 138 return false; |
138 } | 139 } |
139 return true; | 140 return true; |
140 } | 141 } |
141 | 142 |
| 143 |
| 144 int OwnerKey::StartGeneration(ChildJobInterface* generator) { |
| 145 int pid = fork(); |
| 146 if (pid == 0) { |
| 147 generator->Run(); |
| 148 exit(1); // Run() is not supposed to return. |
| 149 } |
| 150 return pid; |
| 151 } |
| 152 |
142 } // namespace login_manager | 153 } // namespace login_manager |
OLD | NEW |