Commit graph

54 commits

Author SHA1 Message Date
David Horstmann
3c33cb599a Fix 3rdparty target names for custom config
Use the correct names qualified by MBEDTLS_TARGET_PREFIX.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-10-06 12:04:25 +01:00
Minos Galanakis
8f4c19a680 Merge pull request #8273 from davidhorstmann-arm:target-prefix-3rdparty
Add MBEDTLS_TARGET_PREFIX to 3rdparty CMake
2023-10-04 16:03:22 +01:00
David Horstmann
bf66b752b4 Add custom config logic to 3rdparty modules
These do not link directly against Mbed TLS so need their own
propagation of the custom config values through CMake.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-10-02 11:07:35 +01:00
David Horstmann
de527fbfe0 Add MBEDTLS_TARGET_PREFIX to 3rdparty CMake
MBEDTLS_TARGET_PREFIX is prepended to the CMake targets for Mbed TLS
except for targets in 3rdparty. Change this so that 3rdparty targets use
the prefix as well.

This allows multiple copies of Mbed TLS to be used in the same CMake
tree when using code in the 3rdparty directory.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-09-28 18:39:33 +01:00
Gilles Peskine
e820c0abc8 Update spelling "mbed TLS" to "Mbed TLS"
The official spelling of the trade mark changed from all-lowercase "mbed"
to normal proper noun capitalization "Mbed" a few years ago. We've been
using the new spelling in new text but still have the old spelling in a
lot of text. This commit updates most occurrences of "mbed TLS":

```
sed -i -e 's/mbed TLS/Mbed TLS/g' $(git ls-files ':!ChangeLog' ':!tests/data_files/**' ':!tests/suites/*.data' ':!programs/x509/*' ':!configs/tfm*')
```

Justification for the omissions:

* `ChangeLog`: historical text.
* `test/data_files/**`, `tests/suites/*.data`, `programs/x509/*`: many
  occurrences are significant names in certificates and such. Changing
  the spelling would invalidate many signatures and tests.
* `configs/tfm*`: this is an imported file. We'll follow the upstream
  updates.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-09-12 19:18:17 +02:00
Gilles Peskine
8075f76708 Ignore *.o everywhere
We don't commit *.o files anywhere, not even as test data. So ignore them
everywhere.

This resolves *.o files not being ignored under 3rdparty/p256-m.

Also remove a redundant ignore of *.exe in a subdirectory.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-05-12 13:58:05 +02:00
Dave Rodgman
378ecdd859 Rename VS2010 directory to VS2013 and update Makefiles etc
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-01-11 18:56:11 +00:00
Gilles Peskine
945b23c46f Include platform.h unconditionally: automatic part
We used to include platform.h only when MBEDTLS_PLATFORM_C was enabled, and
to define ad hoc replacements for mbedtls_xxx functions on a case-by-case
basis when MBEDTLS_PLATFORM_C was disabled. The only reason for this
complication was to allow building individual source modules without copying
platform.h. This is not something we support or recommend anymore, so get
rid of the complication: include platform.h unconditionally.

There should be no change in behavior since just including the header should
not change the behavior of a program.

This commit replaces most occurrences of conditional inclusion of
platform.h, using the following code:

```
perl -i -0777 -pe 's!#if.*\n#include "mbedtls/platform.h"\n(#else.*\n(#define (mbedtls|MBEDTLS)_.*\n|#include <(stdarg|stddef|stdio|stdlib|string|time)\.h>\n)*)?#endif.*!#include "mbedtls/platform.h"!mg' $(git grep -l '#include "mbedtls/platform.h"')
```

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-09-15 20:33:07 +02:00
Dave Rodgman
32c995afa3
Merge pull request #5724 from Biswa96/cmake-mingw
cmake: Fix runtime library install location in mingw
2022-05-25 13:34:43 +01:00
bootstrap-prime
6dbbf44d78
Fix typos in documentation and constants with typo finding tool
Signed-off-by: bootstrap-prime <bootstrap.prime@gmail.com>
2022-05-18 14:15:33 -04:00
Dave Rodgman
d87e46f3de
Merge pull request #3641 from okhowang/c99
Pass c99 to compiler
2022-05-12 14:01:10 +01:00
Dave Rodgman
c9c6e8d189 Improve comments
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2022-05-12 09:22:50 +01:00
Shaun Case
8b0ecbccf4 Redo of PR#5345. Fixed spelling and typographical errors found by CodeSpell.
Signed-off-by: Shaun Case <warmsocks@gmail.com>
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2022-05-11 21:25:51 +01:00
Dave Rodgman
85fba901ff Add comment
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2022-05-11 19:55:52 +01:00
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
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
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
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
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
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