Revert "Switch gatekeeper to std::unique_ptr."
Gatekeeper is used in Trusty, which does not support the C++ standard library, so std::unique_ptr is not available.
This reverts commit 3b6f0be3850fcf92e6a9097f2042624c7dd80891.
Change-Id: Ibe287efc4c68cf3f94abfa7b07dd16bf796ef429
diff --git a/gatekeeper.cpp b/gatekeeper.cpp
index 9724ed7..cfd878f 100644
--- a/gatekeeper.cpp
+++ b/gatekeeper.cpp
@@ -13,12 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+#include <UniquePtr.h>
#include <gatekeeper/gatekeeper.h>
#include <endian.h>
-#include <memory>
-
#define DAY_IN_MS (1000 * 60 * 60 * 24)
namespace gatekeeper {
@@ -148,7 +147,7 @@
if (DoVerify(password_handle, request.provided_password)) {
// Signature matches
- std::unique_ptr<uint8_t> auth_token_buffer;
+ UniquePtr<uint8_t> auth_token_buffer;
uint32_t auth_token_len;
MintAuthToken(&auth_token_buffer, &auth_token_len, timestamp,
user_id, authenticator_id, request.challenge);
@@ -183,7 +182,7 @@
uint32_t metadata_length = sizeof(user_id) + sizeof(flags) + sizeof(HANDLE_VERSION);
const size_t to_sign_size = password_length + metadata_length;
- std::unique_ptr<uint8_t> to_sign(new uint8_t[to_sign_size]);
+ UniquePtr<uint8_t> to_sign(new uint8_t[to_sign_size]);
if (to_sign.get() == nullptr) {
return false;
@@ -221,7 +220,7 @@
sizeof(expected_handle->signature)) == 0;
}
-void GateKeeper::MintAuthToken(std::unique_ptr<uint8_t> *auth_token, uint32_t *length,
+void GateKeeper::MintAuthToken(UniquePtr<uint8_t> *auth_token, uint32_t *length,
uint64_t timestamp, secure_id_t user_id, secure_id_t authenticator_id,
uint64_t challenge) {
if (auth_token == NULL) return;