chaps: fixup Linux build for new SecureBlob API
Commit 89f59bbe5df changed the interface for the SecureBlob class
and updated most of the Chaps code, but some of the Linux-specific
code was missed.
BUG=None
TEST=Chaps unit tests
Change-Id: Ib52743408caabc8a4e7c8dcf153073d22b286095
Reviewed-on: https://chromium-review.googlesource.com/263712
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Tested-by: David Drysdale <drysdale@google.com>
Trybot-Ready: David Drysdale <drysdale@google.com>
Commit-Queue: Darren Krahn <dkrahn@chromium.org>
diff --git a/chaps/pam_helper.cc b/chaps/pam_helper.cc
index 0c27a78..11d86d8 100644
--- a/chaps/pam_helper.cc
+++ b/chaps/pam_helper.cc
@@ -82,7 +82,8 @@
return false;
}
- SecureBlob tmp(data_raw, strlen(data_raw));
+ string data_string(data_raw, strlen(data_raw));
+ SecureBlob tmp(data_string);
data->swap(tmp);
// Note: data_raw is the actual data, so should not be overwritten or freed.
diff --git a/chaps/token_file_manager_linux.cc b/chaps/token_file_manager_linux.cc
index 0e9f8bc..00ba1c9 100644
--- a/chaps/token_file_manager_linux.cc
+++ b/chaps/token_file_manager_linux.cc
@@ -143,14 +143,14 @@
}
SecureBlob out_key(kSaltedKeyBytes);
- if (1 != PKCS5_PBKDF2_HMAC(static_cast<const char *>(auth_data.data()),
+ if (1 != PKCS5_PBKDF2_HMAC(auth_data.char_data(),
auth_data.size(),
salt.data(),
kSaltBytes,
kSaltIterations,
EVP_sha512(),
kSaltedKeyBytes,
- out_key.data()) {
+ out_key.data())) {
LOG(ERROR) << "Could not salt authorization data.";
return false;
}