<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta name="generator" content="Doxygen 1.8.13"/> <meta name="viewport" content="width=device-width, initial-scale=1"/> <title>mbed TLS v2.7.8: memory_buffer_alloc.h Source File</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td id="projectalign" style="padding-left: 0.5em;"> <div id="projectname">mbed TLS v2.7.8 </div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.13 --> <script type="text/javascript" src="menudata.js"></script> <script type="text/javascript" src="menu.js"></script> <script type="text/javascript"> $(function() { initMenu('',false,false,'search.php','Search'); }); </script> <div id="main-nav"></div> <div id="nav-path" class="navpath"> <ul> <li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="dir_b4d146e9a6d8dd56ed4afb2480a97fd3.html">mbedtls</a></li> </ul> </div> </div><!-- top --> <div class="header"> <div class="headertitle"> <div class="title">memory_buffer_alloc.h</div> </div> </div><!--header--> <div class="contents"> <a href="memory__buffer__alloc_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> </div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="comment">/*</span></div><div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="comment"> * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved</span></div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="comment"> * SPDX-License-Identifier: Apache-2.0</span></div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="comment"> *</span></div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="comment"> * Licensed under the Apache License, Version 2.0 (the "License"); you may</span></div><div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="comment"> * not use this file except in compliance with the License.</span></div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span> <span class="comment"> * You may obtain a copy of the License at</span></div><div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="comment"> *</span></div><div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="comment"> * http://www.apache.org/licenses/LICENSE-2.0</span></div><div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="comment"> *</span></div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span> <span class="comment"> * Unless required by applicable law or agreed to in writing, software</span></div><div class="line"><a name="l00017"></a><span class="lineno"> 17</span> <span class="comment"> * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT</span></div><div class="line"><a name="l00018"></a><span class="lineno"> 18</span> <span class="comment"> * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span></div><div class="line"><a name="l00019"></a><span class="lineno"> 19</span> <span class="comment"> * See the License for the specific language governing permissions and</span></div><div class="line"><a name="l00020"></a><span class="lineno"> 20</span> <span class="comment"> * limitations under the License.</span></div><div class="line"><a name="l00021"></a><span class="lineno"> 21</span> <span class="comment"> *</span></div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span> <span class="comment"> * This file is part of mbed TLS (https://tls.mbed.org)</span></div><div class="line"><a name="l00023"></a><span class="lineno"> 23</span> <span class="comment"> */</span></div><div class="line"><a name="l00024"></a><span class="lineno"> 24</span> <span class="preprocessor">#ifndef MBEDTLS_MEMORY_BUFFER_ALLOC_H</span></div><div class="line"><a name="l00025"></a><span class="lineno"> 25</span> <span class="preprocessor">#define MBEDTLS_MEMORY_BUFFER_ALLOC_H</span></div><div class="line"><a name="l00026"></a><span class="lineno"> 26</span> </div><div class="line"><a name="l00027"></a><span class="lineno"> 27</span> <span class="preprocessor">#if !defined(MBEDTLS_CONFIG_FILE)</span></div><div class="line"><a name="l00028"></a><span class="lineno"> 28</span> <span class="preprocessor">#include "<a class="code" href="config_8h.html">config.h</a>"</span></div><div class="line"><a name="l00029"></a><span class="lineno"> 29</span> <span class="preprocessor">#else</span></div><div class="line"><a name="l00030"></a><span class="lineno"> 30</span> <span class="preprocessor">#include MBEDTLS_CONFIG_FILE</span></div><div class="line"><a name="l00031"></a><span class="lineno"> 31</span> <span class="preprocessor">#endif</span></div><div class="line"><a name="l00032"></a><span class="lineno"> 32</span> </div><div class="line"><a name="l00033"></a><span class="lineno"> 33</span> <span class="preprocessor">#include <stddef.h></span></div><div class="line"><a name="l00034"></a><span class="lineno"> 34</span> </div><div class="line"><a name="l00043"></a><span class="lineno"> 43</span> <span class="preprocessor">#if !defined(MBEDTLS_MEMORY_ALIGN_MULTIPLE)</span></div><div class="line"><a name="l00044"></a><span class="lineno"><a class="line" href="memory__buffer__alloc_8h.html#a1fa1e20d4ff40eb6c2a740d7d26b2749"> 44</a></span> <span class="preprocessor">#define MBEDTLS_MEMORY_ALIGN_MULTIPLE 4 </span></div><div class="line"><a name="l00045"></a><span class="lineno"> 45</span> <span class="preprocessor">#endif</span></div><div class="line"><a name="l00046"></a><span class="lineno"> 46</span> </div><div class="line"><a name="l00047"></a><span class="lineno"> 47</span> <span class="comment">/* \} name SECTION: Module settings */</span></div><div class="line"><a name="l00048"></a><span class="lineno"> 48</span> </div><div class="line"><a name="l00049"></a><span class="lineno"><a class="line" href="memory__buffer__alloc_8h.html#a2b9fd1ef7a128cf7680e6c9c377134d4"> 49</a></span> <span class="preprocessor">#define MBEDTLS_MEMORY_VERIFY_NONE 0</span></div><div class="line"><a name="l00050"></a><span class="lineno"><a class="line" href="memory__buffer__alloc_8h.html#a3fb815b3f3b7cfce7c5ddd6f2a33b80d"> 50</a></span> <span class="preprocessor">#define MBEDTLS_MEMORY_VERIFY_ALLOC (1 << 0)</span></div><div class="line"><a name="l00051"></a><span class="lineno"><a class="line" href="memory__buffer__alloc_8h.html#a1c7f2d8956e95373dcb4fe24154b6650"> 51</a></span> <span class="preprocessor">#define MBEDTLS_MEMORY_VERIFY_FREE (1 << 1)</span></div><div class="line"><a name="l00052"></a><span class="lineno"><a class="line" href="memory__buffer__alloc_8h.html#a581a709e67d33b34d3c8a7dfb4b3df00"> 52</a></span> <span class="preprocessor">#define MBEDTLS_MEMORY_VERIFY_ALWAYS (MBEDTLS_MEMORY_VERIFY_ALLOC | MBEDTLS_MEMORY_VERIFY_FREE)</span></div><div class="line"><a name="l00053"></a><span class="lineno"> 53</span> </div><div class="line"><a name="l00054"></a><span class="lineno"> 54</span> <span class="preprocessor">#ifdef __cplusplus</span></div><div class="line"><a name="l00055"></a><span class="lineno"> 55</span> <span class="keyword">extern</span> <span class="stringliteral">"C"</span> {</div><div class="line"><a name="l00056"></a><span class="lineno"> 56</span> <span class="preprocessor">#endif</span></div><div class="line"><a name="l00057"></a><span class="lineno"> 57</span> </div><div class="line"><a name="l00073"></a><span class="lineno"> 73</span> <span class="keywordtype">void</span> <a class="code" href="memory__buffer__alloc_8h.html#ac70d134be54133c272d8eab2cb85dfbf">mbedtls_memory_buffer_alloc_init</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *buf, <span class="keywordtype">size_t</span> len );</div><div class="line"><a name="l00074"></a><span class="lineno"> 74</span> </div><div class="line"><a name="l00078"></a><span class="lineno"> 78</span> <span class="keywordtype">void</span> <a class="code" href="memory__buffer__alloc_8h.html#ae9d7316a19b72776f34ba74720a06325">mbedtls_memory_buffer_alloc_free</a>( <span class="keywordtype">void</span> );</div><div class="line"><a name="l00079"></a><span class="lineno"> 79</span> </div><div class="line"><a name="l00088"></a><span class="lineno"> 88</span> <span class="keywordtype">void</span> <a class="code" href="memory__buffer__alloc_8h.html#aaa50603bb2f2f1fe8d97d6953589b832">mbedtls_memory_buffer_set_verify</a>( <span class="keywordtype">int</span> verify );</div><div class="line"><a name="l00089"></a><span class="lineno"> 89</span> </div><div class="line"><a name="l00090"></a><span class="lineno"> 90</span> <span class="preprocessor">#if defined(MBEDTLS_MEMORY_DEBUG)</span></div><div class="line"><a name="l00091"></a><span class="lineno"> 91</span> </div><div class="line"><a name="l00097"></a><span class="lineno"> 97</span> <span class="keywordtype">void</span> mbedtls_memory_buffer_alloc_status( <span class="keywordtype">void</span> );</div><div class="line"><a name="l00098"></a><span class="lineno"> 98</span> </div><div class="line"><a name="l00107"></a><span class="lineno"> 107</span> <span class="keywordtype">void</span> mbedtls_memory_buffer_alloc_max_get( <span class="keywordtype">size_t</span> *max_used, <span class="keywordtype">size_t</span> *max_blocks );</div><div class="line"><a name="l00108"></a><span class="lineno"> 108</span> </div><div class="line"><a name="l00112"></a><span class="lineno"> 112</span> <span class="keywordtype">void</span> mbedtls_memory_buffer_alloc_max_reset( <span class="keywordtype">void</span> );</div><div class="line"><a name="l00113"></a><span class="lineno"> 113</span> </div><div class="line"><a name="l00122"></a><span class="lineno"> 122</span> <span class="keywordtype">void</span> mbedtls_memory_buffer_alloc_cur_get( <span class="keywordtype">size_t</span> *cur_used, <span class="keywordtype">size_t</span> *cur_blocks );</div><div class="line"><a name="l00123"></a><span class="lineno"> 123</span> <span class="preprocessor">#endif </span><span class="comment">/* MBEDTLS_MEMORY_DEBUG */</span><span class="preprocessor"></span></div><div class="line"><a name="l00124"></a><span class="lineno"> 124</span> </div><div class="line"><a name="l00136"></a><span class="lineno"> 136</span> <span class="keywordtype">int</span> <a class="code" href="memory__buffer__alloc_8h.html#a7aae8a0cd61f08dd6734ebc8a8a3ba38">mbedtls_memory_buffer_alloc_verify</a>( <span class="keywordtype">void</span> );</div><div class="line"><a name="l00137"></a><span class="lineno"> 137</span> </div><div class="line"><a name="l00138"></a><span class="lineno"> 138</span> <span class="preprocessor">#if defined(MBEDTLS_SELF_TEST)</span></div><div class="line"><a name="l00139"></a><span class="lineno"> 139</span> </div><div class="line"><a name="l00144"></a><span class="lineno"> 144</span> <span class="keywordtype">int</span> <a class="code" href="memory__buffer__alloc_8h.html#ab1304c317468fb66c21ee52c79efe084">mbedtls_memory_buffer_alloc_self_test</a>( <span class="keywordtype">int</span> verbose );</div><div class="line"><a name="l00145"></a><span class="lineno"> 145</span> <span class="preprocessor">#endif</span></div><div class="line"><a name="l00146"></a><span class="lineno"> 146</span> </div><div class="line"><a name="l00147"></a><span class="lineno"> 147</span> <span class="preprocessor">#ifdef __cplusplus</span></div><div class="line"><a name="l00148"></a><span class="lineno"> 148</span> }</div><div class="line"><a name="l00149"></a><span class="lineno"> 149</span> <span class="preprocessor">#endif</span></div><div class="line"><a name="l00150"></a><span class="lineno"> 150</span> </div><div class="line"><a name="l00151"></a><span class="lineno"> 151</span> <span class="preprocessor">#endif </span><span class="comment">/* memory_buffer_alloc.h */</span><span class="preprocessor"></span></div><div class="ttc" id="memory__buffer__alloc_8h_html_ab1304c317468fb66c21ee52c79efe084"><div class="ttname"><a href="memory__buffer__alloc_8h.html#ab1304c317468fb66c21ee52c79efe084">mbedtls_memory_buffer_alloc_self_test</a></div><div class="ttdeci">int mbedtls_memory_buffer_alloc_self_test(int verbose)</div><div class="ttdoc">Checkup routine. </div></div> <div class="ttc" id="memory__buffer__alloc_8h_html_a7aae8a0cd61f08dd6734ebc8a8a3ba38"><div class="ttname"><a href="memory__buffer__alloc_8h.html#a7aae8a0cd61f08dd6734ebc8a8a3ba38">mbedtls_memory_buffer_alloc_verify</a></div><div class="ttdeci">int mbedtls_memory_buffer_alloc_verify(void)</div><div class="ttdoc">Verifies that all headers in the memory buffer are correct and contain sane values. Helps debug buffer-overflow errors. </div></div> <div class="ttc" id="config_8h_html"><div class="ttname"><a href="config_8h.html">config.h</a></div><div class="ttdoc">Configuration options (set of defines) </div></div> <div class="ttc" id="memory__buffer__alloc_8h_html_ac70d134be54133c272d8eab2cb85dfbf"><div class="ttname"><a href="memory__buffer__alloc_8h.html#ac70d134be54133c272d8eab2cb85dfbf">mbedtls_memory_buffer_alloc_init</a></div><div class="ttdeci">void mbedtls_memory_buffer_alloc_init(unsigned char *buf, size_t len)</div><div class="ttdoc">Initialize use of stack-based memory allocator. The stack-based allocator does memory management insi...</div></div> <div class="ttc" id="memory__buffer__alloc_8h_html_ae9d7316a19b72776f34ba74720a06325"><div class="ttname"><a href="memory__buffer__alloc_8h.html#ae9d7316a19b72776f34ba74720a06325">mbedtls_memory_buffer_alloc_free</a></div><div class="ttdeci">void mbedtls_memory_buffer_alloc_free(void)</div><div class="ttdoc">Free the mutex for thread-safety and clear remaining memory. </div></div> <div class="ttc" id="memory__buffer__alloc_8h_html_aaa50603bb2f2f1fe8d97d6953589b832"><div class="ttname"><a href="memory__buffer__alloc_8h.html#aaa50603bb2f2f1fe8d97d6953589b832">mbedtls_memory_buffer_set_verify</a></div><div class="ttdeci">void mbedtls_memory_buffer_set_verify(int verify)</div><div class="ttdoc">Determine when the allocator should automatically verify the state of the entire chain of headers / m...</div></div> </div><!-- fragment --></div><!-- contents --> <!-- start footer part --> <hr class="footer"/><address class="footer"><small> Generated on Tue Jan 1 2019 18:27:17 for mbed TLS v2.7.8 by  <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.13 </small></address> </body> </html>