Revision bd31d02e412f80f53073a1eb776dffe06ac91746 authored by Richard Levitte on 14 January 2016, 14:26:56 UTC, committed by Richard Levitte on 14 January 2016, 14:26:56 UTC
Reviewed-by: Matt Caswell <matt@openssl.org>
1 parent 58add89
secmemtest.c
#include <openssl/crypto.h>
int main(int argc, char **argv)
{
#if defined(OPENSSL_SYS_LINUX) || defined(OPENSSL_SYS_UNIX)
char *p = NULL, *q = NULL;
if (!CRYPTO_secure_malloc_init(4096, 32)) {
perror("failed");
return 1;
}
p = OPENSSL_secure_malloc(20);
if (!CRYPTO_secure_allocated(p)) {
perror("failed 1");
return 1;
}
q = OPENSSL_malloc(20);
if (CRYPTO_secure_allocated(q)) {
perror("failed 1");
return 1;
}
CRYPTO_secure_free(p);
CRYPTO_free(q);
CRYPTO_secure_malloc_done();
#else
/* Should fail. */
if (CRYPTO_secure_malloc_init(4096, 32)) {
perror("failed");
return 1;
}
#endif
return 0;
}

Computing file changes ...