From 22b608111d32de8b0c8fa34f35bd0d8892df2285 Mon Sep 17 00:00:00 2001 From: bg Date: Thu, 27 Jan 2011 18:49:30 +0000 Subject: [PATCH] JH and Blake updated for round 3 --- blake/blake_common.c | 25 +- blake/blake_large.c | 49 ++-- blake/blake_large.h | 32 +-- blake/blake_small.c | 49 ++-- blake/blake_small.h | 32 +-- hfal/hfal_blake_large.c | 32 +-- hfal/hfal_blake_large.h | 4 +- hfal/hfal_blake_small.c | 32 +-- hfal/hfal_blake_small.h | 4 +- jh/jh_simple_small_core.c | 12 +- jh/jh_simple_speed_core.c | 12 +- jh/jh_tablegen.rb | 41 +++ jh/jh_tables.c | 246 +++++++++++++++--- test_src/main-blake-test.c | 52 ++-- testconf/Blake.conf | 8 +- .../ExtremelyLongMsgKAT_224.txt | 0 .../ExtremelyLongMsgKAT_256.txt | 0 .../ExtremelyLongMsgKAT_384.txt | 0 .../ExtremelyLongMsgKAT_512.txt | 0 .../JH => JH-round2}/LongMsgKAT_224.txt | 0 .../JH => JH-round2}/LongMsgKAT_256.txt | 0 .../JH => JH-round2}/LongMsgKAT_384.txt | 0 .../JH => JH-round2}/LongMsgKAT_512.txt | 0 .../JH => JH-round2}/MonteCarlo_224.txt | 0 .../JH => JH-round2}/MonteCarlo_256.txt | 0 .../JH => JH-round2}/MonteCarlo_384.txt | 0 .../JH => JH-round2}/MonteCarlo_512.txt | 0 .../JH => JH-round2}/ShortMsgKAT_224.txt | 0 .../JH => JH-round2}/ShortMsgKAT_256.txt | 0 .../JH => JH-round2}/ShortMsgKAT_384.txt | 0 .../JH => JH-round2}/ShortMsgKAT_512.txt | 0 .../ExtremelyLongMsgKAT.txt | 0 .../ExtremelyLongMsgKAT_224.txt | 0 .../ExtremelyLongMsgKAT_256.txt | 0 .../ExtremelyLongMsgKAT_384.txt | 0 .../ExtremelyLongMsgKAT_512.txt | 0 .../{Blake => Blake-round2}/LongMsgKAT.txt | 0 .../LongMsgKAT_224.txt | 0 .../LongMsgKAT_256.txt | 0 .../LongMsgKAT_384.txt | 0 .../LongMsgKAT_512.txt | 0 .../{Blake => Blake-round2}/MonteCarlo.txt | 0 .../MonteCarlo_224.txt | 0 .../MonteCarlo_256.txt | 0 .../MonteCarlo_384.txt | 0 .../MonteCarlo_512.txt | 0 .../{Blake => Blake-round2}/ShortMsgKAT.txt | 0 .../ShortMsgKAT_224.txt | 0 .../ShortMsgKAT_256.txt | 0 .../ShortMsgKAT_384.txt | 0 .../ShortMsgKAT_512.txt | 0 51 files changed, 416 insertions(+), 214 deletions(-) rename testvectors/{shavs/JH => JH-round2}/ExtremelyLongMsgKAT_224.txt (100%) rename testvectors/{shavs/JH => JH-round2}/ExtremelyLongMsgKAT_256.txt (100%) rename testvectors/{shavs/JH => JH-round2}/ExtremelyLongMsgKAT_384.txt (100%) rename testvectors/{shavs/JH => JH-round2}/ExtremelyLongMsgKAT_512.txt (100%) rename testvectors/{shavs/JH => JH-round2}/LongMsgKAT_224.txt (100%) rename testvectors/{shavs/JH => JH-round2}/LongMsgKAT_256.txt (100%) rename testvectors/{shavs/JH => JH-round2}/LongMsgKAT_384.txt (100%) rename testvectors/{shavs/JH => JH-round2}/LongMsgKAT_512.txt (100%) rename testvectors/{shavs/JH => JH-round2}/MonteCarlo_224.txt (100%) rename testvectors/{shavs/JH => JH-round2}/MonteCarlo_256.txt (100%) rename testvectors/{shavs/JH => JH-round2}/MonteCarlo_384.txt (100%) rename testvectors/{shavs/JH => JH-round2}/MonteCarlo_512.txt (100%) rename testvectors/{shavs/JH => JH-round2}/ShortMsgKAT_224.txt (100%) rename testvectors/{shavs/JH => JH-round2}/ShortMsgKAT_256.txt (100%) rename testvectors/{shavs/JH => JH-round2}/ShortMsgKAT_384.txt (100%) rename testvectors/{shavs/JH => JH-round2}/ShortMsgKAT_512.txt (100%) rename testvectors/shavs/{Blake => Blake-round2}/ExtremelyLongMsgKAT.txt (100%) rename testvectors/shavs/{Blake => Blake-round2}/ExtremelyLongMsgKAT_224.txt (100%) rename testvectors/shavs/{Blake => Blake-round2}/ExtremelyLongMsgKAT_256.txt (100%) rename testvectors/shavs/{Blake => Blake-round2}/ExtremelyLongMsgKAT_384.txt (100%) rename testvectors/shavs/{Blake => Blake-round2}/ExtremelyLongMsgKAT_512.txt (100%) rename testvectors/shavs/{Blake => Blake-round2}/LongMsgKAT.txt (100%) rename testvectors/shavs/{Blake => Blake-round2}/LongMsgKAT_224.txt (100%) rename testvectors/shavs/{Blake => Blake-round2}/LongMsgKAT_256.txt (100%) rename testvectors/shavs/{Blake => Blake-round2}/LongMsgKAT_384.txt (100%) rename testvectors/shavs/{Blake => Blake-round2}/LongMsgKAT_512.txt (100%) rename testvectors/shavs/{Blake => Blake-round2}/MonteCarlo.txt (100%) rename testvectors/shavs/{Blake => Blake-round2}/MonteCarlo_224.txt (100%) rename testvectors/shavs/{Blake => Blake-round2}/MonteCarlo_256.txt (100%) rename testvectors/shavs/{Blake => Blake-round2}/MonteCarlo_384.txt (100%) rename testvectors/shavs/{Blake => Blake-round2}/MonteCarlo_512.txt (100%) rename testvectors/shavs/{Blake => Blake-round2}/ShortMsgKAT.txt (100%) rename testvectors/shavs/{Blake => Blake-round2}/ShortMsgKAT_224.txt (100%) rename testvectors/shavs/{Blake => Blake-round2}/ShortMsgKAT_256.txt (100%) rename testvectors/shavs/{Blake => Blake-round2}/ShortMsgKAT_384.txt (100%) rename testvectors/shavs/{Blake => Blake-round2}/ShortMsgKAT_512.txt (100%) diff --git a/blake/blake_common.c b/blake/blake_common.c index 4baf372..eadd247 100644 --- a/blake/blake_common.c +++ b/blake/blake_common.c @@ -29,21 +29,16 @@ #include uint8_t blake_sigma[] PROGMEM = { - 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xA, 0xB, 0xC, 0xD, 0xE, 0xF, - 0xE, 0xA, 0x4, 0x8, 0x9, 0xF, 0xD, 0x6, 0x1, 0xC, 0x0, 0x2, 0xB, 0x7, 0x5, 0x3, - 0xB, 0x8, 0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EF, + 0xEA, 0x48, 0x9F, 0xD6, 0x1C, 0x02, 0xB7, 0x53, + 0xB8, 0xC0, 0x52, 0xFD, 0xAE, 0x36, 0x71, 0x94, + 0x79, 0x31, 0xDC, 0xBE, 0x26, 0x5A, 0x40, 0xF8, + 0x90, 0x57, 0x24, 0xAF, 0xE1, 0xBC, 0x68, 0x3D, + 0x2C, 0x6A, 0x0B, 0x83, 0x4D, 0x75, 0xFE, 0x19, + 0xC5, 0x1F, 0xED, 0x4A, 0x07, 0x63, 0x92, 0x8B, + 0xDB, 0x7E, 0xC1, 0x39, 0x50, 0xF4, 0x86, 0x2A, + 0x6F, 0xE9, 0xB3, 0x08, 0xC2, 0xD7, 0x14, 0xA5, + 0xA2, 0x84, 0x76, 0x15, 0xFB, 0x9E, 0x3C, 0xD0, }; uint8_t blake_index_lut[] PROGMEM = { diff --git a/blake/blake_large.c b/blake/blake_large.c index af967e2..b0b6ceb 100644 --- a/blake/blake_large.c +++ b/blake/blake_large.c @@ -89,15 +89,20 @@ void blake_large_changeendian(void* dest, const void* src){ static void blake_large_compress(uint64_t* v,const void* m){ uint8_t r,i; - uint8_t a,b,c,d, s0, s1; - for(r=0; r<14; ++r){ + uint8_t a,b,c,d, s0, s1, sigma_idx=0; + for(r=0; r<16; ++r){ for(i=0; i<8; ++i){ a = pgm_read_byte(blake_index_lut+4*i+0); b = pgm_read_byte(blake_index_lut+4*i+1); c = pgm_read_byte(blake_index_lut+4*i+2); d = pgm_read_byte(blake_index_lut+4*i+3); - s0 = pgm_read_byte(blake_sigma+16*r+2*i+0); - s1 = pgm_read_byte(blake_sigma+16*r+2*i+1); + s0 = pgm_read_byte(blake_sigma+sigma_idx); + s1 = s0&0x0f; + s0 >>= 4; + ++sigma_idx; + if(sigma_idx>=80){ + sigma_idx-=80; + } v[a] += v[b] + (((uint64_t*)m)[s0] ^ pgm_read_qword(&(blake_c[s1]))); v[d] = ROTR64(v[d]^v[a], 32); v[c] += v[d]; @@ -171,41 +176,41 @@ void blake_large_lastBlock(blake_large_ctx_t* ctx, const void* msg, uint16_t len } -uint64_t blake64_iv[] PROGMEM = { +uint64_t blake512_iv[] PROGMEM = { 0x6A09E667F3BCC908LL, 0xBB67AE8584CAA73BLL, 0x3C6EF372FE94F82BLL, 0xA54FF53A5F1D36F1LL, 0x510E527FADE682D1LL, 0x9B05688C2B3E6C1FLL, 0x1F83D9ABFB41BD6BLL, 0x5BE0CD19137E2179LL }; -void blake64_init(blake64_ctx_t* ctx){ +void blake512_init(blake512_ctx_t* ctx){ uint8_t i; for(i=0; i<8; ++i){ - ctx->h[i] = pgm_read_qword(&(blake64_iv[i])); + ctx->h[i] = pgm_read_qword(&(blake512_iv[i])); } memset(ctx->s, 0, 4*8); ctx->counter = 0; ctx->appendone = 1; } -uint64_t blake48_iv[] PROGMEM = { +uint64_t blake384_iv[] PROGMEM = { 0xCBBB9D5DC1059ED8LL, 0x629A292A367CD507LL, 0x9159015A3070DD17LL, 0x152FECD8F70E5939LL, 0x67332667FFC00B31LL, 0x8EB44A8768581511LL, 0xDB0C2E0D64F98FA7LL, 0x47B5481DBEFA4FA4LL }; -void blake48_init(blake48_ctx_t* ctx){ +void blake384_init(blake384_ctx_t* ctx){ uint8_t i; for(i=0; i<8; ++i){ - ctx->h[i] = pgm_read_qword(&(blake48_iv[i])); + ctx->h[i] = pgm_read_qword(&(blake384_iv[i])); } memset(ctx->s, 0, 4*8); ctx->counter = 0; ctx->appendone = 0; } -void blake64_ctx2hash(void* dest, const blake64_ctx_t* ctx){ +void blake512_ctx2hash(void* dest, const blake512_ctx_t* ctx){ uint8_t i; for(i=0; i<8; ++i){ ((uint32_t*)dest)[2*i+0] = CHANGE_ENDIAN32((ctx->h[i])>>32); @@ -213,7 +218,7 @@ void blake64_ctx2hash(void* dest, const blake64_ctx_t* ctx){ } } -void blake48_ctx2hash(void* dest, const blake48_ctx_t* ctx){ +void blake384_ctx2hash(void* dest, const blake384_ctx_t* ctx){ uint8_t i; for(i=0; i<6; ++i){ ((uint32_t*)dest)[2*i+0] = CHANGE_ENDIAN32((ctx->h[i])>>32); @@ -221,42 +226,42 @@ void blake48_ctx2hash(void* dest, const blake48_ctx_t* ctx){ } } -void blake64_nextBlock(blake64_ctx_t* ctx, const void* block){ +void blake512_nextBlock(blake512_ctx_t* ctx, const void* block){ blake_large_nextBlock(ctx, block); } -void blake48_nextBlock(blake48_ctx_t* ctx, const void* block){ +void blake384_nextBlock(blake384_ctx_t* ctx, const void* block){ blake_large_nextBlock(ctx, block); } -void blake64_lastBlock(blake64_ctx_t* ctx, const void* block, uint16_t length_b){ +void blake512_lastBlock(blake512_ctx_t* ctx, const void* block, uint16_t length_b){ blake_large_lastBlock(ctx, block, length_b); } -void blake48_lastBlock(blake48_ctx_t* ctx, const void* block, uint16_t length_b){ +void blake384_lastBlock(blake384_ctx_t* ctx, const void* block, uint16_t length_b){ blake_large_lastBlock(ctx, block, length_b); } -void blake64(void* dest, const void* msg, uint32_t length_b){ +void blake512(void* dest, const void* msg, uint32_t length_b){ blake_large_ctx_t ctx; - blake64_init(&ctx); + blake512_init(&ctx); while(length_b>=BLAKE_LARGE_BLOCKSIZE){ blake_large_nextBlock(&ctx, msg); msg = (uint8_t*)msg + BLAKE_LARGE_BLOCKSIZE_B; length_b -= BLAKE_LARGE_BLOCKSIZE; } blake_large_lastBlock(&ctx, msg, length_b); - blake64_ctx2hash(dest, &ctx); + blake512_ctx2hash(dest, &ctx); } -void blake48(void* dest, const void* msg, uint32_t length_b){ +void blake384(void* dest, const void* msg, uint32_t length_b){ blake_large_ctx_t ctx; - blake48_init(&ctx); + blake384_init(&ctx); while(length_b>=BLAKE_LARGE_BLOCKSIZE){ blake_large_nextBlock(&ctx, msg); msg = (uint8_t*)msg + BLAKE_LARGE_BLOCKSIZE_B; length_b -= BLAKE_LARGE_BLOCKSIZE; } blake_large_lastBlock(&ctx, msg, length_b); - blake48_ctx2hash(dest, &ctx); + blake384_ctx2hash(dest, &ctx); } diff --git a/blake/blake_large.h b/blake/blake_large.h index 3556f2c..0ad66ea 100644 --- a/blake/blake_large.h +++ b/blake/blake_large.h @@ -31,10 +31,10 @@ #define BLAKE_LARGE_BLOCKSIZE 1024 #define BLAKE_LARGE_BLOCKSIZE_B ((BLAKE_LARGE_BLOCKSIZE+7)/8) -#define BLAKE48_BLOCKSIZE BLAKE_LARGE_BLOCKSIZE -#define BLAKE48_BLOCKSIZE_B BLAKE_LARGE_BLOCKSIZE_B -#define BLAKE64_BLOCKSIZE BLAKE_LARGE_BLOCKSIZE -#define BLAKE64_BLOCKSIZE_B BLAKE_LARGE_BLOCKSIZE_B +#define BLAKE384_BLOCKSIZE BLAKE_LARGE_BLOCKSIZE +#define BLAKE384_BLOCKSIZE_B BLAKE_LARGE_BLOCKSIZE_B +#define BLAKE512_BLOCKSIZE BLAKE_LARGE_BLOCKSIZE +#define BLAKE512_BLOCKSIZE_B BLAKE_LARGE_BLOCKSIZE_B typedef struct { uint64_t h[8]; @@ -43,25 +43,25 @@ typedef struct { uint8_t appendone; } blake_large_ctx_t; -typedef blake_large_ctx_t blake48_ctx_t; -typedef blake_large_ctx_t blake64_ctx_t; +typedef blake_large_ctx_t blake384_ctx_t; +typedef blake_large_ctx_t blake512_ctx_t; -void blake48_init(blake48_ctx_t* ctx); -void blake64_init(blake64_ctx_t* ctx); +void blake384_init(blake384_ctx_t* ctx); +void blake512_init(blake512_ctx_t* ctx); void blake_large_nextBlock(blake_large_ctx_t* ctx, const void* block); void blake_large_lastBlock(blake_large_ctx_t* ctx, const void* block, uint16_t length_b); -void blake48_nextBlock(blake48_ctx_t* ctx, const void* block); -void blake48_lastBlock(blake48_ctx_t* ctx, const void* block, uint16_t length_b); +void blake384_nextBlock(blake384_ctx_t* ctx, const void* block); +void blake384_lastBlock(blake384_ctx_t* ctx, const void* block, uint16_t length_b); -void blake64_nextBlock(blake64_ctx_t* ctx, const void* block); -void blake64_lastBlock(blake64_ctx_t* ctx, const void* block, uint16_t length_b); +void blake512_nextBlock(blake512_ctx_t* ctx, const void* block); +void blake512_lastBlock(blake512_ctx_t* ctx, const void* block, uint16_t length_b); -void blake48_ctx2hash(void* dest, const blake48_ctx_t* ctx); -void blake64_ctx2hash(void* dest, const blake64_ctx_t* ctx); +void blake384_ctx2hash(void* dest, const blake384_ctx_t* ctx); +void blake512_ctx2hash(void* dest, const blake512_ctx_t* ctx); -void blake48(void* dest, const void* msg, uint32_t length_b); -void blake64(void* dest, const void* msg, uint32_t length_b); +void blake384(void* dest, const void* msg, uint32_t length_b); +void blake512(void* dest, const void* msg, uint32_t length_b); #endif /* BLAKE_LARGE_H_ */ diff --git a/blake/blake_small.c b/blake/blake_small.c index 0f99668..d355940 100644 --- a/blake/blake_small.c +++ b/blake/blake_small.c @@ -72,17 +72,20 @@ void blake_small_changeendian(void* dest, const void* src){ static void blake_small_compress(uint32_t* v,const void* m){ uint8_t r,i; - uint8_t a,b,c,d, s0, s1; + uint8_t a,b,c,d, s0, s1, sigma_idx=0; uint32_t lv[4]; - for(r=0; r<10; ++r){ + for(r=0; r<14; ++r){ for(i=0; i<8; ++i){ a = pgm_read_byte(blake_index_lut+4*i+0); b = pgm_read_byte(blake_index_lut+4*i+1); c = pgm_read_byte(blake_index_lut+4*i+2); d = pgm_read_byte(blake_index_lut+4*i+3); - s0 = pgm_read_byte(blake_sigma+16*r+2*i+0); - s1 = pgm_read_byte(blake_sigma+16*r+2*i+1); - + s0 = pgm_read_byte(blake_sigma+sigma_idx); + s1 = s0&0xf; + s0 >>= 4;++sigma_idx; + if(sigma_idx>=80){ + sigma_idx-=80; + } lv[0] = v[a]; lv[1] = v[b]; lv[2] = v[c]; @@ -176,90 +179,90 @@ void blake_small_lastBlock(blake_small_ctx_t* ctx, const void* msg, uint16_t len } -uint32_t blake32_iv[] PROGMEM = { +uint32_t blake256_iv[] PROGMEM = { 0x6A09E667L, 0xBB67AE85, 0x3C6EF372L, 0xA54FF53A, 0x510E527FL, 0x9B05688C, 0x1F83D9ABL, 0x5BE0CD19 }; -void blake32_init(blake32_ctx_t* ctx){ +void blake256_init(blake256_ctx_t* ctx){ uint8_t i; for(i=0; i<8; ++i){ - ctx->h[i] = pgm_read_dword(&(blake32_iv[i])); + ctx->h[i] = pgm_read_dword(&(blake256_iv[i])); } memset(ctx->s, 0, 4*4); ctx->counter = 0; ctx->appendone = 1; } -uint32_t blake28_iv[] PROGMEM = { +uint32_t blake224_iv[] PROGMEM = { 0xC1059ED8, 0x367CD507, 0x3070DD17, 0xF70E5939, 0xFFC00B31, 0x68581511, 0x64F98FA7, 0xBEFA4FA4 }; -void blake28_init(blake28_ctx_t* ctx){ +void blake224_init(blake224_ctx_t* ctx){ uint8_t i; for(i=0; i<8; ++i){ - ctx->h[i] = pgm_read_dword(&(blake28_iv[i])); + ctx->h[i] = pgm_read_dword(&(blake224_iv[i])); } memset(ctx->s, 0, 4*4); ctx->counter = 0; ctx->appendone = 0; } -void blake32_ctx2hash(void* dest, const blake32_ctx_t* ctx){ +void blake256_ctx2hash(void* dest, const blake256_ctx_t* ctx){ uint8_t i; for(i=0; i<8; ++i){ ((uint32_t*)dest)[i] = CHANGE_ENDIAN32(ctx->h[i]); } } -void blake28_ctx2hash(void* dest, const blake28_ctx_t* ctx){ +void blake224_ctx2hash(void* dest, const blake224_ctx_t* ctx){ uint8_t i; for(i=0; i<7; ++i){ ((uint32_t*)dest)[i] = CHANGE_ENDIAN32(ctx->h[i]); } } -void blake32_nextBlock(blake32_ctx_t* ctx, const void* block){ +void blake256_nextBlock(blake256_ctx_t* ctx, const void* block){ blake_small_nextBlock(ctx, block); } -void blake28_nextBlock(blake28_ctx_t* ctx, const void* block){ +void blake224_nextBlock(blake224_ctx_t* ctx, const void* block){ blake_small_nextBlock(ctx, block); } -void blake32_lastBlock(blake32_ctx_t* ctx, const void* block, uint16_t length_b){ +void blake256_lastBlock(blake256_ctx_t* ctx, const void* block, uint16_t length_b){ blake_small_lastBlock(ctx, block, length_b); } -void blake28_lastBlock(blake28_ctx_t* ctx, const void* block, uint16_t length_b){ +void blake224_lastBlock(blake224_ctx_t* ctx, const void* block, uint16_t length_b){ blake_small_lastBlock(ctx, block, length_b); } -void blake32(void* dest, const void* msg, uint32_t length_b){ +void blake256(void* dest, const void* msg, uint32_t length_b){ blake_small_ctx_t ctx; - blake32_init(&ctx); + blake256_init(&ctx); while(length_b>=BLAKE_SMALL_BLOCKSIZE){ blake_small_nextBlock(&ctx, msg); msg = (uint8_t*)msg + BLAKE_SMALL_BLOCKSIZE_B; length_b -= BLAKE_SMALL_BLOCKSIZE; } blake_small_lastBlock(&ctx, msg, length_b); - blake32_ctx2hash(dest, &ctx); + blake256_ctx2hash(dest, &ctx); } -void blake28(void* dest, const void* msg, uint32_t length_b){ +void blake224(void* dest, const void* msg, uint32_t length_b){ blake_small_ctx_t ctx; - blake28_init(&ctx); + blake224_init(&ctx); while(length_b>=BLAKE_SMALL_BLOCKSIZE){ blake_small_nextBlock(&ctx, msg); msg = (uint8_t*)msg + BLAKE_SMALL_BLOCKSIZE_B; length_b -= BLAKE_SMALL_BLOCKSIZE; } blake_small_lastBlock(&ctx, msg, length_b); - blake28_ctx2hash(dest, &ctx); + blake224_ctx2hash(dest, &ctx); } diff --git a/blake/blake_small.h b/blake/blake_small.h index 9502344..3d96cf7 100644 --- a/blake/blake_small.h +++ b/blake/blake_small.h @@ -31,10 +31,10 @@ #define BLAKE_SMALL_BLOCKSIZE 512 #define BLAKE_SMALL_BLOCKSIZE_B ((BLAKE_SMALL_BLOCKSIZE+7)/8) -#define BLAKE28_BLOCKSIZE BLAKE_SMALL_BLOCKSIZE -#define BLAKE28_BLOCKSIZE_B BLAKE_SMALL_BLOCKSIZE_B -#define BLAKE32_BLOCKSIZE BLAKE_SMALL_BLOCKSIZE -#define BLAKE32_BLOCKSIZE_B BLAKE_SMALL_BLOCKSIZE_B +#define BLAKE224_BLOCKSIZE BLAKE_SMALL_BLOCKSIZE +#define BLAKE224_BLOCKSIZE_B BLAKE_SMALL_BLOCKSIZE_B +#define BLAKE256_BLOCKSIZE BLAKE_SMALL_BLOCKSIZE +#define BLAKE256_BLOCKSIZE_B BLAKE_SMALL_BLOCKSIZE_B typedef struct { uint32_t h[8]; @@ -43,25 +43,25 @@ typedef struct { uint8_t appendone; } blake_small_ctx_t; -typedef blake_small_ctx_t blake28_ctx_t; -typedef blake_small_ctx_t blake32_ctx_t; +typedef blake_small_ctx_t blake224_ctx_t; +typedef blake_small_ctx_t blake256_ctx_t; -void blake28_init(blake28_ctx_t* ctx); -void blake32_init(blake32_ctx_t* ctx); +void blake224_init(blake224_ctx_t* ctx); +void blake256_init(blake256_ctx_t* ctx); void blake_small_nextBlock(blake_small_ctx_t* ctx, const void* block); void blake_small_lastBlock(blake_small_ctx_t* ctx, const void* block, uint16_t length_b); -void blake28_nextBlock(blake28_ctx_t* ctx, const void* block); -void blake28_lastBlock(blake28_ctx_t* ctx, const void* block, uint16_t length_b); +void blake224_nextBlock(blake224_ctx_t* ctx, const void* block); +void blake224_lastBlock(blake224_ctx_t* ctx, const void* block, uint16_t length_b); -void blake32_nextBlock(blake32_ctx_t* ctx, const void* block); -void blake32_lastBlock(blake32_ctx_t* ctx, const void* block, uint16_t length_b); +void blake256_nextBlock(blake256_ctx_t* ctx, const void* block); +void blake256_lastBlock(blake256_ctx_t* ctx, const void* block, uint16_t length_b); -void blake28_ctx2hash(void* dest, const blake28_ctx_t* ctx); -void blake32_ctx2hash(void* dest, const blake32_ctx_t* ctx); +void blake224_ctx2hash(void* dest, const blake224_ctx_t* ctx); +void blake256_ctx2hash(void* dest, const blake256_ctx_t* ctx); -void blake28(void* dest, const void* msg, uint32_t length_b); -void blake32(void* dest, const void* msg, uint32_t length_b); +void blake224(void* dest, const void* msg, uint32_t length_b); +void blake256(void* dest, const void* msg, uint32_t length_b); #endif /* BLAKE_SMALL_H_ */ diff --git a/hfal/hfal_blake_large.c b/hfal/hfal_blake_large.c index f9f8180..38183eb 100644 --- a/hfal/hfal_blake_large.c +++ b/hfal/hfal_blake_large.c @@ -31,37 +31,37 @@ #include "blake_large.h" -static const char blake48_str[] PROGMEM = "Blake-48"; -static const char blake64_str[] PROGMEM = "Blake-64"; +static const char blake384_str[] PROGMEM = "Blake-384"; +static const char blake512_str[] PROGMEM = "Blake-512"; -const hfdesc_t blake48_desc PROGMEM = { +const hfdesc_t blake384_desc PROGMEM = { HFDESC_TYPE_HASHFUNCTION, 0, - blake48_str, - sizeof(blake48_ctx_t), - BLAKE48_BLOCKSIZE, + blake384_str, + sizeof(blake384_ctx_t), + BLAKE384_BLOCKSIZE, 384, - (hf_init_fpt)blake48_init, + (hf_init_fpt)blake384_init, (hf_nextBlock_fpt)blake_large_nextBlock, (hf_lastBlock_fpt)blake_large_lastBlock, - (hf_ctx2hash_fpt)blake48_ctx2hash, + (hf_ctx2hash_fpt)blake384_ctx2hash, (hf_free_fpt)NULL, - (hf_mem_fpt)blake48 + (hf_mem_fpt)blake384 }; -const hfdesc_t blake64_desc PROGMEM = { +const hfdesc_t blake512_desc PROGMEM = { HFDESC_TYPE_HASHFUNCTION, 0, - blake64_str, - sizeof(blake64_ctx_t), - BLAKE64_BLOCKSIZE, + blake512_str, + sizeof(blake512_ctx_t), + BLAKE512_BLOCKSIZE, 512, - (hf_init_fpt)blake64_init, + (hf_init_fpt)blake512_init, (hf_nextBlock_fpt)blake_large_nextBlock, (hf_lastBlock_fpt)blake_large_lastBlock, - (hf_ctx2hash_fpt)blake64_ctx2hash, + (hf_ctx2hash_fpt)blake512_ctx2hash, (hf_free_fpt)NULL, - (hf_mem_fpt)blake64 + (hf_mem_fpt)blake512 }; diff --git a/hfal/hfal_blake_large.h b/hfal/hfal_blake_large.h index e894689..218a703 100644 --- a/hfal/hfal_blake_large.h +++ b/hfal/hfal_blake_large.h @@ -31,7 +31,7 @@ #include #include "hashfunction_descriptor.h" -extern const hfdesc_t blake48_desc; -extern const hfdesc_t blake64_desc; +extern const hfdesc_t blake384_desc; +extern const hfdesc_t blake512_desc; #endif /* HFAL_BLAKE_LARGE_H_ */ diff --git a/hfal/hfal_blake_small.c b/hfal/hfal_blake_small.c index 1d890f6..b53b450 100644 --- a/hfal/hfal_blake_small.c +++ b/hfal/hfal_blake_small.c @@ -31,37 +31,37 @@ #include "blake_small.h" -static const char blake28_str[] PROGMEM = "Blake-28"; -static const char blake32_str[] PROGMEM = "Blake-32"; +static const char blake224_str[] PROGMEM = "Blake-224"; +static const char blake256_str[] PROGMEM = "Blake-256"; -const hfdesc_t blake28_desc PROGMEM = { +const hfdesc_t blake224_desc PROGMEM = { HFDESC_TYPE_HASHFUNCTION, 0, - blake28_str, - sizeof(blake28_ctx_t), - BLAKE28_BLOCKSIZE, + blake224_str, + sizeof(blake224_ctx_t), + BLAKE224_BLOCKSIZE, 224, - (hf_init_fpt)blake28_init, + (hf_init_fpt)blake224_init, (hf_nextBlock_fpt)blake_small_nextBlock, (hf_lastBlock_fpt)blake_small_lastBlock, - (hf_ctx2hash_fpt)blake28_ctx2hash, + (hf_ctx2hash_fpt)blake224_ctx2hash, (hf_free_fpt)NULL, - (hf_mem_fpt)blake28 + (hf_mem_fpt)blake224 }; -const hfdesc_t blake32_desc PROGMEM = { +const hfdesc_t blake256_desc PROGMEM = { HFDESC_TYPE_HASHFUNCTION, 0, - blake32_str, - sizeof(blake32_ctx_t), - BLAKE32_BLOCKSIZE, + blake256_str, + sizeof(blake256_ctx_t), + BLAKE256_BLOCKSIZE, 256, - (hf_init_fpt)blake32_init, + (hf_init_fpt)blake256_init, (hf_nextBlock_fpt)blake_small_nextBlock, (hf_lastBlock_fpt)blake_small_lastBlock, - (hf_ctx2hash_fpt)blake32_ctx2hash, + (hf_ctx2hash_fpt)blake256_ctx2hash, (hf_free_fpt)NULL, - (hf_mem_fpt)blake32 + (hf_mem_fpt)blake256 }; diff --git a/hfal/hfal_blake_small.h b/hfal/hfal_blake_small.h index 70c8b83..6e0f78b 100644 --- a/hfal/hfal_blake_small.h +++ b/hfal/hfal_blake_small.h @@ -31,7 +31,7 @@ #include #include "hashfunction_descriptor.h" -extern const hfdesc_t blake28_desc; -extern const hfdesc_t blake32_desc; +extern const hfdesc_t blake224_desc; +extern const hfdesc_t blake256_desc; #endif /* HFAL_BLAKE_SMALL_H_ */ diff --git a/jh/jh_simple_small_core.c b/jh/jh_simple_small_core.c index 15d8571..907d48a 100644 --- a/jh/jh_simple_small_core.c +++ b/jh/jh_simple_small_core.c @@ -150,21 +150,11 @@ void jh_encrypt(uint8_t* a){ for(i=0;i<32;++i){ rc[i] = pgm_read_byte(&(round_const_0[i])); } - for(i=0;i<35;++i){ + for(i=0;i<42;++i){ jh_round(a, rc); jh_next_round_const(rc); } - uint8_t r=0,x,y; - for(i=0; i<128; ++i){ - if(i%4==0){ - r = rc[i/4]; - } - x = pgm_read_byte(((r&0x80)?sbox1:sbox0)+(a[i]>>4)); - y = pgm_read_byte(((r&0x40)?sbox1:sbox0)+(a[i]&0xf)); - a[i]=(x<<4)|y; - r<<=2; - } /* degrouping */ #if DEBUG cli_putstr_P(PSTR("\r\n== pre degroup ==\r\n")); diff --git a/jh/jh_simple_speed_core.c b/jh/jh_simple_speed_core.c index 47a2938..94c029c 100644 --- a/jh/jh_simple_speed_core.c +++ b/jh/jh_simple_speed_core.c @@ -119,20 +119,10 @@ void jh_encrypt(uint8_t* a){ cli_hexdump_block(a, 128, 4, 16); #endif group(a); - for(i=0;i<35;++i){ + for(i=0;i<42;++i){ jh_round(a, i); } - uint8_t r=0; - uint8_t *pr; - pr = jh_round_const + 32*35; - for(i=0; i<128; ++i){ - if(i%4==0){ - r = pgm_read_byte(pr++); - } - a[i]=jh_l_inv(pgm_read_byte(&(jh_lutbox[((r&0xC0)<<2)|a[i]]))); - r<<=2; - } /* degrouping */ #if DEBUG cli_putstr_P(PSTR("\r\n== pre degroup ==\r\n")); diff --git a/jh/jh_tablegen.rb b/jh/jh_tablegen.rb index 5862a0e..1d71457 100644 --- a/jh/jh_tablegen.rb +++ b/jh/jh_tablegen.rb @@ -238,6 +238,30 @@ def single_round(data, round) return b end +def next_rc(data) + a = Array.new +=begin + printf("\n== rc round ==\n\t") + 4.times do |y| + 8.times do |x| + printf("%02X ", data[8*y+x]) + end + print("\n\t") + end +=end + 32.times do |idx| + x,y=split_byte($lutbox[0][data[idx]]) + a << x << y +# if(x==nil)or(y==nil) +# printf("DBG: idx=%2d, x=%2x, y=%2x", idx, x, y) +# end + end + a = permutation(a, 6) + b = Array.new + 32.times {|idx| b << join_nibbles(a[2*idx],a[2*idx+1])} + return b +end + def encrypt(data) =begin print("\n== ENCRYPT ==\n") @@ -345,3 +369,20 @@ end #=end puts("") +c0 = [ 0x6a, 0x09, 0xe6, 0x67, 0xf3, 0xbc, 0xc9, 0x08, + 0xb2, 0xfb, 0x13, 0x66, 0xea, 0x95, 0x7d, 0x3e, + 0x3a, 0xde, 0xc1, 0x75, 0x12, 0x77, 0x50, 0x99, + 0xda, 0x2f, 0x59, 0x0b, 0x06, 0x67, 0x32, 0x2a ] + +rc = c0 +42.times do |i| + printf("/* C_%02d: */\n", i) + 4.times do |y| + printf("\t") + 8.times do |x| + printf("0x%02x, ", rc[y*8+x]) + end + printf("\n") + end + rc = next_rc(rc) +end diff --git a/jh/jh_tables.c b/jh/jh_tables.c index ad3cd44..33c83a4 100644 --- a/jh/jh_tables.c +++ b/jh/jh_tables.c @@ -113,40 +113,214 @@ uint8_t jh_lutbox[] PROGMEM = { }; uint8_t jh_round_const[] PROGMEM = { - 0x6a, 0x09, 0xe6, 0x67, 0xf3, 0xbc, 0xc9, 0x08, 0xb2, 0xfb, 0x13, 0x66, 0xea, 0x95, 0x7d, 0x3e, 0x3a, 0xde, 0xc1, 0x75, 0x12, 0x77, 0x50, 0x99, 0xda, 0x2f, 0x59, 0x0b, 0x06, 0x67, 0x32, 0x2a, - 0xbb, 0x89, 0x6b, 0xf0, 0x59, 0x55, 0xab, 0xcd, 0x52, 0x81, 0x82, 0x8d, 0x66, 0xe7, 0xd9, 0x9a, 0xc4, 0x20, 0x34, 0x94, 0xf8, 0x9b, 0xf1, 0x28, 0x17, 0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, 0xbc, 0xc9, 0x08, + 0xb2, 0xfb, 0x13, 0x66, 0xea, 0x95, 0x7d, 0x3e, + 0x3a, 0xde, 0xc1, 0x75, 0x12, 0x77, 0x50, 0x99, + 0xda, 0x2f, 0x59, 0x0b, 0x06, 0x67, 0x32, 0x2a, + /* C_01: */ + 0xbb, 0x89, 0x6b, 0xf0, 0x59, 0x55, 0xab, 0xcd, + 0x52, 0x81, 0x82, 0x8d, 0x66, 0xe7, 0xd9, 0x9a, + 0xc4, 0x20, 0x34, 0x94, 0xf8, 0x9b, 0xf1, 0x28, + 0x17, 0xde, 0xb4, 0x32, 0x88, 0x71, 0x22, 0x31, + /* C_02: */ + 0x18, 0x36, 0xe7, 0x6b, 0x12, 0xd7, 0x9c, 0x55, + 0x11, 0x8a, 0x11, 0x39, 0xd2, 0x41, 0x7d, 0xf5, + 0x2a, 0x20, 0x21, 0x22, 0x5f, 0xf6, 0x35, 0x00, + 0x63, 0xd8, 0x8e, 0x5f, 0x1f, 0x91, 0x63, 0x1c, + /* C_03: */ + 0x26, 0x30, 0x85, 0xa7, 0x00, 0x0f, 0xa9, 0xc3, + 0x31, 0x7c, 0x6c, 0xa8, 0xab, 0x65, 0xf7, 0xa7, + 0x71, 0x3c, 0xf4, 0x20, 0x10, 0x60, 0xce, 0x88, + 0x6a, 0xf8, 0x55, 0xa9, 0x0d, 0x6a, 0x4e, 0xed, + /* C_04: */ + 0x1c, 0xeb, 0xaf, 0xd5, 0x1a, 0x15, 0x6a, 0xeb, + 0x62, 0xa1, 0x1f, 0xb3, 0xbe, 0x2e, 0x14, 0xf6, + 0x0b, 0x7e, 0x48, 0xde, 0x85, 0x81, 0x42, 0x70, + 0xfd, 0x62, 0xe9, 0x76, 0x14, 0xd7, 0xb4, 0x41, + /* C_05: */ + 0xe5, 0x56, 0x4c, 0xb5, 0x74, 0xf7, 0xe0, 0x9c, + 0x75, 0xe2, 0xe2, 0x44, 0x92, 0x9e, 0x95, 0x49, + 0x27, 0x9a, 0xb2, 0x24, 0xa2, 0x8e, 0x44, 0x5d, + 0x57, 0x18, 0x5e, 0x7d, 0x7a, 0x09, 0xfd, 0xc1, + /* C_06: */ + 0x58, 0x20, 0xf0, 0xf0, 0xd7, 0x64, 0xcf, 0xf3, + 0xa5, 0x55, 0x2a, 0x5e, 0x41, 0xa8, 0x2b, 0x9e, + 0xff, 0x6e, 0xe0, 0xaa, 0x61, 0x57, 0x73, 0xbb, + 0x07, 0xe8, 0x60, 0x34, 0x24, 0xc3, 0xcf, 0x8a, + /* C_07: */ + 0xb1, 0x26, 0xfb, 0x74, 0x17, 0x33, 0xc5, 0xbf, + 0xce, 0xf6, 0xf4, 0x3a, 0x62, 0xe8, 0xe5, 0x70, + 0x6a, 0x26, 0x65, 0x60, 0x28, 0xaa, 0x89, 0x7e, + 0xc1, 0xea, 0x46, 0x16, 0xce, 0x8f, 0xd5, 0x10, + /* C_08: */ + 0xdb, 0xf0, 0xde, 0x32, 0xbc, 0xa7, 0x72, 0x54, + 0xbb, 0x4f, 0x56, 0x25, 0x81, 0xa3, 0xbc, 0x99, + 0x1c, 0xf9, 0x4f, 0x22, 0x56, 0x52, 0xc2, 0x7f, + 0x14, 0xea, 0xe9, 0x58, 0xae, 0x6a, 0xa6, 0x16, + /* C_09: */ + 0xe6, 0x11, 0x3b, 0xe6, 0x17, 0xf4, 0x5f, 0x3d, + 0xe5, 0x3c, 0xff, 0x03, 0x91, 0x9a, 0x94, 0xc3, + 0x2c, 0x92, 0x7b, 0x09, 0x3a, 0xc8, 0xf2, 0x3b, + 0x47, 0xf7, 0x18, 0x9a, 0xad, 0xb9, 0xbc, 0x67, + /* C_10: */ + 0x80, 0xd0, 0xd2, 0x60, 0x52, 0xca, 0x45, 0xd5, + 0x93, 0xab, 0x5f, 0xb3, 0x10, 0x25, 0x06, 0x39, + 0x00, 0x83, 0xaf, 0xb5, 0xff, 0xe1, 0x07, 0xda, + 0xcf, 0xcb, 0xa7, 0xdb, 0xe6, 0x01, 0xa1, 0x2b, + /* C_11: */ + 0x43, 0xaf, 0x1c, 0x76, 0x12, 0x67, 0x14, 0xdf, + 0xa9, 0x50, 0xc3, 0x68, 0x78, 0x7c, 0x81, 0xae, + 0x3b, 0xee, 0xcf, 0x95, 0x6c, 0x85, 0xc9, 0x62, + 0x08, 0x6a, 0xe1, 0x6e, 0x40, 0xeb, 0xb0, 0xb4, + /* C_12: */ + 0x9a, 0xee, 0x89, 0x94, 0xd2, 0xd7, 0x4a, 0x5c, + 0xdb, 0x7b, 0x1e, 0xf2, 0x94, 0xee, 0xd5, 0xc1, + 0x52, 0x07, 0x24, 0xdd, 0x8e, 0xd5, 0x8c, 0x92, + 0xd3, 0xf0, 0xe1, 0x74, 0xb0, 0xc3, 0x20, 0x45, + /* C_13: */ + 0x0b, 0x2a, 0xa5, 0x8c, 0xeb, 0x3b, 0xdb, 0x9e, + 0x1e, 0xef, 0x66, 0xb3, 0x76, 0xe0, 0xc5, 0x65, + 0xd5, 0xd8, 0xfe, 0x7b, 0xac, 0xb8, 0xda, 0x86, + 0x6f, 0x85, 0x9a, 0xc5, 0x21, 0xf3, 0xd5, 0x71, + /* C_14: */ + 0x7a, 0x15, 0x23, 0xef, 0x3d, 0x97, 0x0a, 0x3a, + 0x9b, 0x0b, 0x4d, 0x61, 0x0e, 0x02, 0x74, 0x9d, + 0x37, 0xb8, 0xd5, 0x7c, 0x18, 0x85, 0xfe, 0x42, + 0x06, 0xa7, 0xf3, 0x38, 0xe8, 0x35, 0x68, 0x66, + /* C_15: */ + 0x2c, 0x2d, 0xb8, 0xf7, 0x87, 0x66, 0x85, 0xf2, + 0xcd, 0x9a, 0x2e, 0x0d, 0xdb, 0x64, 0xc9, 0xd5, + 0xbf, 0x13, 0x90, 0x53, 0x71, 0xfc, 0x39, 0xe0, + 0xfa, 0x86, 0xe1, 0x47, 0x72, 0x34, 0xa2, 0x97, + /* C_16: */ + 0x9d, 0xf0, 0x85, 0xeb, 0x25, 0x44, 0xeb, 0xf6, + 0x2b, 0x50, 0x68, 0x6a, 0x71, 0xe6, 0xe8, 0x28, + 0xdf, 0xed, 0x9d, 0xbe, 0x0b, 0x10, 0x6c, 0x94, + 0x52, 0xce, 0xdd, 0xff, 0x3d, 0x13, 0x89, 0x90, + /* C_17: */ + 0xe6, 0xe5, 0xc4, 0x2c, 0xb2, 0xd4, 0x60, 0xc9, + 0xd6, 0xe4, 0x79, 0x1a, 0x16, 0x81, 0xbb, 0x2e, + 0x22, 0x2e, 0x54, 0x55, 0x8e, 0xb7, 0x8d, 0x52, + 0x44, 0xe2, 0x17, 0xd1, 0xbf, 0xcf, 0x50, 0x58, + /* C_18: */ + 0x8f, 0x1f, 0x57, 0xe4, 0x4e, 0x12, 0x62, 0x10, + 0xf0, 0x07, 0x63, 0xff, 0x57, 0xda, 0x20, 0x8a, + 0x50, 0x93, 0xb8, 0xff, 0x79, 0x47, 0x53, 0x4a, + 0x4c, 0x26, 0x0a, 0x17, 0x64, 0x2f, 0x72, 0xb2, + /* C_19: */ + 0xae, 0x4e, 0xf4, 0x79, 0x2e, 0xa1, 0x48, 0x60, + 0x8c, 0xf1, 0x16, 0xcb, 0x2b, 0xff, 0x66, 0xe8, + 0xfc, 0x74, 0x81, 0x12, 0x66, 0xcd, 0x64, 0x11, + 0x12, 0xcd, 0x17, 0x80, 0x1e, 0xd3, 0x8b, 0x59, + /* C_20: */ + 0x91, 0xa7, 0x44, 0xef, 0xbf, 0x68, 0xb1, 0x92, + 0xd0, 0x54, 0x9b, 0x60, 0x8b, 0xdb, 0x31, 0x91, + 0xfc, 0x12, 0xa0, 0xe8, 0x35, 0x43, 0xce, 0xc5, + 0xf8, 0x82, 0x25, 0x0b, 0x24, 0x4f, 0x78, 0xe4, + /* C_21: */ + 0x4b, 0x5d, 0x27, 0xd3, 0x36, 0x8f, 0x9c, 0x17, + 0xd4, 0xb2, 0xa2, 0xb2, 0x16, 0xc7, 0xe7, 0x4e, + 0x77, 0x14, 0xd2, 0xcc, 0x03, 0xe1, 0xe4, 0x45, + 0x88, 0xcd, 0x99, 0x36, 0xde, 0x74, 0x35, 0x7c, + /* C_22: */ + 0x0e, 0xa1, 0x7c, 0xaf, 0xb8, 0x28, 0x61, 0x31, + 0xbd, 0xa9, 0xe3, 0x75, 0x7b, 0x36, 0x10, 0xaa, + 0x3f, 0x77, 0xa6, 0xd0, 0x57, 0x50, 0x53, 0xfc, + 0x92, 0x6e, 0xea, 0x7e, 0x23, 0x7d, 0xf2, 0x89, + /* C_23: */ + 0x84, 0x8a, 0xf9, 0xf5, 0x7e, 0xb1, 0xa6, 0x16, + 0xe2, 0xc3, 0x42, 0xc8, 0xce, 0xa5, 0x28, 0xb8, + 0xa9, 0x5a, 0x5d, 0x16, 0xd9, 0xd8, 0x7b, 0xe9, + 0xbb, 0x37, 0x84, 0xd0, 0xc3, 0x51, 0xc3, 0x2b, + /* C_24: */ + 0xc0, 0x43, 0x5c, 0xc3, 0x65, 0x4f, 0xb8, 0x5d, + 0xd9, 0x33, 0x5b, 0xa9, 0x1a, 0xc3, 0xdb, 0xde, + 0x1f, 0x85, 0xd5, 0x67, 0xd7, 0xad, 0x16, 0xf9, + 0xde, 0x6e, 0x00, 0x9b, 0xca, 0x3f, 0x95, 0xb5, + /* C_25: */ + 0x92, 0x75, 0x47, 0xfe, 0x5e, 0x5e, 0x45, 0xe2, + 0xfe, 0x99, 0xf1, 0x65, 0x1e, 0xa1, 0xcb, 0xf0, + 0x97, 0xdc, 0x3a, 0x3d, 0x40, 0xdd, 0xd2, 0x1c, + 0xee, 0x26, 0x05, 0x43, 0xc2, 0x88, 0xec, 0x6b, + /* C_26: */ + 0xc1, 0x17, 0xa3, 0x77, 0x0d, 0x3a, 0x34, 0x46, + 0x9d, 0x50, 0xdf, 0xa7, 0xdb, 0x02, 0x03, 0x00, + 0xd3, 0x06, 0xa3, 0x65, 0x37, 0x4f, 0xa8, 0x28, + 0xc8, 0xb7, 0x80, 0xee, 0x1b, 0x9d, 0x7a, 0x34, + /* C_27: */ + 0x8f, 0xf2, 0x17, 0x8a, 0xe2, 0xdb, 0xe5, 0xe8, + 0x72, 0xfa, 0xc7, 0x89, 0xa3, 0x4b, 0xc2, 0x28, + 0xde, 0xbf, 0x54, 0xa8, 0x82, 0x74, 0x3c, 0xaa, + 0xd1, 0x4f, 0x3a, 0x55, 0x0f, 0xdb, 0xe6, 0x8f, + /* C_28: */ + 0xab, 0xd0, 0x6c, 0x52, 0xed, 0x58, 0xff, 0x09, + 0x12, 0x05, 0xd0, 0xf6, 0x27, 0x57, 0x4c, 0x8c, + 0xbc, 0x1f, 0xe7, 0xcf, 0x79, 0x21, 0x0f, 0x5a, + 0x22, 0x86, 0xf6, 0xe2, 0x3a, 0x27, 0xef, 0xa0, + /* C_29: */ + 0x63, 0x1f, 0x4a, 0xcb, 0x8d, 0x3c, 0xa4, 0x25, + 0x3e, 0x30, 0x18, 0x49, 0xf1, 0x57, 0x57, 0x1d, + 0x32, 0x11, 0xb6, 0xc1, 0x04, 0x53, 0x47, 0xbe, + 0xfb, 0x7c, 0x77, 0xdf, 0x3c, 0x6c, 0xa7, 0xbd, + /* C_30: */ + 0xae, 0x88, 0xf2, 0x34, 0x2c, 0x23, 0x34, 0x45, + 0x90, 0xbe, 0x20, 0x14, 0xfa, 0xb4, 0xf1, 0x79, + 0xfd, 0x4b, 0xf7, 0xc9, 0x0d, 0xb1, 0x4f, 0xa4, + 0x01, 0x8f, 0xcc, 0xe6, 0x89, 0xd2, 0x12, 0x7b, + /* C_31: */ + 0x93, 0xb8, 0x93, 0x85, 0x54, 0x6d, 0x71, 0x37, + 0x9f, 0xe4, 0x1c, 0x39, 0xbc, 0x60, 0x2e, 0x8b, + 0x7c, 0x8b, 0x2f, 0x78, 0xee, 0x91, 0x4d, 0x1f, + 0x0a, 0xf0, 0xd4, 0x37, 0xa1, 0x89, 0xa8, 0xa4, + /* C_32: */ + 0x1d, 0x1e, 0x03, 0x6a, 0xbe, 0xef, 0x3f, 0x44, + 0x84, 0x8c, 0xd7, 0x6e, 0xf6, 0xba, 0xa8, 0x89, + 0xfc, 0xec, 0x56, 0xcd, 0x79, 0x67, 0xeb, 0x90, + 0x9a, 0x46, 0x4b, 0xfc, 0x23, 0xc7, 0x24, 0x35, + /* C_33: */ + 0xa8, 0xe4, 0xed, 0xe4, 0xc5, 0xfe, 0x5e, 0x88, + 0xd4, 0xfb, 0x19, 0x2e, 0x0a, 0x08, 0x21, 0xe9, + 0x35, 0xba, 0x14, 0x5b, 0xbf, 0xc5, 0x9c, 0x25, + 0x08, 0x28, 0x27, 0x55, 0xa5, 0xdf, 0x53, 0xa5, + /* C_34: */ + 0x8e, 0x4e, 0x37, 0xa3, 0xb9, 0x70, 0xf0, 0x79, + 0xae, 0x9d, 0x22, 0xa4, 0x99, 0xa7, 0x14, 0xc8, + 0x75, 0x76, 0x02, 0x73, 0xf7, 0x4a, 0x93, 0x98, + 0x99, 0x5d, 0x32, 0xc0, 0x50, 0x27, 0xd8, 0x10, + /* C_35: */ + 0x61, 0xcf, 0xa4, 0x27, 0x92, 0xf9, 0x3b, 0x9f, + 0xde, 0x36, 0xeb, 0x16, 0x3e, 0x97, 0x87, 0x09, + 0xfa, 0xfa, 0x76, 0x16, 0xec, 0x3c, 0x7d, 0xad, + 0x01, 0x35, 0x80, 0x6c, 0x3d, 0x91, 0xa2, 0x1b, + /* C_36: */ + 0xf0, 0x37, 0xc5, 0xd9, 0x16, 0x23, 0x28, 0x8b, + 0x7d, 0x03, 0x02, 0xc1, 0xb9, 0x41, 0xb7, 0x26, + 0x76, 0xa9, 0x43, 0xb3, 0x72, 0x65, 0x9d, 0xcd, + 0x7d, 0x6e, 0xf4, 0x08, 0xa1, 0x1b, 0x40, 0xc0, + /* C_37: */ + 0x2a, 0x30, 0x63, 0x54, 0xca, 0x3e, 0xa9, 0x0b, + 0x0e, 0x97, 0xea, 0xeb, 0xce, 0xa0, 0xa6, 0xd7, + 0xc6, 0x52, 0x23, 0x99, 0xe8, 0x85, 0xc6, 0x13, + 0xde, 0x82, 0x49, 0x22, 0xc8, 0x92, 0xc4, 0x90, + /* C_38: */ + 0x3c, 0xa6, 0xcd, 0xd7, 0x88, 0xa5, 0xbd, 0xc5, + 0xef, 0x2d, 0xce, 0xeb, 0x16, 0xbc, 0xa3, 0x1e, + 0x0a, 0x0d, 0x2c, 0x7e, 0x99, 0x21, 0xb6, 0xf7, + 0x1d, 0x33, 0xe2, 0x5d, 0xd2, 0xf3, 0xcf, 0x53, + /* C_39: */ + 0xf7, 0x25, 0x78, 0x72, 0x1d, 0xb5, 0x6b, 0xf8, + 0xf4, 0x95, 0x38, 0xb0, 0xae, 0x6e, 0xa4, 0x70, + 0xc2, 0xfb, 0x13, 0x39, 0xdd, 0x26, 0x33, 0x3f, + 0x13, 0x5f, 0x7d, 0xef, 0x45, 0x37, 0x6e, 0xc0, + /* C_40: */ + 0xe4, 0x49, 0xa0, 0x3e, 0xab, 0x35, 0x9e, 0x34, + 0x09, 0x5f, 0x8b, 0x4b, 0x55, 0xcd, 0x7a, 0xc7, + 0xc0, 0xec, 0x65, 0x10, 0xf2, 0xc4, 0xcc, 0x79, + 0xfa, 0x6b, 0x1f, 0xee, 0x6b, 0x18, 0xc5, 0x9e, + /* C_41: */ + 0x73, 0xbd, 0x69, 0x78, 0xc5, 0x9f, 0x2b, 0x21, + 0x94, 0x49, 0xb3, 0x67, 0x70, 0xfb, 0x31, 0x3f, + 0xbe, 0x2d, 0xa2, 0x8f, 0x6b, 0x04, 0x27, 0x5f, + 0x07, 0x1a, 0x1b, 0x19, 0x3d, 0xde, 0x20, 0x72 }; diff --git a/test_src/main-blake-test.c b/test_src/main-blake-test.c index 6b18c38..ea7e7c8 100644 --- a/test_src/main-blake-test.c +++ b/test_src/main-blake-test.c @@ -46,10 +46,10 @@ char* algo_name = "Blake"; const hfdesc_t* algolist[] PROGMEM = { - (hfdesc_t*)&blake28_desc, - (hfdesc_t*)&blake32_desc, - (hfdesc_t*)&blake48_desc, - (hfdesc_t*)&blake64_desc, + (hfdesc_t*)&blake224_desc, + (hfdesc_t*)&blake256_desc, + (hfdesc_t*)&blake384_desc, + (hfdesc_t*)&blake512_desc, NULL }; @@ -60,40 +60,44 @@ const hfdesc_t* algolist[] PROGMEM = { void testrun_nessie_blake(void){ hfal_nessie_multiple(algolist); } -void blake28_test(void* msg, uint32_t length_b){ - hfal_test(&blake28_desc, msg, length_b); +void blake224_test(void* msg, uint32_t length_b){ + hfal_test(&blake224_desc, msg, length_b); } -void blake32_test(void* msg, uint32_t length_b){ - hfal_test(&blake32_desc, msg, length_b); +void blake256_test(void* msg, uint32_t length_b){ + hfal_test(&blake256_desc, msg, length_b); } -void blake48_test(void* msg, uint32_t length_b){ - hfal_test(&blake48_desc, msg, length_b); +void blake384_test(void* msg, uint32_t length_b){ + hfal_test(&blake384_desc, msg, length_b); } -void blake64_test(void* msg, uint32_t length_b){ - hfal_test(&blake64_desc, msg, length_b); +void blake512_test(void* msg, uint32_t length_b){ + hfal_test(&blake512_desc, msg, length_b); } void testrun_stdtest_blake(void){ uint8_t msg1[144]; memset(msg1, 0, 144); - blake28_test("", 8); - blake28_test(msg1, 576); - blake32_test("", 8); - blake32_test(msg1, 576); - blake48_test("", 8); - blake48_test(msg1, 1152); - blake64_test("", 8); - blake64_test(msg1, 1152); + blake224_test("", 0); + blake224_test("", 8); + blake224_test(msg1, 576); + blake256_test("", 0); + blake256_test("", 8); + blake256_test(msg1, 576); + blake384_test("", 0); + blake384_test("", 8); + blake384_test(msg1, 1152); + blake512_test("", 0); + blake512_test("", 8); + blake512_test(msg1, 1152); } void testshort(void){ - blake32_test("", 8); + blake256_test("", 8); } void testlshort(void){ - blake64_test("", 8); + blake512_test("", 8); } void test512_32(void){ @@ -105,7 +109,7 @@ void test512_32(void){ 0xDC, 0xDE, 0x57, 0x9A, 0x37, 0xE1, 0x50, 0xEF, 0xBE, 0xF5, 0x55, 0x5B, 0x4C, 0x1C, 0xB4, 0x04, 0x39, 0xD8, 0x35, 0xA7, 0x24, 0xE2, 0xFA, 0xE7 }; - blake32_test(d, 512); + blake256_test(d, 512); } void performance_blake(void){ @@ -150,7 +154,7 @@ int main (void){ cli_rx = (cli_rx_fpt)uart0_getc; cli_tx = (cli_tx_fpt)uart0_putc; shavs_algolist=(hfdesc_t**)algolist; - shavs_algo=(hfdesc_t*)&blake32_desc; + shavs_algo=(hfdesc_t*)&blake256_desc; for(;;){ cli_putstr_P(PSTR("\r\n\r\nCrypto-VS (")); cli_putstr(algo_name); diff --git a/testconf/Blake.conf b/testconf/Blake.conf index 9444a0f..243d106 100644 --- a/testconf/Blake.conf +++ b/testconf/Blake.conf @@ -1,20 +1,20 @@ -[Blake-28] +[Blake-224] algo=a file_0=testvectors/shavs/Blake/ShortMsgKAT_224.txt file_1=testvectors/shavs/Blake/LongMsgKAT_224.txt -[Blake-32] +[Blake-256] algo=b file_0=testvectors/shavs/Blake/ShortMsgKAT_256.txt file_1=testvectors/shavs/Blake/LongMsgKAT_256.txt -[Blake-48] +[Blake-384] algo=c file_0=testvectors/shavs/Blake/ShortMsgKAT_384.txt file_1=testvectors/shavs/Blake/LongMsgKAT_384.txt -[Blake-64] +[Blake-512] algo=d file_0=testvectors/shavs/Blake/ShortMsgKAT_512.txt file_1=testvectors/shavs/Blake/LongMsgKAT_512.txt diff --git a/testvectors/shavs/JH/ExtremelyLongMsgKAT_224.txt b/testvectors/JH-round2/ExtremelyLongMsgKAT_224.txt similarity index 100% rename from testvectors/shavs/JH/ExtremelyLongMsgKAT_224.txt rename to testvectors/JH-round2/ExtremelyLongMsgKAT_224.txt diff --git a/testvectors/shavs/JH/ExtremelyLongMsgKAT_256.txt b/testvectors/JH-round2/ExtremelyLongMsgKAT_256.txt similarity index 100% rename from testvectors/shavs/JH/ExtremelyLongMsgKAT_256.txt rename to testvectors/JH-round2/ExtremelyLongMsgKAT_256.txt diff --git a/testvectors/shavs/JH/ExtremelyLongMsgKAT_384.txt b/testvectors/JH-round2/ExtremelyLongMsgKAT_384.txt similarity index 100% rename from testvectors/shavs/JH/ExtremelyLongMsgKAT_384.txt rename to testvectors/JH-round2/ExtremelyLongMsgKAT_384.txt diff --git a/testvectors/shavs/JH/ExtremelyLongMsgKAT_512.txt b/testvectors/JH-round2/ExtremelyLongMsgKAT_512.txt similarity index 100% rename from testvectors/shavs/JH/ExtremelyLongMsgKAT_512.txt rename to testvectors/JH-round2/ExtremelyLongMsgKAT_512.txt diff --git a/testvectors/shavs/JH/LongMsgKAT_224.txt b/testvectors/JH-round2/LongMsgKAT_224.txt similarity index 100% rename from testvectors/shavs/JH/LongMsgKAT_224.txt rename to testvectors/JH-round2/LongMsgKAT_224.txt diff --git a/testvectors/shavs/JH/LongMsgKAT_256.txt b/testvectors/JH-round2/LongMsgKAT_256.txt similarity index 100% rename from testvectors/shavs/JH/LongMsgKAT_256.txt rename to testvectors/JH-round2/LongMsgKAT_256.txt diff --git a/testvectors/shavs/JH/LongMsgKAT_384.txt b/testvectors/JH-round2/LongMsgKAT_384.txt similarity index 100% rename from testvectors/shavs/JH/LongMsgKAT_384.txt rename to testvectors/JH-round2/LongMsgKAT_384.txt diff --git a/testvectors/shavs/JH/LongMsgKAT_512.txt b/testvectors/JH-round2/LongMsgKAT_512.txt similarity index 100% rename from testvectors/shavs/JH/LongMsgKAT_512.txt rename to testvectors/JH-round2/LongMsgKAT_512.txt diff --git a/testvectors/shavs/JH/MonteCarlo_224.txt b/testvectors/JH-round2/MonteCarlo_224.txt similarity index 100% rename from testvectors/shavs/JH/MonteCarlo_224.txt rename to testvectors/JH-round2/MonteCarlo_224.txt diff --git a/testvectors/shavs/JH/MonteCarlo_256.txt b/testvectors/JH-round2/MonteCarlo_256.txt similarity index 100% rename from testvectors/shavs/JH/MonteCarlo_256.txt rename to testvectors/JH-round2/MonteCarlo_256.txt diff --git a/testvectors/shavs/JH/MonteCarlo_384.txt b/testvectors/JH-round2/MonteCarlo_384.txt similarity index 100% rename from testvectors/shavs/JH/MonteCarlo_384.txt rename to testvectors/JH-round2/MonteCarlo_384.txt diff --git a/testvectors/shavs/JH/MonteCarlo_512.txt b/testvectors/JH-round2/MonteCarlo_512.txt similarity index 100% rename from testvectors/shavs/JH/MonteCarlo_512.txt rename to testvectors/JH-round2/MonteCarlo_512.txt diff --git a/testvectors/shavs/JH/ShortMsgKAT_224.txt b/testvectors/JH-round2/ShortMsgKAT_224.txt similarity index 100% rename from testvectors/shavs/JH/ShortMsgKAT_224.txt rename to testvectors/JH-round2/ShortMsgKAT_224.txt diff --git a/testvectors/shavs/JH/ShortMsgKAT_256.txt b/testvectors/JH-round2/ShortMsgKAT_256.txt similarity index 100% rename from testvectors/shavs/JH/ShortMsgKAT_256.txt rename to testvectors/JH-round2/ShortMsgKAT_256.txt diff --git a/testvectors/shavs/JH/ShortMsgKAT_384.txt b/testvectors/JH-round2/ShortMsgKAT_384.txt similarity index 100% rename from testvectors/shavs/JH/ShortMsgKAT_384.txt rename to testvectors/JH-round2/ShortMsgKAT_384.txt diff --git a/testvectors/shavs/JH/ShortMsgKAT_512.txt b/testvectors/JH-round2/ShortMsgKAT_512.txt similarity index 100% rename from testvectors/shavs/JH/ShortMsgKAT_512.txt rename to testvectors/JH-round2/ShortMsgKAT_512.txt diff --git a/testvectors/shavs/Blake/ExtremelyLongMsgKAT.txt b/testvectors/shavs/Blake-round2/ExtremelyLongMsgKAT.txt similarity index 100% rename from testvectors/shavs/Blake/ExtremelyLongMsgKAT.txt rename to testvectors/shavs/Blake-round2/ExtremelyLongMsgKAT.txt diff --git a/testvectors/shavs/Blake/ExtremelyLongMsgKAT_224.txt b/testvectors/shavs/Blake-round2/ExtremelyLongMsgKAT_224.txt similarity index 100% rename from testvectors/shavs/Blake/ExtremelyLongMsgKAT_224.txt rename to testvectors/shavs/Blake-round2/ExtremelyLongMsgKAT_224.txt diff --git a/testvectors/shavs/Blake/ExtremelyLongMsgKAT_256.txt b/testvectors/shavs/Blake-round2/ExtremelyLongMsgKAT_256.txt similarity index 100% rename from testvectors/shavs/Blake/ExtremelyLongMsgKAT_256.txt rename to testvectors/shavs/Blake-round2/ExtremelyLongMsgKAT_256.txt diff --git a/testvectors/shavs/Blake/ExtremelyLongMsgKAT_384.txt b/testvectors/shavs/Blake-round2/ExtremelyLongMsgKAT_384.txt similarity index 100% rename from testvectors/shavs/Blake/ExtremelyLongMsgKAT_384.txt rename to testvectors/shavs/Blake-round2/ExtremelyLongMsgKAT_384.txt diff --git a/testvectors/shavs/Blake/ExtremelyLongMsgKAT_512.txt b/testvectors/shavs/Blake-round2/ExtremelyLongMsgKAT_512.txt similarity index 100% rename from testvectors/shavs/Blake/ExtremelyLongMsgKAT_512.txt rename to testvectors/shavs/Blake-round2/ExtremelyLongMsgKAT_512.txt diff --git a/testvectors/shavs/Blake/LongMsgKAT.txt b/testvectors/shavs/Blake-round2/LongMsgKAT.txt similarity index 100% rename from testvectors/shavs/Blake/LongMsgKAT.txt rename to testvectors/shavs/Blake-round2/LongMsgKAT.txt diff --git a/testvectors/shavs/Blake/LongMsgKAT_224.txt b/testvectors/shavs/Blake-round2/LongMsgKAT_224.txt similarity index 100% rename from testvectors/shavs/Blake/LongMsgKAT_224.txt rename to testvectors/shavs/Blake-round2/LongMsgKAT_224.txt diff --git a/testvectors/shavs/Blake/LongMsgKAT_256.txt b/testvectors/shavs/Blake-round2/LongMsgKAT_256.txt similarity index 100% rename from testvectors/shavs/Blake/LongMsgKAT_256.txt rename to testvectors/shavs/Blake-round2/LongMsgKAT_256.txt diff --git a/testvectors/shavs/Blake/LongMsgKAT_384.txt b/testvectors/shavs/Blake-round2/LongMsgKAT_384.txt similarity index 100% rename from testvectors/shavs/Blake/LongMsgKAT_384.txt rename to testvectors/shavs/Blake-round2/LongMsgKAT_384.txt diff --git a/testvectors/shavs/Blake/LongMsgKAT_512.txt b/testvectors/shavs/Blake-round2/LongMsgKAT_512.txt similarity index 100% rename from testvectors/shavs/Blake/LongMsgKAT_512.txt rename to testvectors/shavs/Blake-round2/LongMsgKAT_512.txt diff --git a/testvectors/shavs/Blake/MonteCarlo.txt b/testvectors/shavs/Blake-round2/MonteCarlo.txt similarity index 100% rename from testvectors/shavs/Blake/MonteCarlo.txt rename to testvectors/shavs/Blake-round2/MonteCarlo.txt diff --git a/testvectors/shavs/Blake/MonteCarlo_224.txt b/testvectors/shavs/Blake-round2/MonteCarlo_224.txt similarity index 100% rename from testvectors/shavs/Blake/MonteCarlo_224.txt rename to testvectors/shavs/Blake-round2/MonteCarlo_224.txt diff --git a/testvectors/shavs/Blake/MonteCarlo_256.txt b/testvectors/shavs/Blake-round2/MonteCarlo_256.txt similarity index 100% rename from testvectors/shavs/Blake/MonteCarlo_256.txt rename to testvectors/shavs/Blake-round2/MonteCarlo_256.txt diff --git a/testvectors/shavs/Blake/MonteCarlo_384.txt b/testvectors/shavs/Blake-round2/MonteCarlo_384.txt similarity index 100% rename from testvectors/shavs/Blake/MonteCarlo_384.txt rename to testvectors/shavs/Blake-round2/MonteCarlo_384.txt diff --git a/testvectors/shavs/Blake/MonteCarlo_512.txt b/testvectors/shavs/Blake-round2/MonteCarlo_512.txt similarity index 100% rename from testvectors/shavs/Blake/MonteCarlo_512.txt rename to testvectors/shavs/Blake-round2/MonteCarlo_512.txt diff --git a/testvectors/shavs/Blake/ShortMsgKAT.txt b/testvectors/shavs/Blake-round2/ShortMsgKAT.txt similarity index 100% rename from testvectors/shavs/Blake/ShortMsgKAT.txt rename to testvectors/shavs/Blake-round2/ShortMsgKAT.txt diff --git a/testvectors/shavs/Blake/ShortMsgKAT_224.txt b/testvectors/shavs/Blake-round2/ShortMsgKAT_224.txt similarity index 100% rename from testvectors/shavs/Blake/ShortMsgKAT_224.txt rename to testvectors/shavs/Blake-round2/ShortMsgKAT_224.txt diff --git a/testvectors/shavs/Blake/ShortMsgKAT_256.txt b/testvectors/shavs/Blake-round2/ShortMsgKAT_256.txt similarity index 100% rename from testvectors/shavs/Blake/ShortMsgKAT_256.txt rename to testvectors/shavs/Blake-round2/ShortMsgKAT_256.txt diff --git a/testvectors/shavs/Blake/ShortMsgKAT_384.txt b/testvectors/shavs/Blake-round2/ShortMsgKAT_384.txt similarity index 100% rename from testvectors/shavs/Blake/ShortMsgKAT_384.txt rename to testvectors/shavs/Blake-round2/ShortMsgKAT_384.txt diff --git a/testvectors/shavs/Blake/ShortMsgKAT_512.txt b/testvectors/shavs/Blake-round2/ShortMsgKAT_512.txt similarity index 100% rename from testvectors/shavs/Blake/ShortMsgKAT_512.txt rename to testvectors/shavs/Blake-round2/ShortMsgKAT_512.txt -- 2.39.5