OLD | NEW |
---|---|
1 // Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium OS Authors. All rights reserved. |
Greg Spencer (Chromium)
2011/04/08 20:21:45
Update copyright
kmixter1
2011/04/08 21:04:14
Done.
| |
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 "service.h" | 5 #include "service.h" |
6 | 6 |
7 #include <stdio.h> | 7 #include <stdio.h> |
8 #include <stdlib.h> | 8 #include <stdlib.h> |
9 | 9 |
10 #include <base/file_util.h> | 10 #include <base/file_util.h> |
11 #include <base/logging.h> | 11 #include <base/logging.h> |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
74 }; | 74 }; |
75 | 75 |
76 Service::Service() | 76 Service::Service() |
77 : loop_(NULL), | 77 : loop_(NULL), |
78 cryptohome_(NULL), | 78 cryptohome_(NULL), |
79 system_salt_(), | 79 system_salt_(), |
80 default_mount_(new cryptohome::Mount()), | 80 default_mount_(new cryptohome::Mount()), |
81 mount_(default_mount_.get()), | 81 mount_(default_mount_.get()), |
82 default_tpm_init_(new TpmInit()), | 82 default_tpm_init_(new TpmInit()), |
83 tpm_init_(default_tpm_init_.get()), | 83 tpm_init_(default_tpm_init_.get()), |
84 default_pkcs11_init_(new Pkcs11Init()), | |
85 pkcs11_init_(default_pkcs11_init_.get()), | |
84 initialize_tpm_(true), | 86 initialize_tpm_(true), |
85 mount_thread_(kMountThreadName), | 87 mount_thread_(kMountThreadName), |
86 async_complete_signal_(-1), | 88 async_complete_signal_(-1), |
87 tpm_init_signal_(-1), | 89 tpm_init_signal_(-1), |
88 event_source_(), | 90 event_source_(), |
89 auto_cleanup_period_(kAutoCleanupPeriodMS) { | 91 auto_cleanup_period_(kAutoCleanupPeriodMS) { |
90 } | 92 } |
91 | 93 |
92 Service::~Service() { | 94 Service::~Service() { |
93 if (loop_) | 95 if (loop_) |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
560 tpm_init_->StartInitializeTpm(); | 562 tpm_init_->StartInitializeTpm(); |
561 } | 563 } |
562 return TRUE; | 564 return TRUE; |
563 } | 565 } |
564 | 566 |
565 gboolean Service::TpmClearStoredPassword(GError** error) { | 567 gboolean Service::TpmClearStoredPassword(GError** error) { |
566 tpm_init_->ClearStoredTpmPassword(); | 568 tpm_init_->ClearStoredTpmPassword(); |
567 return TRUE; | 569 return TRUE; |
568 } | 570 } |
569 | 571 |
572 gboolean Service::Pkcs11IsReady(gboolean* OUT_ready, GError** error) { | |
573 // TODO(kmixter/gauravsh): Base this on PKCS#11 really being initialized. | |
574 *OUT_ready = TRUE; | |
575 return TRUE; | |
576 } | |
577 | |
578 gboolean Service::Pkcs11GetTpmTokenInfo(gchar** OUT_label, | |
579 gchar** OUT_so_pin, | |
kmixter1
2011/04/08 21:04:14
I'm now removing the SO pin from sending after dis
| |
580 gchar** OUT_user_pin, | |
581 GError** error) { | |
582 pkcs11_init_->GetTpmTokenInfo(OUT_label, | |
583 OUT_so_pin, | |
584 OUT_user_pin); | |
585 return TRUE; | |
586 } | |
587 | |
570 gboolean Service::GetStatusString(gchar** OUT_status, GError** error) { | 588 gboolean Service::GetStatusString(gchar** OUT_status, GError** error) { |
571 Tpm::TpmStatusInfo tpm_status; | 589 Tpm::TpmStatusInfo tpm_status; |
572 mount_->get_crypto()->EnsureTpm(false); | 590 mount_->get_crypto()->EnsureTpm(false); |
573 Tpm* tpm = const_cast<Tpm*>(mount_->get_crypto()->get_tpm()); | 591 Tpm* tpm = const_cast<Tpm*>(mount_->get_crypto()->get_tpm()); |
574 | 592 |
575 if (tpm) { | 593 if (tpm) { |
576 tpm->GetStatus(true, &tpm_status); | 594 tpm->GetStatus(true, &tpm_status); |
577 } else { | 595 } else { |
578 Tpm::GetSingleton()->GetStatus(true, &tpm_status); | 596 Tpm::GetSingleton()->GetStatus(true, &tpm_status); |
579 } | 597 } |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
672 FROM_HERE, NewRunnableMethod(this, &Service::AutoCleanupCallback), | 690 FROM_HERE, NewRunnableMethod(this, &Service::AutoCleanupCallback), |
673 auto_cleanup_period_); | 691 auto_cleanup_period_); |
674 } | 692 } |
675 | 693 |
676 } // namespace cryptohome | 694 } // namespace cryptohome |
677 | 695 |
678 // We do not want AutoCleanupCallback() to refer the class and make it | 696 // We do not want AutoCleanupCallback() to refer the class and make it |
679 // wait for its execution. If Mount thread terminates, it will delete | 697 // wait for its execution. If Mount thread terminates, it will delete |
680 // our pending task or wait for it to finish. | 698 // our pending task or wait for it to finish. |
681 DISABLE_RUNNABLE_METHOD_REFCOUNT(cryptohome::Service); | 699 DISABLE_RUNNABLE_METHOD_REFCOUNT(cryptohome::Service); |
OLD | NEW |