CINXE.COM
wolfSSL Static Buffer Allocation Option | Documentation – wolfSSL
<!DOCTYPE html> <html lang="en-US" prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb#"> <head> <meta charset="UTF-8"> <meta name="keywords" content="iot tls"> <link rel="profile" href="http://gmpg.org/xfn/11"> <link rel="pingback" href="https://www.wolfssl.com/wordpress/xmlrpc.php"> <meta name="viewport" content="width=device-width, initial-scale=1"><title>wolfSSL Static Buffer Allocation Option | Documentation – wolfSSL</title> <meta name='robots' content='max-image-preview:large' /> <link rel='dns-prefetch' href='//fonts.googleapis.com' /> <link rel="alternate" type="application/rss+xml" title="wolfSSL » Feed" href="https://www.wolfssl.com/feed/" /> <link rel="alternate" type="application/rss+xml" title="wolfSSL » Comments Feed" href="https://www.wolfssl.com/comments/feed/" /> <!-- This site uses the Google Analytics by ExactMetrics plugin v7.12.1 - Using Analytics tracking - https://www.exactmetrics.com/ --> <script src="//www.googletagmanager.com/gtag/js?id=UA-64826966-1" data-cfasync="false" data-wpfc-render="false" type="text/javascript" async></script> <script data-cfasync="false" data-wpfc-render="false" type="text/javascript"> var em_version = '7.12.1'; var em_track_user = true; var em_no_track_reason = ''; var disableStrs = [ 'ga-disable-G-19EKT1MGL2', 'ga-disable-UA-64826966-1', ]; /* Function to detect opted out users */ function __gtagTrackerIsOptedOut() { for (var index = 0; index < disableStrs.length; index++) { if (document.cookie.indexOf(disableStrs[index] + '=true') > -1) { return true; } } return false; } /* Disable tracking if the opt-out cookie exists. */ if (__gtagTrackerIsOptedOut()) { for (var index = 0; index < disableStrs.length; index++) { window[disableStrs[index]] = true; } } /* Opt-out function */ function __gtagTrackerOptout() { for (var index = 0; index < disableStrs.length; index++) { document.cookie = disableStrs[index] + '=true; expires=Thu, 31 Dec 2099 23:59:59 UTC; path=/'; window[disableStrs[index]] = true; } } if ('undefined' === typeof gaOptout) { function gaOptout() { __gtagTrackerOptout(); } } window.dataLayer = window.dataLayer || []; window.ExactMetricsDualTracker = { helpers: {}, trackers: {}, }; if (em_track_user) { function __gtagDataLayer() { dataLayer.push(arguments); } function __gtagTracker(type, name, parameters) { if (!parameters) { parameters = {}; } if (parameters.send_to) { __gtagDataLayer.apply(null, arguments); return; } if (type === 'event') { parameters.send_to = exactmetrics_frontend.v4_id; var hookName = name; if (typeof parameters['event_category'] !== 'undefined') { hookName = parameters['event_category'] + ':' + name; } if (typeof ExactMetricsDualTracker.trackers[hookName] !== 'undefined') { ExactMetricsDualTracker.trackers[hookName](parameters); } else { __gtagDataLayer('event', name, parameters); } parameters.send_to = exactmetrics_frontend.ua; __gtagDataLayer(type, name, parameters); } else { __gtagDataLayer.apply(null, arguments); } } __gtagTracker('js', new Date()); __gtagTracker('set', { 'developer_id.dNDMyYj': true, }); __gtagTracker('config', 'G-19EKT1MGL2', {"forceSSL":"true"} ); __gtagTracker('config', 'UA-64826966-1', {"forceSSL":"true"} ); window.gtag = __gtagTracker; (function () { /* https://developers.google.com/analytics/devguides/collection/analyticsjs/ */ /* ga and __gaTracker compatibility shim. */ var noopfn = function () { return null; }; var newtracker = function () { return new Tracker(); }; var Tracker = function () { return null; }; var p = Tracker.prototype; p.get = noopfn; p.set = noopfn; p.send = function () { var args = Array.prototype.slice.call(arguments); args.unshift('send'); __gaTracker.apply(null, args); }; var __gaTracker = function () { var len = arguments.length; if (len === 0) { return; } var f = arguments[len - 1]; if (typeof f !== 'object' || f === null || typeof f.hitCallback !== 'function') { if ('send' === arguments[0]) { var hitConverted, hitObject = false, action; if ('event' === arguments[1]) { if ('undefined' !== typeof arguments[3]) { hitObject = { 'eventAction': arguments[3], 'eventCategory': arguments[2], 'eventLabel': arguments[4], 'value': arguments[5] ? arguments[5] : 1, } } } if ('pageview' === arguments[1]) { if ('undefined' !== typeof arguments[2]) { hitObject = { 'eventAction': 'page_view', 'page_path': arguments[2], } } } if (typeof arguments[2] === 'object') { hitObject = arguments[2]; } if (typeof arguments[5] === 'object') { Object.assign(hitObject, arguments[5]); } if ('undefined' !== typeof arguments[1].hitType) { hitObject = arguments[1]; if ('pageview' === hitObject.hitType) { hitObject.eventAction = 'page_view'; } } if (hitObject) { action = 'timing' === arguments[1].hitType ? 'timing_complete' : hitObject.eventAction; hitConverted = mapArgs(hitObject); __gtagTracker('event', action, hitConverted); } } return; } function mapArgs(args) { var arg, hit = {}; var gaMap = { 'eventCategory': 'event_category', 'eventAction': 'event_action', 'eventLabel': 'event_label', 'eventValue': 'event_value', 'nonInteraction': 'non_interaction', 'timingCategory': 'event_category', 'timingVar': 'name', 'timingValue': 'value', 'timingLabel': 'event_label', 'page': 'page_path', 'location': 'page_location', 'title': 'page_title', }; for (arg in args) { if (!(!args.hasOwnProperty(arg) || !gaMap.hasOwnProperty(arg))) { hit[gaMap[arg]] = args[arg]; } else { hit[arg] = args[arg]; } } return hit; } try { f.hitCallback(); } catch (ex) { } }; __gaTracker.create = newtracker; __gaTracker.getByName = newtracker; __gaTracker.getAll = function () { return []; }; __gaTracker.remove = noopfn; __gaTracker.loaded = true; window['__gaTracker'] = __gaTracker; })(); } else { console.log(""); (function () { function __gtagTracker() { return null; } window['__gtagTracker'] = __gtagTracker; window['gtag'] = __gtagTracker; })(); } </script> <!-- / Google Analytics by ExactMetrics --> <script type="text/javascript"> window._wpemojiSettings = {"baseUrl":"https:\/\/s.w.org\/images\/core\/emoji\/14.0.0\/72x72\/","ext":".png","svgUrl":"https:\/\/s.w.org\/images\/core\/emoji\/14.0.0\/svg\/","svgExt":".svg","source":{"concatemoji":"https:\/\/www.wolfssl.com\/wordpress\/wp-includes\/js\/wp-emoji-release.min.js?ver=6.1.1"}}; /*! This file is auto-generated */ !function(e,a,t){var n,r,o,i=a.createElement("canvas"),p=i.getContext&&i.getContext("2d");function s(e,t){var a=String.fromCharCode,e=(p.clearRect(0,0,i.width,i.height),p.fillText(a.apply(this,e),0,0),i.toDataURL());return p.clearRect(0,0,i.width,i.height),p.fillText(a.apply(this,t),0,0),e===i.toDataURL()}function c(e){var t=a.createElement("script");t.src=e,t.defer=t.type="text/javascript",a.getElementsByTagName("head")[0].appendChild(t)}for(o=Array("flag","emoji"),t.supports={everything:!0,everythingExceptFlag:!0},r=0;r<o.length;r++)t.supports[o[r]]=function(e){if(p&&p.fillText)switch(p.textBaseline="top",p.font="600 32px Arial",e){case"flag":return s([127987,65039,8205,9895,65039],[127987,65039,8203,9895,65039])?!1:!s([55356,56826,55356,56819],[55356,56826,8203,55356,56819])&&!s([55356,57332,56128,56423,56128,56418,56128,56421,56128,56430,56128,56423,56128,56447],[55356,57332,8203,56128,56423,8203,56128,56418,8203,56128,56421,8203,56128,56430,8203,56128,56423,8203,56128,56447]);case"emoji":return!s([129777,127995,8205,129778,127999],[129777,127995,8203,129778,127999])}return!1}(o[r]),t.supports.everything=t.supports.everything&&t.supports[o[r]],"flag"!==o[r]&&(t.supports.everythingExceptFlag=t.supports.everythingExceptFlag&&t.supports[o[r]]);t.supports.everythingExceptFlag=t.supports.everythingExceptFlag&&!t.supports.flag,t.DOMReady=!1,t.readyCallback=function(){t.DOMReady=!0},t.supports.everything||(n=function(){t.readyCallback()},a.addEventListener?(a.addEventListener("DOMContentLoaded",n,!1),e.addEventListener("load",n,!1)):(e.attachEvent("onload",n),a.attachEvent("onreadystatechange",function(){"complete"===a.readyState&&t.readyCallback()})),(e=t.source||{}).concatemoji?c(e.concatemoji):e.wpemoji&&e.twemoji&&(c(e.twemoji),c(e.wpemoji)))}(window,document,window._wpemojiSettings); </script> <style type="text/css"> img.wp-smiley, img.emoji { display: inline !important; border: none !important; box-shadow: none !important; height: 1em !important; width: 1em !important; margin: 0 0.07em !important; vertical-align: -0.1em !important; background: none !important; padding: 0 !important; } </style> <link rel='stylesheet' id='wp-block-library-css' href='https://www.wolfssl.com/wordpress/wp-includes/css/dist/block-library/style.min.css?ver=6.1.1' type='text/css' media='all' /> <link rel='stylesheet' id='classic-theme-styles-css' href='https://www.wolfssl.com/wordpress/wp-includes/css/classic-themes.min.css?ver=1' type='text/css' media='all' /> <style id='global-styles-inline-css' type='text/css'> body{--wp--preset--color--black: #000000;--wp--preset--color--cyan-bluish-gray: #abb8c3;--wp--preset--color--white: #ffffff;--wp--preset--color--pale-pink: #f78da7;--wp--preset--color--vivid-red: #cf2e2e;--wp--preset--color--luminous-vivid-orange: #ff6900;--wp--preset--color--luminous-vivid-amber: #fcb900;--wp--preset--color--light-green-cyan: #7bdcb5;--wp--preset--color--vivid-green-cyan: #00d084;--wp--preset--color--pale-cyan-blue: #8ed1fc;--wp--preset--color--vivid-cyan-blue: #0693e3;--wp--preset--color--vivid-purple: #9b51e0;--wp--preset--gradient--vivid-cyan-blue-to-vivid-purple: linear-gradient(135deg,rgba(6,147,227,1) 0%,rgb(155,81,224) 100%);--wp--preset--gradient--light-green-cyan-to-vivid-green-cyan: linear-gradient(135deg,rgb(122,220,180) 0%,rgb(0,208,130) 100%);--wp--preset--gradient--luminous-vivid-amber-to-luminous-vivid-orange: linear-gradient(135deg,rgba(252,185,0,1) 0%,rgba(255,105,0,1) 100%);--wp--preset--gradient--luminous-vivid-orange-to-vivid-red: linear-gradient(135deg,rgba(255,105,0,1) 0%,rgb(207,46,46) 100%);--wp--preset--gradient--very-light-gray-to-cyan-bluish-gray: linear-gradient(135deg,rgb(238,238,238) 0%,rgb(169,184,195) 100%);--wp--preset--gradient--cool-to-warm-spectrum: linear-gradient(135deg,rgb(74,234,220) 0%,rgb(151,120,209) 20%,rgb(207,42,186) 40%,rgb(238,44,130) 60%,rgb(251,105,98) 80%,rgb(254,248,76) 100%);--wp--preset--gradient--blush-light-purple: linear-gradient(135deg,rgb(255,206,236) 0%,rgb(152,150,240) 100%);--wp--preset--gradient--blush-bordeaux: linear-gradient(135deg,rgb(254,205,165) 0%,rgb(254,45,45) 50%,rgb(107,0,62) 100%);--wp--preset--gradient--luminous-dusk: linear-gradient(135deg,rgb(255,203,112) 0%,rgb(199,81,192) 50%,rgb(65,88,208) 100%);--wp--preset--gradient--pale-ocean: linear-gradient(135deg,rgb(255,245,203) 0%,rgb(182,227,212) 50%,rgb(51,167,181) 100%);--wp--preset--gradient--electric-grass: linear-gradient(135deg,rgb(202,248,128) 0%,rgb(113,206,126) 100%);--wp--preset--gradient--midnight: linear-gradient(135deg,rgb(2,3,129) 0%,rgb(40,116,252) 100%);--wp--preset--duotone--dark-grayscale: url('#wp-duotone-dark-grayscale');--wp--preset--duotone--grayscale: url('#wp-duotone-grayscale');--wp--preset--duotone--purple-yellow: url('#wp-duotone-purple-yellow');--wp--preset--duotone--blue-red: url('#wp-duotone-blue-red');--wp--preset--duotone--midnight: url('#wp-duotone-midnight');--wp--preset--duotone--magenta-yellow: url('#wp-duotone-magenta-yellow');--wp--preset--duotone--purple-green: url('#wp-duotone-purple-green');--wp--preset--duotone--blue-orange: url('#wp-duotone-blue-orange');--wp--preset--font-size--small: 13px;--wp--preset--font-size--medium: 20px;--wp--preset--font-size--large: 36px;--wp--preset--font-size--x-large: 42px;--wp--preset--spacing--20: 0.44rem;--wp--preset--spacing--30: 0.67rem;--wp--preset--spacing--40: 1rem;--wp--preset--spacing--50: 1.5rem;--wp--preset--spacing--60: 2.25rem;--wp--preset--spacing--70: 3.38rem;--wp--preset--spacing--80: 5.06rem;}:where(.is-layout-flex){gap: 0.5em;}body .is-layout-flow > .alignleft{float: left;margin-inline-start: 0;margin-inline-end: 2em;}body .is-layout-flow > .alignright{float: right;margin-inline-start: 2em;margin-inline-end: 0;}body .is-layout-flow > .aligncenter{margin-left: auto !important;margin-right: auto !important;}body .is-layout-constrained > .alignleft{float: left;margin-inline-start: 0;margin-inline-end: 2em;}body .is-layout-constrained > .alignright{float: right;margin-inline-start: 2em;margin-inline-end: 0;}body .is-layout-constrained > .aligncenter{margin-left: auto !important;margin-right: auto !important;}body .is-layout-constrained > :where(:not(.alignleft):not(.alignright):not(.alignfull)){max-width: var(--wp--style--global--content-size);margin-left: auto !important;margin-right: auto !important;}body .is-layout-constrained > .alignwide{max-width: var(--wp--style--global--wide-size);}body .is-layout-flex{display: flex;}body .is-layout-flex{flex-wrap: wrap;align-items: center;}body .is-layout-flex > *{margin: 0;}:where(.wp-block-columns.is-layout-flex){gap: 2em;}.has-black-color{color: var(--wp--preset--color--black) !important;}.has-cyan-bluish-gray-color{color: var(--wp--preset--color--cyan-bluish-gray) !important;}.has-white-color{color: var(--wp--preset--color--white) !important;}.has-pale-pink-color{color: var(--wp--preset--color--pale-pink) !important;}.has-vivid-red-color{color: var(--wp--preset--color--vivid-red) !important;}.has-luminous-vivid-orange-color{color: var(--wp--preset--color--luminous-vivid-orange) !important;}.has-luminous-vivid-amber-color{color: var(--wp--preset--color--luminous-vivid-amber) !important;}.has-light-green-cyan-color{color: var(--wp--preset--color--light-green-cyan) !important;}.has-vivid-green-cyan-color{color: var(--wp--preset--color--vivid-green-cyan) !important;}.has-pale-cyan-blue-color{color: var(--wp--preset--color--pale-cyan-blue) !important;}.has-vivid-cyan-blue-color{color: var(--wp--preset--color--vivid-cyan-blue) !important;}.has-vivid-purple-color{color: var(--wp--preset--color--vivid-purple) !important;}.has-black-background-color{background-color: var(--wp--preset--color--black) !important;}.has-cyan-bluish-gray-background-color{background-color: var(--wp--preset--color--cyan-bluish-gray) !important;}.has-white-background-color{background-color: var(--wp--preset--color--white) !important;}.has-pale-pink-background-color{background-color: var(--wp--preset--color--pale-pink) !important;}.has-vivid-red-background-color{background-color: var(--wp--preset--color--vivid-red) !important;}.has-luminous-vivid-orange-background-color{background-color: var(--wp--preset--color--luminous-vivid-orange) !important;}.has-luminous-vivid-amber-background-color{background-color: var(--wp--preset--color--luminous-vivid-amber) !important;}.has-light-green-cyan-background-color{background-color: var(--wp--preset--color--light-green-cyan) !important;}.has-vivid-green-cyan-background-color{background-color: var(--wp--preset--color--vivid-green-cyan) !important;}.has-pale-cyan-blue-background-color{background-color: var(--wp--preset--color--pale-cyan-blue) !important;}.has-vivid-cyan-blue-background-color{background-color: var(--wp--preset--color--vivid-cyan-blue) !important;}.has-vivid-purple-background-color{background-color: var(--wp--preset--color--vivid-purple) !important;}.has-black-border-color{border-color: var(--wp--preset--color--black) !important;}.has-cyan-bluish-gray-border-color{border-color: var(--wp--preset--color--cyan-bluish-gray) !important;}.has-white-border-color{border-color: var(--wp--preset--color--white) !important;}.has-pale-pink-border-color{border-color: var(--wp--preset--color--pale-pink) !important;}.has-vivid-red-border-color{border-color: var(--wp--preset--color--vivid-red) !important;}.has-luminous-vivid-orange-border-color{border-color: var(--wp--preset--color--luminous-vivid-orange) !important;}.has-luminous-vivid-amber-border-color{border-color: var(--wp--preset--color--luminous-vivid-amber) !important;}.has-light-green-cyan-border-color{border-color: var(--wp--preset--color--light-green-cyan) !important;}.has-vivid-green-cyan-border-color{border-color: var(--wp--preset--color--vivid-green-cyan) !important;}.has-pale-cyan-blue-border-color{border-color: var(--wp--preset--color--pale-cyan-blue) !important;}.has-vivid-cyan-blue-border-color{border-color: var(--wp--preset--color--vivid-cyan-blue) !important;}.has-vivid-purple-border-color{border-color: var(--wp--preset--color--vivid-purple) !important;}.has-vivid-cyan-blue-to-vivid-purple-gradient-background{background: var(--wp--preset--gradient--vivid-cyan-blue-to-vivid-purple) !important;}.has-light-green-cyan-to-vivid-green-cyan-gradient-background{background: var(--wp--preset--gradient--light-green-cyan-to-vivid-green-cyan) !important;}.has-luminous-vivid-amber-to-luminous-vivid-orange-gradient-background{background: var(--wp--preset--gradient--luminous-vivid-amber-to-luminous-vivid-orange) !important;}.has-luminous-vivid-orange-to-vivid-red-gradient-background{background: var(--wp--preset--gradient--luminous-vivid-orange-to-vivid-red) !important;}.has-very-light-gray-to-cyan-bluish-gray-gradient-background{background: var(--wp--preset--gradient--very-light-gray-to-cyan-bluish-gray) !important;}.has-cool-to-warm-spectrum-gradient-background{background: var(--wp--preset--gradient--cool-to-warm-spectrum) !important;}.has-blush-light-purple-gradient-background{background: var(--wp--preset--gradient--blush-light-purple) !important;}.has-blush-bordeaux-gradient-background{background: var(--wp--preset--gradient--blush-bordeaux) !important;}.has-luminous-dusk-gradient-background{background: var(--wp--preset--gradient--luminous-dusk) !important;}.has-pale-ocean-gradient-background{background: var(--wp--preset--gradient--pale-ocean) !important;}.has-electric-grass-gradient-background{background: var(--wp--preset--gradient--electric-grass) !important;}.has-midnight-gradient-background{background: var(--wp--preset--gradient--midnight) !important;}.has-small-font-size{font-size: var(--wp--preset--font-size--small) !important;}.has-medium-font-size{font-size: var(--wp--preset--font-size--medium) !important;}.has-large-font-size{font-size: var(--wp--preset--font-size--large) !important;}.has-x-large-font-size{font-size: var(--wp--preset--font-size--x-large) !important;} .wp-block-navigation a:where(:not(.wp-element-button)){color: inherit;} :where(.wp-block-columns.is-layout-flex){gap: 2em;} .wp-block-pullquote{font-size: 1.5em;line-height: 1.6;} </style> <link rel='stylesheet' id='tfba_socialfeed_style-css' href='https://www.wolfssl.com/wordpress/wp-content/plugins/arrow-twitter-feed/includes/../css/jquery.socialfeed.css?ver=1.0.0' type='text/css' media='all' /> <link rel='stylesheet' id='siteorigin-panels-front-css' href='https://www.wolfssl.com/wordpress/wp-content/plugins/siteorigin-panels/css/front-flex.min.css?ver=2.20.4' type='text/css' media='all' /> <link rel='stylesheet' id='smls-fontawesome-style-css' href='https://www.wolfssl.com/wordpress/wp-content/plugins/smart-logo-showcase-lite/css/font-awesome.min.css?ver=1.1.2' type='text/css' media='all' /> <link rel='stylesheet' id='smls-google-fonts-sans-css' href='https://fonts.googleapis.com/css?family=Open+Sans%3A400%2C300%2C600%2C700%2C800&ver=6.1.1' type='text/css' media='all' /> <link rel='stylesheet' id='smls-google-fonts-roboto-css' href='https://fonts.googleapis.com/css?family=Roboto%3A400%2C300italic%2C400italic%2C500%2C500italic%2C700%2C700italic%2C900italic%2C900&ver=6.1.1' type='text/css' media='all' /> <link rel='stylesheet' id='smls-google-fonts-lato-css' href='https://fonts.googleapis.com/css?family=Lato%3A400%2C300italic%2C400italic%2C700%2C700italic%2C900italic%2C900&ver=6.1.1' type='text/css' media='all' /> <link rel='stylesheet' id='smls-google-fonts-montserrat-css' href='https://fonts.googleapis.com/css?family=Montserrat%3A400%2C700&ver=6.1.1' type='text/css' media='all' /> <link rel='stylesheet' id='smls-google-fonts-merriweather-css' href='https://fonts.googleapis.com/css?family=Merriweather+Sans%3A300%2C400%2C700%2C800+Sans%3A300%2C400%2C700&ver=6.1.1' type='text/css' media='all' /> <link rel='stylesheet' id='smls-google-fonts-droid-css' href='https://fonts.googleapis.com/css?family=Droid+Sans%3A400%2C700&ver=6.1.1' type='text/css' media='all' /> <link rel='stylesheet' id='smls-google-fonts-oxygen-css' href='https://fonts.googleapis.com/css?family=Oxygen%3A300%2C400%2C700&ver=6.1.1' type='text/css' media='all' /> <link rel='stylesheet' id='smls-google-fonts-raleway-css' href='https://fonts.googleapis.com/css?family=Raleway%3A100%2C200%2C300%2C400%2C500%2C600%2C700%2C800%2C900&ver=6.1.1' type='text/css' media='all' /> <link rel='stylesheet' id='smls-owl-style-css' href='https://www.wolfssl.com/wordpress/wp-content/plugins/smart-logo-showcase-lite/css/owl.carousel.css?ver=1.1.2' type='text/css' media='all' /> <link rel='stylesheet' id='smls-tooltip-style-css' href='https://www.wolfssl.com/wordpress/wp-content/plugins/smart-logo-showcase-lite/css/tooltipster.bundle.css?ver=1.1.2' type='text/css' media='all' /> <link rel='stylesheet' id='smls-frontend-style-css' href='https://www.wolfssl.com/wordpress/wp-content/plugins/smart-logo-showcase-lite/css/smls-frontend-style.css?ver=1.1.2' type='text/css' media='all' /> <link rel='stylesheet' id='smls-responsive-style-css' href='https://www.wolfssl.com/wordpress/wp-content/plugins/smart-logo-showcase-lite/css/smls-responsive.css?ver=1.1.2' type='text/css' media='all' /> <link rel='stylesheet' id='siteorigin-north-style-css' href='https://www.wolfssl.com/wordpress/wp-content/themes/siteorigin-north/style.min.css?ver=1.3.15' type='text/css' media='all' /> <link rel='stylesheet' id='siteorigin-north-icons-css' href='https://www.wolfssl.com/wordpress/wp-content/themes/siteorigin-north/css/north-icons.min.css?ver=1.3.15' type='text/css' media='all' /> <link rel='stylesheet' id='siteorigin-north-flexslider-css' href='https://www.wolfssl.com/wordpress/wp-content/themes/siteorigin-north/css/flexslider.min.css?ver=6.1.1' type='text/css' media='all' /> <link rel='stylesheet' id='siteorigin-google-web-fonts-css' href='//fonts.googleapis.com/css?family=Droid+Sans%3A400%2C700%7CMontserrat%3A400%7CDroid+Serif%3A400&ver=6.1.1' type='text/css' media='all' /> <link rel='stylesheet' id='newsletter-css' href='https://www.wolfssl.com/wordpress/wp-content/plugins/newsletter/style.css?ver=7.6.1' type='text/css' media='all' /> <link rel='stylesheet' id='tablepress-default-css' href='https://www.wolfssl.com/wordpress/wp-content/plugins/tablepress/css/build/default.css?ver=2.0.4' type='text/css' media='all' /> <script type='text/javascript' src='https://www.wolfssl.com/wordpress/wp-content/plugins/google-analytics-dashboard-for-wp/assets/js/frontend-gtag.min.js?ver=7.12.1' id='exactmetrics-frontend-script-js'></script> <script data-cfasync="false" data-wpfc-render="false" type="text/javascript" id='exactmetrics-frontend-script-js-extra'>/* <![CDATA[ */ var exactmetrics_frontend = {"js_events_tracking":"true","download_extensions":"zip,mp3,mpeg,pdf,docx,pptx,xlsx,rar","inbound_paths":"[{\"path\":\"\\\/go\\\/\",\"label\":\"affiliate\"},{\"path\":\"\\\/recommend\\\/\",\"label\":\"affiliate\"}]","home_url":"https:\/\/www.wolfssl.com","hash_tracking":"false","ua":"UA-64826966-1","v4_id":"G-19EKT1MGL2"};/* ]]> */ </script> <script type='text/javascript' src='https://www.wolfssl.com/wordpress/wp-includes/js/jquery/jquery.min.js?ver=3.6.1' id='jquery-core-js'></script> <script type='text/javascript' src='https://www.wolfssl.com/wordpress/wp-includes/js/jquery/jquery-migrate.min.js?ver=3.3.2' id='jquery-migrate-js'></script> <script type='text/javascript' src='https://www.wolfssl.com/wordpress/wp-content/plugins/arrow-twitter-feed/includes/../bower_components/codebird-js/codebird.js?ver=6.1.1' id='tfba_codebird-js'></script> <script type='text/javascript' src='https://www.wolfssl.com/wordpress/wp-content/plugins/arrow-twitter-feed/includes/../bower_components/doT/doT.min.js?ver=6.1.1' id='tfba_doT-js'></script> <script type='text/javascript' src='https://www.wolfssl.com/wordpress/wp-content/plugins/arrow-twitter-feed/includes/../bower_components/moment/min/moment.min.js?ver=6.1.1' id='tfba_moment-js'></script> <script type='text/javascript' src='https://www.wolfssl.com/wordpress/wp-content/plugins/arrow-twitter-feed/includes/../js/jquery.socialfeed.js?ver=6.1.1' id='tfba_socialfeed-js'></script> <script type='text/javascript' src='https://www.wolfssl.com/wordpress/wp-content/plugins/smart-logo-showcase-lite/js/owl.carousel.js?ver=1.1.2' id='smls-owl-script-js'></script> <script type='text/javascript' src='https://www.wolfssl.com/wordpress/wp-content/plugins/smart-logo-showcase-lite/js/tooltipster.bundle.js?ver=1.1.2' id='smls-tooltip-script-js'></script> <script type='text/javascript' src='https://www.wolfssl.com/wordpress/wp-content/plugins/smart-logo-showcase-lite/js/smls-frontend-script.js?ver=1.1.2' id='smls-frontend-script-js'></script> <script type='text/javascript' src='https://www.wolfssl.com/wordpress/wp-content/themes/siteorigin-north/js/iframeResizer.min.js?ver=6.1.1' id='iFrameResize-js'></script> <link rel="https://api.w.org/" href="https://www.wolfssl.com/wp-json/" /><link rel="alternate" type="application/json" href="https://www.wolfssl.com/wp-json/wp/v2/pages/29070" /><link rel="EditURI" type="application/rsd+xml" title="RSD" href="https://www.wolfssl.com/wordpress/xmlrpc.php?rsd" /> <link rel="wlwmanifest" type="application/wlwmanifest+xml" href="https://www.wolfssl.com/wordpress/wp-includes/wlwmanifest.xml" /> <meta name="generator" content="WordPress 6.1.1" /> <link rel="canonical" href="https://www.wolfssl.com/docs/static-buffer-allocation/" /> <link rel='shortlink' href='https://www.wolfssl.com/?p=29070' /> <link rel="alternate" type="application/json+oembed" href="https://www.wolfssl.com/wp-json/oembed/1.0/embed?url=https%3A%2F%2Fwww.wolfssl.com%2Fdocs%2Fstatic-buffer-allocation%2F" /> <link rel="alternate" type="text/xml+oembed" href="https://www.wolfssl.com/wp-json/oembed/1.0/embed?url=https%3A%2F%2Fwww.wolfssl.com%2Fdocs%2Fstatic-buffer-allocation%2F&format=xml" /> <script> (function($){ "use strict"; var $searchArea = $('.top-search-menu'); $searchArea.click(function(){ $(this).addClass('input-expanded'); }); $(document).mouseup(function (e){ var container = $(".top-search-menu"); if (!$searchArea.is(e.target) && $searchArea.has(e.target).length === 0){ $searchArea.removeClass('input-expanded'); } }); })(jQuery); </script> <style type="text/css" id="siteorigin-north-settings-custom" data-siteorigin-settings="true"> .content-area { margin: 0 -0% 0 0; } .site-main { margin: 0 0% 0 0; } .site-content .widget-area { width: 0%; } .layout-sidebar-left .content-area { margin: 0 0 0 -0%; } .layout-sidebar-left .site-main { margin: 0 0 0 0%; } .layout-sidebar-left .site-content .widget-area { width: 0%; } @media screen and (max-width: 600px) { body.responsive .main-navigation #mobile-menu-button { display: inline-block; } body.responsive .main-navigation ul { display: none; } body.responsive .main-navigation .north-search-icon { display: none; } .main-navigation #mobile-menu-button { display: none; } .main-navigation ul { display: inline-block; } .main-navigation .north-search-icon { display: inline-block; } } @media screen and (min-width: 601px) { body.responsive #mobile-navigation { display: none !important; } } </style> <style type="text/css" media="all" id="siteorigin-panels-layouts-head">/* Layout 29070 */ #pgc-29070-0-0 , #pgc-29070-1-0 { width:100%;width:calc(100% - ( 0 * 30px ) ) } #pg-29070-0 , #pl-29070 .so-panel { margin-bottom:30px } #pl-29070 .so-panel:last-of-type { margin-bottom:0px } #pg-29070-0.panel-has-style > .panel-row-style, #pg-29070-0.panel-no-style , #pg-29070-1.panel-has-style > .panel-row-style, #pg-29070-1.panel-no-style { -webkit-align-items:flex-start;align-items:flex-start } #pgc-29070-1-0 { align-self:auto } @media (max-width:780px){ #pg-29070-0.panel-no-style, #pg-29070-0.panel-has-style > .panel-row-style, #pg-29070-0 , #pg-29070-1.panel-no-style, #pg-29070-1.panel-has-style > .panel-row-style, #pg-29070-1 { -webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column } #pg-29070-0 > .panel-grid-cell , #pg-29070-0 > .panel-row-style > .panel-grid-cell , #pg-29070-1 > .panel-grid-cell , #pg-29070-1 > .panel-row-style > .panel-grid-cell { width:100%;margin-right:0 } #pl-29070 .panel-grid-cell { padding:0 } #pl-29070 .panel-grid .panel-grid-cell-empty { display:none } #pl-29070 .panel-grid .panel-grid-cell-mobile-last { margin-bottom:0px } } </style><link rel="icon" href="https://www.wolfssl.com/wordpress/wp-content/uploads/2017/07/cropped-wolf-square-32x32.png" sizes="32x32" /> <link rel="icon" href="https://www.wolfssl.com/wordpress/wp-content/uploads/2017/07/cropped-wolf-square-192x192.png" sizes="192x192" /> <link rel="apple-touch-icon" href="https://www.wolfssl.com/wordpress/wp-content/uploads/2017/07/cropped-wolf-square-180x180.png" /> <meta name="msapplication-TileImage" content="https://www.wolfssl.com/wordpress/wp-content/uploads/2017/07/cropped-wolf-square-270x270.png" /> <!-- START - Open Graph and Twitter Card Tags 3.3.0 --> <!-- Facebook Open Graph --> <meta property="article:publisher" content="https://www.facebook.com/wolfssl/"/> <meta property="fb:app_id" content="308652656395809"/> <!-- Google+ / Schema.org --> <meta itemprop="name" content="wolfSSL Static Buffer Allocation Option | Documentation"/> <meta itemprop="headline" content="wolfSSL Static Buffer Allocation Option | Documentation"/> <meta itemprop="description" content="WOLFSSL STATIC BUFFER ALLOCATION OPTION Static Buffer Allocation Option Documentation and User’s Guide May 2016 (revised June 2017) 1.0 INTRO This document covers the API and build of wolfSSL with the staticmemory feature. Enabling the feature allows for use of static memory when performing a T"/> <meta itemprop="author" content="wolfSSL"/> <!--<meta itemprop="publisher" content="wolfSSL"/>--> <!-- To solve: The attribute publisher.itemtype has an invalid value --> <!-- Twitter Cards --> <meta name="twitter:title" content="wolfSSL Static Buffer Allocation Option | Documentation"/> <meta name="twitter:url" content="https://www.wolfssl.com/docs/static-buffer-allocation/"/> <meta name="twitter:description" content="WOLFSSL STATIC BUFFER ALLOCATION OPTION Static Buffer Allocation Option Documentation and User’s Guide May 2016 (revised June 2017) 1.0 INTRO This document covers the API and build of wolfSSL with the staticmemory feature. Enabling the feature allows for use of static memory when performing a T"/> <meta name="twitter:card" content="summary_large_image"/> <!-- SEO --> <!-- Misc. tags --> <!-- is_singular --> <!-- END - Open Graph and Twitter Card Tags 3.3.0 --> </head> <body class="page-template-default page page-id-29070 page-child parent-pageid-22 wp-custom-logo siteorigin-panels siteorigin-panels-before-js group-blog no-js css3-animations no-touch responsive page-layout-default page-layout-menu-default sticky-menu no-topbar wc-columns-3"> <div id="page" class="hfeed site"> <a class="skip-link screen-reader-text" href="#content">Skip to content</a> <header id="masthead" class="site-header layout-defaultsticky-menu" role="banner" > <div class="container"> <div id="extraHeaderInfo"> <!--<a href="https://www.wolfssl.jp/wolfsite/" target="_blank"><img src="/wordpress/wp-content/uploads/2017/11/japan-site.png" alt="wolfSSL Japan"></a>--> <div class="push"></div> <ul id="supportNav"> <li><br/>Questions? <a href="https://www.wolfssl.com/contact/">Contact Us</a></li> <!--<li>Questions? <a href="tel:425-245-8247">+1 (425) 245-8247</a></li> <li><a href="tel:425-245-8247">+1(425)245-8247</a></li>--> <li><a href="https://www.wolfssl.com/products/support-and-maintenance/">Support Forums</a></li> <li><a href="https://www.wolfssl.jp" target="_blank"><img src="/wordpress/wp-content/uploads/2017/11/japan-site.png" alt="wolfSSL Japan"></a></li> </ul> </div> <div class="container-inner"> <div class="site-branding"> <a href="https://www.wolfssl.com/" rel="home"> <span class="screen-reader-text">Home</span><img width="300" height="233" src="https://www.wolfssl.com/wordpress/wp-content/uploads/2021/11/wolf-thanksgiving.png" class="attachment-full size-full" alt="" decoding="async" loading="lazy" srcset="https://www.wolfssl.com/wordpress/wp-content/uploads/2021/11/wolf-thanksgiving.png 1x,https://www.wolfssl.com/wordpress/wp-content/uploads/2021/11/wolf-thanksgiving.png 2x" /></a> </div><!-- .site-branding --> <nav id="site-navigation" class="main-navigation" role="navigation"> <a href="#menu" id="mobile-menu-button"> <svg version="1.1" class="svg-icon-menu" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 24 24" style="enable-background:new 0 0 24 24;" xml:space="preserve"> <path class="line-1" d="M3,5h18c0.3,0,0.5,0.1,0.7,0.3C21.9,5.5,22,5.7,22,6s-0.1,0.5-0.3,0.7C21.5,6.9,21.3,7,21,7H3 C2.7,7,2.5,6.9,2.3,6.7C2.1,6.5,2,6.3,2,6s0.1-0.5,0.3-0.7C2.5,5.1,2.7,5,3,5z"/> <path class="line-2" d="M3,11h18c0.3,0,0.5,0.1,0.7,0.3S22,11.7,22,12s-0.1,0.5-0.3,0.7S21.3,13,21,13H3c-0.3,0-0.5-0.1-0.7-0.3 C2.1,12.5,2,12.3,2,12s0.1-0.5,0.3-0.7C2.5,11.1,2.7,11,3,11z"/> <path class="line-3" d="M3,17h18c0.3,0,0.5,0.1,0.7,0.3S22,17.7,22,18s-0.1,0.5-0.3,0.7S21.3,19,21,19H3c-0.3,0-0.5-0.1-0.7-0.3 C2.1,18.5,2,18.3,2,18s0.1-0.5,0.3-0.7C2.5,17.1,2.7,17,3,17z"/> </svg> Menu <span class="screen-reader-text">Menu</span> </a> <div class="menu-navigation-container"><ul id="primary-menu" class="menu"><li id="menu-item-86" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-home menu-item-86"><a href="https://www.wolfssl.com/">Home</a></li> <li id="menu-item-66" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-has-children menu-item-66"><a href="https://www.wolfssl.com/about/">About</a> <ul class="sub-menu"> <li id="menu-item-68" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-68"><a href="https://www.wolfssl.com/contact/">Contact Us</a></li> <li id="menu-item-38072" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-38072"><a href="https://www.wolfssl.com/about/wolfssl-software-development-process-quality-assurance/">wolfSSL Software Development Process and Quality Assurance</a></li> </ul> </li> <li id="menu-item-65" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-has-children menu-item-65"><a href="https://www.wolfssl.com/products/">Products</a> <ul class="sub-menu"> <li id="menu-item-42283" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-42283"><a href="https://www.wolfssl.com/products/wolfhsm/">wolfHSM</a></li> <li id="menu-item-31384" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-31384"><a href="https://www.wolfssl.com/products/wolfssl/">wolfSSL / wolfCrypt</a></li> <li id="menu-item-31386" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-31386"><a href="https://www.wolfssl.com/license/fips/">wolfCrypt FIPS 140-2/3</a></li> <li id="menu-item-37202" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-37202"><a href="https://www.wolfssl.com/wolfssl-support-178-dal/">DO-178</a></li> <li id="menu-item-31387" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-31387"><a href="https://www.wolfssl.com/products/wolftpm/">wolfTPM</a></li> <li id="menu-item-31388" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-31388"><a href="https://www.wolfssl.com/products/wolfmqtt/">wolfMQTT</a></li> <li id="menu-item-31389" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-31389"><a href="https://www.wolfssl.com/products/wolfssh/">wolfSSH</a></li> <li id="menu-item-33537" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-33537"><a href="https://www.wolfssl.com/products/wolfboot/">wolfBoot</a></li> <li id="menu-item-37772" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-37772"><a href="https://www.wolfssl.com/products/wolfsentry/">wolfSentry IDPS</a></li> <li id="menu-item-34705" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-34705"><a href="https://www.wolfssl.com/products/curl/">curl / tinycurl</a></li> <li id="menu-item-31390" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-31390"><a href="https://www.wolfssl.com/products/wolfssl-jni-jsse/">wolfSSL JNI and JSSE Provider</a></li> <li id="menu-item-31391" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-31391"><a href="https://www.wolfssl.com/products/wolfcrypt-jni-jce/">wolfCrypt JNI and JCE Provider</a></li> <li id="menu-item-38343" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-38343"><a href="https://www.wolfssl.com/products/wolfclu/">wolfCLU</a></li> </ul> </li> <li id="menu-item-28820" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-28820"><a href="/download">Download</a></li> <li id="menu-item-63" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-has-children menu-item-63"><a href="https://www.wolfssl.com/license/">License</a> <ul class="sub-menu"> <li id="menu-item-36382" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-36382"><a href="https://www.wolfssl.com/products/support-and-maintenance/">Support and Maintenance</a></li> <li id="menu-item-36383" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-36383"><a href="https://www.wolfssl.com/docs/consulting/">Consulting Services</a></li> <li id="menu-item-37201" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-37201"><a href="https://www.wolfssl.com/license/fips/">FIPS 140-2 and FIPS 140-3</a></li> <li id="menu-item-37200" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-37200"><a href="https://www.wolfssl.com/wolfssl-support-178-dal/">DO-178</a></li> </ul> </li> <li id="menu-item-62" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-62"><a href="https://www.wolfssl.com/blog/">Blog</a></li> <li id="menu-item-60" class="menu-item menu-item-type-post_type menu-item-object-page current-page-ancestor menu-item-has-children menu-item-60"><a href="https://www.wolfssl.com/docs/">Docs</a> <ul class="sub-menu"> <li id="menu-item-36384" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-36384"><a href="https://www.wolfssl.com/docs/frequently-asked-questions-faq/">FAQ</a></li> <li id="menu-item-38697" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-38697"><a href="https://www.wolfssl.com/documentation/manuals/wolfssl/index.html">wolfSSL Manual</a></li> <li id="menu-item-40552" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-40552"><a href="https://www.youtube.com/wolfssl">YouTube Videos</a></li> <li id="menu-item-38698" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-38698"><a href="https://www.wolfssl.com/docs/benchmarks/">Benchmarks</a></li> <li id="menu-item-35828" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-35828"><a href="https://www.wolfssl.com/docs/case-studies/">Case Studies</a></li> <li id="menu-item-39479" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-39479"><a href="https://www.wolfssl.com/docs/wolfssl-white-papers/">White Papers</a></li> <li id="menu-item-40554" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-40554"><a href="https://www.wolfssl.com/docs/security-vulnerabilities/">Vulnerability Info</a></li> </ul> </li> <li id="menu-item-59" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-has-children menu-item-59"><a href="https://www.wolfssl.com/community/">Community</a> <ul class="sub-menu"> <li id="menu-item-35479" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-35479"><a href="https://www.wolfssl.com/events/">Events / Webinars</a></li> <li id="menu-item-35477" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-35477"><a href="https://www.wolfssl.com/forums/">Forums</a></li> </ul> </li> <li id="menu-item-35954" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-35954"><a href="https://www.wolfssl.com/community/partner-network/">Partners</a></li> <li class="top-search-menu"><form method="get" action="https://www.wolfssl.com" role="search"> <label for='s' class='screen-reader-text'>Search for:</label> <input type="search" name="s" placeholder="Search" value="" /> <button type="submit"> <i class="north-icon-search"><label class="screen-reader-text">Search</label></i> </button> </form> </li></ul></div> </nav><!-- #site-navigation --> </div><!-- .container-inner --> </div><!-- .container --> </header><!-- #masthead --> <div id="content" class="site-content"> <div class="container"> <div id="primary" class="content-area"> <main id="main" class="site-main" role="main"> <article id="post-29070" class="post-29070 page type-page status-publish post"> <div class="entry-content"> <div id="pl-29070" class="panel-layout" ><div id="pg-29070-0" class="panel-grid panel-no-style" ><div id="pgc-29070-0-0" class="panel-grid-cell" ><div id="panel-29070-0-0-0" class="so-panel widget widget_sow-editor panel-first-child panel-last-child" data-index="0" ><div class="so-widget-sow-editor so-widget-sow-editor-base" > <div class="siteorigin-widget-tinymce textwidget"> <h1 class="pageTitle">WOLFSSL STATIC BUFFER ALLOCATION OPTION</h1> </div> </div></div></div></div><div id="pg-29070-1" class="panel-grid panel-no-style" ><div id="pgc-29070-1-0" class="panel-grid-cell" ><div id="panel-29070-1-0-0" class="so-panel widget widget_sow-editor panel-first-child panel-last-child" data-index="1" ><div class="manualPage panel-widget-style panel-widget-style-for-29070-1-0-0" ><div class="so-widget-sow-editor so-widget-sow-editor-base" > <div class="siteorigin-widget-tinymce textwidget"> <p><style type="text/css">ol{margin:0;padding:0}table td,table th{padding:0}.c4{color:#000000;font-weight:400;text-decoration:none;vertical-align:baseline;font-size:12pt;font-family:"Arial";font-style:normal}.c1{color:#000000;font-weight:400;text-decoration:none;vertical-align:baseline;font-size:10pt;font-family:"Courier New";font-style:normal}.c12{color:#000000;text-decoration:none;vertical-align:baseline;font-family:"Arial";font-style:normal}.c9{font-weight:400;text-decoration:none;vertical-align:baseline;font-family:"Arial";font-style:normal}.c0{padding-top:0pt;padding-bottom:0pt;line-height:1.15;text-align:left}.c10{padding-top:0pt;padding-bottom:0pt;line-height:1.15;text-align:center}.c15{font-size:10pt;font-family:"Courier New";font-weight:400}.c14{background-color:#ffffff;max-width:468pt;padding:72pt 72pt 72pt 72pt}.c7{font-size:14pt;font-weight:700}.c16{font-weight:700;font-size:18pt}.c5{font-size:12pt;font-weight:700}.c11{orphans:2;widows:2}.c13{font-weight:400;font-size:11pt}.c6{color:#b45f06;font-size:12pt}.c3{text-indent:36pt}.c2{height:11pt}.c8{font-size:12pt}.title{padding-top:0pt;color:#000000;font-size:26pt;padding-bottom:3pt;font-family:"Arial";line-height:1.15;page-break-after:avoid;orphans:2;widows:2;text-align:left}.subtitle{padding-top:0pt;color:#666666;font-size:15pt;padding-bottom:16pt;font-family:"Arial";line-height:1.15;page-break-after:avoid;orphans:2;widows:2;text-align:left}li{color:#000000;font-size:11pt;font-family:"Arial"}p{margin:0;color:#000000;font-size:11pt;font-family:"Arial"}h1{padding-top:20pt;color:#000000;font-size:20pt;padding-bottom:6pt;font-family:"Arial";line-height:1.15;page-break-after:avoid;orphans:2;widows:2;text-align:left}h2{padding-top:18pt;color:#000000;font-size:16pt;padding-bottom:6pt;font-family:"Arial";line-height:1.15;page-break-after:avoid;orphans:2;widows:2;text-align:left}h3{padding-top:16pt;color:#434343;font-size:14pt;padding-bottom:4pt;font-family:"Arial";line-height:1.15;page-break-after:avoid;orphans:2;widows:2;text-align:left}h4{padding-top:14pt;color:#666666;font-size:12pt;padding-bottom:4pt;font-family:"Arial";line-height:1.15;page-break-after:avoid;orphans:2;widows:2;text-align:left}h5{padding-top:12pt;color:#666666;font-size:11pt;padding-bottom:4pt;font-family:"Arial";line-height:1.15;page-break-after:avoid;orphans:2;widows:2;text-align:left}h6{padding-top:12pt;color:#666666;font-size:11pt;padding-bottom:4pt;font-family:"Arial";line-height:1.15;page-break-after:avoid;font-style:italic;orphans:2;widows:2;text-align:left}</style> </p> <p class="c10"><span class="c12 c16">Static Buffer Allocation Option</span></p> <p class="c10"><span class="c12 c7">Documentation and User’s Guide</span></p> <p class="c10"><span class="c4">May 2016 (revised June 2017)</span></p> <hr /> <p class="c0"><span class="c7">1.0 INTRO</span></p> <p class="c0"><span class="c8">This document covers the API and build of wolfSSL with the staticmemory feature. Enabling the feature allows for use of static memory when performing a TLS/DTLS connection. To avoid calling system free’s on static memory and avoid memory not getting returned to a heap as available, the user should never call free on values created from wolfSSL functions in static memory mode. If a case is encountered where calling free is necessary on objects created by and returned from a wolfSSL function call, please contact us at wolfSSL for handling the free.<br /></span></p> <p class="c0"><span class="c7">2.0 INSTALLATION</span></p> <p class="c0"><span class="c8">To enable the use of static memory with wolfSSL connections the configure flag staticmemory is used. An example of building wolfSSL with it enabled is as follows.</span></p> <p>./configure --enable-staticmemory</p> <p>Use of the static memory feature requires that WOLFSSL_SMALL_STACK not be turned on and that USE_FAST_MATH be defined. By default autotools turns on fastmath on 64bit systems. For non 64bit systems use --enable-fastmath, on some 32bit systems clang will be needed or C_EXTRA_FLAGS=-DTMF_NO_ASM for building with fastmath. For builds not using autotools, settings.h has a compile time error message displayed if these conditions are not met.</p> <p><span class="c7">3.0 Design Overview</span></p> <p class="c0"><span class="c4"><br />Static memory is assigned to a CTX structure that then passes a heap hint to all structures created by the CTX. In the following diagram the arrow indicates passing a pointer to the heap, “…” shows is all structs and not specific to the ones listed.<br /></span></p> <p class="c0"><span class="c8"><img decoding="async" loading="lazy" class="aligncenter wp-image-29071" src="https://www.wolfssl.com/wordpress/wp-content/uploads/2017/11/image2-759x1024.png" alt="Static Buffer Allocation" width="400" height="539" srcset="https://www.wolfssl.com/wordpress/wp-content/uploads/2017/11/image2-759x1024.png 759w, https://www.wolfssl.com/wordpress/wp-content/uploads/2017/11/image2-222x300.png 222w, https://www.wolfssl.com/wordpress/wp-content/uploads/2017/11/image2-768x1036.png 768w, https://www.wolfssl.com/wordpress/wp-content/uploads/2017/11/image2-482x650.png 482w, https://www.wolfssl.com/wordpress/wp-content/uploads/2017/11/image2.png 1024w" sizes="(max-width: 400px) 100vw, 400px" /><br />This allows for a connection established using a particular CTX to use the heap assigned to it. Functions being called with not using a structure that has a heap hint will not use the static memory set aside.<br /> Memory is divided into to two separate types; IO memory, and general use. Depending on which flag is used when loading in memory will determine which type it is. By default it is stored as general memory. Assigning memory as IO memory using the flag WOLFMEM_IO_POOL will keep it set aside for when trying to malloc memory for use with sending and receiving information across the connection. This is to eliminate competition with none IO processes. Each IO pool of memory is close to 17k, this is to account for the max TLS packet size being 16k with some overhead.<br /> There are some current function restrictions due to heap hint being passed in. These restrictions are derived from the design of passing heap hint from structure to structure since the functions have no connection with the base CTX but use dynamic memory. Many of these functions are in the OpenSSL compatibility layer. All of these can be ran with the default --enable-staticmemory but in cases will be making calls to malloc instead of using the static memory heap hint.</span></p> <p><span class="c5">Functions for creating CTX:</span><span class="c4"><br />wolfSSL_CTX_load_static_memory() should be used to create a static ctx instead of wolfSSL_CTX_new(). wolfSSL_CTX_new() can be used but will use dynamic memory for the creation of ctx and for the creation of WOLFSSL_METHOD struct. To avoid using dynamic memory wolfSSL_CTX_load_static_memory() can take a ctx set as NULL and a static method function (ending in _ex) to use only memory from the static buffer.<br /></span></p> <p class="c0"><span class="c5">Functions that will not malloc in static mode and return null: </span><span class="c4">these functions have the option of taking in a buffer or creating a buffer. If a buffer is not passed in as an argument then when using static memory a NULL value is returned.<br /></span></p> <p class="c0"><span class="c4">char* wolfSSL_X509_NAME_oneline</span></p> <p class="c0"><span class="c4">byte* wolfSSL_X509_get_device_type</span></p> <p class="c0"><span class="c4">byte* wolfSSL_X509_get_hw_type</span></p> <p class="c0"><span class="c4">byte* wolfSSL_X509_get_hw_serial_number</span></p> <p class="c0"><span class="c5">Functions not supported to use static memory: </span><span class="c4">these functions call malloc without any connection to a ctx heap hint. Many are in the OpenSSL compatibility layer and have the parameters and behavior they do to allow compatibility.<br /></span></p> <p class="c0"><span class="c4">WOLFSSL_X509* wolfSSL_X509_d2i</span></p> <p class="c0"><span class="c4">WOLFSSL_X509* wolfSSL_X509_d2i_fp</span></p> <p class="c0"><span class="c4">WOLFSSL_X509* wolfSSL_X509_load_certificate_file</span></p> <p class="c0"><span class="c4">WOLFSSL_X509_STORE* wolfSSL_X509_STORE_new</span></p> <p class="c0"><span class="c4">WOLFSSL_X509_STORE_CTX* wolfSSL_X509_STORE_CTX_new</span></p> <p class="c0"><span class="c4">WOLFSSL_BIGNUM* wolfSSL_BN_new</span></p> <p class="c0"><span class="c4">void wolfSSL_BN_free</span></p> <p class="c0"><span class="c4">char *wolfSSL_BN_bn2dec</span></p> <p class="c0"><span class="c4">char *wolfSSL_BN_bn2hex</span></p> <p class="c0"><span class="c4">WOLFSSL_DH* wolfSSL_DH_new</span></p> <p class="c0"><span class="c4">WOLFSSL_DSA* wolfSSL_DSA_new</span></p> <p class="c0"><span class="c4">WOLFSSL_RSA* wolfSSL_RSA_new</span></p> <p class="c0"><span class="c4">int wolfSSL_PEM_write_mem_ECPrivateKey</span></p> <p class="c0"><span class="c4">int wolfSSL_PEM_write_mem_DSAPrivateKey</span></p> <p class="c0"><span class="c4">int wolfSSL_PEM_write_mem_RSAPrivateKey</span></p> <p class="c0"><span class="c4">WOLFSSL_EC_KEY *wolfSSL_EC_KEY_new</span></p> <p class="c0"><span class="c4">WOLFSSL_EC_GROUP *wolfSSL_EC_GROUP_new_by_curve_name</span></p> <p class="c0"><span class="c4">WOLFSSL_ECDSA_SIG *wolfSSL_ECDSA_SIG_new</span></p> <p class="c0"><span class="c4">int wolfSSL_PEM_write_mem_ECPrivateKey</span></p> <p class="c0"><span class="c4">int wolfSSL_PEM_write_mem_DSAPrivateKey</span></p> <p class="c0"><span class="c4">WOLFSSL_X509* wolfSSL_get_chain_X509</span></p> <p class="c0"><span class="c4">WOLFSSL_BIO* wolfSSL_BIO_new_socket</span></p> <p class="c0"><span class="c4">WOLFSSL_BIO* wolfSSL_BIO_new</span></p> <p class="c0"><span class="c4">WOLFSSL_BIO* wolfSSL_BIO_new_mem_buf</span></p> <p class="c0"><span class="c5">These 2 have fixed static buffer sizes by default and if a file is larger it is then dynamic: </span><span class="c4">with these two functions there is partial functionality with static buffers. A buffer is placed on the stack by default and if not large enough then the buffer is increased using dynamic memory. In the case of static memory a MEMORY_E value is returned for files too large with these functions rather than creating new dynamic memory. <br /></span></p> <p class="c0"><span class="c4">int wolfSSL_PemCertToDer</span></p> <p class="c0"><span class="c4">int wolfSSL_PemPubKeyToDer</span></p> <p class="c0"> </p> <p>If absolutely no mallocs is sought after then WOLFSSL_NO_MALLOC can be defined. This macro will have wolfSSL not compile in the use of malloc when a heap hint is not used. It will also cause make check to fail with unit tests and api tests that do not have heap hints. With WOLFSSL_NO_MALLOC examples/server/server is setup to function and can be ran to show a connection with absolutely no application mallocs. (note: using something like iprofiler will show system mallocs such as fopen for when certificate files are opened)</p> <p class="c0 c2"><span class="c4"> </span></p> <p class="c0 c11"><span class="c7">4.0 wolfSSL API</span></p> <p class="c10"><span class="c5">wolfSSL_CTX_load_static_memory</span></p> <p class="c0"><span class="c9 c6">Synopsis:</span></p> <p class="c0"><span class="c4">#include <wolfssl/ssl.h></span></p> <p class="c0"><span class="c4">int wolfSSL_CTX_load_static_memory(WOLFSSL_CTX** ctx, wolfSSL_method_func method, unsigned char* buf, unsigned int sz, int flag, int max);</span></p> <p class="c0"><span class="c9 c6">Description:</span></p> <p class="c0"><span class="c4">This function is used to set aside static memory for a CTX. Memory set aside is then used for the CTX’s lifetime and for any SSL objects created from the CTX. By passing in a NULL ctx pointer and a wolfSSL_method_func function the creation of the CTX itself will also use static memory. wolfSSL_method_func has the function signature of WOLFSSL_METHOD* (*wolfSSL_method_func)(void* heap);.<br />Passing in 0 for max makes it behave as if not set and no max concurrent use restrictions is in place.<br />The flag value passed in determines how the memory is used and behavior while operating. Available flags are the following.</span></p> <p>0 - default general memory</p> <p class="c0"><span class="c4">WOLFMEM_IO_POOL - used for input/output buffer when sending receiving messages. <br /> Overrides general memory, so all memory in buffer passed in is used for IO.<br />WOLFMEM_IO_FIXED - same as WOLFMEM_IO_POOL but each SSL now keeps two <br /> buffers to themselves for their lifetime.<br />WOLFMEM_TRACK_STATS - each SSL keeps track of memory stats while running.<br /></span></p> <p class="c0"><span class="c9 c6">Return Values:</span></p> <p class="c0"><span class="c4">If successful, SSL_SUCCESS will be returned.</span></p> <p class="c0"><span class="c4">All unsuccessful return values will be less than 0 or equal to SSL_FAILURE.</span></p> <p class="c0"><span class="c9 c6">Parameters:</span></p> <p class="c0"><span class="c5">ctx</span><span class="c4"> - address of pointer to a WOLFSSL_CTX structure.</span></p> <p class="c0"><span class="c5">method</span><span class="c4"> - function to create protocol. (should be NULL if ctx is not also NULL)</span></p> <p class="c0"><span class="c5">buf</span><span class="c4"> - memory to use for all operations.</span></p> <p class="c0"><span class="c5">sz</span><span class="c4"> - size of memory buffer being passed in.</span></p> <p class="c0"><span class="c5">flag</span><span class="c4"> - type of memory.</span></p> <p class="c0"><span class="c5">max</span><span class="c4">- max concurrent operations.</span></p> <p class="c0"><span class="c6">Example:</span></p> <p class="c0"><span class="c1">WOLFSSL_CTX* ctx;</span></p> <p class="c0"><span class="c1">WOLFSSL* ssl;<br />int ret;<br />unsigned char memory[MAX];</span></p> <p class="c0"><span class="c1">int memorySz = MAX;</span></p> <p class="c0"><span class="c1">unsigned char IO[MAX];</span></p> <p class="c0"><span class="c1">int IOSz = MAX;<br />int flag = WOLFMEM_IO_FIXED | WOLFMEM_TRACK_STATS;</span></p> <p class="c0"><span class="c1">...</span></p> <p class="c0"><span class="c1">// create ctx also using static memory, start with general memory to use</span></p> <p class="c0"><span class="c1">ctx = NULL:</span></p> <p class="c0"><span class="c1">ret = wolfSSL_CTX_load_static_memory(&ctx, wolfSSLv23_server_method_ex, memory, memorySz, 0, MAX_CONCURRENT_HANDSHAKES);</span></p> <p class="c0"><span class="c1">if (ret != SSL_SUCCESS) {</span></p> <p class="c0 c3"><span class="c1">// handle error case</span></p> <p class="c0"><span class="c1">}</span></p> <p class="c0"><span class="c1">// load in memory for use with IO</span></p> <p class="c0"><span class="c1">ret = wolfSSL_CTX_load_static_memory(&ctx, NULL, IO, IOSz, flag, MAX_CONCURRENT_IO);</span></p> <p class="c0"><span class="c1">if (ret != SSL_SUCCESS) {</span></p> <p class="c0 c3"><span class="c1">// handle error case</span></p> <p class="c0"><span class="c1">}<br />...</span></p> <p class="c0"><span class="c6">See Also:</span></p> <p class="c0 c11"><span class="c8">wolfSSL_CTX_new<br />wolfSSL_CTX_is_static_memory<br />wolfSSL_is_static_memory</span></p> <p> </p> <p class="c10"><span class="c12 c5">wolfSSL_CTX_is_static_memory</span></p> <p class="c0"><span class="c9 c6">Synopsis:</span></p> <p class="c0"><span class="c4">#include <wolfssl/ssl.h></span></p> <p class="c0"><span class="c4">int wolfSSL_CTX_is_static_memory(WOLFSSL_CTX* ctx, WOLFSSL_MEM_STATS* mem_stats);</span></p> <p class="c0"><span class="c9 c6">Description:</span></p> <p class="c0"><span class="c8">This function does not change any of the connections behavior and is used only for gathering information about the static memory usage. </span></p> <p class="c0"><span class="c9 c6">Return Values:</span></p> <p class="c0"><span class="c8">A value of 1 is returned if using static memory for the CTX is true.</span></p> <p class="c0"><span class="c4">0 is returned if not using static memory.</span></p> <p class="c0"><span class="c9 c6">Parameters:</span></p> <p class="c0"><span class="c5">ctx</span><span class="c4"> - a pointer to a WOLFSSL_CTX structure, created using wolfSSL_CTX_new().</span></p> <p class="c0"><span class="c5">mem_stats</span><span class="c4"> - structure to hold information about static memory usage.</span></p> <p class="c0"><span class="c6">Example:</span></p> <p class="c0"><span class="c1">WOLFSSL_CTX* ctx;<br />int ret;<br />WOLFSSL_MEM_STATS mem_stats;</span></p> <p class="c0"><span class="c1">...</span></p> <p class="c0"><span class="c1">//get information about static memory with CTX</span></p> <p class="c0"><span class="c1">ret = wolfSSL_CTX_is_static_memory(ctx, &mem_stats);</span></p> <p class="c0"><span class="c1">if (ret == 1) {</span></p> <p class="c0"><span class="c1"> // handle case of is using static memory<br /> // print out or inspect elements of mem_stats</span></p> <p class="c0"><span class="c1">}</span></p> <p class="c0"><span class="c1">if (ret == 0) {</span></p> <p class="c0"><span class="c1"> //handle case of ctx not using static memory</span></p> <p class="c0"><span class="c1">}</span></p> <p class="c0"><span class="c1">…<br /></span></p> <p class="c0"><span class="c6">See Also:</span></p> <p class="c0 c11"><span class="c8">wolfSSL_CTX_new<br />wolfSSL_CTX_load_static_memory<br />wolfSSL_is_static_memory<br /></span></p> <p class="c10"><span class="c12 c5">wolfSSL_is_static_memory</span></p> <p class="c0"><span class="c9 c6">Synopsis:</span></p> <p class="c0"><span class="c4">#include <wolfssl/ssl.h></span></p> <p class="c0"><span class="c4">int wolfSSL_is_static_memory(WOLFSSL* ssl, WOLFSSL_MEM_CONN_STATS* mem_stats);</span></p> <p class="c0"><span class="c6 c9">Description:</span></p> <p class="c0"><span class="c8">wolfSSL_is_static_memory is used to gather information about a SSL’s static memory usage. The return value indicates if static memory is being used and WOLFSSL_MEM_CONN_STATS will be filled out if and only if the flag WOLFMEM_TRACK_STATS was passed to the parent CTX when loading in static memory.</span></p> <p class="c0"><span class="c9 c6">Return Values:</span></p> <p class="c0"><span class="c4">A value of 1 is returned if using static memory for the CTX is true.</span></p> <p class="c0"><span class="c8">0 is returned if not using static memory.</span></p> <p class="c0"><span class="c9 c6">Parameters:</span></p> <p class="c0"><span class="c5">ssl</span><span class="c4"> - a pointer to a WOLFSSL structure, created using wolfSSL_new().</span></p> <p class="c0"><span class="c5">mem_stats</span><span class="c4"> - structure to contain static memory usage.</span></p> <p class="c0"><span class="c9 c6">Example:</span></p> <p class="c0"><span class="c1">WOLFSSL* ssl;<br />int ret;<br />WOLFSSL_MEM_CONN_STATS mem_stats;</span></p> <p class="c0"><span class="c1">...</span></p> <p class="c0"><span class="c1">ret = wolfSSL_is_static_memory(ssl, mem_stats);</span></p> <p class="c0"><span class="c1">if (ret == 1) {</span></p> <p class="c0"><span class="c1"> // handle case when is static memory</span></p> <p class="c0"><span class="c1"> // investigate elements in mem_stats if WOLFMEM_TRACK_STATS flag</span></p> <p class="c0"><span class="c1">}</span></p> <p class="c0"><span class="c1">...</span></p> <p class="c0"><span class="c9 c6">See Also:</span></p> <p class="c0"><span class="c4">wolfSSL_new</span></p> <p class="c0"><span class="c8">wolfSSL_CTX_is_static_memory</span></p> <p> </p> <p class="c10"><span class="c5">wolfSSLv3_server_method_ex</span></p> <p class="c10"><span class="c5">wolfSSLv3_client_method_ex</span></p> <p class="c10"><span class="c5">wolfTLSv1_server_method_ex</span></p> <p class="c10"><span class="c5">wolfTLSv1_client_method_ex</span></p> <p class="c10"><span class="c5">wolfTLSv1_1_server_method_ex<br />wolfTLSv1_1_client_method_ex</span></p> <p class="c10"><span class="c5">wolfTLSv1_2_server_method_ex</span></p> <p class="c10"><span class="c5">wolfTLSv1_2_client_method_ex</span></p> <p class="c10"><span class="c5">wolfSSLv23_server_method_ex</span></p> <p class="c10"><span class="c12 c5">wolfSSLv23_client_method_ex</span></p> <p class="c0"><span class="c9 c6">Synopsis:</span></p> <p class="c0"><span class="c4">#include <wolfssl/ssl.h></span></p> <p class="c0"><span class="c4">WOLFSSL_METHOD* (*wolfSSL_method_func)(void* heap)</span></p> <p class="c0"><span class="c9 c6">Description:</span></p> <p class="c0"><span class="c8">These functions have the same behavior as their counterparts (functions with not having _ex) except that they do not create WOLFSSL_METHOD* using dynamic memory. The functions will use the heap hint passed in to create a new WOLFSSL_METHOD struct. </span></p> <p class="c0"><span class="c9 c6">Return Values:</span></p> <p class="c0"><span class="c4">A value of WOLFSSL_METHOD pointer if success.</span></p> <p class="c0"><span class="c4">NULL is returned in error cases.</span></p> <p class="c0"><span class="c9 c6">Parameters:</span></p> <p class="c0"><span class="c5">heap</span><span class="c4"> - a pointer to a heap hint for creating WOLFSSL_METHOD struct.</span></p> <p class="c0"><span class="c9 c6">Example:</span></p> <p class="c0"><span class="c1">WOLFSSL_CTX* ctx;<br />int ret;</span></p> <p class="c0"><span class="c1">...</span></p> <p class="c0"><span class="c1">ctx = NULL:</span></p> <p class="c0"><span class="c1">ret = wolfSSL_CTX_load_static_memory(&ctx, wolfSSLv23_server_method_ex, memory, memorySz, 0, MAX_CONCURRENT_HANDSHAKES);</span></p> <p class="c0"><span class="c1">if (ret != SSL_SUCCESS) {</span></p> <p class="c0 c3"><span class="c1">// handle error case</span></p> <p class="c0"><span class="c1">}</span></p> <p class="c0"><span class="c1">...</span></p> <p class="c0"><span class="c9 c6">See Also:</span></p> <p class="c0"><span class="c4">wolfSSL_new</span></p> <p class="c0"><span class="c4">wolfSSL_CTX_new<br />wolfSSL_CTX_free<br /></span></p> <p class="c0"><span class="c8"><br /></span><span class="c7">4.1 wolfCrypt API</span></p> <p class="c10"><span class="c5">wolfSSL_MemoryPaddingSz</span></p> <p class="c0"><span class="c9 c6">Synopsis:</span></p> <p class="c0"><span class="c4">#include <wolfssl/wolfcrypt/memory.h></span></p> <p class="c0"><span class="c4">int wolfSSL_MemoryPaddingSz(void);</span></p> <p class="c0"><span class="c9 c6">Description:</span></p> <p class="c0"><span class="c4">This function calculates the amount of padding needed with each bucket and is for informational purposes. The padding value is used for holding a memory management structure.<br /></span></p> <p class="c0"><span class="c9 c6">Return Values:</span></p> <p class="c0"><span class="c4">Returns padding size needed with each memory bucket.</span></p> <p class="c0"><span class="c9 c6">Parameters:</span></p> <p class="c0"><span class="c5">None</span></p> <p class="c0"><span class="c6">Example:</span></p> <p class="c0"> </p> <p>...</p> <p class="c0"><span class="c1">printf(“with current setup %d padding is used\n”, wolfSSL_MemoryPaddingSz());</span></p> <p class="c0"><span class="c6">See Also:</span></p> <p class="c0 c11"><span class="c4">wolfSSL_CTX_new<br />wolfSSL_CTX_is_static_memory<br />wolfSSL_is_static_memory</span></p> <p class="c0 c11"><span class="c8">wc_LoadStaticMemory<br /></span></p> <p class="c10"><span class="c5">wolfSSL_StaticBufferSz</span></p> <p class="c0"><span class="c9 c6">Synopsis:</span></p> <p class="c0"><span class="c4">#include <wolfssl/wolfcrypt/memory.h></span></p> <p class="c0"><span class="c4">int wolfSSL_StaticBufferSz(byte* buf, word32 sz, int flag);</span></p> <p class="c0"><span class="c9 c6">Description:</span></p> <p class="c0"><span class="c4">This function calculates the optimum buffer size given the preset memory buckets. The value returned is rounded down.<br /></span></p> <p class="c0"><span class="c9 c6">Return Values:</span></p> <p class="c0"><span class="c8">Returns optimum buffer size to use for no trailing memory space unused in the buffer.</span></p> <p class="c0"><span class="c9 c6">Parameters:</span></p> <p class="c0"><span class="c5">buf</span><span class="c4"> - address of the buffer, needed for calculating memory alignment requirements.</span></p> <p class="c0"><span class="c5">sz</span><span class="c4"> - size in bytes of the buffer</span></p> <p class="c0"><span class="c5">flag</span><span class="c4"> - type of memory desired</span></p> <p class="c0"><span class="c6">Example:</span></p> <p class="c0"><span class="c1"><br />int ret;<br />unsigned char memory[MAX];</span></p> <p class="c0"><span class="c1">int memorySz = MAX;<br />int flag = WOLFMEM_IO_FIXED | WOLFMEM_TRACK_STATS;</span></p> <p class="c0"><span class="c1">...</span></p> <p class="c0"><span class="c1">ret = wolfSSL_StaticBufferSz(memory, memorySz, flag);</span></p> <p class="c0"><span class="c1">//trim memory buffer based on ret<br />...</span></p> <p class="c0"><span class="c6">See Also:</span></p> <p class="c0 c11"><span class="c4">wolfSSL_CTX_new<br />wolfSSL_CTX_is_static_memory<br />wolfSSL_is_static_memory</span></p> <p class="c0 c11"><span class="c4">wc_LoadStaticMemory</span></p> <p> </p> <p class="c10"><span class="c5">wc_LoadStaticMemory</span></p> <p class="c0"><span class="c9 c6">Synopsis:</span></p> <p class="c0"><span class="c4">#include <wolfssl/wolfcrypt/memory.h></span></p> <p class="c0"><span class="c4">int wc_LoadStaticMemory(WOLFSSL_HEAP_HINT* hint, unsigned char* buf, unsigned int sz, int flag, int max);</span></p> <p class="c0"><span class="c9 c6">Description:</span></p> <p class="c0"><span class="c4">This function is used to set aside static memory for wolfCrypt use. Memory can be used by passing the created heap hint into functions. An example of this is when calling wc_InitRng_ex. The flag value passed in determines how the memory is used and behavior while operating, in general wolfCrypt operations will use memory from a WOLFMEM_GENERAL pool. Available flags are the following.</span></p> <p>WOLFMEM_GENERAL - default general memory</p> <p class="c0"><span class="c8">WOLFMEM_IO_POOL - used for input/output buffer when sending receiving messages. <br /> Overrides general memory, so all memory in buffer passed in is used for IO.<br />WOLFMEM_IO_FIXED - same as WOLFMEM_IO_POOL but each SSL now keeps two <br /> buffers to themselves for their lifetime.<br />WOLFMEM_TRACK_STATS - each SSL keeps track of memory stats while running.</span><span class="c4"><br /></span></p> <p class="c0"><span class="c9 c6">Return Values:</span></p> <p class="c0"><span class="c4">If successful, 0 will be returned.</span></p> <p class="c0"><span class="c4">All unsuccessful return values will be less than 0.</span></p> <p class="c0"><span class="c9 c6">Parameters:</span></p> <p class="c0"><span class="c5">hint</span><span class="c4">- WOLFSSL_HEAP_HINT structure to use</span></p> <p class="c0"><span class="c5">buf</span><span class="c4"> - memory to use for all operations.</span></p> <p class="c0"><span class="c5">sz</span><span class="c4"> - size of memory buffer being passed in.</span></p> <p class="c0"><span class="c5">flag</span><span class="c4"> - type of memory.</span></p> <p class="c0"><span class="c5">max</span><span class="c8">- max concurrent operations (handshakes, IO). Currently not as applicable with wolfCrypt operations but retained for the instance of when used with TLS connections.</span></p> <p class="c0"><span class="c6">Example:</span></p> <p class="c0"><span class="c1">WOLFSSL_HEAP_HINT hint;<br />int ret;<br />unsigned char memory[MAX];</span></p> <p class="c0"><span class="c1">int memorySz = MAX;<br />int flag = WOLFMEM_GENERAL | WOLFMEM_TRACK_STATS;</span></p> <p class="c0"><span class="c1">...</span></p> <p class="c0"><span class="c1">// load in memory for use</span></p> <p class="c0"><span class="c1">ret = wc_LoadStaticMemory(&hint, memory, memorySz, flag, 0);</span></p> <p class="c0"><span class="c1">if (ret != SSL_SUCCESS) {</span></p> <p class="c0 c3"><span class="c1">// handle error case</span></p> <p class="c0"><span class="c1">}<br />…</span></p> <p class="c0"><span class="c15">r</span><span class="c1">et = wc_InitRng_ex(&rng, hint, 0);</span></p> <p class="c0"><span class="c1">// check ret value</span></p> <p class="c0"><span class="c6">See Also:</span></p> <p><span class="c12 c7">5.0 Tuning</span></p> <p class="c0"><span class="c4"><br />To help in the case of limited resources and to reduce the overhead of using memory buckets, tuning can be done with setting the macros WOLFMEM_BUCKETS and WOLFMEM_DIST. For example configuring with the following reduced the peak usage of the cipher suite ECDHE-ECDSA-AES256-SHA384:</span></p> <p class="c0"><span class="c4"><br />./configure --enable-staticmemory --enable-psk C_EXTRA_FLAGS="-DALT_ECC_SIZE -DWOLFSSL_DEBUG_MEMORY -DWOLFMEM_BUCKETS=64,256,384,432,512,1632,2976,3456,16128 -DWOLFMEM_DIST=16,8,6,4,6,3,2,1,1" --disable-extended-master --enable-debug</span></p> <p class="c0"><span class="c4">The way this would be interpreted is 1 bucket of 16128 bytes each pass, 1 of 3456 bytes, 2 of 2976 bytes and so on, matching the distribution number to the bucket size. WOLFMEM_BUCKETS sizes being a list with the smallest on the left and largest on the right in order.</span></p> <p class="c0"><span class="c8"><br />In the case that memory alignment needs to be adjusted it can be set by using the macro WOLFSSL_STATIC_ALIGN. By default this is set to be 16 byte aligned but the following gives an example of setting to 8 byte aligned.</span></p> <p>./configure --enable-staticmemory C_EXTRA_FLAGS=-DWOLFSSL_STATIC_ALIGN=8</p> <p><span class="c5">5.1 Tuning IO Size</span><span class="c4"><br />This accounts for if controlling both server and client side and using the --enable-maxfragment feature. When using a set TLS packet size the static IO buffer can be reduced with setting the macro WOLFMEM_IO_SZ. The default size for WOLFMEM_IO_SZ is 16,992 bytes to account for the largest packet size possibly seen when connecting to uncontrolled end points but if reducing the packet size in a controlled connection this size then becomes wasteful. An example of setting this with using autotools would be “./configure --enable-staticmemory C_EXTRA_FLAGS=-DWOLFMEM_IO_SZ=660”. For more information about setting the fragment size with TLS connections see documentation on wolfSSL_CTX_UseMaxFragment and wolfSSL_UseMaxFragment.</span></p> </div> </div></div></div></div></div></div> </div><!-- .entry-content --> </article><!-- #post-## --> </main><!-- #main --> </div><!-- #primary --> <div id="secondary" class="widget-area" role="complementary" aria-label="Main Sidebar"> </div><!-- #secondary --> </div><!-- .container --> </div><!-- #content --> <footer id="colophon" class="site-footer unconstrained-footer" role="contentinfo"> <div class="container"> </div><!-- .container --> <div class="site-info"> <div class="container"> <div class="banner"> <a href="https://www.wolfssl.com/frequently-asked-questions-faq/"> <h1>wolfSSL FAQ</h1> </a> </div> <div class="banner"> <a href="https://www.wolfssl.com/products/curl/"> <h1>wolfSSL curl</h1> </a> </div> <a href="https://www.wolfssl.com/docs/tls13/"> <img id="tls13Banner" src="/wordpress/wp-content/uploads/2018/08/TLS13-now-avail.png"> </a> <div class="banner"> <a href="https://www.wolfssl.com/events/"><h1>Upcoming Events</h1></a> </div> <div id="lastBanner"> <a href="https://www.wolfssl.com/community/partner-network/"><h1>wolfSSL Partners</h1></a> </div> <div id="footerProducts"> <!--<a href="https://www.wolfssl.com/curl-up-2022-wolfssl/"> <img src="https://www.wolfssl.com/wordpress/wp-content/uploads/2022/07/curl_up_2022_virtual_1200.png" style="width:1200px"> </a>--> <!-- footer box row BEGIN --> <div class="footerBox"> <a href="/products/wolfssl/"> <h2>wolfSSL SSL/TLS Library</h2> <p>The wolfSSL lightweight TLS library supports TLS 1.3 and DTLS 1.3 on both client and server sides, features progressive algorithm support, is optimized for footprint and runtime memory use, and more!</p> <a/> </div> <div class="footerBox"> <a href="/products/wolfcrypt/"> <h2>wolfCrypt Crypto Engine</h2> <p>The wolfCrypt Crypto engine is a lightweight, embeddable, and easy-to-configure crypto library with a strong focus on portability, modularity, security, and feature set. FIPS 140-3 and MISRA available.</p> </a> </div> <div class="footerBox"> <a href="/docs/case-studies/"> <h2>Case Studies</h2> <p>Through use in games, databases, sensors, VoIP application, and more there is over 1 Billion copies of wolfSSL products in production environments today. Click to view all wolfSSL case studies.</p> </a> </div> <div id="rightFooterBox" class="footerBox"> <a href="/license/fips/"> <h2>wolfCrypt FIPS Module</h2> <p>The Cryptographic Module Validation Program (CMVP) has issued FIPS 140-3 Certificate #4718 for the wolfCrypt Module developed by wolfSSL Inc, the world's first SP800-140Br1 validated certificate. Click to read more.</p> </a> </div> <!-- footer box row END --> <div id="footer"><div id="innerFooter"> <div class="lowNav"> <p class="footText">Product Information</p> <ul class="lowNavList"> <a href="/products/wolfssl/"><li>wolfSSL TLS Library</li></a> <a href="/products/wolfcrypt/"><li>wolfCrypt Crypto Engine</li></a> <a href="/license/fips/"><li>wolfCrypt FIPS</li></a> <a href="/products/wolftpm/"><li>wolfTPM Portable TPM 2.0 Library</li></a> <a href="/products/wolfmqtt/"><li>wolfMQTT Client Library</li></a> <a href="/products/wolfssh/"><li>wolfSSH SSH Library</li></a> <a href="/products/wolfboot/"><li>wolfBoot Secure Bootloader</li></a> <a href="/products/curl/"><li>cURL</li></a> <a href="/products/wolfssl-jni/"><li>wolfSSL JNI</li></a> <a href="/products/wolfcrypt-jni-jce/"><li>wolfCrypt JNI and JCE Provider</li></a> <a href="/license/"><li>License Information</li></a> </ul> </div> <div class="lowNav"> <p class="footText">Documentation</p> <ul class="lowNavList"> <a href="/documentation/manuals/wolfssl/"><li>wolfSSL Manual</li></a> <a href="/docs/wolfssl-manual/ch17/"><li>wolfSSL API Reference</li></a> <a href="/doxygen/index.html"><li>Doxygen API Reference</li></a> <a href="/docs/wolfssl-manual/ch2/"><li>Building wolfSSL</li></a> <a href="/docs/wolfssl-manual/ch11/"><li>SSL Tutorial</li></a> <a href="/docs/case-studies/"><li>Case Studies</li></a> <a href="/docs/"><li>Additional Documentation</li></a> </ul> </div> <div id="lowCenter"> <p class="footText" id="center">Copyright © 2024 wolfSSL Inc.<br>All rights reserved.</p> <div id="socialIcons"> <!--<a href="https://twitter.com/wolfssl" target="_blank"><img src="/wordpress/wp-content/uploads/2018/06/twitter-icon.png" alt="Twitter"/></a>--> <a href="https://twitter.com/wolfssl" target="_blank"><img src="/wordpress/wp-content/uploads/2023/08/x.png" alt="X"/></a> <a href="https://www.facebook.com/wolfssl" target="_blank"><img src="https://www.wolfssl.com/wordpress/wp-content/uploads/2018/06/facebook-icon.png" alt="Facebook"/></a> <a href="https://www.github.com/wolfssl" target="_blank"><img src="/wordpress/wp-content/uploads/2018/06/github-icon.png" alt="Github"/></a> <a href="https://www.linkedin.com/company/wolfssl/" target="_blank"><img src="/wordpress/wp-content/uploads/2020/12/linkedin_50_50.png" alt="Linkedin"/></a> <a href="https://www.flickr.com/photos/54654493@N05/" target="_blank"><img src="/wordpress/wp-content/uploads/2018/06/flickr-icon.png" alt="Flickr"/></a> </div> <div id="madeInUsa"><img src="/wordpress/wp-content/uploads/2020/12/madeInUsa_100px.png" alt="Made in the USA"></div> </div> <div class="lowNav"> <p class="footText">Help and Support</p> <ul class="lowNavList"> <a href="https://www.wolfssl.com/frequently-asked-questions-faq/"><li>FAQ Page</li></a> <a href="https://www.wolfssl.com/products/support-and-maintenance/"><li>Support Forum</li></a> <a href="/support-blog/"><li>Support Blog</li></a> <a href="/products/support-and-maintenance/"><li>Support and Maintenance</li></a> <a href="/docs/consulting/"><li>Consulting Services</li></a> <a href="/docs/security-vulnerabilities/"><li>Vulnerability Info</li></a> <a href="/contact/"><li>Contact Us</li></a> <a href="/community/partner-network/"><li>Partners</li></a> </ul> </div> <div class="lowNav" id="lastLowNav"> <p class="footText">Reference</p> <ul class="lowNavList"> <a href="/docs/wolfssl-manual/appendix-b/"><li>Algorithm/Protocol Reference</li></a> <a href="/docs/media/"><li>Presentations</li></a> <a href="/events/"><li>Upcoming Events</li></a> <a href="/directory/"><li>Site Directory</li></a> </ul> </div> </div></div> <!--<div class="push"></div><div id="conferences">--> <!-- Distributech --> <!-- <a href="https://www.wolfssl.com/events/"><img class="conf" src="/wordpress/wp-content/uploads/2020/02/rsaconference_2020_medium.jpg" alt="Upcoming wolfSSL Event"></a>--> <!--</div>--> </div><!-- .site-info --> </footer><!-- #colophon --> </div><!-- #page --> <script> (function($){ "use strict"; var $searchArea = $('.top-search-menu'); $searchArea.click(function(){ $(this).addClass('input-expanded'); }); $(document).mouseup(function (e){ var container = $(".top-search-menu"); if (!$searchArea.is(e.target) && $searchArea.has(e.target).length === 0){ $searchArea.removeClass('input-expanded'); } }); })(jQuery); </script><link rel='stylesheet' id='so-css-siteorigin-north-css' href='https://www.wolfssl.com/wordpress/wp-content/uploads/so-css/so-css-siteorigin-north.css?ver=1693437314' type='text/css' media='all' /> <script type='text/javascript' src='https://www.wolfssl.com/wordpress/wp-content/themes/siteorigin-north/js/jquery.flexslider.min.js?ver=2.6.3' id='jquery-flexslider-js'></script> <script type='text/javascript' src='https://www.wolfssl.com/wordpress/wp-content/themes/siteorigin-north/js/jquery.transit.min.js?ver=0.9.12' id='jquery-transit-js'></script> <script type='text/javascript' id='siteorigin-north-script-js-extra'> /* <![CDATA[ */ var siteoriginNorth = {"smoothScroll":"1"}; /* ]]> */ </script> <script type='text/javascript' src='https://www.wolfssl.com/wordpress/wp-content/themes/siteorigin-north/js/north.min.js?ver=1.3.15' id='siteorigin-north-script-js'></script> <script type='text/javascript' src='https://www.wolfssl.com/wordpress/wp-content/themes/siteorigin-north/js/skip-link-focus-fix.min.js?ver=1.3.15' id='siteorigin-north-skip-link-js'></script> <script type='text/javascript' src='https://www.wolfssl.com/wordpress/wp-content/themes/siteorigin-north/js/jquery.fitvids.min.js?ver=1.1' id='jquery-fitvids-js'></script> <script type="text/javascript">document.body.className = document.body.className.replace("siteorigin-panels-before-js","");</script> <!-- WooCommerce Quick View --> <div id="quick-view-container"> <div id="product-quick-view" class="quick-view"></div> </div> <!-- Highlight parent page link when on child page --> <script type="text/javascript"> jQuery("li.current-page-ancestor").addClass('current-menu-item'); </script> </body> </html>