PandA-2024.02
aes.c
Go to the documentation of this file.
1 /*
2 +--------------------------------------------------------------------------+
3 | CHStone : a suite of benchmark programs for C-based High-Level Synthesis |
4 | ======================================================================== |
5 | |
6 | * Collected and Modified : Y. Hara, H. Tomiyama, S. Honda, |
7 | H. Takada and K. Ishii |
8 | Nagoya University, Japan |
9 | |
10 | * Remark : |
11 | 1. This source code is modified to unify the formats of the benchmark |
12 | programs in CHStone. |
13 | 2. Test vectors are added for CHStone. |
14 | 3. If "main_result" is 0 at the end of the program, the program is |
15 | correctly executed. |
16 | 4. Please follow the copyright of each benchmark program. |
17 +--------------------------------------------------------------------------+
18 */
19 /* aes.c */
20 /*
21  * Copyright (C) 2005
22  * Akira Iwata & Masayuki Sato
23  * Akira Iwata Laboratory,
24  * Nagoya Institute of Technology in Japan.
25  *
26  * All rights reserved.
27  *
28  * This software is written by Masayuki Sato.
29  * And if you want to contact us, send an email to Kimitake Wakayama
30  * (wakayama@elcom.nitech.ac.jp)
31  *
32  * Redistribution and use in source and binary forms, with or without modification,
33  * are permitted provided that the following conditions are met:
34  *
35  * 1. Redistributions of source code must retain the above copyright notice,
36  * this list of conditions and the following disclaimer.
37  *
38  * 2. Redistributions in binary form must reproduce the above copyright notice,
39  * this list of conditions and the following disclaimer in the documentation
40  * and/or other materials provided with the distribution.
41  *
42  * 3. All advertising materials mentioning features or use of this software must
43  * display the following acknowledgment:
44  * "This product includes software developed by Akira Iwata Laboratory,
45  * Nagoya Institute of Technology in Japan (http://mars.elcom.nitech.ac.jp/)."
46  *
47  * 4. Redistributions of any form whatsoever must retain the following
48  * acknowledgment:
49  * "This product includes software developed by Akira Iwata Laboratory,
50  * Nagoya Institute of Technology in Japan (http://mars.elcom.nitech.ac.jp/)."
51  *
52  * THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
53  * AKIRA IWATA LABORATORY DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
54  * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
55  * IN NO EVENT SHALL AKIRA IWATA LABORATORY BE LIABLE FOR ANY SPECIAL,
56  * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
57  * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
58  * NEGLIGENCE OR OTHER TORTUOUS ACTION, ARISING OUT OF OR IN CONNECTION
59  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
60  *
61  */
62 #include <stdio.h>
63 
64 
66 
67 #include "aes.h"
68 #include "aes_enc.c"
69 #include "aes_dec.c"
70 #include "aes_key.c"
71 #include "aes_func.c"
72 
73 /* ***************** main **************************** */
74 int
75 aes_main (void)
76 {
77 /*
78 +--------------------------------------------------------------------------+
79 | * Test Vectors (added for CHStone) |
80 | statemt, key : input data |
81 +--------------------------------------------------------------------------+
82 */
83  statemt[0] = 50;
84  statemt[1] = 67;
85  statemt[2] = 246;
86  statemt[3] = 168;
87  statemt[4] = 136;
88  statemt[5] = 90;
89  statemt[6] = 48;
90  statemt[7] = 141;
91  statemt[8] = 49;
92  statemt[9] = 49;
93  statemt[10] = 152;
94  statemt[11] = 162;
95  statemt[12] = 224;
96  statemt[13] = 55;
97  statemt[14] = 7;
98  statemt[15] = 52;
99 
100  key[0] = 43;
101  key[1] = 126;
102  key[2] = 21;
103  key[3] = 22;
104  key[4] = 40;
105  key[5] = 174;
106  key[6] = 210;
107  key[7] = 166;
108  key[8] = 171;
109  key[9] = 247;
110  key[10] = 21;
111  key[11] = 136;
112  key[12] = 9;
113  key[13] = 207;
114  key[14] = 79;
115  key[15] = 60;
116 
117  encrypt (statemt, key, 128128);
118  decrypt (statemt, key, 128128);
119  return 0;
120 }
121 
122 int
124 {
125  main_result = 0;
126  aes_main ();
127  printf ("\n%d\n", main_result);
128  return main_result;
129  }
int key[32]
Definition: aes.h:67
int statemt[32]
Definition: aes.h:68
int decrypt(int *, int *, int)
int encrypt(int *, int *, int)
int main_result
Definition: aes.c:65
int main()
Definition: aes.c:123
int aes_main(void)
Definition: aes.c:75

Generated on Mon Feb 12 2024 13:02:48 for PandA-2024.02 by doxygen 1.8.13