CS318 - Pintos
Pintos source browser for JHU CS318 course
pt-grow-stack.c
Go to the documentation of this file.
1 /** Demonstrate that the stack can grow.
2  This must succeed. */
3 
4 #include <string.h>
5 #include "tests/arc4.h"
6 #include "tests/cksum.h"
7 #include "tests/lib.h"
8 #include "tests/main.h"
9 
10 void
11 test_main (void)
12 {
13  char stack_obj[4096];
14  struct arc4 arc4;
15 
16  arc4_init (&arc4, "foobar", 6);
17  memset (stack_obj, 0, sizeof stack_obj);
18  arc4_crypt (&arc4, stack_obj, sizeof stack_obj);
19  msg ("cksum: %lu", cksum (stack_obj, sizeof stack_obj));
20 }
lib.h
test_main
void test_main(void)
Demonstrate that the stack can grow.
Definition: pt-grow-stack.c:11
arc4
Alleged RC4 algorithm encryption state.
Definition: arc4.h:8
string.h
arc4_init
void arc4_init(struct arc4 *arc4, const void *key_, size_t size)
Definition: arc4.c:14
arc4_crypt
void arc4_crypt(struct arc4 *arc4, void *buf_, size_t size)
tests/arc4.h
Definition: arc4.c:35
arc4.h
cksum.h
cksum
unsigned long cksum(const void *b_, size_t n)
This is the algorithm used by the Posix ‘cksum’ utility.
Definition: cksum.c:63
main.h
msg
void msg(const char *format,...)
Definition: lib.c:28
memset
void * memset(void *dst_, int value, size_t size)
Sets the SIZE bytes in DST to VALUE.
Definition: string.c:279