ECIES: fix memory leaks and add malloc checks in HKDF. Use fixed-timing
memcmp in HmacOperation.
Change-Id: Ia059730ae31976a684f957c6dcc8c975c06f05a5
diff --git a/hmac.h b/hmac.h
index 09ae5e8..ebd5b70 100644
--- a/hmac.h
+++ b/hmac.h
@@ -21,11 +21,10 @@
namespace keymaster {
-
// Only HMAC-SHA256 is supported.
class HmacSha256 {
public:
- HmacSha256() {};
+ HmacSha256(){};
// DigestLength returns the length, in bytes, of the resulting digest.
size_t DigestLength() const;
@@ -52,7 +51,8 @@
size_t digest_len) const;
private:
- Buffer key_;
+ UniquePtr<uint8_t[]> key_;
+ size_t key_len_;
};
} // namespace keymaster