Make sure to actually use @smime_cms_comp_test when testing it...
[openssl.git] / test / secmemtest.c
1
2 #include <openssl/crypto.h>
3
4 int 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     }
23     CRYPTO_secure_free(p);
24     CRYPTO_free(q);
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 }