unleashed-firmware/lib/mbedtls.scons
hedger 890c9e87ce
[FL-3690] Libraries cleanup; u2f crypto rework to use mbedtls (#3234)
* examples: plugins: utilize fal_embedded
* libs: removed fnv1a_hash
* furi: added FURI_PACKED; apps, libs: changed to use FURI_PACKED
* lib: mbedtls: using custom config
* lib: toolbox: removed md5, switched to mbedtls
* targets: f18: link fix
* lib: added mbedtls_cfg.h
* apps: nfc: explicit dependency on libmbedtls
* u2f: reworking to mbedtls
* u2f: replaced sha256 & hmac with mbedtls
* u2f: functional rework using mbedtls
* libs: dropped micro-ecc
* u2f: dropped old implementation
* toolbox: removed sha256 impl
* mcheck() for mbedtls
* libs: removed libmisc; split into smaller libs
* apps: debug: fixed display_test
* apps: include cleanups
* fbt: fixed VERSIONCOMSTR
* furi: added FURI_CHECK_RETURN
* lib: removed qrcode
* cleanup
* fbt: lint_py+format_py: fixed excessive command length
* api: Removed bzero from f7
* api: Removed bzero from f18
* Bump API Symbols

Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2023-12-01 18:16:48 +09:00

58 lines
1.7 KiB
Text

Import("env")
env.Append(
CPPPATH=[
# "#/lib/mbedtls",
"#/lib/mbedtls/include",
],
SDK_HEADERS=[
File("mbedtls/include/mbedtls/des.h"),
File("mbedtls/include/mbedtls/sha1.h"),
File("mbedtls/include/mbedtls/sha256.h"),
File("mbedtls/include/mbedtls/md5.h"),
File("mbedtls/include/mbedtls/md.h"),
File("mbedtls/include/mbedtls/ecdsa.h"),
File("mbedtls/include/mbedtls/ecdh.h"),
File("mbedtls/include/mbedtls/ecp.h"),
# File("mbedtls/include/mbedtls/sha1.h"),
],
CPPDEFINES=[("MBEDTLS_CONFIG_FILE", '\\"mbedtls_cfg.h\\"')],
)
libenv = env.Clone(FW_LIB_NAME="mbedtls")
libenv.ApplyLibFlags()
libenv.AppendUnique(
CCFLAGS=[
# Required for lib to be linkable with .faps
"-mword-relocations",
"-mlong-calls",
# Crappy code :)
"-Wno-redundant-decls",
],
)
# If we were to build full mbedtls, we would need to use this:
# sources = libenv.GlobRecursive("*.c*", "mbedtls/library")
# Otherwise, we can just use the files we need:
sources = [
File("mbedtls/library/bignum.c"),
File("mbedtls/library/bignum_core.c"),
File("mbedtls/library/ecdsa.c"),
File("mbedtls/library/ecp.c"),
File("mbedtls/library/ecp_curves.c"),
File("mbedtls/library/md.c"),
File("mbedtls/library/md5.c"),
File("mbedtls/library/platform_util.c"),
File("mbedtls/library/ripemd160.c"),
File("mbedtls/library/sha1.c"),
File("mbedtls/library/sha256.c"),
File("mbedtls/library/des.c"),
]
Depends(sources, File("mbedtls_cfg.h"))
lib = libenv.StaticLibrary("${FW_LIB_NAME}", sources)
libenv.Install("${LIB_DIST_DIR}", lib)
Return("lib")