From 938bd7bbf0f617d44ed9659addca3a4879948551 Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Wed, 27 Jan 2021 20:43:40 +0100 Subject: fix: allocation of object' variable --- src/sha256.cc | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/sha256.cc b/src/sha256.cc index 7790f8a..7ef467e 100644 --- a/src/sha256.cc +++ b/src/sha256.cc @@ -8,6 +8,7 @@ hmacsha256::SHA256::SHA256(const uint8_t* data, uint32_t length) { } void hmacsha256::SHA256::init(const uint8_t* data, uint32_t length) { + digest_ = new uint8_t[32]; message_l_ = bit_len_ = 0; vars_[0] = 0x6a09e667; vars_[1] = 0xbb67ae85; @@ -29,6 +30,10 @@ void hmacsha256::SHA256::init(const uint8_t* data, uint32_t length) { } } +hmacsha256::SHA256::~SHA256() { + delete digest_; +} + hmacsha256::SHA256::SHA256(const std::string& data) { init(reinterpret_cast (data.c_str()), data.size()); } -- cgit v1.2.3-18-g5258