]> git.cryptolib.org Git - avr-crypto-lib.git/blobdiff - test_src/main-skein-test.c
forgot hfal_shabval.*
[avr-crypto-lib.git] / test_src / main-skein-test.c
index aa68950a19f971659222fe033f82bc43bbf2010c..0a44e34e7ff4f9c8efc6f92a40bde6e04f72f225 100644 (file)
@@ -17,7 +17,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 /*
- * threefish test-suit
+ * skein test-suit
  * 
 */
 
 #include "hfal_skein1024.h"
 #include "cli.h"
 #include "shavs.h"
+#include "nessie_hash_test.h"
 #include "performance_test.h"
+#include "hfal-performance.h"
+#include "hfal-nessie.h"
+
 
 #include <stdint.h>
 #include <string.h>
 
 char* algo_name = "Skein";
 
+const hfdesc_t* algolist[] PROGMEM = {
+       (hfdesc_t*)&skein256_128_desc,
+       (hfdesc_t*)&skein256_160_desc,
+       (hfdesc_t*)&skein256_224_desc,
+       (hfdesc_t*)&skein256_256_desc,
+       (hfdesc_t*)&skein256_384_desc,
+       (hfdesc_t*)&skein256_512_desc,
+       
+       (hfdesc_t*)&skein512_128_desc,
+       (hfdesc_t*)&skein512_160_desc,
+       (hfdesc_t*)&skein512_224_desc,
+       (hfdesc_t*)&skein512_256_desc,
+       (hfdesc_t*)&skein512_384_desc,
+       (hfdesc_t*)&skein512_512_desc,
+       (hfdesc_t*)&skein512_1024_desc,
+       
+       (hfdesc_t*)&skein1024_128_desc,
+       (hfdesc_t*)&skein1024_160_desc,
+       (hfdesc_t*)&skein1024_224_desc,
+       (hfdesc_t*)&skein1024_256_desc,
+       (hfdesc_t*)&skein1024_384_desc,
+       (hfdesc_t*)&skein1024_512_desc,
+       (hfdesc_t*)&skein1024_1024_desc,
+       NULL
+};
+
 /*****************************************************************************
  *  additional validation-functions                                                                                     *
  *****************************************************************************/
@@ -53,16 +83,19 @@ void testrun_stdtest_skein256(uint16_t outsize_b){
                message[i] = 0xFF-i;
        
        cli_putstr_P(PSTR("\r\nmessage:    "));
+       cli_hexdump(message, 1);
        skein256(hash, outsize_b, message, 8);
        cli_putstr_P(PSTR("\r\nhash:"));
        cli_hexdump_block(hash, (outsize_b+7)/8, 4, 16);
        
        cli_putstr_P(PSTR("\r\nmessage:"));
+       cli_hexdump_block(message, 32, 4, 16);
        skein256(hash, outsize_b, message, 32*8);
        cli_putstr_P(PSTR("\r\nhash:"));
        cli_hexdump_block(hash, (outsize_b+7)/8, 4, 16);
        
        cli_putstr_P(PSTR("\r\nmessage:"));
+       cli_hexdump_block(message, 64, 4, 16);
        skein256(hash, outsize_b, message, 64*8);
        cli_putstr_P(PSTR("\r\nhash:"));
        cli_hexdump_block(hash, (outsize_b+7)/8, 4, 16);
@@ -84,11 +117,13 @@ void testrun_stdtest_skein512(uint16_t outsize_b){
        cli_hexdump_block(hash, (outsize_b+7)/8, 4, 16);
        
        cli_putstr_P(PSTR("\r\nmessage:"));
+       cli_hexdump_block(message, 64, 4, 16);
        skein512(hash, outsize_b, message, 64*8);
        cli_putstr_P(PSTR("\r\nhash:"));
        cli_hexdump_block(hash, (outsize_b+7)/8, 4, 16);
        
        cli_putstr_P(PSTR("\r\nmessage:"));
+       cli_hexdump_block(message, 128, 4, 16);
        skein512(hash, outsize_b, message, 128*8);
        cli_putstr_P(PSTR("\r\nhash:"));
        cli_hexdump_block(hash, (outsize_b+7)/8, 4, 16);
@@ -110,6 +145,7 @@ void testrun_stdtest_skein1024(uint16_t outsize_b){
        cli_hexdump_block(hash, (outsize_b+7)/8, 4, 16);
        
        cli_putstr_P(PSTR("\r\nmessage:"));
+       cli_hexdump_block(message, 128, 4, 16);
        skein1024(hash, outsize_b, message, 128*8);
        cli_putstr_P(PSTR("\r\nhash:"));
        cli_hexdump_block(hash, (outsize_b+7)/8, 4, 16);
@@ -168,35 +204,20 @@ void zeromsg_test_common(char* p){
        }
 }
 
+void performance_skein(void){
+       hfal_performance_multiple(algolist);
+}
+
+void testrun_nessie_skein(void){
+       nessie_hash_quick = 1;
+       hfal_nessie_multiple(algolist);
+}
+
+
 /*****************************************************************************
  *  main                                                                                                                                        *
  *****************************************************************************/
 
-const hfdesc_t* algolist[] PROGMEM = {
-       (hfdesc_t*)&skein256_128_desc,
-       (hfdesc_t*)&skein256_160_desc,
-       (hfdesc_t*)&skein256_224_desc,
-       (hfdesc_t*)&skein256_256_desc,
-       (hfdesc_t*)&skein256_384_desc,
-       (hfdesc_t*)&skein256_512_desc,
-       
-       (hfdesc_t*)&skein512_128_desc,
-       (hfdesc_t*)&skein512_160_desc,
-       (hfdesc_t*)&skein512_224_desc,
-       (hfdesc_t*)&skein512_256_desc,
-       (hfdesc_t*)&skein512_384_desc,
-       (hfdesc_t*)&skein512_512_desc,
-       (hfdesc_t*)&skein512_1024_desc,
-       
-       (hfdesc_t*)&skein1024_128_desc,
-       (hfdesc_t*)&skein1024_160_desc,
-       (hfdesc_t*)&skein1024_224_desc,
-       (hfdesc_t*)&skein1024_256_desc,
-       (hfdesc_t*)&skein1024_384_desc,
-       (hfdesc_t*)&skein1024_512_desc,
-       (hfdesc_t*)&skein1024_1024_desc,
-       NULL
-};
 
 const char nessie_str[]      PROGMEM = "nessie";
 const char test_str[]        PROGMEM = "test";
@@ -208,7 +229,8 @@ const char shavs_set_str[]   PROGMEM = "shavs_set";
 const char shavs_test1_str[] PROGMEM = "shavs_test1";
 
 cmdlist_entry_t cmdlist[] PROGMEM = {
-//     { nessie_str,      NULL, testrun_nessie_noekeon},
+       { nessie_str,          NULL, testrun_nessie_skein},
+       { performance_str,     NULL, performance_skein},
        { test_str,            NULL, testrun_stdtest_skein},
        { ztest_str,       (void*)1, (void_fpt)zeromsg_test_common},
        { shavs_list_str,      NULL, shavs_listalgos},
@@ -228,7 +250,12 @@ int main (void){
        for(;;){
                cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
                cli_putstr(algo_name);
+               cli_putstr_P(PSTR("; "));
+               cli_putstr(__DATE__);
+               cli_putstr_P(PSTR(" "));
+               cli_putstr(__TIME__);
                cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
+               
                cmd_interface(cmdlist);
        }
 }