Implement BLAKE2s with the same macro as BLAKE2b
authorнаб <nabijaczleweli@nabijaczleweli.xyz>
Thu, 19 Oct 2023 16:31:33 +0000 (18:31 +0200)
committerTomas Mraz <tomas@openssl.org>
Wed, 8 Nov 2023 08:42:13 +0000 (09:42 +0100)
commit6d1e730a1ea2c64bdffa88c6b3bee4c3f5bed602
tree3a901c8c3ac87b5ed22b1d879e1bbeaf6adc3fd3
parent8349c02e86310d0263b97a26fefd24ab83571ae8
Implement BLAKE2s with the same macro as BLAKE2b

This avoids code duplication and provides variable-size support
for BLAKE2s like 786b9a8

Test data obtained with libb2 with the following programs:

==> b2.c <==
#include <blake2.h>
#include <unistd.h>

int main() {
char buf[16] = {};
blake2s(buf, 0, 0, 16, 0, 0);
write(1, buf, 16);
}

==> b3.c <==
#include <blake2.h>
#include <unistd.h>

int main() {
char buf[10] = {};
blake2s(buf, "\x61", 0, 10, 1, 0);
write(1, buf, 10);
}

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22444)
providers/implementations/digests/blake2_prov.c
providers/implementations/include/prov/blake2.h
test/recipes/30-test_evp_data/evpmd_blake.txt