OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2009-2010 The Chromium OS Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "cryptohome/secure_blob.h" |
| 6 |
| 7 namespace cryptohome { |
| 8 |
| 9 SecureBlob::SecureBlob() |
| 10 : chromeos::Blob() { |
| 11 } |
| 12 |
| 13 SecureBlob::SecureBlob(chromeos::Blob::const_iterator begin, |
| 14 chromeos::Blob::const_iterator end) |
| 15 : chromeos::Blob(begin, end) { |
| 16 } |
| 17 |
| 18 SecureBlob::SecureBlob(int size) |
| 19 : chromeos::Blob(size) { |
| 20 } |
| 21 |
| 22 SecureBlob::~SecureBlob() { |
| 23 chromeos::SecureMemset(&this->front(), this->capacity(), 0); |
| 24 } |
| 25 |
| 26 void SecureBlob::resize(size_type sz) { |
| 27 if(sz < size()) { |
| 28 chromeos::SecureMemset(&this->at(sz), size() - sz, 0); |
| 29 } |
| 30 chromeos::Blob::resize(sz); |
| 31 } |
| 32 |
| 33 void SecureBlob::resize(size_type sz, const SecureBlobElement& x) { |
| 34 if(sz < size()) { |
| 35 chromeos::SecureMemset(&this->at(sz), size() - sz, 0); |
| 36 } |
| 37 chromeos::Blob::resize(sz, x); |
| 38 } |
| 39 |
| 40 } // cryptohome |
OLD | NEW |