1/* ==================================================================== 2 * Copyright (c) 2005 The OpenSSL Project. All rights reserved. 3 * ==================================================================== 4 */ 5#include <stdio.h> 6#include <string.h> 7#include <stdlib.h> 8 9#include <openssl/whrlpool.h> 10#include <openssl/crypto.h> 11 12#if defined(OPENSSL_NO_WHIRLPOOL) 13int main(int argc, char *argv[]) 14{ 15 printf("No Whirlpool support\n");
| 1/* ==================================================================== 2 * Copyright (c) 2005 The OpenSSL Project. All rights reserved. 3 * ==================================================================== 4 */ 5#include <stdio.h> 6#include <string.h> 7#include <stdlib.h> 8 9#include <openssl/whrlpool.h> 10#include <openssl/crypto.h> 11 12#if defined(OPENSSL_NO_WHIRLPOOL) 13int main(int argc, char *argv[]) 14{ 15 printf("No Whirlpool support\n");
|
16 return(0);
| 16 return (0);
|
17} 18#else 19 20/* ISO/IEC 10118-3 test vector set */ 21unsigned char iso_test_1[WHIRLPOOL_DIGEST_LENGTH] = {
| 17} 18#else 19 20/* ISO/IEC 10118-3 test vector set */ 21unsigned char iso_test_1[WHIRLPOOL_DIGEST_LENGTH] = {
|
22 0x19,0xFA,0x61,0xD7,0x55,0x22,0xA4,0x66, 23 0x9B,0x44,0xE3,0x9C,0x1D,0x2E,0x17,0x26, 24 0xC5,0x30,0x23,0x21,0x30,0xD4,0x07,0xF8, 25 0x9A,0xFE,0xE0,0x96,0x49,0x97,0xF7,0xA7, 26 0x3E,0x83,0xBE,0x69,0x8B,0x28,0x8F,0xEB, 27 0xCF,0x88,0xE3,0xE0,0x3C,0x4F,0x07,0x57, 28 0xEA,0x89,0x64,0xE5,0x9B,0x63,0xD9,0x37, 29 0x08,0xB1,0x38,0xCC,0x42,0xA6,0x6E,0xB3 };
| 22 0x19, 0xFA, 0x61, 0xD7, 0x55, 0x22, 0xA4, 0x66, 23 0x9B, 0x44, 0xE3, 0x9C, 0x1D, 0x2E, 0x17, 0x26, 24 0xC5, 0x30, 0x23, 0x21, 0x30, 0xD4, 0x07, 0xF8, 25 0x9A, 0xFE, 0xE0, 0x96, 0x49, 0x97, 0xF7, 0xA7, 26 0x3E, 0x83, 0xBE, 0x69, 0x8B, 0x28, 0x8F, 0xEB, 27 0xCF, 0x88, 0xE3, 0xE0, 0x3C, 0x4F, 0x07, 0x57, 28 0xEA, 0x89, 0x64, 0xE5, 0x9B, 0x63, 0xD9, 0x37, 29 0x08, 0xB1, 0x38, 0xCC, 0x42, 0xA6, 0x6E, 0xB3 30};
|
30 31unsigned char iso_test_2[WHIRLPOOL_DIGEST_LENGTH] = {
| 31 32unsigned char iso_test_2[WHIRLPOOL_DIGEST_LENGTH] = {
|
32 0x8A,0xCA,0x26,0x02,0x79,0x2A,0xEC,0x6F, 33 0x11,0xA6,0x72,0x06,0x53,0x1F,0xB7,0xD7, 34 0xF0,0xDF,0xF5,0x94,0x13,0x14,0x5E,0x69, 35 0x73,0xC4,0x50,0x01,0xD0,0x08,0x7B,0x42, 36 0xD1,0x1B,0xC6,0x45,0x41,0x3A,0xEF,0xF6, 37 0x3A,0x42,0x39,0x1A,0x39,0x14,0x5A,0x59, 38 0x1A,0x92,0x20,0x0D,0x56,0x01,0x95,0xE5, 39 0x3B,0x47,0x85,0x84,0xFD,0xAE,0x23,0x1A };
| 33 0x8A, 0xCA, 0x26, 0x02, 0x79, 0x2A, 0xEC, 0x6F, 34 0x11, 0xA6, 0x72, 0x06, 0x53, 0x1F, 0xB7, 0xD7, 35 0xF0, 0xDF, 0xF5, 0x94, 0x13, 0x14, 0x5E, 0x69, 36 0x73, 0xC4, 0x50, 0x01, 0xD0, 0x08, 0x7B, 0x42, 37 0xD1, 0x1B, 0xC6, 0x45, 0x41, 0x3A, 0xEF, 0xF6, 38 0x3A, 0x42, 0x39, 0x1A, 0x39, 0x14, 0x5A, 0x59, 39 0x1A, 0x92, 0x20, 0x0D, 0x56, 0x01, 0x95, 0xE5, 40 0x3B, 0x47, 0x85, 0x84, 0xFD, 0xAE, 0x23, 0x1A 41};
|
40 41unsigned char iso_test_3[WHIRLPOOL_DIGEST_LENGTH] = {
| 42 43unsigned char iso_test_3[WHIRLPOOL_DIGEST_LENGTH] = {
|
42 0x4E,0x24,0x48,0xA4,0xC6,0xF4,0x86,0xBB, 43 0x16,0xB6,0x56,0x2C,0x73,0xB4,0x02,0x0B, 44 0xF3,0x04,0x3E,0x3A,0x73,0x1B,0xCE,0x72, 45 0x1A,0xE1,0xB3,0x03,0xD9,0x7E,0x6D,0x4C, 46 0x71,0x81,0xEE,0xBD,0xB6,0xC5,0x7E,0x27, 47 0x7D,0x0E,0x34,0x95,0x71,0x14,0xCB,0xD6, 48 0xC7,0x97,0xFC,0x9D,0x95,0xD8,0xB5,0x82, 49 0xD2,0x25,0x29,0x20,0x76,0xD4,0xEE,0xF5 };
| 44 0x4E, 0x24, 0x48, 0xA4, 0xC6, 0xF4, 0x86, 0xBB, 45 0x16, 0xB6, 0x56, 0x2C, 0x73, 0xB4, 0x02, 0x0B, 46 0xF3, 0x04, 0x3E, 0x3A, 0x73, 0x1B, 0xCE, 0x72, 47 0x1A, 0xE1, 0xB3, 0x03, 0xD9, 0x7E, 0x6D, 0x4C, 48 0x71, 0x81, 0xEE, 0xBD, 0xB6, 0xC5, 0x7E, 0x27, 49 0x7D, 0x0E, 0x34, 0x95, 0x71, 0x14, 0xCB, 0xD6, 50 0xC7, 0x97, 0xFC, 0x9D, 0x95, 0xD8, 0xB5, 0x82, 51 0xD2, 0x25, 0x29, 0x20, 0x76, 0xD4, 0xEE, 0xF5 52};
|
50 51unsigned char iso_test_4[WHIRLPOOL_DIGEST_LENGTH] = {
| 53 54unsigned char iso_test_4[WHIRLPOOL_DIGEST_LENGTH] = {
|
52 0x37,0x8C,0x84,0xA4,0x12,0x6E,0x2D,0xC6, 53 0xE5,0x6D,0xCC,0x74,0x58,0x37,0x7A,0xAC, 54 0x83,0x8D,0x00,0x03,0x22,0x30,0xF5,0x3C, 55 0xE1,0xF5,0x70,0x0C,0x0F,0xFB,0x4D,0x3B, 56 0x84,0x21,0x55,0x76,0x59,0xEF,0x55,0xC1, 57 0x06,0xB4,0xB5,0x2A,0xC5,0xA4,0xAA,0xA6, 58 0x92,0xED,0x92,0x00,0x52,0x83,0x8F,0x33, 59 0x62,0xE8,0x6D,0xBD,0x37,0xA8,0x90,0x3E };
| 55 0x37, 0x8C, 0x84, 0xA4, 0x12, 0x6E, 0x2D, 0xC6, 56 0xE5, 0x6D, 0xCC, 0x74, 0x58, 0x37, 0x7A, 0xAC, 57 0x83, 0x8D, 0x00, 0x03, 0x22, 0x30, 0xF5, 0x3C, 58 0xE1, 0xF5, 0x70, 0x0C, 0x0F, 0xFB, 0x4D, 0x3B, 59 0x84, 0x21, 0x55, 0x76, 0x59, 0xEF, 0x55, 0xC1, 60 0x06, 0xB4, 0xB5, 0x2A, 0xC5, 0xA4, 0xAA, 0xA6, 61 0x92, 0xED, 0x92, 0x00, 0x52, 0x83, 0x8F, 0x33, 62 0x62, 0xE8, 0x6D, 0xBD, 0x37, 0xA8, 0x90, 0x3E 63};
|
60 61unsigned char iso_test_5[WHIRLPOOL_DIGEST_LENGTH] = {
| 64 65unsigned char iso_test_5[WHIRLPOOL_DIGEST_LENGTH] = {
|
62 0xF1,0xD7,0x54,0x66,0x26,0x36,0xFF,0xE9, 63 0x2C,0x82,0xEB,0xB9,0x21,0x2A,0x48,0x4A, 64 0x8D,0x38,0x63,0x1E,0xAD,0x42,0x38,0xF5, 65 0x44,0x2E,0xE1,0x3B,0x80,0x54,0xE4,0x1B, 66 0x08,0xBF,0x2A,0x92,0x51,0xC3,0x0B,0x6A, 67 0x0B,0x8A,0xAE,0x86,0x17,0x7A,0xB4,0xA6, 68 0xF6,0x8F,0x67,0x3E,0x72,0x07,0x86,0x5D, 69 0x5D,0x98,0x19,0xA3,0xDB,0xA4,0xEB,0x3B };
| 66 0xF1, 0xD7, 0x54, 0x66, 0x26, 0x36, 0xFF, 0xE9, 67 0x2C, 0x82, 0xEB, 0xB9, 0x21, 0x2A, 0x48, 0x4A, 68 0x8D, 0x38, 0x63, 0x1E, 0xAD, 0x42, 0x38, 0xF5, 69 0x44, 0x2E, 0xE1, 0x3B, 0x80, 0x54, 0xE4, 0x1B, 70 0x08, 0xBF, 0x2A, 0x92, 0x51, 0xC3, 0x0B, 0x6A, 71 0x0B, 0x8A, 0xAE, 0x86, 0x17, 0x7A, 0xB4, 0xA6, 72 0xF6, 0x8F, 0x67, 0x3E, 0x72, 0x07, 0x86, 0x5D, 73 0x5D, 0x98, 0x19, 0xA3, 0xDB, 0xA4, 0xEB, 0x3B 74};
|
70 71unsigned char iso_test_6[WHIRLPOOL_DIGEST_LENGTH] = {
| 75 76unsigned char iso_test_6[WHIRLPOOL_DIGEST_LENGTH] = {
|
72 0xDC,0x37,0xE0,0x08,0xCF,0x9E,0xE6,0x9B, 73 0xF1,0x1F,0x00,0xED,0x9A,0xBA,0x26,0x90, 74 0x1D,0xD7,0xC2,0x8C,0xDE,0xC0,0x66,0xCC, 75 0x6A,0xF4,0x2E,0x40,0xF8,0x2F,0x3A,0x1E, 76 0x08,0xEB,0xA2,0x66,0x29,0x12,0x9D,0x8F, 77 0xB7,0xCB,0x57,0x21,0x1B,0x92,0x81,0xA6, 78 0x55,0x17,0xCC,0x87,0x9D,0x7B,0x96,0x21, 79 0x42,0xC6,0x5F,0x5A,0x7A,0xF0,0x14,0x67 };
| 77 0xDC, 0x37, 0xE0, 0x08, 0xCF, 0x9E, 0xE6, 0x9B, 78 0xF1, 0x1F, 0x00, 0xED, 0x9A, 0xBA, 0x26, 0x90, 79 0x1D, 0xD7, 0xC2, 0x8C, 0xDE, 0xC0, 0x66, 0xCC, 80 0x6A, 0xF4, 0x2E, 0x40, 0xF8, 0x2F, 0x3A, 0x1E, 81 0x08, 0xEB, 0xA2, 0x66, 0x29, 0x12, 0x9D, 0x8F, 82 0xB7, 0xCB, 0x57, 0x21, 0x1B, 0x92, 0x81, 0xA6, 83 0x55, 0x17, 0xCC, 0x87, 0x9D, 0x7B, 0x96, 0x21, 84 0x42, 0xC6, 0x5F, 0x5A, 0x7A, 0xF0, 0x14, 0x67 85};
|
80 81unsigned char iso_test_7[WHIRLPOOL_DIGEST_LENGTH] = {
| 86 87unsigned char iso_test_7[WHIRLPOOL_DIGEST_LENGTH] = {
|
82 0x46,0x6E,0xF1,0x8B,0xAB,0xB0,0x15,0x4D, 83 0x25,0xB9,0xD3,0x8A,0x64,0x14,0xF5,0xC0, 84 0x87,0x84,0x37,0x2B,0xCC,0xB2,0x04,0xD6, 85 0x54,0x9C,0x4A,0xFA,0xDB,0x60,0x14,0x29, 86 0x4D,0x5B,0xD8,0xDF,0x2A,0x6C,0x44,0xE5, 87 0x38,0xCD,0x04,0x7B,0x26,0x81,0xA5,0x1A, 88 0x2C,0x60,0x48,0x1E,0x88,0xC5,0xA2,0x0B, 89 0x2C,0x2A,0x80,0xCF,0x3A,0x9A,0x08,0x3B };
| 88 0x46, 0x6E, 0xF1, 0x8B, 0xAB, 0xB0, 0x15, 0x4D, 89 0x25, 0xB9, 0xD3, 0x8A, 0x64, 0x14, 0xF5, 0xC0, 90 0x87, 0x84, 0x37, 0x2B, 0xCC, 0xB2, 0x04, 0xD6, 91 0x54, 0x9C, 0x4A, 0xFA, 0xDB, 0x60, 0x14, 0x29, 92 0x4D, 0x5B, 0xD8, 0xDF, 0x2A, 0x6C, 0x44, 0xE5, 93 0x38, 0xCD, 0x04, 0x7B, 0x26, 0x81, 0xA5, 0x1A, 94 0x2C, 0x60, 0x48, 0x1E, 0x88, 0xC5, 0xA2, 0x0B, 95 0x2C, 0x2A, 0x80, 0xCF, 0x3A, 0x9A, 0x08, 0x3B 96};
|
90 91unsigned char iso_test_8[WHIRLPOOL_DIGEST_LENGTH] = {
| 97 98unsigned char iso_test_8[WHIRLPOOL_DIGEST_LENGTH] = {
|
92 0x2A,0x98,0x7E,0xA4,0x0F,0x91,0x70,0x61, 93 0xF5,0xD6,0xF0,0xA0,0xE4,0x64,0x4F,0x48, 94 0x8A,0x7A,0x5A,0x52,0xDE,0xEE,0x65,0x62, 95 0x07,0xC5,0x62,0xF9,0x88,0xE9,0x5C,0x69, 96 0x16,0xBD,0xC8,0x03,0x1B,0xC5,0xBE,0x1B, 97 0x7B,0x94,0x76,0x39,0xFE,0x05,0x0B,0x56, 98 0x93,0x9B,0xAA,0xA0,0xAD,0xFF,0x9A,0xE6, 99 0x74,0x5B,0x7B,0x18,0x1C,0x3B,0xE3,0xFD };
| 99 0x2A, 0x98, 0x7E, 0xA4, 0x0F, 0x91, 0x70, 0x61, 100 0xF5, 0xD6, 0xF0, 0xA0, 0xE4, 0x64, 0x4F, 0x48, 101 0x8A, 0x7A, 0x5A, 0x52, 0xDE, 0xEE, 0x65, 0x62, 102 0x07, 0xC5, 0x62, 0xF9, 0x88, 0xE9, 0x5C, 0x69, 103 0x16, 0xBD, 0xC8, 0x03, 0x1B, 0xC5, 0xBE, 0x1B, 104 0x7B, 0x94, 0x76, 0x39, 0xFE, 0x05, 0x0B, 0x56, 105 0x93, 0x9B, 0xAA, 0xA0, 0xAD, 0xFF, 0x9A, 0xE6, 106 0x74, 0x5B, 0x7B, 0x18, 0x1C, 0x3B, 0xE3, 0xFD 107};
|
100 101unsigned char iso_test_9[WHIRLPOOL_DIGEST_LENGTH] = {
| 108 109unsigned char iso_test_9[WHIRLPOOL_DIGEST_LENGTH] = {
|
102 0x0C,0x99,0x00,0x5B,0xEB,0x57,0xEF,0xF5, 103 0x0A,0x7C,0xF0,0x05,0x56,0x0D,0xDF,0x5D, 104 0x29,0x05,0x7F,0xD8,0x6B,0x20,0xBF,0xD6, 105 0x2D,0xEC,0xA0,0xF1,0xCC,0xEA,0x4A,0xF5, 106 0x1F,0xC1,0x54,0x90,0xED,0xDC,0x47,0xAF, 107 0x32,0xBB,0x2B,0x66,0xC3,0x4F,0xF9,0xAD, 108 0x8C,0x60,0x08,0xAD,0x67,0x7F,0x77,0x12, 109 0x69,0x53,0xB2,0x26,0xE4,0xED,0x8B,0x01 };
| 110 0x0C, 0x99, 0x00, 0x5B, 0xEB, 0x57, 0xEF, 0xF5, 111 0x0A, 0x7C, 0xF0, 0x05, 0x56, 0x0D, 0xDF, 0x5D, 112 0x29, 0x05, 0x7F, 0xD8, 0x6B, 0x20, 0xBF, 0xD6, 113 0x2D, 0xEC, 0xA0, 0xF1, 0xCC, 0xEA, 0x4A, 0xF5, 114 0x1F, 0xC1, 0x54, 0x90, 0xED, 0xDC, 0x47, 0xAF, 115 0x32, 0xBB, 0x2B, 0x66, 0xC3, 0x4F, 0xF9, 0xAD, 116 0x8C, 0x60, 0x08, 0xAD, 0x67, 0x7F, 0x77, 0x12, 117 0x69, 0x53, 0xB2, 0x26, 0xE4, 0xED, 0x8B, 0x01 118};
|
110
| 119
|
111int main (int argc,char *argv[]) 112{ unsigned char md[WHIRLPOOL_DIGEST_LENGTH]; 113 int i; 114 WHIRLPOOL_CTX ctx;
| 120int main(int argc, char *argv[]) 121{ 122 unsigned char md[WHIRLPOOL_DIGEST_LENGTH]; 123 int i; 124 WHIRLPOOL_CTX ctx;
|
115
| 125
|
116#ifdef OPENSSL_IA32_SSE2 117 /* Alternative to this is to call OpenSSL_add_all_algorithms... 118 * The below code is retained exclusively for debugging purposes. */ 119 { char *env;
| 126# ifdef OPENSSL_IA32_SSE2 127 /* 128 * Alternative to this is to call OpenSSL_add_all_algorithms... The below 129 * code is retained exclusively for debugging purposes. 130 */ 131 { 132 char *env;
|
120
| 133
|
121 if ((env=getenv("OPENSSL_ia32cap"))) 122 OPENSSL_ia32cap = strtoul (env,NULL,0);
| 134 if ((env = getenv("OPENSSL_ia32cap"))) 135 OPENSSL_ia32cap = strtoul(env, NULL, 0);
|
123 }
| 136 }
|
124#endif
| 137# endif
|
125
| 138
|
126 fprintf(stdout,"Testing Whirlpool ");
| 139 fprintf(stdout, "Testing Whirlpool ");
|
127
| 140
|
128 WHIRLPOOL("",0,md); 129 if (memcmp(md,iso_test_1,sizeof(iso_test_1))) 130 { fflush(stdout); 131 fprintf(stderr,"\nTEST 1 of 9 failed.\n"); 132 return 1; 133 } 134 else 135 fprintf(stdout,"."); fflush(stdout);
| 141 WHIRLPOOL("", 0, md); 142 if (memcmp(md, iso_test_1, sizeof(iso_test_1))) { 143 fflush(stdout); 144 fprintf(stderr, "\nTEST 1 of 9 failed.\n"); 145 return 1; 146 } else 147 fprintf(stdout, "."); 148 fflush(stdout);
|
136
| 149
|
137 WHIRLPOOL("a",1,md); 138 if (memcmp(md,iso_test_2,sizeof(iso_test_2))) 139 { fflush(stdout); 140 fprintf(stderr,"\nTEST 2 of 9 failed.\n"); 141 return 1; 142 } 143 else 144 fprintf(stdout,"."); fflush(stdout);
| 150 WHIRLPOOL("a", 1, md); 151 if (memcmp(md, iso_test_2, sizeof(iso_test_2))) { 152 fflush(stdout); 153 fprintf(stderr, "\nTEST 2 of 9 failed.\n"); 154 return 1; 155 } else 156 fprintf(stdout, "."); 157 fflush(stdout);
|
145
| 158
|
146 WHIRLPOOL("abc",3,md); 147 if (memcmp(md,iso_test_3,sizeof(iso_test_3))) 148 { fflush(stdout); 149 fprintf(stderr,"\nTEST 3 of 9 failed.\n"); 150 return 1; 151 } 152 else 153 fprintf(stdout,"."); fflush(stdout);
| 159 WHIRLPOOL("abc", 3, md); 160 if (memcmp(md, iso_test_3, sizeof(iso_test_3))) { 161 fflush(stdout); 162 fprintf(stderr, "\nTEST 3 of 9 failed.\n"); 163 return 1; 164 } else 165 fprintf(stdout, "."); 166 fflush(stdout);
|
154
| 167
|
155 WHIRLPOOL("message digest",14,md); 156 if (memcmp(md,iso_test_4,sizeof(iso_test_4))) 157 { fflush(stdout); 158 fprintf(stderr,"\nTEST 4 of 9 failed.\n"); 159 return 1; 160 } 161 else 162 fprintf(stdout,"."); fflush(stdout);
| 168 WHIRLPOOL("message digest", 14, md); 169 if (memcmp(md, iso_test_4, sizeof(iso_test_4))) { 170 fflush(stdout); 171 fprintf(stderr, "\nTEST 4 of 9 failed.\n"); 172 return 1; 173 } else 174 fprintf(stdout, "."); 175 fflush(stdout);
|
163
| 176
|
164 WHIRLPOOL("abcdefghijklmnopqrstuvwxyz",26,md); 165 if (memcmp(md,iso_test_5,sizeof(iso_test_5))) 166 { fflush(stdout); 167 fprintf(stderr,"\nTEST 5 of 9 failed.\n"); 168 return 1; 169 } 170 else 171 fprintf(stdout,"."); fflush(stdout);
| 177 WHIRLPOOL("abcdefghijklmnopqrstuvwxyz", 26, md); 178 if (memcmp(md, iso_test_5, sizeof(iso_test_5))) { 179 fflush(stdout); 180 fprintf(stderr, "\nTEST 5 of 9 failed.\n"); 181 return 1; 182 } else 183 fprintf(stdout, "."); 184 fflush(stdout);
|
172
| 185
|
173 WHIRLPOOL( "ABCDEFGHIJKLMNOPQRSTUVWXYZ" 174 "abcdefghijklmnopqrstuvwxyz" 175 "0123456789",62,md); 176 if (memcmp(md,iso_test_6,sizeof(iso_test_6))) 177 { fflush(stdout); 178 fprintf(stderr,"\nTEST 6 of 9 failed.\n"); 179 return 1; 180 } 181 else 182 fprintf(stdout,"."); fflush(stdout);
| 186 WHIRLPOOL("ABCDEFGHIJKLMNOPQRSTUVWXYZ" 187 "abcdefghijklmnopqrstuvwxyz" "0123456789", 62, md); 188 if (memcmp(md, iso_test_6, sizeof(iso_test_6))) { 189 fflush(stdout); 190 fprintf(stderr, "\nTEST 6 of 9 failed.\n"); 191 return 1; 192 } else 193 fprintf(stdout, "."); 194 fflush(stdout);
|
183
| 195
|
184 WHIRLPOOL( "1234567890""1234567890""1234567890""1234567890" 185 "1234567890""1234567890""1234567890""1234567890",80,md); 186 if (memcmp(md,iso_test_7,sizeof(iso_test_7))) 187 { fflush(stdout); 188 fprintf(stderr,"\nTEST 7 of 9 failed.\n"); 189 return 1; 190 } 191 else 192 fprintf(stdout,"."); fflush(stdout);
| 196 WHIRLPOOL("1234567890" "1234567890" "1234567890" "1234567890" 197 "1234567890" "1234567890" "1234567890" "1234567890", 80, md); 198 if (memcmp(md, iso_test_7, sizeof(iso_test_7))) { 199 fflush(stdout); 200 fprintf(stderr, "\nTEST 7 of 9 failed.\n"); 201 return 1; 202 } else 203 fprintf(stdout, "."); 204 fflush(stdout);
|
193
| 205
|
194 WHIRLPOOL("abcdbcdecdefdefgefghfghighijhijk",32,md); 195 if (memcmp(md,iso_test_8,sizeof(iso_test_8))) 196 { fflush(stdout); 197 fprintf(stderr,"\nTEST 8 of 9 failed.\n"); 198 return 1; 199 } 200 else 201 fprintf(stdout,"."); fflush(stdout); 202 203 WHIRLPOOL_Init (&ctx); 204 for (i=0;i<1000000;i+=288) 205 WHIRLPOOL_Update (&ctx, "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa" 206 "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa" 207 "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa" 208 "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa" 209 "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa" 210 "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa" 211 "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa" 212 "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa" 213 "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa", 214 (1000000-i)<288?1000000-i:288); 215 WHIRLPOOL_Final (md,&ctx); 216 if (memcmp(md,iso_test_9,sizeof(iso_test_9))) 217 { fflush(stdout); 218 fprintf(stderr,"\nTEST 9 of 9 failed.\n"); 219 return 1; 220 } 221 else 222 fprintf(stdout,"."); fflush(stdout);
| 206 WHIRLPOOL("abcdbcdecdefdefgefghfghighijhijk", 32, md); 207 if (memcmp(md, iso_test_8, sizeof(iso_test_8))) { 208 fflush(stdout); 209 fprintf(stderr, "\nTEST 8 of 9 failed.\n"); 210 return 1; 211 } else 212 fprintf(stdout, "."); 213 fflush(stdout);
|
223
| 214
|
224 fprintf(stdout," passed.\n"); fflush(stdout);
| 215 WHIRLPOOL_Init(&ctx); 216 for (i = 0; i < 1000000; i += 288) 217 WHIRLPOOL_Update(&ctx, "aaaaaaaa" "aaaaaaaa" "aaaaaaaa" "aaaaaaaa" 218 "aaaaaaaa" "aaaaaaaa" "aaaaaaaa" "aaaaaaaa" 219 "aaaaaaaa" "aaaaaaaa" "aaaaaaaa" "aaaaaaaa" 220 "aaaaaaaa" "aaaaaaaa" "aaaaaaaa" "aaaaaaaa" 221 "aaaaaaaa" "aaaaaaaa" "aaaaaaaa" "aaaaaaaa" 222 "aaaaaaaa" "aaaaaaaa" "aaaaaaaa" "aaaaaaaa" 223 "aaaaaaaa" "aaaaaaaa" "aaaaaaaa" "aaaaaaaa" 224 "aaaaaaaa" "aaaaaaaa" "aaaaaaaa" "aaaaaaaa" 225 "aaaaaaaa" "aaaaaaaa" "aaaaaaaa" "aaaaaaaa", 226 (1000000 - i) < 288 ? 1000000 - i : 288); 227 WHIRLPOOL_Final(md, &ctx); 228 if (memcmp(md, iso_test_9, sizeof(iso_test_9))) { 229 fflush(stdout); 230 fprintf(stderr, "\nTEST 9 of 9 failed.\n"); 231 return 1; 232 } else 233 fprintf(stdout, "."); 234 fflush(stdout);
|
225
| 235
|
226 return 0;
| 236 fprintf(stdout, " passed.\n"); 237 fflush(stdout); 238 239 return 0;
|
227} 228#endif
| 240} 241#endif
|