mirror of
https://github.com/BLAKE2/BLAKE2
synced 2024-11-26 04:26:12 +01:00
sse kats, reorg
This commit is contained in:
parent
02bf34f3d4
commit
eec32b7170
16469
ref/blake2-kat.h
16469
ref/blake2-kat.h
File diff suppressed because it is too large
Load Diff
103
ref/genkat-json.c
Normal file
103
ref/genkat-json.c
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
/*
|
||||||
|
BLAKE2 reference source code package - reference C implementations
|
||||||
|
|
||||||
|
Copyright 2012, Samuel Neves <sneves@dei.uc.pt>. You may use this under the
|
||||||
|
terms of the CC0, the OpenSSL Licence, or the Apache Public License 2.0, at
|
||||||
|
your option. The terms of these licenses can be found at:
|
||||||
|
|
||||||
|
- CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0
|
||||||
|
- OpenSSL license : https://www.openssl.org/source/license.html
|
||||||
|
- Apache 2.0 : http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
More information about the BLAKE2 hash function can be found at
|
||||||
|
https://blake2.net.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "blake2.h"
|
||||||
|
|
||||||
|
#define STR_(x) #x
|
||||||
|
#define STR(x) STR_(x)
|
||||||
|
|
||||||
|
#define LENGTH 256
|
||||||
|
|
||||||
|
#define MAKE_KAT(name,size_prefix) \
|
||||||
|
do \
|
||||||
|
{ \
|
||||||
|
for( size_t i = 0; i < LENGTH; ++i ) \
|
||||||
|
{ \
|
||||||
|
printf("\n{\n");\
|
||||||
|
\
|
||||||
|
printf(" \"hash\": \"" #name "\",\n");\
|
||||||
|
printf(" \"in\": \"");\
|
||||||
|
for( int j = 0; j < i; ++j ) printf( "%02x", in[j]);\
|
||||||
|
\
|
||||||
|
printf( "\",\n" ); \
|
||||||
|
printf(" \"key\": \"\",\n");\
|
||||||
|
printf(" \"out\": \"");\
|
||||||
|
\
|
||||||
|
name( hash, in, NULL, size_prefix ## _OUTBYTES, i, 0 ); \
|
||||||
|
\
|
||||||
|
for( int j = 0; j < size_prefix ## _OUTBYTES; ++j ) \
|
||||||
|
printf( "%02x", hash[j]);\
|
||||||
|
printf( "\"\n" ); \
|
||||||
|
printf( "}," ); \
|
||||||
|
}\
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define MAKE_KEYED_KAT(name,size_prefix) \
|
||||||
|
do \
|
||||||
|
{ \
|
||||||
|
for( size_t i = 0; i < LENGTH; ++i ) \
|
||||||
|
{ \
|
||||||
|
printf("\n{\n");\
|
||||||
|
\
|
||||||
|
printf(" \"hash\": \"" #name "\",\n");\
|
||||||
|
printf(" \"in\": \"");\
|
||||||
|
for( int j = 0; j < i; ++j ) printf( "%02x", in[j]);\
|
||||||
|
\
|
||||||
|
printf( "\",\n" ); \
|
||||||
|
printf(" \"key\": \"");\
|
||||||
|
for( int j = 0; j < size_prefix ## _KEYBYTES; ++j ) printf( "%02x", key[j]);\
|
||||||
|
printf("\",\n");\
|
||||||
|
printf(" \"out\": \"");\
|
||||||
|
\
|
||||||
|
name( hash, in, key, size_prefix ## _OUTBYTES, i, size_prefix ## _KEYBYTES ); \
|
||||||
|
\
|
||||||
|
for( int j = 0; j < size_prefix ## _OUTBYTES; ++j ) \
|
||||||
|
printf( "%02x", hash[j]);\
|
||||||
|
printf( "\"\n" ); \
|
||||||
|
printf( "}," ); \
|
||||||
|
}\
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
|
||||||
|
int main( int argc, char **argv )
|
||||||
|
{
|
||||||
|
uint8_t key[64] = {0};
|
||||||
|
uint8_t in[LENGTH] = {0};
|
||||||
|
uint8_t hash[64] = {0};
|
||||||
|
|
||||||
|
for( size_t i = 0; i < sizeof( in ); ++i )
|
||||||
|
in[i] = i;
|
||||||
|
|
||||||
|
for( size_t i = 0; i < sizeof( key ); ++i )
|
||||||
|
key[i] = i;
|
||||||
|
|
||||||
|
printf("[");
|
||||||
|
MAKE_KAT( blake2s, BLAKE2S );
|
||||||
|
MAKE_KEYED_KAT( blake2s, BLAKE2S );
|
||||||
|
MAKE_KAT( blake2b, BLAKE2B );
|
||||||
|
MAKE_KEYED_KAT( blake2b, BLAKE2B );
|
||||||
|
MAKE_KAT( blake2sp, BLAKE2S );
|
||||||
|
MAKE_KEYED_KAT( blake2sp, BLAKE2S );
|
||||||
|
MAKE_KAT( blake2bp, BLAKE2B );
|
||||||
|
MAKE_KEYED_KAT( blake2bp, BLAKE2B );
|
||||||
|
printf("\n]\n");
|
||||||
|
fflush(stdout);
|
||||||
|
return 0;
|
||||||
|
}
|
@ -16,8 +16,10 @@ blake2bp: blake2bp-ref.c blake2b-ref.c
|
|||||||
$(CC) blake2bp-ref.c blake2b-ref.c -o $@ $(CFLAGS) -DBLAKE2BP_SELFTEST
|
$(CC) blake2bp-ref.c blake2b-ref.c -o $@ $(CFLAGS) -DBLAKE2BP_SELFTEST
|
||||||
|
|
||||||
kat:
|
kat:
|
||||||
$(CC) $(CFLAGS) -o genkat genkat.c blake2b-ref.c blake2s-ref.c blake2sp-ref.c blake2bp-ref.c
|
$(CC) $(CFLAGS) -o genkat-c genkat-c.c blake2b-ref.c blake2s-ref.c blake2sp-ref.c blake2bp-ref.c
|
||||||
./genkat > blake2-kat.h
|
$(CC) $(CFLAGS) -g -o genkat-json genkat-json.c blake2b-ref.c blake2s-ref.c blake2sp-ref.c blake2bp-ref.c
|
||||||
|
./genkat-c > blake2-kat.h
|
||||||
|
./genkat-json > blake2-kat.json
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf *.o genkat blake2s blake2b blake2sp blake2bp
|
rm -rf *.o genkat-c genkat-json blake2s blake2b blake2sp blake2bp
|
||||||
|
16469
sse/blake2-kat.h
16469
sse/blake2-kat.h
File diff suppressed because it is too large
Load Diff
212
sse/genkat-c.c
Normal file
212
sse/genkat-c.c
Normal file
@ -0,0 +1,212 @@
|
|||||||
|
/*
|
||||||
|
BLAKE2 reference source code package - reference C implementations
|
||||||
|
|
||||||
|
Copyright 2012, Samuel Neves <sneves@dei.uc.pt>. You may use this under the
|
||||||
|
terms of the CC0, the OpenSSL Licence, or the Apache Public License 2.0, at
|
||||||
|
your option. The terms of these licenses can be found at:
|
||||||
|
|
||||||
|
- CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0
|
||||||
|
- OpenSSL license : https://www.openssl.org/source/license.html
|
||||||
|
- Apache 2.0 : http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
More information about the BLAKE2 hash function can be found at
|
||||||
|
https://blake2.net.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "blake2.h"
|
||||||
|
|
||||||
|
#define STR_(x) #x
|
||||||
|
#define STR(x) STR_(x)
|
||||||
|
|
||||||
|
#define LENGTH 256
|
||||||
|
|
||||||
|
#define MAKE_KAT(name,size_prefix) \
|
||||||
|
do \
|
||||||
|
{ \
|
||||||
|
printf( "static const uint8_t " #name "_kat[KAT_LENGTH][" #size_prefix "_OUTBYTES] = \n{\n" ); \
|
||||||
|
\
|
||||||
|
for( size_t i = 0; i < LENGTH; ++i ) \
|
||||||
|
{ \
|
||||||
|
name( hash, in, NULL, size_prefix ## _OUTBYTES, i, 0 ); \
|
||||||
|
printf( "\t{\n\t\t" ); \
|
||||||
|
\
|
||||||
|
for( int j = 0; j < size_prefix ## _OUTBYTES; ++j ) \
|
||||||
|
printf( "0x%02X%s", hash[j], ( j + 1 ) == size_prefix ## _OUTBYTES ? "\n" : j && !( ( j + 1 ) % 8 ) ? ",\n\t\t" : ", " ); \
|
||||||
|
\
|
||||||
|
printf( "\t},\n" ); \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
printf( "};\n\n\n\n\n" ); \
|
||||||
|
\
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define MAKE_KEYED_KAT(name,size_prefix) \
|
||||||
|
do \
|
||||||
|
{ \
|
||||||
|
printf( "static const uint8_t " #name "_keyed_kat[KAT_LENGTH][" #size_prefix "_OUTBYTES] = \n{\n" ); \
|
||||||
|
\
|
||||||
|
for( size_t i = 0; i < LENGTH; ++i ) \
|
||||||
|
{ \
|
||||||
|
name( hash, in, key, size_prefix ## _OUTBYTES, i, size_prefix ## _KEYBYTES ); \
|
||||||
|
printf( "\t{\n\t\t" ); \
|
||||||
|
\
|
||||||
|
for( int j = 0; j < size_prefix ## _OUTBYTES; ++j ) \
|
||||||
|
printf( "0x%02X%s", hash[j], ( j + 1 ) == size_prefix ## _OUTBYTES ? "\n" : j && !( ( j + 1 ) % 8 ) ? ",\n\t\t" : ", " ); \
|
||||||
|
\
|
||||||
|
printf( "\t},\n" ); \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
printf( "};\n\n\n\n\n" ); \
|
||||||
|
\
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
|
||||||
|
int main( int argc, char **argv )
|
||||||
|
{
|
||||||
|
uint8_t key[64] = {0};
|
||||||
|
uint8_t in[LENGTH] = {0};
|
||||||
|
uint8_t hash[64] = {0};
|
||||||
|
|
||||||
|
for( size_t i = 0; i < sizeof( in ); ++i )
|
||||||
|
in[i] = i;
|
||||||
|
|
||||||
|
for( size_t i = 0; i < sizeof( key ); ++i )
|
||||||
|
key[i] = i;
|
||||||
|
|
||||||
|
puts( "#pragma once\n"
|
||||||
|
"#ifndef __BLAKE2_KAT_H__\n"
|
||||||
|
"#define __BLAKE2_KAT_H__\n\n\n"
|
||||||
|
"#include <stdint.h>\n\n"
|
||||||
|
"#define KAT_LENGTH " STR( LENGTH ) "\n\n\n" );
|
||||||
|
MAKE_KAT( blake2s, BLAKE2S );
|
||||||
|
MAKE_KEYED_KAT( blake2s, BLAKE2S );
|
||||||
|
MAKE_KAT( blake2b, BLAKE2B );
|
||||||
|
MAKE_KEYED_KAT( blake2b, BLAKE2B );
|
||||||
|
MAKE_KAT( blake2sp, BLAKE2S );
|
||||||
|
MAKE_KEYED_KAT( blake2sp, BLAKE2S );
|
||||||
|
MAKE_KAT( blake2bp, BLAKE2B );
|
||||||
|
MAKE_KEYED_KAT( blake2bp, BLAKE2B );
|
||||||
|
/*printf( "static const uint8_t blake2s_kat[KAT_LENGTH][BLAKE2S_OUTBYTES] = \n{\n" );
|
||||||
|
|
||||||
|
for( size_t i = 0; i < LENGTH; ++i )
|
||||||
|
{
|
||||||
|
blake2s( hash, in, NULL, BLAKE2S_OUTBYTES, i, 0 );
|
||||||
|
printf( "\t{\n\t\t" );
|
||||||
|
|
||||||
|
for( int j = 0; j < BLAKE2S_OUTBYTES; ++j )
|
||||||
|
printf( "0x%02X%s", hash[j], ( j + 1 ) == BLAKE2S_OUTBYTES ? "\n" : j && !( ( j + 1 ) % 8 ) ? ",\n\t\t" : ", " );
|
||||||
|
|
||||||
|
printf( "\t},\n" );
|
||||||
|
}
|
||||||
|
|
||||||
|
printf( "};\n\n\n\n\n" );
|
||||||
|
printf( "static const uint8_t blake2s_keyed_kat[KAT_LENGTH][BLAKE2S_OUTBYTES] = \n{\n" );
|
||||||
|
|
||||||
|
for( size_t i = 0; i < LENGTH; ++i )
|
||||||
|
{
|
||||||
|
blake2s( hash, in, key, BLAKE2S_OUTBYTES, i, BLAKE2S_KEYBYTES );
|
||||||
|
printf( "\t{\n\t\t" );
|
||||||
|
|
||||||
|
for( int j = 0; j < BLAKE2S_OUTBYTES; ++j )
|
||||||
|
printf( "0x%02X%s", hash[j], ( j + 1 ) == BLAKE2S_OUTBYTES ? "\n" : j && !( ( j + 1 ) % 8 ) ? ",\n\t\t" : ", " );
|
||||||
|
|
||||||
|
printf( "\t},\n" );
|
||||||
|
}
|
||||||
|
|
||||||
|
printf( "};\n\n\n\n\n" );
|
||||||
|
printf( "static const uint8_t blake2b_kat[KAT_LENGTH][BLAKE2B_OUTBYTES] = \n{\n" );
|
||||||
|
|
||||||
|
for( size_t i = 0; i < LENGTH; ++i )
|
||||||
|
{
|
||||||
|
blake2b( hash, in, NULL, BLAKE2B_OUTBYTES, i, 0 );
|
||||||
|
printf( "\t{\n\t\t" );
|
||||||
|
|
||||||
|
for( int j = 0; j < BLAKE2B_OUTBYTES; ++j )
|
||||||
|
printf( "0x%02X%s", hash[j], ( j + 1 ) == BLAKE2B_OUTBYTES ? "\n" : j && !( ( j + 1 ) % 8 ) ? ",\n\t\t" : ", " );
|
||||||
|
|
||||||
|
printf( "\t},\n" );
|
||||||
|
}
|
||||||
|
|
||||||
|
printf( "};\n\n\n\n\n" );
|
||||||
|
printf( "static const uint8_t blake2b_keyed_kat[KAT_LENGTH][BLAKE2B_OUTBYTES] = \n{\n" );
|
||||||
|
|
||||||
|
for( size_t i = 0; i < LENGTH; ++i )
|
||||||
|
{
|
||||||
|
blake2b( hash, in, key, BLAKE2B_OUTBYTES, i, BLAKE2B_KEYBYTES );
|
||||||
|
printf( "\t{\n\t\t" );
|
||||||
|
|
||||||
|
for( int j = 0; j < BLAKE2B_OUTBYTES; ++j )
|
||||||
|
printf( "0x%02X%s", hash[j], ( j + 1 ) == BLAKE2B_OUTBYTES ? "\n" : j && !( ( j + 1 ) % 8 ) ? ",\n\t\t" : ", " );
|
||||||
|
|
||||||
|
printf( "\t},\n" );
|
||||||
|
}
|
||||||
|
|
||||||
|
printf( "};\n\n\n\n\n" );
|
||||||
|
|
||||||
|
|
||||||
|
printf( "static const uint8_t blake2sp_kat[KAT_LENGTH][BLAKE2S_OUTBYTES] = \n{\n" );
|
||||||
|
|
||||||
|
for( size_t i = 0; i < LENGTH; ++i )
|
||||||
|
{
|
||||||
|
blake2sp( hash, in, NULL, BLAKE2S_OUTBYTES, i, 0 );
|
||||||
|
printf( "\t{\n\t\t" );
|
||||||
|
|
||||||
|
for( int j = 0; j < BLAKE2S_OUTBYTES; ++j )
|
||||||
|
printf( "0x%02X%s", hash[j], ( j + 1 ) == BLAKE2S_OUTBYTES ? "\n" : j && !( ( j + 1 ) % 8 ) ? ",\n\t\t" : ", " );
|
||||||
|
|
||||||
|
printf( "\t},\n" );
|
||||||
|
}
|
||||||
|
|
||||||
|
printf( "};\n\n\n\n\n" );
|
||||||
|
printf( "static const uint8_t blake2sp_keyed_kat[KAT_LENGTH][BLAKE2S_OUTBYTES] = \n{\n" );
|
||||||
|
|
||||||
|
for( size_t i = 0; i < LENGTH; ++i )
|
||||||
|
{
|
||||||
|
blake2sp( hash, in, key, BLAKE2S_OUTBYTES, i, BLAKE2S_KEYBYTES );
|
||||||
|
printf( "\t{\n\t\t" );
|
||||||
|
|
||||||
|
for( int j = 0; j < BLAKE2S_OUTBYTES; ++j )
|
||||||
|
printf( "0x%02X%s", hash[j], ( j + 1 ) == BLAKE2S_OUTBYTES ? "\n" : j && !( ( j + 1 ) % 8 ) ? ",\n\t\t" : ", " );
|
||||||
|
|
||||||
|
printf( "\t},\n" );
|
||||||
|
}
|
||||||
|
|
||||||
|
printf( "};\n\n\n\n\n" );
|
||||||
|
|
||||||
|
|
||||||
|
printf( "static const uint8_t blake2bp_kat[KAT_LENGTH][BLAKE2B_OUTBYTES] = \n{\n" );
|
||||||
|
|
||||||
|
for( size_t i = 0; i < LENGTH; ++i )
|
||||||
|
{
|
||||||
|
blake2bp( hash, in, NULL, BLAKE2B_OUTBYTES, i, 0 );
|
||||||
|
printf( "\t{\n\t\t" );
|
||||||
|
|
||||||
|
for( int j = 0; j < BLAKE2B_OUTBYTES; ++j )
|
||||||
|
printf( "0x%02X%s", hash[j], ( j + 1 ) == BLAKE2B_OUTBYTES ? "\n" : j && !( ( j + 1 ) % 8 ) ? ",\n\t\t" : ", " );
|
||||||
|
|
||||||
|
printf( "\t},\n" );
|
||||||
|
}
|
||||||
|
|
||||||
|
printf( "};\n\n\n\n\n" );
|
||||||
|
printf( "static const uint8_t blake2bp_keyed_kat[KAT_LENGTH][BLAKE2B_OUTBYTES] = \n{\n" );
|
||||||
|
|
||||||
|
for( size_t i = 0; i < LENGTH; ++i )
|
||||||
|
{
|
||||||
|
blake2bp( hash, in, key, BLAKE2B_OUTBYTES, i, BLAKE2B_KEYBYTES );
|
||||||
|
printf( "\t{\n\t\t" );
|
||||||
|
|
||||||
|
for( int j = 0; j < BLAKE2B_OUTBYTES; ++j )
|
||||||
|
printf( "0x%02X%s", hash[j], ( j + 1 ) == BLAKE2B_OUTBYTES ? "\n" : j && !( ( j + 1 ) % 8 ) ? ",\n\t\t" : ", " );
|
||||||
|
|
||||||
|
printf( "\t},\n" );
|
||||||
|
}
|
||||||
|
|
||||||
|
printf( "};\n\n\n\n\n" );*/
|
||||||
|
puts( "#endif\n\n\n" );
|
||||||
|
return 0;
|
||||||
|
}
|
103
sse/genkat-json.c
Normal file
103
sse/genkat-json.c
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
/*
|
||||||
|
BLAKE2 reference source code package - reference C implementations
|
||||||
|
|
||||||
|
Copyright 2012, Samuel Neves <sneves@dei.uc.pt>. You may use this under the
|
||||||
|
terms of the CC0, the OpenSSL Licence, or the Apache Public License 2.0, at
|
||||||
|
your option. The terms of these licenses can be found at:
|
||||||
|
|
||||||
|
- CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0
|
||||||
|
- OpenSSL license : https://www.openssl.org/source/license.html
|
||||||
|
- Apache 2.0 : http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
More information about the BLAKE2 hash function can be found at
|
||||||
|
https://blake2.net.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "blake2.h"
|
||||||
|
|
||||||
|
#define STR_(x) #x
|
||||||
|
#define STR(x) STR_(x)
|
||||||
|
|
||||||
|
#define LENGTH 256
|
||||||
|
|
||||||
|
#define MAKE_KAT(name,size_prefix) \
|
||||||
|
do \
|
||||||
|
{ \
|
||||||
|
for( size_t i = 0; i < LENGTH; ++i ) \
|
||||||
|
{ \
|
||||||
|
printf("\n{\n");\
|
||||||
|
\
|
||||||
|
printf(" \"hash\": \"" #name "\",\n");\
|
||||||
|
printf(" \"in\": \"");\
|
||||||
|
for( int j = 0; j < i; ++j ) printf( "%02x", in[j]);\
|
||||||
|
\
|
||||||
|
printf( "\",\n" ); \
|
||||||
|
printf(" \"key\": \"\",\n");\
|
||||||
|
printf(" \"out\": \"");\
|
||||||
|
\
|
||||||
|
name( hash, in, NULL, size_prefix ## _OUTBYTES, i, 0 ); \
|
||||||
|
\
|
||||||
|
for( int j = 0; j < size_prefix ## _OUTBYTES; ++j ) \
|
||||||
|
printf( "%02x", hash[j]);\
|
||||||
|
printf( "\"\n" ); \
|
||||||
|
printf( "}," ); \
|
||||||
|
}\
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define MAKE_KEYED_KAT(name,size_prefix) \
|
||||||
|
do \
|
||||||
|
{ \
|
||||||
|
for( size_t i = 0; i < LENGTH; ++i ) \
|
||||||
|
{ \
|
||||||
|
printf("\n{\n");\
|
||||||
|
\
|
||||||
|
printf(" \"hash\": \"" #name "\",\n");\
|
||||||
|
printf(" \"in\": \"");\
|
||||||
|
for( int j = 0; j < i; ++j ) printf( "%02x", in[j]);\
|
||||||
|
\
|
||||||
|
printf( "\",\n" ); \
|
||||||
|
printf(" \"key\": \"");\
|
||||||
|
for( int j = 0; j < size_prefix ## _KEYBYTES; ++j ) printf( "%02x", key[j]);\
|
||||||
|
printf("\",\n");\
|
||||||
|
printf(" \"out\": \"");\
|
||||||
|
\
|
||||||
|
name( hash, in, key, size_prefix ## _OUTBYTES, i, size_prefix ## _KEYBYTES ); \
|
||||||
|
\
|
||||||
|
for( int j = 0; j < size_prefix ## _OUTBYTES; ++j ) \
|
||||||
|
printf( "%02x", hash[j]);\
|
||||||
|
printf( "\"\n" ); \
|
||||||
|
printf( "}," ); \
|
||||||
|
}\
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
|
||||||
|
int main( int argc, char **argv )
|
||||||
|
{
|
||||||
|
uint8_t key[64] = {0};
|
||||||
|
uint8_t in[LENGTH] = {0};
|
||||||
|
uint8_t hash[64] = {0};
|
||||||
|
|
||||||
|
for( size_t i = 0; i < sizeof( in ); ++i )
|
||||||
|
in[i] = i;
|
||||||
|
|
||||||
|
for( size_t i = 0; i < sizeof( key ); ++i )
|
||||||
|
key[i] = i;
|
||||||
|
|
||||||
|
printf("[");
|
||||||
|
MAKE_KAT( blake2s, BLAKE2S );
|
||||||
|
MAKE_KEYED_KAT( blake2s, BLAKE2S );
|
||||||
|
MAKE_KAT( blake2b, BLAKE2B );
|
||||||
|
MAKE_KEYED_KAT( blake2b, BLAKE2B );
|
||||||
|
MAKE_KAT( blake2sp, BLAKE2S );
|
||||||
|
MAKE_KEYED_KAT( blake2sp, BLAKE2S );
|
||||||
|
MAKE_KAT( blake2bp, BLAKE2B );
|
||||||
|
MAKE_KEYED_KAT( blake2bp, BLAKE2B );
|
||||||
|
printf("\n]\n");
|
||||||
|
fflush(stdout);
|
||||||
|
return 0;
|
||||||
|
}
|
@ -15,5 +15,11 @@ blake2sp: blake2sp.c blake2s.c
|
|||||||
blake2bp: blake2bp.c blake2b.c
|
blake2bp: blake2bp.c blake2b.c
|
||||||
$(CC) blake2bp.c blake2b.c -o $@ $(CFLAGS) -DBLAKE2BP_SELFTEST
|
$(CC) blake2bp.c blake2b.c -o $@ $(CFLAGS) -DBLAKE2BP_SELFTEST
|
||||||
|
|
||||||
|
kat:
|
||||||
|
$(CC) $(CFLAGS) -o genkat-c genkat-c.c blake2b.c blake2s.c blake2sp.c blake2bp.c
|
||||||
|
$(CC) $(CFLAGS) -g -o genkat-json genkat-json.c blake2b.c blake2s.c blake2sp.c blake2bp.c
|
||||||
|
./genkat-c > blake2-kat.h
|
||||||
|
./genkat-json > blake2-kat.json
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf *.o blake2s blake2b blake2sp blake2bp
|
rm -rf *.o blake2s blake2b blake2sp blake2bp genkat-c genkat-json
|
||||||
|
16455
testvectors/blake2-kat.h
Normal file
16455
testvectors/blake2-kat.h
Normal file
File diff suppressed because it is too large
Load Diff
12290
testvectors/blake2-kat.json
Normal file
12290
testvectors/blake2-kat.json
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user