Skip to content

Commit 004d9a7

Browse files
authored
Merge pull request #322 from gilles-peskine-arm/merge-crypto-development-20191115
Update Mbed Crypto with latest Mbed TLS changes as of 2019-11-15
2 parents 63ad668 + 24600e8 commit 004d9a7

File tree

20 files changed

+436
-59
lines changed

20 files changed

+436
-59
lines changed

.travis.yml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,6 @@ compiler:
55
sudo: false
66
cache: ccache
77

8-
# blocklist
9-
branches:
10-
except:
11-
- development-psa
12-
- coverity_scan
13-
148
script:
159
- tests/scripts/recursion.pl library/*.c
1610
- tests/scripts/check-generated-files.sh
@@ -27,7 +21,7 @@ script:
2721
env:
2822
global:
2923
- SEED=1
30-
- secure: "barHldniAfXyoWOD/vcO+E6/Xm4fmcaUoC9BeKW+LwsHqlDMLvugaJnmLXkSpkbYhVL61Hzf3bo0KPJn88AFc5Rkf8oYHPjH4adMnVXkf3B9ghHCgznqHsAH3choo6tnPxaFgOwOYmLGb382nQxfE5lUdvnM/W/psQjWt66A1+k="
24+
- secure: "FrI5d2s+ckckC17T66c8jm2jV6i2DkBPU5nyWzwbedjmEBeocREfQLd/x8yKpPzLDz7ghOvr+/GQvsPPn0dVkGlNzm3Q+hGHc/ujnASuUtGrcuMM+0ALnJ3k4rFr9xEvjJeWb4SmhJO5UCAZYvTItW4k7+bj9L+R6lt3TzQbXzg="
3125

3226
addons:
3327
apt:
@@ -37,7 +31,7 @@ addons:
3731
coverity_scan:
3832
project:
3933
name: "ARMmbed/mbedtls"
40-
notification_email: simon.butcher@arm.com
34+
notification_email: support-mbedtls@arm.com
4135
build_command_prepend:
4236
build_command: make
4337
branch_pattern: coverity_scan

docs/architecture/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ default: all
55
all_markdown = \
66
mbed-crypto-storage-specification.md \
77
testing/driver-interface-test-strategy.md \
8+
testing/test-framework.md \
89
# This line is intentionally left blank
910

1011
html: $(all_markdown:.md=.html)
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Mbed TLS test framework
2+
3+
This document is an overview of the Mbed TLS test framework and test tools.
4+
5+
This document is incomplete. You can help by expanding it.
6+
7+
## Unit tests
8+
9+
See <https://tls.mbed.org/kb/development/test_suites>
10+
11+
### Unit test descriptions
12+
13+
Each test case has a description which succinctly describes for a human audience what the test does. The first non-comment line of each paragraph in a `.data` file is the test description. The following rules and guidelines apply:
14+
15+
* Test descriptions may not contain semicolons, line breaks and other control characters, or non-ASCII characters. <br>
16+
Rationale: keep the tools that process test descriptions (`generate_test_code.py`, [outcome file](#outcome-file) tools) simple.
17+
* Test descriptions must be unique within a `.data` file. If you can't think of a better description, the convention is to append `#1`, `#2`, etc. <br>
18+
Rationale: make it easy to relate a failure log to the test data. Avoid confusion between cases in the [outcome file](#outcome-file).
19+
* Test descriptions should be a maximum of **66 characters**. <br>
20+
Rationale: 66 characters is what our various tools assume (leaving room for 14 more characters on an 80-column line). Longer descriptions may be truncated or may break a visual alignment. <br>
21+
We have a lot of test cases with longer descriptions, but they should be avoided. At least please make sure that the first 66 characters describe the test uniquely.
22+
* Make the description descriptive. “foo: x=2, y=4” is more descriptive than “foo #2”. “foo: 0<x<y, both even” is even better if these inequalities and parities are why this particular test data was chosen.
23+
* Avoid changing the description of an existing test case without a good reason. This breaks the tracking of failures across CI runs, since this tracking is based on the descriptions.
24+
25+
`tests/scripts/check-test-cases.py` enforces some rules and warns if some guidelines are violated.
26+
27+
## TLS tests
28+
29+
### SSL extension tests
30+
31+
#### SSL test case descriptions
32+
33+
Each test case in `ssl-opt.sh` has a description which succinctly describes for a human audience what the test does. The test description is the first parameter to `run_tests`.
34+
35+
The same rules and guidelines apply as for [unit test descriptions](#unit-test-descriptions). In addition, the description must be written on the same line as `run_test`, in double quotes, for the sake of `check-test-cases.py`.
36+
37+
## Running tests
38+
39+
### Outcome file
40+
41+
#### Generating an outcome file
42+
43+
Unit tests and `ssl-opt.sh` record the outcome of each test case in a **test outcome file**. This feature is enabled if the environment variable `MBEDTLS_TEST_OUTCOME_FILE` is set. Set it to the path of the desired file.
44+
45+
If you run `all.sh --outcome-file test-outcome.csv`, this collects the outcome of all the test cases in `test-outcome.csv`.
46+
47+
#### Outcome file format
48+
49+
The outcome file is in a CSV format using `;` (semicolon) as the delimiter and no quoting. This means that fields may not contain newlines or semicolons. There is no title line.
50+
51+
The outcome file has 6 fields:
52+
53+
* **Platform**: a description of the platform, e.g. `Linux-x86_64` or `Linux-x86_64-gcc7-msan`.
54+
* **Configuration**: a unique description of the configuration (`config.h`).
55+
* **Test suite**: `test_suite_xxx` or `ssl-opt`.
56+
* **Test case**: the description of the test case.
57+
* **Result**: one of `PASS`, `SKIP` or `FAIL`.
58+
* **Cause**: more information explaining the result.

doxygen/mbedtls.doxyfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ DOXYFILE_ENCODING = UTF-8
2828
# identify the project. Note that if you do not use Doxywizard you need
2929
# to put quotes around the project name if it contains spaces.
3030

31-
PROJECT_NAME = "mbed TLS v2.17.0"
31+
PROJECT_NAME = "mbed TLS v2.19.1"
3232

3333
# The PROJECT_NUMBER tag can be used to enter a project or revision number.
3434
# This could be handy for archiving the generated documentation or

include/mbedtls/check_config.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,14 @@
237237
#error "MBEDTLS_MEMORY_BUFFER_ALLOC_C defined, but not all prerequisites"
238238
#endif
239239

240+
#if defined(MBEDTLS_MEMORY_BACKTRACE) && !defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C)
241+
#error "MBEDTLS_MEMORY_BACKTRACE defined, but not all prerequesites"
242+
#endif
243+
244+
#if defined(MBEDTLS_MEMORY_DEBUG) && !defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C)
245+
#error "MBEDTLS_MEMORY_DEBUG defined, but not all prerequesites"
246+
#endif
247+
240248
#if defined(MBEDTLS_PADLOCK_C) && !defined(MBEDTLS_HAVE_ASM)
241249
#error "MBEDTLS_PADLOCK_C defined, but not all prerequisites"
242250
#endif

include/mbedtls/error.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@
100100
* ECP 4 10 (Started from top)
101101
* MD 5 5
102102
* HKDF 5 1 (Started from top)
103+
* SSL 5 1 (Started from 0x5F00)
103104
* CIPHER 6 8 (Started from 0x6080)
104105
* SSL 6 24 (Started from top, plus 0x6000)
105106
* SSL 7 32

include/mbedtls/version.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,17 @@
3939
* Major, Minor, Patchlevel
4040
*/
4141
#define MBEDTLS_VERSION_MAJOR 2
42-
#define MBEDTLS_VERSION_MINOR 17
43-
#define MBEDTLS_VERSION_PATCH 0
42+
#define MBEDTLS_VERSION_MINOR 19
43+
#define MBEDTLS_VERSION_PATCH 1
4444

4545
/**
4646
* The single version number has the following structure:
4747
* MMNNPP00
4848
* Major version | Minor version | Patch version
4949
*/
50-
#define MBEDTLS_VERSION_NUMBER 0x02110000
51-
#define MBEDTLS_VERSION_STRING "2.17.0"
52-
#define MBEDTLS_VERSION_STRING_FULL "mbed TLS 2.17.0"
50+
#define MBEDTLS_VERSION_NUMBER 0x02130100
51+
#define MBEDTLS_VERSION_STRING "2.19.1"
52+
#define MBEDTLS_VERSION_STRING_FULL "mbed TLS 2.19.1"
5353

5454
#if defined(MBEDTLS_VERSION_C)
5555

library/Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,11 @@ libmbedcrypto.dll: $(OBJS_CRYPTO)
146146
echo " LD $@"
147147
$(CC) -shared -Wl,-soname,$@ -Wl,--out-implib,$@.a -o $@ $(OBJS_CRYPTO) -lws2_32 -lwinmm -lgdi32 -static-libgcc $(LOCAL_LDFLAGS) $(LDFLAGS)
148148

149+
libmbedcrypto.$(DLEXT): | libmbedcrypto.a
150+
149151
.c.o:
150152
echo " CC $<"
151-
$(CC) $(LOCAL_CFLAGS) $(CFLAGS) -c $< -o $@
153+
$(CC) $(LOCAL_CFLAGS) $(CFLAGS) -o $@ -c $<
152154

153155
clean:
154156
ifndef WINDOWS

programs/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,8 @@ ifndef WINDOWS
249249
rm -f $(APPS) $(EXTRA_GENERATED)
250250
-rm -f test/cpp_dummy_build$(EXEXT)
251251
else
252-
if exist *.o del /S /Q /F *.o
253-
if exist *.exe del /S /Q /F *.exe
252+
if exist *.o del /Q /F *.o
253+
if exist *.exe del /Q /F *.exe
254254
if exist $(EXTRA_GENERATED) del /S /Q /F $(EXTRA_GENERATED)
255255
endif
256256

programs/pkey/pk_sign.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ int main( void )
6060
#include <stdio.h>
6161
#include <string.h>
6262

63-
6463
int main( int argc, char *argv[] )
6564
{
6665
FILE *f;

scripts/config.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,9 @@ def include_in_full(name):
169169
'MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED',
170170
'MBEDTLS_ECP_RESTARTABLE',
171171
'MBEDTLS_HAVE_SSE2',
172+
'MBEDTLS_MEMORY_BACKTRACE',
173+
'MBEDTLS_MEMORY_BUFFER_ALLOC_C',
174+
'MBEDTLS_MEMORY_DEBUG',
172175
'MBEDTLS_NO_64BIT_MULTIPLICATION',
173176
'MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES',
174177
'MBEDTLS_NO_PLATFORM_ENTROPY',
@@ -201,8 +204,6 @@ def keep_in_baremetal(name):
201204
'MBEDTLS_HAVEGE_C',
202205
'MBEDTLS_HAVE_TIME',
203206
'MBEDTLS_HAVE_TIME_DATE',
204-
'MBEDTLS_MEMORY_BACKTRACE',
205-
'MBEDTLS_MEMORY_BUFFER_ALLOC_C',
206207
'MBEDTLS_PLATFORM_FPRINTF_ALT',
207208
'MBEDTLS_PLATFORM_TIME_ALT',
208209
'MBEDTLS_PSA_CRYPTO_SE_C',

0 commit comments

Comments
 (0)