PolarSSL v1.3.1
memory.h
Go to the documentation of this file.
1 
27 #ifndef POLARSSL_MEMORY_H
28 #define POLARSSL_MEMORY_H
29 
30 #include "config.h"
31 
32 #include <stdlib.h>
33 
34 #if !defined(POLARSSL_CONFIG_OPTIONS)
35 #define POLARSSL_MEMORY_ALIGN_MULTIPLE 4
37 #define POLARSSL_MEMORY_STDMALLOC malloc
38 #define POLARSSL_MEMORY_STDFREE free
39 #endif /* POLARSSL_CONFIG_OPTIONS */
40 
41 #define MEMORY_VERIFY_NONE 0
42 #define MEMORY_VERIFY_ALLOC (1 << 0)
43 #define MEMORY_VERIFY_FREE (1 << 1)
44 #define MEMORY_VERIFY_ALWAYS (MEMORY_VERIFY_ALLOC | MEMORY_VERIFY_FREE)
45 
46 #ifdef __cplusplus
47 extern "C" {
48 #endif
49 
50 /*
51  * The function pointers for malloc and free
52  */
53 extern void * (*polarssl_malloc)( size_t len );
54 extern void (*polarssl_free)( void *ptr );
55 
64 int memory_set_own( void * (*malloc_func)( size_t ),
65  void (*free_func)( void * ) );
66 
67 #if defined(POLARSSL_MEMORY_BUFFER_ALLOC_C)
68 
85 int memory_buffer_alloc_init( unsigned char *buf, size_t len );
86 
90 void memory_buffer_alloc_free();
91 
100 void memory_buffer_set_verify( int verify );
101 
102 #if defined(POLARSSL_MEMORY_DEBUG)
103 
109 void memory_buffer_alloc_status();
110 #endif /* POLARSSL_MEMORY_DEBUG */
111 
123 int memory_buffer_alloc_verify();
124 
125 #endif /* POLARSSL_MEMORY_BUFFER_ALLOC_C */
126 
127 #ifdef __cplusplus
128 }
129 #endif
130 
131 #endif /* memory.h */
Configuration options (set of defines)
void(* polarssl_free)(void *ptr)
int memory_set_own(void *(*malloc_func)(size_t), void(*free_func)(void *))
Set your own memory implementation function pointers.