OLD | NEW |
1 /* Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 /* Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
2 * Use of this source code is governed by a BSD-style license that can be | 2 * Use of this source code is governed by a BSD-style license that can be |
3 * found in the LICENSE file. | 3 * found in the LICENSE file. |
4 */ | 4 */ |
5 | 5 |
6 /* FIPS 180-2 Tests for message digest functions. */ | 6 /* FIPS 180-2 Tests for message digest functions. */ |
7 | 7 |
8 #include <stdio.h> | 8 #include <stdio.h> |
9 #include <stdlib.h> | 9 #include <stdlib.h> |
10 #include <string.h> | 10 #include <string.h> |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 fprintf(stderr, "Test vector %d PASSED for SHA-512\n", i+1); | 71 fprintf(stderr, "Test vector %d PASSED for SHA-512\n", i+1); |
72 } | 72 } |
73 else { | 73 else { |
74 fprintf(stderr, "Test vector %d FAILED for SHA-512\n", i+1); | 74 fprintf(stderr, "Test vector %d FAILED for SHA-512\n", i+1); |
75 success = 0; | 75 success = 0; |
76 } | 76 } |
77 } | 77 } |
78 return success; | 78 return success; |
79 } | 79 } |
80 | 80 |
| 81 /* disable MSVC warnings on unused arguments */ |
| 82 __pragma(warning (disable: 4100)) |
| 83 |
81 int main(int argc, char* argv[]) { | 84 int main(int argc, char* argv[]) { |
82 int success = 1; | 85 int success = 1; |
83 /* Initialize long_msg with 'a' x 1,000,000 */ | 86 /* Initialize long_msg with 'a' x 1,000,000 */ |
84 long_msg = (char *) malloc(1000001); | 87 long_msg = (char *) malloc(1000001); |
85 memset(long_msg, 'a', 1000000); | 88 memset(long_msg, 'a', 1000000); |
86 long_msg[1000000]=0; | 89 long_msg[1000000]=0; |
87 | 90 |
88 if (!SHA1_tests()) | 91 if (!SHA1_tests()) |
89 success = 0; | 92 success = 0; |
90 if (!SHA256_tests()) | 93 if (!SHA256_tests()) |
91 success = 0; | 94 success = 0; |
92 if (!SHA512_tests()) | 95 if (!SHA512_tests()) |
93 success = 0; | 96 success = 0; |
94 | 97 |
95 free(long_msg); | 98 free(long_msg); |
96 | 99 |
97 return !success; | 100 return !success; |
98 } | 101 } |
OLD | NEW |