Skip to content

Commit c69af20

Browse files
authored
Merge pull request #92 from gilles-peskine-arm/psa-api-beta2-merge-development
Merge development into API spec branch
2 parents 9b542de + a780f24 commit c69af20

File tree

341 files changed

+24692
-20697
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

341 files changed

+24692
-20697
lines changed

.travis.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ compiler:
44
- gcc
55
sudo: false
66
cache: ccache
7+
8+
# blocklist
9+
branches:
10+
except:
11+
- development-psa
12+
- coverity_scan
13+
714
script:
815
- tests/scripts/recursion.pl library/*.c
916
- tests/scripts/check-generated-files.sh
@@ -15,13 +22,8 @@ script:
1522
- make
1623
- make test
1724
- programs/test/selftest
18-
- OSSL_NO_DTLS=1 tests/compat.sh
19-
- tests/ssl-opt.sh -e '\(DTLS\|SCSV\).*openssl'
2025
- tests/scripts/test-ref-configs.pl
2126
- tests/scripts/curves.pl
22-
- tests/scripts/key-exchanges.pl
23-
after_failure:
24-
- tests/scripts/travis-log-failure.sh
2527
env:
2628
global:
2729
secure: "barHldniAfXyoWOD/vcO+E6/Xm4fmcaUoC9BeKW+LwsHqlDMLvugaJnmLXkSpkbYhVL61Hzf3bo0KPJn88AFc5Rkf8oYHPjH4adMnVXkf3B9ghHCgznqHsAH3choo6tnPxaFgOwOYmLGb382nQxfE5lUdvnM/W/psQjWt66A1+k="
@@ -34,7 +36,7 @@ addons:
3436
coverity_scan:
3537
project:
3638
name: "ARMmbed/mbedtls"
37-
notification_email: [email protected]
39+
notification_email: [email protected]
3840
build_command_prepend:
3941
build_command: make
4042
branch_pattern: coverity_scan

CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,6 @@ if(ENABLE_TESTING)
200200
ADD_CUSTOM_TARGET(covtest
201201
COMMAND make test
202202
COMMAND programs/test/selftest
203-
COMMAND tests/compat.sh
204-
COMMAND tests/ssl-opt.sh
205203
)
206204

207205
ADD_CUSTOM_TARGET(lcov

CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,15 @@ When backporting to these branches please observe the following rules:
5050

5151
2. All bug fixes that correct a defect that is also present in an LTS branch must be backported to that LTS branch. If a bug fix introduces a change to the API such as a new function, the fix should be reworked to avoid the API change. API changes without very strong justification are unlikely to be accepted.
5252

53-
3. If a contribution is a new feature or enhancement, no backporting is required. Exceptions to this may be addtional test cases or quality improvements such as changes to build or test scripts.
53+
3. If a contribution is a new feature or enhancement, no backporting is required. Exceptions to this may be additional test cases or quality improvements such as changes to build or test scripts.
5454

5555
It would be highly appreciated if contributions are backported to LTS branches in addition to the [development branch](https://github.com/ARMmbed/mbedtls/tree/development) by contributors.
5656

5757
Currently maintained LTS branches are:
5858

59-
1. [mbedtls-2.1](https://github.com/ARMmbed/mbedtls/tree/mbedtls-2.1)
59+
1. [mbedtls-2.7](https://github.com/ARMmbed/mbedtls/tree/mbedtls-2.7)
6060

61-
2. [mbedtls-2.7](https://github.com/ARMmbed/mbedtls/tree/mbedtls-2.7)
61+
1. [mbedtls-2.16](https://github.com/ARMmbed/mbedtls/tree/mbedtls-2.16)
6262

6363

6464
Tests

ChangeLog

Lines changed: 216 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,218 @@
11
mbed TLS ChangeLog (Sorted per branch, date)
22

3-
= mbed TLS 2.xx.x branch released xxxx-xx-xx
3+
= mbed TLS x.x.x branch released xxxx-xx-xx
4+
5+
Features
6+
* Add the Any Policy certificate policy oid, as defined in
7+
rfc 5280 section 4.2.1.4.
8+
9+
Bugfix
10+
* Fix private key DER output in the key_app_writer example. File contents
11+
were shifted by one byte, creating an invalid ASN.1 tag. Fixed by
12+
Christian Walther in #2239.
13+
14+
Changes
15+
* Server's RSA certificate in certs.c was SHA-1 signed. In the default
16+
mbedTLS configuration only SHA-2 signed certificates are accepted.
17+
This certificate is used in the demo server programs, which lead the
18+
client programs to fail at the peer's certificate verification
19+
due to an unacceptable hash signature. The certificate has been
20+
updated to one that is SHA-256 signed. Fix contributed by
21+
Illya Gerasymchuk.
22+
* Return from various debugging routines immediately if the
23+
provided SSL context is unset.
24+
* Remove dead code from bignum.c in the default configuration.
25+
Found by Coverity, reported and fixed by Peter Kolbus (Garmin). Fixes #2309.
26+
* Add test for minimal value of MBEDTLS_MPI_WINDOW_SIZE to all.sh.
27+
Contributed by Peter Kolbus (Garmin).
28+
29+
= mbed TLS 2.17.0 branch released 2019-03-19
30+
31+
Features
32+
* Add a new X.509 API call `mbedtls_x509_parse_der_nocopy()`
33+
which allows copy-less parsing of DER encoded X.509 CRTs,
34+
at the cost of additional lifetime constraints on the input
35+
buffer, but at the benefit of reduced RAM consumption.
36+
* Add a new function mbedtls_asn1_write_named_bitstring() to write ASN.1
37+
named bitstring in DER as required by RFC 5280 Appendix B.
38+
* Add MBEDTLS_REMOVE_3DES_CIPHERSUITES to allow removing 3DES ciphersuites
39+
from the default list (enabled by default). See
40+
https://sweet32.info/SWEET32_CCS16.pdf.
41+
42+
API Changes
43+
* Add a new X.509 API call `mbedtls_x509_parse_der_nocopy()`.
44+
See the Features section for more information.
45+
* Allow to opt in to the removal the API mbedtls_ssl_get_peer_cert()
46+
for the benefit of saving RAM, by disabling the new compile-time
47+
option MBEDTLS_SSL_KEEP_PEER_CERTIFICATE (enabled by default for
48+
API stability). Disabling this option makes mbedtls_ssl_get_peer_cert()
49+
always return NULL, and removes the peer_cert field from the
50+
mbedtls_ssl_session structure which otherwise stores the peer's
51+
certificate.
52+
53+
Security
54+
* Make mbedtls_ecdh_get_params return an error if the second key
55+
belongs to a different group from the first. Before, if an application
56+
passed keys that belonged to different group, the first key's data was
57+
interpreted according to the second group, which could lead to either
58+
an error or a meaningless output from mbedtls_ecdh_get_params. In the
59+
latter case, this could expose at most 5 bits of the private key.
60+
61+
Bugfix
62+
* Fix a compilation issue with mbedtls_ecp_restart_ctx not being defined
63+
when MBEDTLS_ECP_ALT is defined. Reported by jwhui. Fixes #2242.
64+
* Run the AD too long test only if MBEDTLS_CCM_ALT is not defined.
65+
Raised as a comment in #1996.
66+
* Reduce the stack consumption of mbedtls_mpi_fill_random() which could
67+
previously lead to a stack overflow on constrained targets.
68+
* Add `MBEDTLS_SELF_TEST` for the mbedtls_self_test functions
69+
in the header files, which missed the precompilation check. #971
70+
* Fix returning the value 1 when mbedtls_ecdsa_genkey failed.
71+
* Remove a duplicate #include in a sample program. Fixed by Masashi Honma #2326.
72+
* Remove the mbedtls namespacing from the header file, to fix a "file not found"
73+
build error. Fixed by Haijun Gu #2319.
74+
* Fix signed-to-unsigned integer conversion warning
75+
in X.509 module. Fixes #2212.
76+
* Reduce stack usage of `mpi_write_hlp()` by eliminating recursion.
77+
Fixes #2190.
78+
* Fix false failure in all.sh when backup files exist in include/mbedtls
79+
(e.g. config.h.bak). Fixed by Peter Kolbus (Garmin) #2407.
80+
* Ensure that unused bits are zero when writing ASN.1 bitstrings when using
81+
mbedtls_asn1_write_bitstring().
82+
* Fix issue when writing the named bitstrings in KeyUsage and NsCertType
83+
extensions in CSRs and CRTs that caused these bitstrings to not be encoded
84+
correctly as trailing zeroes were not accounted for as unused bits in the
85+
leading content octet. Fixes #1610.
486

587
Changes
6-
* Add unit tests for AES-GCM when called through mbedtls_cipher_auth_xxx()
7-
from the cipher abstraction layer. Fixes #2198.
88+
* Reduce RAM consumption during session renegotiation by not storing
89+
the peer CRT chain and session ticket twice.
90+
* Include configuration file in all header files that use configuration,
91+
instead of relying on other header files that they include.
92+
Inserted as an enhancement for #1371
93+
* Add support for alternative CSR headers, as used by Microsoft and defined
94+
in RFC 7468. Found by Michael Ernst. Fixes #767.
95+
* Correct many misspellings. Fixed by MisterDA #2371.
96+
* Provide an abstraction of vsnprintf to allow alternative implementations
97+
for platforms that don't provide it. Based on contributions by Joris Aerts
98+
and Nathaniel Wesley Filardo.
99+
* Fix clobber list in MIPS assembly for large integer multiplication.
100+
Previously, this could lead to functionally incorrect assembly being
101+
produced by some optimizing compilers, showing up as failures in
102+
e.g. RSA or ECC signature operations. Reported in #1722, fix suggested
103+
by Aurelien Jarno and submitted by Jeffrey Martin.
104+
* Reduce the complexity of the timing tests. They were assuming more than the
105+
underlying OS actually guarantees.
106+
* Fix configuration queries in ssl-opt.h. #2030
107+
* Ensure that ssl-opt.h can be run in OS X. #2029
108+
* Re-enable certain interoperability tests in ssl-opt.sh which had previously
109+
been disabled for lack of a sufficiently recent version of GnuTLS on the CI.
110+
* Ciphersuites based on 3DES now have the lowest priority by default when
111+
they are enabled.
112+
113+
= mbed TLS 2.16.0 branch released 2018-12-21
114+
115+
Features
116+
* Add a new config.h option of MBEDTLS_CHECK_PARAMS that enables validation
117+
of parameters in the API. This allows detection of obvious misuses of the
118+
API, such as passing NULL pointers. The API of existing functions hasn't
119+
changed, but requirements on parameters have been made more explicit in
120+
the documentation. See the corresponding API documentation for each
121+
function to see for which parameter values it is defined. This feature is
122+
disabled by default. See its API documentation in config.h for additional
123+
steps you have to take when enabling it.
124+
125+
API Changes
126+
* The following functions in the random generator modules have been
127+
deprecated and replaced as shown below. The new functions change
128+
the return type from void to int to allow returning error codes when
129+
using MBEDTLS_<MODULE>_ALT for the underlying AES or message digest
130+
primitive. Fixes #1798.
131+
mbedtls_ctr_drbg_update() -> mbedtls_ctr_drbg_update_ret()
132+
mbedtls_hmac_drbg_update() -> mbedtls_hmac_drbg_update_ret()
133+
* Extend ECDH interface to enable alternative implementations.
134+
* Deprecate error codes of the form MBEDTLS_ERR_xxx_INVALID_KEY_LENGTH for
135+
ARIA, CAMELLIA and Blowfish. These error codes will be replaced by
136+
the more generic per-module error codes MBEDTLS_ERR_xxx_BAD_INPUT_DATA.
137+
* Additional parameter validation checks have been added for the following
138+
modules - AES, ARIA, Blowfish, CAMELLIA, CCM, GCM, DHM, ECP, ECDSA, ECDH,
139+
ECJPAKE, SHA, Chacha20 and Poly1305, cipher, pk, RSA, and MPI.
140+
Where modules have had parameter validation added, existing parameter
141+
checks may have changed. Some modules, such as Chacha20 had existing
142+
parameter validation whereas other modules had little. This has now been
143+
changed so that the same level of validation is present in all modules, and
144+
that it is now optional with the MBEDTLS_CHECK_PARAMS flag which by default
145+
is off. That means that checks which were previously present by default
146+
will no longer be.
147+
148+
New deprecations
149+
* Deprecate mbedtls_ctr_drbg_update and mbedtls_hmac_drbg_update
150+
in favor of functions that can return an error code.
151+
152+
Bugfix
153+
* Fix for Clang, which was reporting a warning for the bignum.c inline
154+
assembly for AMD64 targets creating string literals greater than those
155+
permitted by the ISO C99 standard. Found by Aaron Jones. Fixes #482.
156+
* Fix runtime error in `mbedtls_platform_entropy_poll()` when run
157+
through qemu user emulation. Reported and fix suggested by randombit
158+
in #1212. Fixes #1212.
159+
* Fix an unsafe bounds check when restoring an SSL session from a ticket.
160+
This could lead to a buffer overflow, but only in case ticket authentication
161+
was broken. Reported and fix suggested by Guido Vranken in #659.
162+
* Add explicit integer to enumeration type casts to example program
163+
programs/pkey/gen_key which previously led to compilation failure
164+
on some toolchains. Reported by phoenixmcallister. Fixes #2170.
165+
* Fix double initialization of ECC hardware that made some accelerators
166+
hang.
167+
* Clarify documentation of mbedtls_ssl_set_own_cert() regarding the absence
168+
of check for certificate/key matching. Reported by Attila Molnar, #507.
169+
170+
= mbed TLS 2.15.1 branch released 2018-11-30
171+
172+
Changes
173+
* Update the Mbed Crypto submodule to version 0.1.0b2.
174+
175+
= mbed TLS 2.15.0 branch released 2018-11-23
176+
177+
Features
178+
* Add an experimental build option, USE_CRYPTO_SUBMODULE, to enable use of
179+
Mbed Crypto as the source of the cryptography implementation.
180+
* Add an experimental configuration option, MBEDTLS_PSA_CRYPTO_C, to enable
181+
the PSA Crypto API from Mbed Crypto when additionally used with the
182+
USE_CRYPTO_SUBMODULE build option.
183+
184+
Changes
185+
* Add unit tests for AES-GCM when called through mbedtls_cipher_auth_xxx()
186+
from the cipher abstraction layer. Fixes #2198.
187+
188+
= mbed TLS 2.14.1 branch released 2018-11-30
189+
190+
Security
191+
* Fix timing variations and memory access variations in RSA PKCS#1 v1.5
192+
decryption that could lead to a Bleichenbacher-style padding oracle
193+
attack. In TLS, this affects servers that accept ciphersuites based on
194+
RSA decryption (i.e. ciphersuites whose name contains RSA but not
195+
(EC)DH(E)). Discovered by Eyal Ronen (Weizmann Institute), Robert Gillham
196+
(University of Adelaide), Daniel Genkin (University of Michigan),
197+
Adi Shamir (Weizmann Institute), David Wong (NCC Group), and Yuval Yarom
198+
(University of Adelaide, Data61). The attack is described in more detail
199+
in the paper available here: http://cat.eyalro.net/cat.pdf CVE-2018-19608
200+
* In mbedtls_mpi_write_binary(), don't leak the exact size of the number
201+
via branching and memory access patterns. An attacker who could submit
202+
a plaintext for RSA PKCS#1 v1.5 decryption but only observe the timing
203+
of the decryption and not its result could nonetheless decrypt RSA
204+
plaintexts and forge RSA signatures. Other asymmetric algorithms may
205+
have been similarly vulnerable. Reported by Eyal Ronen, Robert Gillham,
206+
Daniel Genkin, Adi Shamir, David Wong and Yuval Yarom.
207+
* Wipe sensitive buffers on the stack in the CTR_DRBG and HMAC_DRBG
208+
modules.
209+
210+
API Changes
211+
* The new functions mbedtls_ctr_drbg_update_ret() and
212+
mbedtls_hmac_drbg_update_ret() are similar to mbedtls_ctr_drbg_update()
213+
and mbedtls_hmac_drbg_update() respectively, but the new functions
214+
report errors whereas the old functions return void. We recommend that
215+
applications use the new functions.
8216

9217
= mbed TLS 2.14.0 branch released 2018-11-19
10218

@@ -229,7 +437,7 @@ Security
229437
1.2, that allowed a local attacker, able to execute code on the local
230438
machine as well as manipulate network packets, to partially recover the
231439
plaintext of messages under some conditions by using a cache attack
232-
targetting an internal MD/SHA buffer. With TLS or if
440+
targeting an internal MD/SHA buffer. With TLS or if
233441
mbedtls_ssl_conf_dtls_badmac_limit() was used, the attack only worked if
234442
the same secret (for example a HTTP Cookie) has been repeatedly sent over
235443
connections manipulated by the attacker. Connections using GCM or CCM
@@ -1115,7 +1323,7 @@ Bugfix
11151323
* Fix potential build failures related to the 'apidoc' target, introduced
11161324
in the previous patch release. Found by Robert Scheck. #390 #391
11171325
* Fix issue in Makefile that prevented building using armar. #386
1118-
* Fix memory leak that occured only when ECJPAKE was enabled and ECDHE and
1326+
* Fix memory leak that occurred only when ECJPAKE was enabled and ECDHE and
11191327
ECDSA was disabled in config.h . The leak didn't occur by default.
11201328
* Fix an issue that caused valid certificates to be rejected whenever an
11211329
expired or not yet valid certificate was parsed before a valid certificate
@@ -1357,7 +1565,7 @@ API Changes
13571565
You now need to link to all of them if you use TLS for example.
13581566
* All public identifiers moved to the mbedtls_* or MBEDTLS_* namespace.
13591567
Some names have been further changed to make them more consistent.
1360-
Migration helpers scripts/rename.pl and include/mbedlts/compat-1.3.h are
1568+
Migration helpers scripts/rename.pl and include/mbedtls/compat-1.3.h are
13611569
provided. Full list of renamings in scripts/data_files/rename-1.3-2.0.txt
13621570
* Renamings of fields inside structures, not covered by the previous list:
13631571
mbedtls_cipher_info_t.key_length -> key_bitlen
@@ -1412,7 +1620,7 @@ API Changes
14121620
* net_accept() gained new arguments for the size of the client_ip buffer.
14131621
* In the threading layer, mbedtls_mutex_init() and mbedtls_mutex_free() now
14141622
return void.
1415-
* ecdsa_write_signature() gained an addtional md_alg argument and
1623+
* ecdsa_write_signature() gained an additional md_alg argument and
14161624
ecdsa_write_signature_det() was deprecated.
14171625
* pk_sign() no longer accepts md_alg == POLARSSL_MD_NONE with ECDSA.
14181626
* Last argument of x509_crt_check_key_usage() and
@@ -2947,7 +3155,7 @@ XySSL ChangeLog
29473155
not swapped on PadLock; also fixed compilation on older versions
29483156
of gcc (bug reported by David Barrett)
29493157
* Correctly handle the case in padlock_xcryptcbc() when input or
2950-
ouput data is non-aligned by falling back to the software
3158+
output data is non-aligned by falling back to the software
29513159
implementation, as VIA Nehemiah cannot handle non-aligned buffers
29523160
* Fixed a memory leak in x509parse_crt() which was reported by Greg
29533161
Robson-Garth; some x509write.c fixes by Pascal Vizeli, thanks to

Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,6 @@ ifndef WINDOWS
102102
covtest:
103103
$(MAKE) check
104104
programs/test/selftest
105-
tests/compat.sh
106-
tests/ssl-opt.sh
107105

108106
lcov:
109107
rm -rf Coverage

README.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,21 @@ Mbed Crypto is a reference implementation of the PSA cryptography API. It is wri
2424

2525
## Documentation
2626

27-
Since the Mbed Crypto library is a reference implementation of the PSA cryptography API, the library's API documentation is the PSA cryptography API specification. The PSA cryptography API specification consists of the following documents:
27+
The Mbed Crypto library is a reference implementation of the PSA cryptography API. Please refer to the PSA Cryptography API documents for an overview of the library's interfaces and a detailed description of the types, macros and functions that it provides.
2828

29-
* The [PSA Cryptography API overview](docs/PSA_Crypto_API_Overview.pdf).
30-
* The [PSA Cryptography API detailed function reference](docs/PSA_Crypto_API_Reference.pdf), which you can also browse in [HTML format](docs/html/modules.html).
29+
There are currently a few deviations where the library does not yet implement the latest version of the specification. Please refer to the [compliance issues on Github](https://github.com/ARMmbed/mbed-crypto/labels/compliance) for an up-to-date list.
30+
31+
### PSA Cryptography API
32+
33+
You can read the [complete PSA cryptography API specification as a PDF document](https://github.com/ARMmbed/mbed-crypto/blob/psa-crypto-api/docs/PSA_Cryptography_API_Specification.pdf). The API reference is also available in [HTML format](https://htmlpreview.github.io/?https://github.com/ARMmbed/mbed-crypto/blob/psa-crypto-api/docs/html/modules.html).
34+
35+
### Browsable library documentation
36+
37+
To generate a local copy of the library documentation in HTML format:
38+
39+
1. Make sure that [Doxygen](http://www.doxygen.nl/) is installed. We use version 1.8.11 but slightly older or more recent versions should work.
40+
1. Run `make apidoc`.
41+
1. Browse `apidoc/index.html` or `apidoc/modules.html`.
3142

3243
## Compiling
3344

0 commit comments

Comments
 (0)