Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

Statically setup heap management for mbedTLS. #1709

Closed
wants to merge 1 commit into from

Conversation

lundinc2
Copy link
Contributor

Statically setup heap management for mbedTLS.
Description

This PR is a fix for #1697

Checklist:

  • I have tested my changes. No regression in existing tests.
  • My code is Linted.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@aws-afr-bot
Copy link

uncrustify failed. Please run it manually and resubmit the PR

1 similar comment
@aws-afr-bot
Copy link

uncrustify failed. Please run it manually and resubmit the PR

@lundinc2
Copy link
Contributor Author

/bot run checks

@aws-afr-bot
Copy link

uncrustify failed. Please run it manually and resubmit the PR

yuhui-zheng
yuhui-zheng previously approved these changes Jan 25, 2020
@@ -29,6 +29,9 @@
#ifndef MBEDTLS_CONFIG_H
#define MBEDTLS_CONFIG_H

/* Standard include. */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally, the only changes we should be making to the mbedTLS configuration file are when we comment and un-comment #define lines in order to deviate from their default feature settings. Anything beyond that adds to the merge complexity that already deal with when mbed adds features and/or changes defaults.

//#define MBEDTLS_PLATFORM_FREE_MACRO free /**< Default free macro to use, can be undefined */
/* Set the memory allocation functions on FreeRTOS. */

#ifndef MBEDTLS_PLATFORM_CALLOC_MACRO
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be safer to specify these defines on the compiler/pre-processor command-line for that projects that will use it.

@@ -68,10 +68,10 @@ typedef struct SignatureVerificationState
/*-----------------------------------------------------------*/

/**
* @brief Implements libc calloc semantics using the FreeRTOS heap
* @brief Implementation of calloc for use by the mbedTLS heap management API
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add a period to the end as an additional improvement?

*/
static void * prvCalloc( size_t xNmemb,
size_t xSize )
void * pvMbedTLSCalloc( size_t xNmemb,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For what's it's worth, I have no idea what the variable name "xNmemb" is supposed to represent.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants