Commit graph

22 commits

Author SHA1 Message Date
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
c9c6e8d189 Improve comments
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2022-05-12 09:22:50 +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
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
Christoph M. Wintersteiger
0969eeecbc 3rdparty: Fix Everest's mbedtls_x25519_get_params 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
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
6ea2dea1c5 3rdparty: Add additional build facilities for 3rd-party code 2019-08-19 13:37:46 +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
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