Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport 2.16: Add DER encoded test CRTs to library/certs.c #2497

Merged
merged 17 commits into from Jun 14, 2019

Conversation

hanno-becker
Copy link

This is the backport of #2260 to Mbed TLS 2.16.

@hanno-becker hanno-becker added bug mbed TLS team needs-review Every commit must be reviewed by at least two team members, component-tls component-x509 labels Mar 5, 2019
k-stachowiak
k-stachowiak previously approved these changes Mar 6, 2019
Copy link
Contributor

@k-stachowiak k-stachowiak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a faithful backport of the base PR

Copy link
Contributor

@AndrzejKurek AndrzejKurek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is still a conflict in certs.c to be resolved.

@hanno-becker
Copy link
Author

I re-created the backport on the basis of the updated #2254, backporting also 462c3e5 to resolve merge conflicts.

@hanno-becker
Copy link
Author

@k-stachowiak Could you please re-review?

k-stachowiak
k-stachowiak previously approved these changes Mar 18, 2019
Copy link
Contributor

@k-stachowiak k-stachowiak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a faithful backport.

@hanno-becker
Copy link
Author

@AndrzejKurek Could you please re-review this, too?

@AndrzejKurek
Copy link
Contributor

Shouldn't we resolve the changelog conflict to let CI pass (now with the new after-merge tests)?

@hanno-becker
Copy link
Author

@AndrzejKurek @k-stachowiak Could you please re-review the recent rebase?

@hanno-becker
Copy link
Author

@AndrzejKurek @k-stachowiak Could you please re-review?

Hanno Becker added 6 commits May 30, 2019 10:21
This allows to test PSK-based ciphersuites via ssl_client2 in builds
which have MBEDTLS_X509_CRT_PARSE_C enabled but both MBEDTLS_FS_IO and
MBEDTLS_CERTS_C disabled.

A similar change is applied to the `crt_file` and `key_file` arguments.
This allows to test PSK-based ciphersuites via ssl_server2 in builds
which have MBEDTLS_X509_CRT_PARSE_C enabled but both MBEDTLS_FS_IO and
MBEDTLS_CERTS_C disabled.
Hanno Becker added 11 commits May 30, 2019 10:27
All of them are copied from (former) CRT and key files in `tests/data_files`.
For files which have been regenerated since they've been copied to `certs.c`,
update the copy.

Add declarations for DER encoded test CRTs to certs.h

Add DER encoded versions of CRTs to certs.c

fix comment in certs.c

Don't use (signed) char for DER encoded certificates

Consistently use `const char *` for test CRTs regardless of encoding

Remove non-sensical and unused PW variable for DER encoded key

Provide test CRTs in PEM and DER fmt, + pick suitable per config

This commit modifies `certs.h` and `certs.c` to start following the
following pattern for the provided test certificates and files:

- Raw test data is named `NAME_ATTR1_ATTR2_..._ATTRn`

  For example, there are
     `TEST_CA_CRT_{RSA|EC}_{PEM|DER}_{SHA1|SHA256}`.

- Derived test data with fewer attributes, iteratively defined as one
  of the raw test data instances which suits the current configuration.

  For example,
     `TEST_CA_CRT_RSA_PEM`
  is one of `TEST_CA_CRT_RSA_PEM_SHA1` or `TEST_CA_CRT_RSA_PEM_SHA256`,
  depending on whether SHA-1 and/or SHA-256 are defined in the current
  config.

Add missing public declaration of test key password

Fix signedness and naming mismatches

Further improve structure of certs.h and certs.c

Fix definition of mbedtls_test_cas test CRTs depending on config

Remove semicolon after macro string constant in certs.c
This should allow to run ssl-opt.sh successfully in the default
configuration minus MBEDTLS_PEM_PARSE_C minus MBEDTLS_FS_IO.
This allows to auto-generate them from scripts.
@hanno-becker
Copy link
Author

@AndrzejKurek @k-stachowiak I updated the backport to reflect the current state of #2260 - could you please re-review?

@Patater Patater added approved Design and code approved - may be waiting for CI or backports and removed needs-review Every commit must be reviewed by at least two team members, labels Jun 13, 2019
@Patater Patater merged commit 9582a47 into Mbed-TLS:mbedtls-2.16 Jun 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Design and code approved - may be waiting for CI or backports bug component-tls component-x509
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants