Renesas / SecureDweet
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers memory.h Source File

memory.h

00001 /* memory.h
00002  *
00003  * Copyright (C) 2006-2016 wolfSSL Inc.
00004  *
00005  * This file is part of wolfSSL.
00006  *
00007  * wolfSSL is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 2 of the License, or
00010  * (at your option) any later version.
00011  *
00012  * wolfSSL is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
00020  */
00021 
00022 
00023 /* submitted by eof */
00024 
00025 
00026 #ifndef WOLFSSL_MEMORY_H
00027 #define WOLFSSL_MEMORY_H
00028 
00029 #include <stdlib.h>
00030 #include <wolfssl/wolfcrypt/types.h>
00031 
00032 #ifdef __cplusplus
00033     extern "C" {
00034 #endif
00035 
00036 typedef void *(*wolfSSL_Malloc_cb)(size_t size);
00037 typedef void (*wolfSSL_Free_cb)(void *ptr);
00038 typedef void *(*wolfSSL_Realloc_cb)(void *ptr, size_t size);
00039 
00040 
00041 /* Public set function */
00042 WOLFSSL_API int wolfSSL_SetAllocators(wolfSSL_Malloc_cb  malloc_function,
00043                                     wolfSSL_Free_cb    free_function,
00044                                     wolfSSL_Realloc_cb realloc_function);
00045 
00046 /* Public in case user app wants to use XMALLOC/XFREE */
00047 WOLFSSL_API void* wolfSSL_Malloc(size_t size);
00048 WOLFSSL_API void  wolfSSL_Free(void *ptr);
00049 WOLFSSL_API void* wolfSSL_Realloc(void *ptr, size_t size);
00050 
00051 
00052 #ifdef __cplusplus
00053     }  /* extern "C" */
00054 #endif
00055 
00056 #endif /* WOLFSSL_MEMORY_H */
00057 
00058