1
0
mirror of https://github.com/taigrr/arduinolibs synced 2025-01-18 04:33:12 -08:00

Problem with BLAKE2x HMAC when the data was zero-length

This commit is contained in:
Rhys Weatherley 2018-06-18 16:07:46 +10:00
parent 5db9e834f2
commit 9bbf74a414
3 changed files with 5 additions and 4 deletions

View File

@ -24,6 +24,7 @@ Recent significant changes to the library
XXX 2018:
* Problem with BLAKE2s and BLAKE2b HMAC mode when the data was zero-length.
* KeyRing for storing key pairs and other key material in EEPROM or Flash.
* Add better functions to Curve25519 and Ed25519 for generating key pairs.
* Noise and NoiseLink protocols.

View File

@ -240,7 +240,7 @@ void BLAKE2b::resetHMAC(const void *key, size_t keyLen)
{
formatHMACKey(state.m, key, keyLen, 0x36);
state.lengthLow += 128;
processChunk(0);
state.chunkSize = 128;
}
void BLAKE2b::finalizeHMAC(const void *key, size_t keyLen, void *hash, size_t hashLen)
@ -249,7 +249,7 @@ void BLAKE2b::finalizeHMAC(const void *key, size_t keyLen, void *hash, size_t ha
finalize(temp, sizeof(temp));
formatHMACKey(state.m, key, keyLen, 0x5C);
state.lengthLow += 128;
processChunk(0);
state.chunkSize = 128;
update(temp, sizeof(temp));
finalize(hash, hashLen);
clean(temp);

View File

@ -234,7 +234,7 @@ void BLAKE2s::resetHMAC(const void *key, size_t keyLen)
{
formatHMACKey(state.m, key, keyLen, 0x36);
state.length += 64;
processChunk(0);
state.chunkSize = 64;
}
void BLAKE2s::finalizeHMAC(const void *key, size_t keyLen, void *hash, size_t hashLen)
@ -243,7 +243,7 @@ void BLAKE2s::finalizeHMAC(const void *key, size_t keyLen, void *hash, size_t ha
finalize(temp, sizeof(temp));
formatHMACKey(state.m, key, keyLen, 0x5C);
state.length += 64;
processChunk(0);
state.chunkSize = 64;
update(temp, sizeof(temp));
finalize(hash, hashLen);
clean(temp);