Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move sys_call from cryptlib_mbedtls to mbedtlslib #1634

Open
rw8896 opened this issue Jan 14, 2023 · 6 comments
Open

Move sys_call from cryptlib_mbedtls to mbedtlslib #1634

rw8896 opened this issue Jan 14, 2023 · 6 comments
Assignees
Labels
enhancement New feature or request refactor Should not affect functionality

Comments

@rw8896
Copy link
Contributor

rw8896 commented Jan 14, 2023

https://github.com/DMTF/libspdm/tree/main/os_stub/cryptlib_mbedtls/sys_call

The functions in sys_call folder are actually part of mbedtlslib as specified in mbedtlslib/include/mbedtls/config.h.
For example,

#define MBEDTLS_PLATFORM_MEMORY
#include <stddef.h>
extern void *my_calloc( size_t n, size_t size );
extern void my_free( void *ptr );
#define MBEDTLS_PLATFORM_CALLOC_MACRO my_calloc
#define MBEDTLS_PLATFORM_FREE_MACRO my_free

These functions are not needed when integrators use their existing mbedtls libraries instead of building mbedtlslib

I am not familiar with openssl but I guess the same might also apply.

@steven-bellock steven-bellock added enhancement New feature or request refactor Should not affect functionality labels Jan 14, 2023
@jyao1
Copy link
Member

jyao1 commented Jan 16, 2023

Do you mean remove MACRO and only define mbedtls_calloc and mbedtls_free ?

@jyao1
Copy link
Member

jyao1 commented Jan 16, 2023

Maybe @rw8896 can you propose a patch?

@rw8896
Copy link
Contributor Author

rw8896 commented Jan 16, 2023

Functions under os_stub/cryptlib_mbedtls/sys_call are implemented because of the macros defined in libspdm/os_stub/mbedtlslib/include/mbedtls/config.h.

So I guess these sys_call functions should be part of mbedtlslib rather than cryptlib_mbedtls?

@jyao1
Copy link
Member

jyao1 commented Jan 23, 2023

@rw8896 would you please propose a patch?

@rw8896
Copy link
Contributor Author

rw8896 commented Jan 31, 2023

@rw8896 would you please propose a patch?

Sure, will do.

@rw8896
Copy link
Contributor Author

rw8896 commented Feb 1, 2023

@jyao1
Originally I planned to move sys_call from cryptlib_mbedtls to somewhere, e.g. os_stub/mbedtlslib/sys_call , but that would need to create a new library, probably not a good idea?

Do you have any suggestion? Or just leave it as it is now?

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request refactor Should not affect functionality
Projects
None yet
Development

No branches or pull requests

3 participants