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

Unified Diff: src/platform/cryptohome/secure_blob.cc

Issue 2051003: Initial patch from Will. (Closed) Base URL: ssh://git@chromiumos-git/chromiumos
Patch Set: Address style nits. Created 10 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: src/platform/cryptohome/secure_blob.cc
diff --git a/src/platform/cryptohome/secure_blob.cc b/src/platform/cryptohome/secure_blob.cc
new file mode 100644
index 0000000000000000000000000000000000000000..4f30d1f6b4fb958584ebed303f9ff8da411e6c1c
--- /dev/null
+++ b/src/platform/cryptohome/secure_blob.cc
@@ -0,0 +1,40 @@
+// Copyright (c) 2009-2010 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "cryptohome/secure_blob.h"
+
+namespace cryptohome {
+
+SecureBlob::SecureBlob()
+ : chromeos::Blob() {
+}
+
+SecureBlob::SecureBlob(chromeos::Blob::const_iterator begin,
+ chromeos::Blob::const_iterator end)
+ : chromeos::Blob(begin, end) {
+}
+
+SecureBlob::SecureBlob(int size)
+ : chromeos::Blob(size) {
+}
+
+SecureBlob::~SecureBlob() {
+ chromeos::SecureMemset(&this->front(), this->capacity(), 0);
+}
+
+void SecureBlob::resize(size_type sz) {
+ if(sz < size()) {
+ chromeos::SecureMemset(&this->at(sz), size() - sz, 0);
+ }
+ chromeos::Blob::resize(sz);
+}
+
+void SecureBlob::resize(size_type sz, const SecureBlobElement& x) {
+ if(sz < size()) {
+ chromeos::SecureMemset(&this->at(sz), size() - sz, 0);
+ }
+ chromeos::Blob::resize(sz, x);
+}
+
+} // cryptohome

Powered by Google App Engine
This is Rietveld 408576698