From 04dcea14217395ee09915aafb4532a6dd495fa53 Mon Sep 17 00:00:00 2001 From: Yann Herklotz Date: Fri, 19 Jun 2020 11:17:51 +0100 Subject: Add CHstone --- benchmarks/CHStone/sha/sha_driver.c | 56 +++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100755 benchmarks/CHStone/sha/sha_driver.c (limited to 'benchmarks/CHStone/sha/sha_driver.c') diff --git a/benchmarks/CHStone/sha/sha_driver.c b/benchmarks/CHStone/sha/sha_driver.c new file mode 100755 index 0000000..5cbb394 --- /dev/null +++ b/benchmarks/CHStone/sha/sha_driver.c @@ -0,0 +1,56 @@ +/* ++--------------------------------------------------------------------------+ +| CHStone : a suite of benchmark programs for C-based High-Level Synthesis | +| ======================================================================== | +| | +| * Collected and Modified : Y. Hara, H. Tomiyama, S. Honda, | +| H. Takada and K. Ishii | +| Nagoya University, Japan | +| | +| * Remark : | +| 1. This source code is modified to unify the formats of the benchmark | +| programs in CHStone. | +| 2. Test vectors are added for CHStone. | +| 3. If "main_result" is 0 at the end of the program, the program is | +| correctly executed. | +| 4. Please follow the copyright of each benchmark program. | ++--------------------------------------------------------------------------+ +*/ +/* NIST Secure Hash Algorithm */ +/* heavily modified by Uwe Hollerbach uh@alumni.caltech edu */ +/* from Peter C. Gutmann's implementation as found in */ +/* Applied Cryptography by Bruce Schneier */ + +/* NIST's proposed modification to SHA of 7/11/94 may be */ +/* activated by defining USE_MODIFIED_SHA */ + +#include +#include "sha.h" +#include "sha.c" + +/* ++--------------------------------------------------------------------------+ +| * Test Vector (added for CHStone) | +| outData : expected output data | ++--------------------------------------------------------------------------+ +*/ +const INT32 outData[5] = + { 0x006a5a37UL, 0x93dc9485UL, 0x2c412112UL, 0x63f7ba43UL, 0xad73f922UL }; + +int +main () +{ + int i; + int main_result; + main_result = 0; + sha_stream (); + + for (i = 0; i < 5; i++) + { + + main_result += (sha_info_digest[i] != outData[i]); + } + printf ("%d\n", main_result); + + return main_result; + } -- cgit