blob: 8b8ac5dc4bc5d8a1740b445bbe7cbd0e63dd567d [file] [log] [blame]
Paul Bakker6e339b52013-07-03 13:37:05 +02001/**
2 * \file memory.h
3 *
Manuel Pégourié-Gonnard71432842015-03-20 16:19:35 +00004 * \brief Memory allocation layer
5 *
6 * \deprecated Use the platform layer instead
Paul Bakker6e339b52013-07-03 13:37:05 +02007 *
Manuel Pégourié-Gonnarda658a402015-01-23 09:45:19 +00008 * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved
Paul Bakker6e339b52013-07-03 13:37:05 +02009 *
Manuel Pégourié-Gonnardfe446432015-03-06 13:17:10 +000010 * This file is part of mbed TLS (https://tls.mbed.org)
Paul Bakker6e339b52013-07-03 13:37:05 +020011 *
Paul Bakker6e339b52013-07-03 13:37:05 +020012 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License along
23 * with this program; if not, write to the Free Software Foundation, Inc.,
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 */
26#ifndef POLARSSL_MEMORY_H
27#define POLARSSL_MEMORY_H
28
Manuel Pégourié-Gonnardcef4ad22014-04-29 12:39:06 +020029#if !defined(POLARSSL_CONFIG_FILE)
Paul Bakker6e339b52013-07-03 13:37:05 +020030#include "config.h"
Manuel Pégourié-Gonnardcef4ad22014-04-29 12:39:06 +020031#else
32#include POLARSSL_CONFIG_FILE
33#endif
Paul Bakker6e339b52013-07-03 13:37:05 +020034
35#include <stdlib.h>
36
Paul Bakkerdefc0ca2014-02-04 17:30:24 +010037#include "platform.h"
38#include "memory_buffer_alloc.h"
Paul Bakker6e339b52013-07-03 13:37:05 +020039
Manuel Pégourié-Gonnardc70581c2015-03-23 13:58:27 +010040#if ! defined(POLARSSL_DEPRECATED_REMOVED)
41#if defined(POLARSSL_DEPRECATED_WARNING)
42#define DEPRECATED __attribute__((deprecated))
43#else
44#define DEPRECATED
45#endif
Manuel Pégourié-Gonnard71432842015-03-20 16:19:35 +000046/**
47 * \brief Set malloc() / free() callback
48 *
49 * \deprecated Use platform_set_malloc_free instead
50 */
Paul Bakker6e339b52013-07-03 13:37:05 +020051int memory_set_own( void * (*malloc_func)( size_t ),
Manuel Pégourié-Gonnardc70581c2015-03-23 13:58:27 +010052 void (*free_func)( void * ) ) DEPRECATED;
53int memory_set_own( void * (*malloc_func)( size_t ),
Paul Bakkerdefc0ca2014-02-04 17:30:24 +010054 void (*free_func)( void * ) )
55{
56 return platform_set_malloc_free( malloc_func, free_func );
Paul Bakker6e339b52013-07-03 13:37:05 +020057}
Manuel Pégourié-Gonnardc70581c2015-03-23 13:58:27 +010058#undef DEPRECATED
59#endif /* POLARSSL_DEPRECATED_REMOVED */
Paul Bakkerdefc0ca2014-02-04 17:30:24 +010060
Paul Bakker6e339b52013-07-03 13:37:05 +020061
62#endif /* memory.h */