blob: 039740c12a80c489e90d66603008956733af8223 [file] [log] [blame]
Paul Bakker6e339b52013-07-03 13:37:05 +02001/**
2 * \file memory.h
3 *
Paul Bakkerdefc0ca2014-02-04 17:30:24 +01004 * \brief Memory allocation layer (Deprecated to platform layer)
Paul Bakker6e339b52013-07-03 13:37:05 +02005 *
Manuel Pégourié-Gonnarda658a402015-01-23 09:45:19 +00006 * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved
Paul Bakker6e339b52013-07-03 13:37:05 +02007 *
Manuel Pégourié-Gonnard085ab042015-01-23 11:06:27 +00008 * This file is part of mbed TLS (https://www.polarssl.org)
Paul Bakker6e339b52013-07-03 13:37:05 +02009 *
Paul Bakker6e339b52013-07-03 13:37:05 +020010 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 */
24#ifndef POLARSSL_MEMORY_H
25#define POLARSSL_MEMORY_H
26
Manuel Pégourié-Gonnardcef4ad22014-04-29 12:39:06 +020027#if !defined(POLARSSL_CONFIG_FILE)
Paul Bakker6e339b52013-07-03 13:37:05 +020028#include "config.h"
Manuel Pégourié-Gonnardcef4ad22014-04-29 12:39:06 +020029#else
30#include POLARSSL_CONFIG_FILE
31#endif
Paul Bakker6e339b52013-07-03 13:37:05 +020032
33#include <stdlib.h>
34
Paul Bakkerdefc0ca2014-02-04 17:30:24 +010035#if defined(POLARSSL_MEMORY_C) && !defined(POLARSSL_PLATFORM_MEMORY)
36#define POLARSSL_PLATFORM_MEMORY
Paul Bakker6e339b52013-07-03 13:37:05 +020037#endif
38
Paul Bakkerdefc0ca2014-02-04 17:30:24 +010039#include "platform.h"
40#include "memory_buffer_alloc.h"
Paul Bakker6e339b52013-07-03 13:37:05 +020041
Paul Bakker6e339b52013-07-03 13:37:05 +020042int memory_set_own( void * (*malloc_func)( size_t ),
Paul Bakkerdefc0ca2014-02-04 17:30:24 +010043 void (*free_func)( void * ) )
44{
45 return platform_set_malloc_free( malloc_func, free_func );
Paul Bakker6e339b52013-07-03 13:37:05 +020046}
Paul Bakkerdefc0ca2014-02-04 17:30:24 +010047
Paul Bakker6e339b52013-07-03 13:37:05 +020048
49#endif /* memory.h */