Commit graph

95 commits

Author SHA1 Message Date
okhowang(王沛文)
df865c349a Pass c99 to compiler in CMakeLists.txt
Fixes #3631

Signed-off-by: okhowang(王沛文) <okhowang@tencent.com>
2022-05-11 16:26:11 +00:00
Biswapriyo Nath
0f2e87bdf5 cmake: Use GnuInstallDirs to customize install directories
Replace custom LIB_INSTALL_DIR with standard CMAKE_INSTALL_LIBDIR variable.
For backward compatibility, set CMAKE_INSTALL_LIBDIR if LIB_INSTALL_DIR is set.

Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
2022-04-22 20:59:28 +05:30
Bence Szépkúti
bb0cfeb2d4 Rename config.h to mbedtls_config.h
This commit was generated using the following script:

# ========================
#!/bin/sh
git ls-files | grep -v '^ChangeLog' | xargs sed -b -E -i '
s/((check|crypto|full|mbedtls|query)_config)\.h/\1\nh/g
s/config\.h/mbedtls_config.h/g
y/\n/./
'
mv include/mbedtls/config.h include/mbedtls/mbedtls_config.h
# ========================

Signed-off-by: Bence Szépkúti <bence.szepkuti@arm.com>
2021-06-28 09:28:33 +01:00
Chris Kay
d259e347e6 Add CMake package config file
This change enables automatic detection and consumption of Mbed TLS
library targets from within other CMake projects. By generating an
`MbedTLSConfig.cmake` file, consuming projects receive a more complete
view of these targets, allowing them to be used as dependencies which
properly inherit the transitive dependencies of the libraries.

This is fairly fragile, as it seems Mbed TLS's libraries do not appear
to properly model their dependencies on other targets, including
third-party dependencies. It is, however, sufficient for building and
linking the compiled Mbed TLS libraries when there are no third-party
dependencies involved. Further work is needed for more complex
use-cases, but this will likely meet the needs of most projects.

Resolves #298. Probably useful for #2857.

Signed-off-by: Chris Kay <chris.kay@arm.com>
2021-06-04 16:02:48 +01:00
Gilles Peskine
db09ef6d22 Include common.h instead of config.h in library source files
In library source files, include "common.h", which takes care of
including "mbedtls/config.h" (or the alternative MBEDTLS_CONFIG_FILE)
and other things that are used throughout the library.

FROM=$'#if !defined(MBEDTLS_CONFIG_FILE)\n#include "mbedtls/config.h"\n#else\n#include MBEDTLS_CONFIG_FILE\n#endif' perl -i -0777 -pe 's~\Q$ENV{FROM}~#include "common.h"~' library/*.c 3rdparty/*/library/*.c scripts/data_files/error.fmt scripts/data_files/version_features.fmt

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2020-07-02 11:26:57 +02:00
Ronald Cron
f19f312aa6 cmake: Add 3rd party public include directories
Add the possibility to distinguish between public and
non-public include directories. Public directories are
the one to use to access definitions of 3rd party code
interfaces.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2020-06-22 13:44:03 +02:00
Ronald Cron
00f5b8cd63 cmake: Compile everest code only if necessary
Compile everest code only if
MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED is defined
in config.h

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2020-06-22 13:44:03 +02:00
okhowang(王沛文)
3c1b090e58 Use FindPython3 when cmake version >= 3.15.0
Signed-off-by: okhowang(王沛文) <okhowang@tencent.com>
2020-06-10 10:21:50 +08:00
Gilles Peskine
18a9d5b425 Use an indirect reference to detect the 3rdparty directory 2020-03-23 17:55:31 +01:00
Gilles Peskine
3bdd412d09 Invoke config.py instead of config.pl
git grep -Fl /config.pl | xargs sed -i -e 's!/config\.pl!/config.py!g'

Also:
* Change one comment in include/mbedtls/check_config.h.
* Change PERL to PYTHON in CMakeLists.txt.
2019-11-13 14:33:33 +00:00
Janos Follath
71dcefbb8a Remove Mbed Crypto headers from everest_inc
At this point Mbed TLS and Mbed Crypto headers with the same name,
including the Mbed Crypto headers in `everest_inc` breaks Mbed TLS
builds.
2019-08-21 13:01:18 +01:00
Janos Follath
20082cb488 Correct 3rdparty include path for Mbed TLS 2019-08-20 15:18:19 +01:00
Christoph M. Wintersteiger
0969eeecbc 3rdparty: Fix Everest's mbedtls_x25519_get_params 2019-08-19 13:37:46 +01:00
Christoph M. Wintersteiger
d64e1e1e1c 3rdparty: Fix Everest header installation 2019-08-19 13:37:46 +01:00
Christoph M. Wintersteiger
ec70771a71 3rdparty: fix paths in Everest build scripts 2019-08-19 13:37:46 +01:00
Christoph M. Wintersteiger
26b98e12c5 3rdparty: Fix newlines and trailing whitespace 2019-08-19 13:37:46 +01:00
Christoph M. Wintersteiger
6e0cac1f57 3rdparty: Fix Everest build to not depend on build-time macros 2019-08-19 13:37:46 +01:00
Christoph M. Wintersteiger
7ec367ffc1 3rdparty: don't claim armcc support in Everest Readme.md 2019-08-19 13:37:46 +01:00
Christoph M. Wintersteiger
e7e74ba33b 3rdparty: Improve Everest README.md 2019-08-19 13:37:46 +01:00
Christoph M. Wintersteiger
1b73a71ac1 3rdparty: Fix .gitignore 2019-08-19 13:37:46 +01:00
Christoph M. Wintersteiger
8592958205 ECDH: Use macro-based sizes in Everest x25519 2019-08-19 13:37:46 +01:00
Christoph M. Wintersteiger
efdf4d7baa ECDH: Fix Everest x25519 make_public 2019-08-19 13:37:46 +01:00
Christoph M. Wintersteiger
537f41ebbf 3rdparty: Updated comments for Everest x25519 2019-08-19 13:37:46 +01:00
Christoph M. Wintersteiger
088ef49681 3rdparty: Make proper use of mbedtls_platform_zeroize in Everest x25519 2019-08-19 13:37:46 +01:00
Christoph M. Wintersteiger
fb779f1700 3rdparty: Pull Everest x25519 key size into macro 2019-08-19 13:37:46 +01:00
Christoph M. Wintersteiger
f21aba4cb2 3rdparty: Fix Everest platform detection for CMake 2019-08-19 13:37:46 +01:00
Christoph M. Wintersteiger
737df0c755 Fix file permissions 2019-08-19 13:37:46 +01:00
Christoph M. Wintersteiger
9b5e77e2e3 3rdparty: Use LOCAL_FLAGS instead of CFLAGS 2019-08-19 13:37:46 +01:00
Christoph M. Wintersteiger
2d4725f204 3rdparty: Rename THIRDPARTY_OBJECTS 2019-08-19 13:37:46 +01:00
Christoph M. Wintersteiger
f43e1d942f 3rdparty: Remove unnecessary copy of license file 2019-08-19 13:37:46 +01:00
Christoph M. Wintersteiger
20819afcad 3rdparty: Adjust .gitignore 2019-08-19 13:37:46 +01:00
Christoph M. Wintersteiger
02174b90dc 3rdparty: Fix Makefile coding conventions 2019-08-19 13:37:46 +01:00
Christoph M. Wintersteiger
6ea2dea1c5 3rdparty: Add additional build facilities for 3rd-party code 2019-08-19 13:37:46 +01:00
Christoph M. Wintersteiger
ea24394c03 ECDH: Fix whitespace and permission problems 2019-08-19 13:36:44 +01:00
Christoph M. Wintersteiger
8a0f5bb3c1 Make check-names.sh find the right names in 3rdparty
Essentially adds the Everest .h and .c files to the various variables. This
should be generalized at some point, but there is no infrastructure for this
yet.
2019-08-19 13:36:44 +01:00
Christoph M. Wintersteiger
62dddd08fd Add new 3rdparty build scripts 2019-08-19 13:36:44 +01:00
Christoph M. Wintersteiger
24fbceff50 ECDH: Everest: Remove unnecessary file 2019-08-19 13:36:44 +01:00
Christoph M. Wintersteiger
c3cbddecb5 ECDH: Fix whitespace, permissions 2019-08-19 13:36:44 +01:00
Christoph M. Wintersteiger
4936beb513 ECDH: Clean up the interface to Everest code 2019-08-19 13:36:44 +01:00
Christoph M. Wintersteiger
6acfbb52d7 ECDH: Add #ifdef to cleanly disable the Everest code 2019-08-19 13:36:44 +01:00
Christoph M. Wintersteiger
fb72367f96 ECDH: Remove old code from mbedtls_everest_make_params 2019-08-19 13:36:44 +01:00
Christoph M. Wintersteiger
d5fd766c49 ECDH: Include Everest Curve25519 in build scripts 2019-08-19 13:36:44 +01:00
Christoph M. Wintersteiger
de4fcf2ae3 ECDH: Add new ECDH context for Everest Curve25519 2019-08-19 13:19:38 +01:00
Christoph M. Wintersteiger
2a9684e7c9 ECDH: Add VS2010 support files for Everest Curve25519 2019-08-19 13:19:38 +01:00
Christoph M. Wintersteiger
bee486146e ECDH: Add Everest Curve25519 to 3rdparty/everest
These files are automatically generated by the Everest toolchain from F*
files. They do not respect the mbedTLS code style guidelines as manual
modification would invalidate verification guarantees. The files in
3rdparty/everest/include/kremli{n,b} are a customized (minimzed) version of the
support headers expected by the code extracted using KreMLin.
2019-08-19 13:19:38 +01:00