PKUOS - Pintos
Pintos source browser for PKU Operating System course
pt-big-stk-obj.c
Go to the documentation of this file.
1/** Allocates and writes to a 64 kB object on the stack.
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
10void
12{
13 char stk_obj[65536];
14 struct arc4 arc4;
15
16 arc4_init (&arc4, "foobar", 6);
17 memset (stk_obj, 0, sizeof stk_obj);
18 arc4_crypt (&arc4, stk_obj, sizeof stk_obj);
19 msg ("cksum: %lu", cksum (stk_obj, sizeof stk_obj));
20}
void arc4_init(struct arc4 *arc4, const void *key_, size_t size)
Definition: arc4.c:14
void arc4_crypt(struct arc4 *arc4, void *buf_, size_t size)
tests/arc4.h
Definition: arc4.c:35
unsigned long cksum(const void *b_, size_t n)
This is the algorithm used by the Posix ‘cksum’ utility.
Definition: cksum.c:63
void msg(const char *format,...)
Definition: lib.c:28
void test_main(void)
Allocates and writes to a 64 kB object on the stack.
void * memset(void *dst_, int value, size_t size)
Sets the SIZE bytes in DST to VALUE.
Definition: string.c:279
Alleged RC4 algorithm encryption state.
Definition: arc4.h:9