blob: 81f9d542327a7976ae757eaa7ec4df754e1b8685 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
/* See LICENSE file for copyright and license details. */
#include "common.h"
#ifndef TEST
extern inline void librecrypt_wipe_str(char *string);
#else
#define CHECK(TEXT)\
do {\
memset(buf, 0, sizeof(buf));\
stpcpy(buf, (TEXT));\
assert(!strcmp(buf, (TEXT)));\
librecrypt_wipe_str(buf);\
for (i = 0u; i < sizeof(buf); i++)\
EXPECT(!buf[i]);\
} while (0)
int
main(void)
{
char buf[64u];
size_t i;
SET_UP_ALARM();
/* Check NULL is supported */
librecrypt_wipe_str(NULL);
/* Check normal cases */
CHECK("");
CHECK("hello");
CHECK("hello developer");
CHECK(" hello developer ");
CHECK("\1 hello developer \1");
return 0;
}
#endif
|