PandA-2024.02
support.c
Go to the documentation of this file.
1 #include "FIXME.h"
2 #include <string.h>
3 
4 int INPUT_SIZE = sizeof(struct bench_args_t);
5 
6 void run_benchmark( void *vargs ) {
7  struct bench_args_t *args = (struct bench_args_t *)vargs;
8  FIXME( &(args->ctx), args->k, args->buf );
9 }
10 
11 /* Input format:
12 %% Section 1
13 FIXME type[SIZE]: FIXME description
14 ...
15 */
16 
17 void input_to_data(int fd, void *vdata) {
18  struct bench_args_t *data = (struct bench_args_t *)vdata;
19  char *p, *s;
20  // Zero-out everything.
21  memset(vdata,0,sizeof(struct bench_args_t));
22  // Load input string
23  p = readfile(fd);
24 
25  s = find_section_start(p,1);
26  parse_FIXME_array(s, data->FIXME_attribute, FIXME_size);
27  // FIXME ...
28 }
29 
30 void data_to_input(int fd, void *vdata) {
31  struct bench_args_t *data = (struct bench_args_t *)vdata;
32 
34  write_FIXME_array(fd, data->FIXME_attribute, FIXME_size);
35  // FIXME ...
36 }
37 
38 /* Output format:
39 %% Section 1
40 FIXME type[SIZE]: FIXME description
41 ...
42 */
43 
44 void output_to_data(int fd, void *vdata) {
45  struct bench_args_t *data = (struct bench_args_t *)vdata;
46  char *p, *s;
47  // Zero-out everything.
48  memset(vdata,0,sizeof(struct bench_args_t));
49  // Load input string
50  p = readfile(fd);
51 
52  s = find_section_start(p,1);
53  parse_FIXME_array(s, data->FIXME_attribute, FIXME_size);
54  // FIXME ...
55 }
56 
57 void data_to_output(int fd, void *vdata) {
58  struct bench_args_t *data = (struct bench_args_t *)vdata;
59 
61  write_FIXME_array(fd, data->FIXME_attribute, FIXME_size);
62  // FIXME ...
63 }
64 
65 int check_data( void *vdata, void *vref ) {
66  struct bench_args_t *data = (struct bench_args_t *)vdata;
67  struct bench_args_t *ref = (struct bench_args_t *)vref;
68  int has_errors = 0;
69 
70  // FIXME
71  // example of direct memory (string) compare
72  //has_errors |= memcmp(&data->FIXME_attr, &ref->FIXME_attr, FIXME_size);
73  // example of element compare
74  //for(int i=0; i<FIXME_size; i++) {
75  // has_errors |= (data->FIXME_attr[i]!=ref->FIXME_attr[i]);
76  //}
77 
78  // Return true if it's correct.
79  return !has_errors;
80 }
void input_to_data(int fd, void *vdata)
Definition: support.c:17
int check_data(void *vdata, void *vref)
Definition: support.c:65
int INPUT_SIZE
Definition: support.c:4
int write_section_header(int fd)
void output_to_data(int fd, void *vdata)
Definition: support.c:44
uint8_t buf[16]
Definition: aes.h:21
char * readfile(int fd)
Definition: support.c:34
void data_to_output(int fd, void *vdata)
Definition: support.c:57
char * find_section_start(char *s, int n)
Definition: support.c:56
void run_benchmark(void *vargs)
Definition: support.c:6
aes256_context ctx
Definition: aes.h:19
uint8_t k[32]
Definition: aes.h:20
void data_to_input(int fd, void *vdata)
Definition: support.c:30

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