| Index: secure_blob.cc
|
| diff --git a/secure_blob.cc b/secure_blob.cc
|
| index 4f30d1f6b4fb958584ebed303f9ff8da411e6c1c..cb9d3d6a48f97ba86b359f400d71ef8fce1b6dd8 100644
|
| --- a/secure_blob.cc
|
| +++ b/secure_blob.cc
|
| @@ -2,7 +2,7 @@
|
| // 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"
|
| +#include "secure_blob.h"
|
|
|
| namespace cryptohome {
|
|
|
| @@ -19,22 +19,40 @@ SecureBlob::SecureBlob(int size)
|
| : chromeos::Blob(size) {
|
| }
|
|
|
| +SecureBlob::SecureBlob(const unsigned char* from, int from_length)
|
| + : chromeos::Blob(from_length) {
|
| + memcpy(data(), from, from_length);
|
| +}
|
| +
|
| +SecureBlob::SecureBlob(const char* from, int from_length)
|
| + : chromeos::Blob(from_length) {
|
| + memcpy(data(), from, from_length);
|
| +}
|
| +
|
| SecureBlob::~SecureBlob() {
|
| - chromeos::SecureMemset(&this->front(), this->capacity(), 0);
|
| + chromeos::SecureMemset(&this->front(), 0, this->capacity());
|
| }
|
|
|
| void SecureBlob::resize(size_type sz) {
|
| if(sz < size()) {
|
| - chromeos::SecureMemset(&this->at(sz), size() - sz, 0);
|
| + chromeos::SecureMemset(&this->at(sz), 0, size() - sz);
|
| }
|
| 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::SecureMemset(&this->at(sz), 0, size() - sz);
|
| }
|
| chromeos::Blob::resize(sz, x);
|
| }
|
|
|
| -} // cryptohome
|
| +void* SecureBlob::data() {
|
| + return &(this->front());
|
| +}
|
| +
|
| +const void* SecureBlob::const_data() const {
|
| + return &(this->front());
|
| +}
|
| +
|
| +} // namespace cryptohome
|
|
|