Commit Graph

7357 Commits

Author SHA1 Message Date
Gilles Peskine
1323fba357 Update the copy of tests/data_files/server2-sha256.crt in certs.c
Before this commit, certs.c had a copy of a different version of
tests/data_files/server2-sha256.crt (from the then development branch)
which was generated by cert_write. Update certs.c with the new
tests/data_files/server2-sha256.crt which is also generated by
cert_write.

The new copy has the same size as the old copy so there is no concern
about existing application binaries relying on the size. (The old
tests/data_files/server2-sha256.crt had a different size because it
had been generated by openssl and so had slightly different content.)

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2020-08-24 15:15:00 +02:00
Gilles Peskine
74243ee878 Regenerate server2-sha256.crt with a PrintableString issuer
server2-sha256.crt had the issuer ON and CN encoded as UTF8String, but the
corresponding CA certificate test-ca_cat12.crt had them encoded as
PrintableString. The strings matched, which is sufficient according to RFC
5280 §7.1 and RFC 4518 §2.1. However, GnuTLS 3.4.10 requires the strings to
have the same encoding, so it did not accept that the
UTF8String "PolarSSL Test CA" certificate was signed by the
PrintableString "PolarSSL Test CA" CA.

Since Mbed TLS 2.14 (specifically ebc1f40aa0
merged via https://github.com/ARMmbed/mbedtls/pull/1641), server2-sha256.crt
is generated by Mbed TLS's own cert_write program, which emits a
PrintableString. In older versions, this file was generated by OpenSSL,
which started emitting UTF8String at some point.
4f928c0f37 merged via
https://github.com/ARMmbed/mbedtls/pull/2418 fixed this for the SHA-1
certificate which was used at the time. The present commit applies the same
fix for the SHA-256 certificate that is now in use.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2020-08-21 19:15:51 +02:00
Gilles Peskine
da118e130d Regenerate test client certificates with a PrintableString issuer
The test certificate used for clients in compat.sh, cert_sha256.crt,
had the issuer ON and CN encoded as UTF8String, but the corresponding
CA certificate test-ca_cat12.crt had them encoded as PrintableString.
The strings matched, which is sufficient according to RFC 5280 §7.1
and RFC 4518 §2.1. However, GnuTLS 3.4.10 requires the strings to have
the same encoding, so it did not accept that the certificate issued by
UTF8String "PolarSSL Test CA" was validly issued by the
PrintableString "PolarSSL Test CA" CA.

ebc1f40aa0, merged via
https://github.com/ARMmbed/mbedtls/pull/1641 and released in Mbed TLS
2.14, updated these certificates.
4f928c0f37 merged, via
https://github.com/ARMmbed/mbedtls/pull/2418 fixed this in the 2.7 LTS
branch for the SHA-1 certificate which was used at the time. The
present commit applies the same fix for the SHA-256 certificate that
is now in use.

For uniformity, this commit regenerates all the cert_*.crt.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2020-08-21 19:15:51 +02:00
Gilles Peskine
a3511b97c1 cert_write: support all hash algorithms
For some reason, RIPEMD160, SHA224 and SHA384 were not supported.

This fixes the build recipes for tests/data_files/cert_sha224.crt and
tests/data_files/cert_sha384.crt .

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2020-08-21 19:15:51 +02:00
Manuel Pégourié-Gonnard
741c4e2d64 compat.sh: stop using allow_sha1
After the changes of certificates, it's no longer needed.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2020-08-21 13:42:29 +02:00
Manuel Pégourié-Gonnard
351dd59e9a compat.sh: quit using SHA-1 certificates
Replace server2.crt with server2-sha256.crt which, as the name implies, is
just the SHA-256 version of the same certificate.

Replace server1.crt with cert_sha256.crt which, as the name doesn't imply, is
associated with the same key and just have a slightly different Subject Name,
which doesn't matter in this instance.

The other certificates used in this script (server5.crt and server6.crt) are
already signed with SHA-256.

This change is motivated by the fact that recent versions of GnuTLS (or older
versions with the Debian patches) reject SHA-1 in certificates by default, as
they should. There are options to still accept it (%VERIFY_ALLOW_BROKEN and
%VERIFY_ALLOW_SIGN_WITH_SHA1) but:

- they're not available in all versions that reject SHA-1-signed certs;
- moving to SHA-2 just seems cleaner anyway.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2020-08-21 13:42:27 +02:00
Manuel Pégourié-Gonnard
a6e640264f compat.sh: enable CBC-SHA-2 suites for GnuTLS
Recent GnuTLS packages on Ubuntu 16.04 have them disabled.

From /usr/share/doc/libgnutls30/changelog.Debian.gz:

gnutls28 (3.4.10-4ubuntu1.5) xenial-security; urgency=medium

  * SECURITY UPDATE: Lucky-13 issues
    [...]
    - debian/patches/CVE-2018-1084x-4.patch: hmac-sha384 and sha256
      ciphersuites were removed from defaults in lib/gnutls_priority.c,
      tests/priorities.c.

Since we do want to test the ciphersuites, explicitly re-enable them in the
server's priority string. (This is a no-op with versions of GnuTLS where those
are already enabled by default.)

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2020-08-21 13:42:17 +02:00
Gilles Peskine
690eec0a75
Merge pull request #3583 from bensze01/license-2.7
Backport 2.7: Fix license header in pre-commit hook
2020-08-20 10:14:56 +02:00
Bence Szépkúti
9df64ad39f Fix license header in pre-commit hook
The file was not updated to include the GPL 2.0+ header as well when it
was backported.

Signed-off-by: Bence Szépkúti <bence.szepkuti@arm.com>
2020-08-20 09:27:07 +02:00
danh-arm
47ad15d9ec
Merge pull request #3581 from bensze01/copyright-2.7
[Backport 2.7] Update copyright notices to use Linux Foundation guidance
2020-08-19 16:41:44 +01:00
Bence Szépkúti
44bfbe3b95 Update copyright notices to use Linux Foundation guidance
As a result, the copyright of contributors other than Arm is now
acknowledged, and the years of publishing are no longer tracked in the
source files.

Also remove the now-redundant lines declaring that the files are part of
MbedTLS.

This commit was generated using the following script:

# ========================
#!/bin/sh

# Find files
find '(' -path './.git' -o -path './3rdparty' ')' -prune -o -type f -print | xargs sed -bi '

# Replace copyright attribution line
s/Copyright.*Arm.*/Copyright The Mbed TLS Contributors/I

# Remove redundant declaration and the preceding line
$!N
/This file is part of Mbed TLS/Id
P
D
'
# ========================

Signed-off-by: Bence Szépkúti <bence.szepkuti@arm.com>
2020-08-19 16:54:51 +02:00
Manuel Pégourié-Gonnard
918b5f15d1
Merge pull request #3556 from mpg/x509-verify-non-dns-san-2.7
[Backport 2.7]  X509 verify non-DNS SANs
2020-08-18 10:02:16 +02:00
Manuel Pégourié-Gonnard
30c1df3f84
Merge pull request #3570 from gufe44/net-sockets-fixes-2.7
[Backport 2.7] NetBSD 9.0 build fixes
2020-08-18 09:13:52 +02:00
Manuel Pégourié-Gonnard
52df1cc4f0
Merge pull request #3566 from mpg/improve-ssl-opt-logs-2.7
[Backport 2.7] Improve ssl-opt.sh logs
2020-08-17 12:04:48 +02:00
gufe44
3ca3b9ea88 Fix building on NetBSD 9.0
Fixes #2310

Signed-off-by: gufe44 <gu981@protonmail.com>
2020-08-17 07:14:16 +02:00
Manuel Pégourié-Gonnard
793c4367d7 Remove obsolete buildbot reference in compat.sh
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2020-08-14 11:06:12 +02:00
Manuel Pégourié-Gonnard
33659700a3 Fix misuse of printf in shell script
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2020-08-14 11:06:12 +02:00
Manuel Pégourié-Gonnard
ed0aaf46a9 Fix added proxy command when IPv6 is used
For explicit proxy commands (included with `-p "$P_PXY <args>` in the test
case), it's the test's writer responsibility to handle IPv6; only fix the
proxy command when we're auto-adding it.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2020-08-14 11:06:12 +02:00
Manuel Pégourié-Gonnard
c5ae9c8532 Simplify test syntax
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2020-08-14 11:06:12 +02:00
Manuel Pégourié-Gonnard
57e328e805 Fix logic error in setting client port
We need to do this after we possibly added the proxy.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2020-08-14 11:06:08 +02:00
Manuel Pégourié-Gonnard
e5201e479a ssl-opt.sh: include test name in log files
This is a convenience for when we get log files from failed CI runs, or attach
them to bug reports, etc.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2020-08-14 11:02:55 +02:00
Manuel Pégourié-Gonnard
bc079e263b ssl-opt.sh: remove old buildbot-specific condition
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2020-08-14 11:02:54 +02:00
Manuel Pégourié-Gonnard
1fcb1a18c8 ssl-opt.sh: add proxy to all DTLS tests
A lot of DTLS test are timing-sensitive, especially those that contain
assertions about retransmission. Sometimes some DTLS test fails intermittently
on the CI with no clear apparent reason; we need more information in the log
to understand the cause of those failures.

Adding a proxy means we'll get timing information from the proxy logs.

An alternative would be to add timing information to the debug output of
ssl_server2 and ssl_client2. But that's more complex because getting
sub-second timing info is outside the scope of the C standard, and our current
timing module only provides a APi for sub-second intervals, not absolute time.
Using the proxy is easier as it's a single point that sees all messages, so
elapsed time is fine here, and it's already implemented in the proxy output.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2020-08-14 11:02:54 +02:00
Gilles Peskine
99d67823a2
Merge pull request #3559 from gufe44/netbsd-rand-arc4random_buf-2.7
[Backport 2.7] Use arc4random_buf instead of rand on NetBSD
2020-08-13 15:27:57 +02:00
Gilles Peskine
7cf6ff76d5
Merge pull request #3549 from mpg/check-generated-files-2.7
[Backport 2.7] Add update option to check-generated-files
2020-08-13 11:24:30 +02:00
gufe44
da0ea9e9df Log change as bugfix
Signed-off-by: gufe44 <gu981@protonmail.com>
2020-08-13 06:26:41 +02:00
gufe44
6f837332f0 Add changelog entry
Signed-off-by: gufe44 <gu981@protonmail.com>
2020-08-13 06:26:09 +02:00
gufe44
206cb39116 Use arc4random_buf instead of rand on NetBSD
Avoid old implementation of rand returning numbers with cyclical lower bits. Allow tests to pass.

Signed-off-by: gufe44 <gu981@protonmail.com>
2020-08-13 06:22:45 +02:00
Manuel Pégourié-Gonnard
894c05df32 Add test: DNS names should not match IP addresses
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2020-08-11 12:09:01 +02:00
Manuel Pégourié-Gonnard
845e408a55 Add a pre-commit hook that checks generated files
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2020-08-10 12:59:09 +02:00
Manuel Pégourié-Gonnard
961fb133ad Add -u option to check-generated-files.sh
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2020-08-10 12:59:09 +02:00
Gilles Peskine
22b265b9f2
Merge pull request #3476 from gilles-peskine-arm/rename-check_files-2.7
Backport 2.7: Rename Python scripts to use '_' and not '-'
2020-07-03 15:12:49 +02:00
Gilles Peskine
00de80378c Rename Python scripts to use '_' and not '-'
You can't import a Python script whose name includes '-'.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2020-07-02 12:09:25 +02:00
Janos Follath
4a4aad8983
Merge pull request #715 from ARMmbed/merge-2.7.16-release-to-mbedtls-2.7
Merge 2.7.16 release to mbedtls 2.7
2020-07-01 14:44:34 +01:00
Janos Follath
6d3913f05c Merge tag 'mbedtls-2.7.16' into merge-2.7.16-release-to-mbedtls-2.7
Mbed TLS 2.7.16
2020-07-01 11:35:10 +01:00
Janos Follath
e0f13347fd
Merge pull request #712 from ARMmbed/mbedtls-2.7.16r0-pr
Prepare Release Candidate for Mbed TLS 2.7.16
2020-06-30 12:08:17 +01:00
Manuel Pégourié-Gonnard
631b076d6b
Merge pull request #3462 from gilles-peskine-arm/programs-cmake-cleanup-2.7
Programs cmake cleanup 2.7
2020-06-29 09:58:16 +02:00
Ronald Cron
9b4b023964 programs: ssl: cmake: Add missing executable
Add the missing executable in the list of executables
to install.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2020-06-26 18:10:56 +02:00
Ronald Cron
d915d00b52 programs: ssl: cmake: Reorder declaration of executables
Reorder declaration of executables in alphabetic order.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2020-06-26 18:10:50 +02:00
Janos Follath
6d5a109d15 Update ChangeLog header
Signed-off-by: Janos Follath <janos.follath@arm.com>
2020-06-26 12:55:02 +01:00
Janos Follath
2a4f8991b3 Bump version to Mbed TLS 2.7.16
Executed "./scripts/bump_version.sh --version 2.7.16"

Signed-off-by: Janos Follath <janos.follath@arm.com>
2020-06-26 12:37:57 +01:00
Janos Follath
994f7c0343 Assemble ChangeLog
Executed scripts/assemble_changelog.py.

Signed-off-by: Janos Follath <janos.follath@arm.com>
2020-06-26 11:34:34 +01:00
Janos Follath
9cdda866bf Merge branch 'mbedtls-2.7-restricted' into mbedtls-2.7.16r0 2020-06-25 09:20:57 +01:00
Gilles Peskine
b1d1097316
Merge pull request #3447 from mpg/use-all-sh-checks-for-pre-push-2.7
[backport 2.7] Use all.sh in pre-push hook
2020-06-23 14:37:24 +02:00
Manuel Pégourié-Gonnard
c09bb4c3ab all.sh: clean up some uses of "local" variables
While pure sh doesn't have a concept of local variables, we can partially
emulate them by unsetting variables before we exit the function, and use the
convention of giving them lowercase names to distinguish from global
variables.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2020-06-23 11:54:13 +02:00
Manuel Pégourié-Gonnard
4f265fbff7 Use all.sh in pre-push hook
The list in the pre-push hook was redundant with the list of `check_*`
components in all.sh, and unsurprisingly it was outdated.

Missing components were:

- check_recursion
- check_changelog
- check_test_cases
- check_python_files
- check_generate_test_code

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2020-06-23 11:54:13 +02:00
Manuel Pégourié-Gonnard
73341a0f84 Add a --quiet option to all.sh
The primary purpose is to use it to run all.sh -k -q in the pre-push hook, but
this can be useful in any circumstance where you're not interested in the full
output from each component and just want a short summary of which components
were run (and if any failed).

Note that only stdout from components is suppressed, stderr is preserved so
that errors are reported. This means components should avoid printing to
stderr in normal usage (ie in the absence of errors).

Currently all the `check_*` components obey this convention except:
- check_generate_test_code: unittest prints progress to stderr
- check_test_cases: lots of non-fatal warnings printed to stderr

These components will be fixed in follow-up commits.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2020-06-23 11:53:07 +02:00
Manuel Pégourié-Gonnard
f2027b5c46
Merge pull request #705 from mpg/l13-hw-starts-finish-2.7-restricted
[backport 2.7] Use starts/finish around Lucky 13 dummy compressions
2020-06-23 10:43:22 +02:00
Janos Follath
3f44eb5ac5
Merge pull request #706 from mpg/ecp-mul-null-rng-2.7-restricted
[Backport 2.7] Use internal RNG in ecp_mul when none was provided
2020-06-22 15:06:44 +01:00
Gilles Peskine
eaf31e39c2
Merge pull request #3443 from mpg/make-coverage-script-deterministic-2.7
[Backport 2.7] Make basic-build-test.sh more deterministic
2020-06-22 12:30:54 +02:00