mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-04-10 06:44:28 +00:00
Merge pull request #8877 from gilles-peskine-arm/split-minimal-3.6
Create a minimal framework submodule
This commit is contained in:
commit
775c7768ee
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
[submodule "framework"]
|
||||
path = framework
|
||||
url = https://github.com/Mbed-TLS/mbedtls-framework
|
@ -5,6 +5,11 @@
|
||||
# Required
|
||||
version: 2
|
||||
|
||||
# Include the framework submodule in the build
|
||||
submodules:
|
||||
include:
|
||||
- framework
|
||||
|
||||
# Set the version of Python and other tools you might need
|
||||
build:
|
||||
os: ubuntu-20.04
|
||||
|
@ -283,6 +283,11 @@ if(LIB_INSTALL_DIR)
|
||||
set(CMAKE_INSTALL_LIBDIR "${LIB_INSTALL_DIR}")
|
||||
endif()
|
||||
|
||||
if (NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/framework/CMakeLists.txt")
|
||||
message(FATAL_ERROR "${CMAKE_CURRENT_SOURCE_DIR}/framework/CMakeLists.txt not found. Run `git submodule update --init` from the source tree to fetch the submodule contents.")
|
||||
endif()
|
||||
add_subdirectory(framework)
|
||||
|
||||
add_subdirectory(include)
|
||||
|
||||
add_subdirectory(3rdparty)
|
||||
|
14
Makefile
14
Makefile
@ -2,6 +2,20 @@ DESTDIR=/usr/local
|
||||
PREFIX=mbedtls_
|
||||
PERL ?= perl
|
||||
|
||||
ifneq (,$(filter-out lib library/%,$(or $(MAKECMDGOALS),all)))
|
||||
ifeq (,$(wildcard framework/exported.make))
|
||||
# Use the define keyword to get a multi-line message.
|
||||
# GNU make appends ". Stop.", so tweak the ending of our message accordingly.
|
||||
define error_message
|
||||
$(MBEDTLS_PATH)/framework/exported.make not found.
|
||||
Run `git submodule update --init` to fetch the submodule contents.
|
||||
This is a fatal error
|
||||
endef
|
||||
$(error $(error_message))
|
||||
endif
|
||||
include framework/exported.make
|
||||
endif
|
||||
|
||||
.SILENT:
|
||||
|
||||
.PHONY: all no_test programs lib tests install uninstall clean test check lcov apidoc apidoc_clean
|
||||
|
@ -54,6 +54,10 @@ You need the following tools to build the library with the provided makefiles:
|
||||
* Microsoft Visual Studio 2013 or later (if using Visual Studio).
|
||||
* Doxygen 1.8.11 or later (if building the documentation; slightly older versions should work).
|
||||
|
||||
### Git usage
|
||||
|
||||
The `development` branch and the `mbedtls-3.6` long-term support branch of Mbed TLS use a [Git submodule](https://git-scm.com/book/en/v2/Git-Tools-Submodules#_cloning_submodules) ([framework](https://github.com/Mbed-TLS/mbedtls-framework)). This is not needed to merely compile the library at a release tag. This is not needed to consume a release archive (zip or tar).
|
||||
|
||||
### Generated source files in the development branch
|
||||
|
||||
The source code of Mbed TLS includes some files that are automatically generated by scripts and whose content depends only on the Mbed TLS source, not on the platform or on the library configuration. These files are not included in the development branch of Mbed TLS, but the generated files are included in official releases. This section explains how to generate the missing files in the development branch.
|
||||
|
1
framework
Submodule
1
framework
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 750634d3a51eb9d61b59fd5d801546927c946588
|
@ -1,3 +1,26 @@
|
||||
ifndef MBEDTLS_PATH
|
||||
MBEDTLS_PATH := ..
|
||||
endif
|
||||
|
||||
GENERATED_FILES := \
|
||||
error.c version_features.c \
|
||||
ssl_debug_helpers_generated.c \
|
||||
psa_crypto_driver_wrappers.h \
|
||||
psa_crypto_driver_wrappers_no_static.c
|
||||
|
||||
ifneq ($(GENERATED_FILES),$(wildcard $(GENERATED_FILES)))
|
||||
ifeq (,$(wildcard $(MBEDTLS_PATH)/framework/exported.make))
|
||||
# Use the define keyword to get a multi-line message.
|
||||
# GNU make appends ". Stop.", so tweak the ending of our message accordingly.
|
||||
define error_message
|
||||
$(MBEDTLS_PATH)/framework/exported.make not found.
|
||||
Run `git submodule update --init` to fetch the submodule contents.
|
||||
This is a fatal error
|
||||
endef
|
||||
$(error $(error_message))
|
||||
endif
|
||||
include $(MBEDTLS_PATH)/framework/exported.make
|
||||
endif
|
||||
|
||||
# Also see "include/mbedtls/mbedtls_config.h"
|
||||
|
||||
@ -315,11 +338,6 @@ libmbedcrypto.dll: $(OBJS_CRYPTO)
|
||||
$(CC) $(LOCAL_CFLAGS) $(CFLAGS) -o $@ -c $<
|
||||
|
||||
.PHONY: generated_files
|
||||
GENERATED_FILES = \
|
||||
error.c version_features.c \
|
||||
ssl_debug_helpers_generated.c \
|
||||
psa_crypto_driver_wrappers.h \
|
||||
psa_crypto_driver_wrappers_no_static.c
|
||||
generated_files: $(GENERATED_FILES)
|
||||
|
||||
# See root Makefile
|
||||
|
@ -4,6 +4,18 @@ ifndef MBEDTLS_PATH
|
||||
MBEDTLS_PATH := ..
|
||||
endif
|
||||
|
||||
ifeq (,$(wildcard $(MBEDTLS_PATH)/framework/exported.make))
|
||||
# Use the define keyword to get a multi-line message.
|
||||
# GNU make appends ". Stop.", so tweak the ending of our message accordingly.
|
||||
define error_message
|
||||
$(MBEDTLS_PATH)/framework/exported.make not found.
|
||||
Run `git submodule update --init` to fetch the submodule contents.
|
||||
This is a fatal error
|
||||
endef
|
||||
$(error $(error_message))
|
||||
endif
|
||||
include $(MBEDTLS_PATH)/framework/exported.make
|
||||
|
||||
CFLAGS ?= -O2
|
||||
WARNING_CFLAGS ?= -Wall -Wextra -Wformat=2 -Wno-format-nonliteral
|
||||
WARNING_CXXFLAGS ?= -Wall -Wextra -Wformat=2 -Wno-format-nonliteral
|
||||
|
@ -208,6 +208,7 @@ define libtestdriver1_rewrite :=
|
||||
s/\b(?=mbedtls_|psa_)/libtestdriver1_/g;
|
||||
endef
|
||||
|
||||
libtestdriver1.a: export MBEDTLS_PATH := $(patsubst ../..//%,/%,../../$(MBEDTLS_PATH))
|
||||
libtestdriver1.a:
|
||||
# Copy the library and fake a 3rdparty Makefile include.
|
||||
rm -Rf ./libtestdriver1
|
||||
|
@ -323,6 +323,7 @@ class TabIssueTracker(LineIssueTracker):
|
||||
".make",
|
||||
".pem", # some openssl dumps have tabs
|
||||
".sln",
|
||||
"/.gitmodules",
|
||||
"/Makefile",
|
||||
"/Makefile.inc",
|
||||
"/generate_visualc_files.pl",
|
||||
@ -469,6 +470,7 @@ class IntegrityChecker:
|
||||
]
|
||||
|
||||
def setup_logger(self, log_file, level=logging.INFO):
|
||||
"""Log to log_file if provided, or to stderr if None."""
|
||||
self.logger = logging.getLogger()
|
||||
self.logger.setLevel(level)
|
||||
if log_file:
|
||||
@ -480,9 +482,19 @@ class IntegrityChecker:
|
||||
|
||||
@staticmethod
|
||||
def collect_files():
|
||||
"""Return the list of files to check.
|
||||
|
||||
These are the regular files commited into Git.
|
||||
"""
|
||||
bytes_output = subprocess.check_output(['git', 'ls-files', '-z'])
|
||||
bytes_filepaths = bytes_output.split(b'\0')[:-1]
|
||||
ascii_filepaths = map(lambda fp: fp.decode('ascii'), bytes_filepaths)
|
||||
# Filter out directories. Normally Git doesn't list directories
|
||||
# (it only knows about the files inside them), but there is
|
||||
# at least one case where 'git ls-files' includes a directory:
|
||||
# submodules. Just skip submodules (and any other directories).
|
||||
ascii_filepaths = [fp for fp in ascii_filepaths
|
||||
if os.path.isfile(fp)]
|
||||
# Prepend './' to files in the top-level directory so that
|
||||
# something like `'/Makefile' in fp` matches in the top-level
|
||||
# directory as well as in subdirectories.
|
||||
@ -490,12 +502,17 @@ class IntegrityChecker:
|
||||
for fp in ascii_filepaths]
|
||||
|
||||
def check_files(self):
|
||||
"""Check all files for all issues."""
|
||||
for issue_to_check in self.issues_to_check:
|
||||
for filepath in self.collect_files():
|
||||
if issue_to_check.should_check_file(filepath):
|
||||
issue_to_check.check_file_for_issue(filepath)
|
||||
|
||||
def output_issues(self):
|
||||
"""Log the issues found and their locations.
|
||||
|
||||
Return 1 if there were issues, 0 otherwise.
|
||||
"""
|
||||
integrity_return_code = 0
|
||||
for issue_to_check in self.issues_to_check:
|
||||
if issue_to_check.files_with_issues:
|
||||
|
Loading…
x
Reference in New Issue
Block a user