Unverified Commit c4e2b3b5 authored by Oleh Nikolaiev's avatar Oleh Nikolaiev Committed by GitHub

Merge pull request #262 from skalenetwork/bug/SKALE-3661-fix-hashing

Bug/skale 3661 fix hashing
parents 734b1572 abe43b81
......@@ -345,7 +345,13 @@ int hash_key(char* key, char* hashed_key) {
return ret;
}
ret = sgx_sha256_msg((uint8_t*)key, ECDSA_SKEY_LEN - 1, (uint8_t*)hashed_key);
uint8_t key_to_hash[33];
uint64_t len;
if (!hex2carray(key, &len, key_to_hash)) {
return ret;
}
ret = sgx_sha256_msg(key_to_hash, ECDSA_BIN_LEN - 1, (uint8_t*)hashed_key);
return ret;
}
......@@ -946,7 +946,11 @@ TEST_CASE_METHOD(TestFixture, "AES_DKG V2 test", "[aes-dkg-v2]") {
SAFE_CHAR_BUF(common_key, BUF_LEN);
REQUIRE(sessionKeyRecoverDH(dhKey.c_str(), encr_sshare, common_key) == 0);
auto hashed_key = cryptlite::sha256::hash_hex(string(common_key, 64));
uint8_t key_to_hash[33];
uint64_t len;
REQUIRE( hex2carray(common_key, &len, key_to_hash, 64) );
auto hashed_key = cryptlite::sha256::hash_hex(string((char*)key_to_hash, 32));
SAFE_CHAR_BUF(derived_key, 33)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment