]> git.ipfire.org Git - thirdparty/openssl.git/blame - test/secmemtest.c
ssl/record/rec_layer_s3.c: fix typo from previous commit.
[thirdparty/openssl.git] / test / secmemtest.c
CommitLineData
74924dcb
RS
1
2#include <openssl/crypto.h>
3
4int main(int argc, char **argv)
5{
6#if defined(OPENSSL_SYS_LINUX) || defined(OPENSSL_SYS_UNIX)
7 char *p = NULL, *q = NULL;
8
9 if (!CRYPTO_secure_malloc_init(4096, 32)) {
10 perror("failed");
11 return 1;
12 }
13 p = OPENSSL_secure_malloc(20);
14 if (!CRYPTO_secure_allocated(p)) {
15 perror("failed 1");
16 return 1;
17 }
18 q = OPENSSL_malloc(20);
19 if (CRYPTO_secure_allocated(q)) {
20 perror("failed 1");
21 return 1;
22 }
d6b55fac
RL
23 OPENSSL_secure_free(p);
24 OPENSSL_free(q);
74924dcb
RS
25 CRYPTO_secure_malloc_done();
26#else
27 /* Should fail. */
28 if (CRYPTO_secure_malloc_init(4096, 32)) {
29 perror("failed");
30 return 1;
31 }
32#endif
33 return 0;
34}