Use vector to pass around keys
In the future the key size for new master keys will increase.
To maintain backwards compatibility the size of the key
can no longer be assumed. To help communicate the actual
size of the key, it will be passed around in a vector.
Bug: 121272336
Test: Ran Keystore CTS tests against Walleye
Change-Id: I4c05acb15b77959f2bf89abbdc325904fffb497a
diff --git a/keystore/blob.h b/keystore/blob.h
index 86f367f..8d68fc4 100644
--- a/keystore/blob.h
+++ b/keystore/blob.h
@@ -30,6 +30,7 @@
#include <mutex>
#include <set>
#include <sstream>
+#include <vector>
constexpr size_t kValueSize = 32768;
constexpr size_t kAesKeySize = 128 / 8;
@@ -153,7 +154,8 @@
private:
std::unique_ptr<blobv3> mBlob;
- ResponseCode readBlob(const std::string& filename, const uint8_t* aes_key, State state);
+ ResponseCode readBlob(const std::string& filename, const std::vector<uint8_t>& aes_key,
+ State state);
};
/**
@@ -261,9 +263,10 @@
std::function<bool(uid_t, const std::string&)> filter =
[](uid_t, const std::string&) -> bool { return true; });
- ResponseCode writeBlobs(Blob keyBlob, Blob characteristicsBlob, const uint8_t* aes_key,
- State state) const;
- std::tuple<ResponseCode, Blob, Blob> readBlobs(const uint8_t* aes_key, State state) const;
+ ResponseCode writeBlobs(Blob keyBlob, Blob characteristicsBlob,
+ const std::vector<uint8_t>& aes_key, State state) const;
+ std::tuple<ResponseCode, Blob, Blob> readBlobs(const std::vector<uint8_t>& aes_key,
+ State state) const;
ResponseCode deleteBlobs() const;
inline operator bool() const { return entry_ != nullptr; }