1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-07-29 11:41:15 +03:00
Commit Graph

8761 Commits

Author SHA1 Message Date
f231eaae28 Add configuration file in md.h
include `*config.h*` in md.h as MACROS in the header file get ignored.
Fix for #1001.
2017-08-22 14:50:14 +03:00
be2f0b5e27 Fix test that didn't check full value of flags 2017-08-21 11:00:22 +02:00
7766a2c9c0 Improve some comments 2017-08-21 10:57:57 +02:00
1680d3dc19 Add a couple of statements to the contribution section
Add a notice for short contributions, and for Apache license header that
should be added. Added an adivce to enable the git hooks scripts as well.
2017-08-20 16:46:43 +03:00
d55f776cb7 Skip context allocation if restart disabled 2017-08-18 17:40:15 +02:00
aaa9814879 Uniformize ifdefs to ECDSA_C+ECP_RESTARTABLE
Some parts were already implicitly using this as the two ifdefs were nested,
and some others didn't, which resulted in compile errors in some configs. This
fixes those errors and saves a bit of code+RAM that was previously wasted when
ECP_RESTARTABLE was defined but ECDSA_C wasn't
2017-08-18 17:30:37 +02:00
fe6877034d Keep PK layer context in the PK layer
Previously we kept the ecdsa context created by the PK layer for ECDSA
operations on ECKEY in the ecdsa_restart_ctx structure, which was wrong, and
caused by the fact that we didn't have a proper handling of restart
sub-contexts in the PK layer.
2017-08-18 17:04:07 +02:00
0bbc66cc76 Dynamically allocate/free restart subcontext in PK 2017-08-18 16:22:06 +02:00
15d7df2ba8 Introduce mbedtls_pk_restart_ctx and use it
The fact that you needed to pass a pointer to mbedtls_ecdsa_restart_ctx (or
that you needed to know the key type of the PK context) was a breach of
abstraction.

Change the API (and callers) now, and the implementation will be changed in
the next commit.
2017-08-17 15:16:11 +02:00
98a6778d47 Better document some function arguments 2017-08-17 10:52:20 +02:00
b889d3e5fb Clarify & uniformise test comments 2017-08-17 10:25:18 +02:00
5faafa76cf Update X.509 test certs' Readme 2017-08-17 10:13:00 +02:00
7f888982fd Modify Contribution Guidelines after comments
Modify the Contribution guidelines after comments from Gilles, Andres and
Jaeden
2017-08-16 16:59:29 +03:00
b5e6a77010 Add Contribution guidelines to github
Add Contribution Guidelines that will be shown in github, when PRs are
made.
2017-08-16 11:30:07 +03:00
c9e16a97da Disable restartable ECC by default 2017-08-15 14:30:59 +02:00
9897cc933d Update ChangeLog 2017-08-15 14:30:43 +02:00
3bf49c4552 Enable restart for certificate verify 2017-08-15 14:12:47 +02:00
fed37ed039 Extract some code to separate function
Goals include:
- reducing the number of local variables in the main function (so that we
  don't have to worry about saving/restoring them)
- reducing the number exit points in the main function, making it easier to
  update ssl->state only right before we return
2017-08-15 13:35:42 +02:00
39eda87382 Make more auto variables const
That way we know we don't have to worry about saving and restoring their
value.
2017-08-15 13:00:33 +02:00
6b7301c872 Change restart context type.
No need to have both x509 and ecdsa, as the former contains the later.
2017-08-15 12:08:45 +02:00
d27d1a5a82 Clean up existing SSL restartable ECC code
- more consistent naming with ecrs prefix for everything
- always check it enabled before touching the rest
- rm duplicated code in parse_server_hello()
2017-08-15 11:49:08 +02:00
8b59049407 Make verify() actually restartable 2017-08-15 10:45:09 +02:00
c11e4baa63 Rework type for verify chain
- create container with length + table
- make types public (will be needed in restart context)
2017-08-15 10:44:13 +02:00
18547b5db6 Refactor find_parent() to merge two call sites 2017-08-15 10:44:13 +02:00
a4a5d1dbe6 Adapt function signatures to rs_ctx + ret 2017-08-15 10:44:13 +02:00
be4ff42fe4 Call crt_check_signature from one place only 2017-08-15 10:44:13 +02:00
d19a41d9aa Add tests for verify_restartable()
For selection of test cases, see comments added in the commit.

It makes the most sense to test with chains using ECC only, so for the chain
of length 2 we use server10 -> int-ca3 -> int-ca2 and trust int-ca2 directly.

Note: server10.crt was created by copying server10_int3_int-ca2.crt and
manually truncating it to remove the intermediates. That base can now be used
to create derived certs (without or with a chain) in a programmatic way.
2017-08-15 10:44:08 +02:00
72ea31b026 Update version number to 2.6.0 mbedtls-2.6.0 2017-08-10 11:51:16 +01:00
01971d094e Fix language in Changelog for clarity 2017-08-10 10:48:01 +01:00
bc3f44ae9c Introduce mbedtls_x509_crt_verify_restartable() 2017-08-09 11:44:53 +02:00
21b7719fb2 Add ChangeLog entry for current progress 2017-08-09 11:44:53 +02:00
32033da127 Test some more handshake flows 2017-08-09 11:44:53 +02:00
23e416261c ECDH: not restartable unless explicitly enabled
This is mainly for the benefit of SSL modules, which only supports restart in
a limited number of cases. In the other cases (ECDHE_PSK) it would currently
return ERR_ECP_IN_PROGRESS and the user would thus call ssl_handshake() again,
but the SSL code wouldn't handle state properly and things would go wrong in
possibly unexpected ways.  This is undesirable, so it should be possible for
the SSL module to choose if ECDHE should behave the old or the new way.

Not that it also brings ECDHE more in line with the other modules which
already have that choice available (by passing a NULL or valid restart
context).
2017-08-09 11:44:53 +02:00
1f1f2a1ca6 Adapt ServerKeyEchange processing to restart 2017-08-09 11:44:53 +02:00
862cde5b8e Add restart support for ECDSA client auth 2017-08-09 11:44:53 +02:00
2350b4ebdc Adapt ECDHE_ECDSA key exchange to restartable EC
For now some other key exchanges (ECDHE_PSK) will just fail to work, this will
be either fixed or properly fixed later.
2017-08-09 11:44:53 +02:00
b3c8307960 Adapt ssl_client2 to restartable EC 2017-08-09 11:44:53 +02:00
171a481b96 Add a ChangeLog entry for changes so far 2017-08-09 11:44:53 +02:00
31f0ef7b19 Fix style issues introduced earlier 2017-08-09 11:44:53 +02:00
1f596064bc Make PK EC sign/verify actually restartable 2017-08-09 11:44:53 +02:00
c4ee9acb7b Add tests for restartable PK sign/verify 2017-08-09 11:44:53 +02:00
82cb27b3db PK: declare restartable sign/verify functions
For RSA, we could either have the function return an error code like
NOT_IMPLEMENTED or just run while disregarding ecp_max_ops. IMO the second
option makes more sense, as otherwise the caller would need to check whether
the key is EC or RSA before deciding to call either sign() or
sign_restartable(), and having to do this kind of check feels contrary to the
goal of the PK layer.
2017-08-09 11:44:53 +02:00
fd838dab5c Comment cosmetics 2017-08-09 11:44:53 +02:00
66ba48a3c8 Make ECDH functions actually restartable 2017-08-09 11:44:53 +02:00
71b2c53254 Add tests for restartable ECDH 2017-08-09 11:44:53 +02:00
c90d3b0f89 Update doc for restartable ECDH functions 2017-08-09 11:44:53 +02:00
af081f5460 Make ECDSA sign actually restartable 2017-08-09 11:44:53 +02:00
50b63ba2f5 Use ecp_gen_privkey() in ECDSA sign
Two different changes:

- the first one will allow us to store k in the restart context while
  restarting the following ecp_mul() operation

- the second one is an simplification, unrelated to restartability, made
  possible by the fact that ecp_gen_privkey() is now public
2017-08-09 11:44:53 +02:00
675439620d Improve sign/key_tries handling
(Unrelated to restartable work, just noticed while staring at the code.)

Checking at the end is inefficient as we might give up when we just generated
a valid signature or key.
2017-08-09 11:44:53 +02:00
b90883dc1d Prepare infra for restartable sign 2017-08-09 11:44:53 +02:00