diff options
author | Michael Ryleev <gmar@google.com> | 2018-12-04 13:57:49 -0800 |
---|---|---|
committer | Michael Ryleev <gmar@google.com> | 2018-12-04 13:57:49 -0800 |
commit | 64793e21bb9cc5d426e95262db837e0c6ea33d87 (patch) | |
tree | d37b8d8ff12515d2fff63b102deee811640a6329 | |
parent | cb846c8d8723f9501265f674ed55e22b7bbba207 (diff) | |
download | gatekeeper-64793e21bb9cc5d426e95262db837e0c6ea33d87.tar.gz |
Clean up gatekeeper app in preparation for 64-bit apps
Bug: 120497636
Change-Id: Ica85723262d2bfa94a35b2dc90a589eeb71f19f4
-rw-r--r-- | trusty_gatekeeper.cpp | 20 | ||||
-rw-r--r-- | trusty_gatekeeper.h | 18 |
2 files changed, 19 insertions, 19 deletions
diff --git a/trusty_gatekeeper.cpp b/trusty_gatekeeper.cpp index 3e6e9a8..9b5ef55 100644 --- a/trusty_gatekeeper.cpp +++ b/trusty_gatekeeper.cpp @@ -114,7 +114,7 @@ void TrustyGateKeeper::ClearMasterKey() { } bool TrustyGateKeeper::GetAuthTokenKey(const uint8_t** auth_token_key, - size_t* length) const { + uint32_t* length) const { *length = 0; *auth_token_key = NULL; @@ -141,17 +141,17 @@ bool TrustyGateKeeper::GetAuthTokenKey(const uint8_t** auth_token_key, } void TrustyGateKeeper::GetPasswordKey(const uint8_t** password_key, - size_t* length) { + uint32_t* length) { *password_key = const_cast<const uint8_t*>(master_key_.get()); *length = HMAC_SHA_256_KEY_SIZE; } void TrustyGateKeeper::ComputePasswordSignature(uint8_t* signature, - size_t signature_length, + uint32_t signature_length, const uint8_t* key, - size_t key_length, + uint32_t key_length, const uint8_t* password, - size_t password_length, + uint32_t password_length, salt_t salt) const { // todo: heap allocate uint8_t salted_password[password_length + sizeof(salt)]; @@ -161,20 +161,20 @@ void TrustyGateKeeper::ComputePasswordSignature(uint8_t* signature, salted_password, password_length + sizeof(salt)); } -void TrustyGateKeeper::GetRandom(void* random, size_t requested_size) const { +void TrustyGateKeeper::GetRandom(void* random, uint32_t requested_size) const { if (random == NULL) return; trusty_rng_secure_rand(reinterpret_cast<uint8_t*>(random), requested_size); } void TrustyGateKeeper::ComputeSignature(uint8_t* signature, - size_t signature_length, + uint32_t signature_length, const uint8_t* key, - size_t key_length, + uint32_t key_length, const uint8_t* message, - const size_t length) const { + const uint32_t length) const { uint8_t buf[HMAC_SHA_256_KEY_SIZE]; - size_t buf_len; + unsigned int buf_len; HMAC(EVP_sha256(), key, key_length, message, length, buf, &buf_len); size_t to_write = buf_len; diff --git a/trusty_gatekeeper.h b/trusty_gatekeeper.h index 3a52e37..5d45f50 100644 --- a/trusty_gatekeeper.h +++ b/trusty_gatekeeper.h @@ -37,25 +37,25 @@ protected: // See gatekeeper/gatekeeper.h for documentation virtual bool GetAuthTokenKey(const uint8_t** auth_token_key, - size_t* length) const; + uint32_t* length) const; - virtual void GetPasswordKey(const uint8_t** password_key, size_t* length); + virtual void GetPasswordKey(const uint8_t** password_key, uint32_t* length); virtual void ComputePasswordSignature(uint8_t* signature, - size_t signature_length, + uint32_t signature_length, const uint8_t* key, - size_t key_length, + uint32_t key_length, const uint8_t* password, - size_t password_length, + uint32_t password_length, salt_t salt) const; - virtual void GetRandom(void* random, size_t requested_size) const; + virtual void GetRandom(void* random, uint32_t requested_size) const; virtual void ComputeSignature(uint8_t* signature, - size_t signature_length, + uint32_t signature_length, const uint8_t* key, - size_t key_length, + uint32_t key_length, const uint8_t* message, - const size_t length) const; + const uint32_t length) const; virtual uint64_t GetMillisecondsSinceBoot() const; virtual bool GetFailureRecord(uint32_t uid, |