boringssl/ssl
David Benjamin 4414874f1f Simplify ssl_private_key_* state machine points.
The original motivation behind the sign/complete split was to avoid
needlessly hashing the input on each pass through the state machine, but
we're payload-based now and, in all cases, the payload is either cheap
to compute or readily available. (Even the hashing worry was probably
unnecessary.)

Tweak ssl_private_key_{sign,decrypt} to automatically call
ssl_private_key_complete as needed and take advantage of this in the
handshake state machines:

- TLS 1.3 signing now computes the payload each pass. The payload is
  small and we're already allocating a comparable-sized buffer each
  iteration to hold the signature. This shouldn't be a big deal.

- TLS 1.2 decryption code still needs two states due to reading the
  message (fixed in new state machine style), but otherwise it just
  performs cheap idempotent tasks again. The PSK code is reshuffled to
  guarantee the callback is not called twice (though this was impossible
  anyway because we don't support RSA_PSK).

- TLS 1.2 CertificateVerify signing is easy as the transcript is readily
  available. The buffer is released very slightly later, but it
  shouldn't matter.

- TLS 1.2 ServerKeyExchange signing required some reshuffling.
  Assembling the ServerKeyExchange parameters is moved to the previous
  state. The signing payload has some randoms prepended. This is cheap
  enough, but a nuisance in C. Pre-prepend the randoms in
  hs->server_params.

With this change, we are *nearly* rid of the A/B => same function
pattern.

BUG=128

Change-Id: Iec4fe0be7cfc88a6de027ba2760fae70794ea810
Reviewed-on: https://boringssl-review.googlesource.com/17265
Commit-Queue: David Benjamin <davidben@google.com>
Commit-Queue: Steven Valdez <svaldez@google.com>
Reviewed-by: Steven Valdez <svaldez@google.com>
2017-06-20 19:37:05 +00:00
..
test Update fuzzer mode suppressions. 2017-06-16 16:53:11 +00:00
bio_ssl.c
CMakeLists.txt Convert bio_test to GTest. 2017-03-21 17:39:57 +00:00
custom_extensions.c Support enabling early data on SSL 2017-04-03 20:25:29 +00:00
d1_both.c Trim x509.h includes. 2017-03-07 23:13:49 +00:00
d1_lib.c Don't use long for timestamps. 2017-03-01 21:58:38 +00:00
d1_pkt.c Adding support for sending early data on the client. 2017-06-15 19:34:59 +00:00
d1_srtp.c
dtls_method.c Adding support for receiving early data on the server. 2017-03-26 19:30:27 +00:00
dtls_record.c
handshake_client.c Simplify ssl_private_key_* state machine points. 2017-06-20 19:37:05 +00:00
handshake_server.c Simplify ssl_private_key_* state machine points. 2017-06-20 19:37:05 +00:00
internal.h Simplify ssl_private_key_* state machine points. 2017-06-20 19:37:05 +00:00
s3_both.c Unwind V2ClientHello counters. 2017-06-16 20:24:00 +00:00
s3_lib.c Really remove DHE ciphersuites from TLS. 2017-04-11 23:41:31 +00:00
s3_pkt.c Adding support for sending early data on the client. 2017-06-15 19:34:59 +00:00
ssl_aead_ctx.c Enforce incrementing counter for TLS 1.2 AES-GCM. 2017-05-26 20:06:36 +00:00
ssl_asn1.c Remove the last remnants of key_exchange_info. 2017-04-13 21:23:40 +00:00
ssl_buffer.c Just allocate what's needed for SSL write buffers. 2017-03-27 16:37:53 +00:00
ssl_cert.c Really remove DHE ciphersuites from TLS. 2017-04-11 23:41:31 +00:00
ssl_cipher.c Enforce incrementing counter for TLS 1.2 AES-GCM. 2017-05-26 20:06:36 +00:00
ssl_ecdh.c Fix some malloc failure handling. 2017-06-15 19:38:59 +00:00
ssl_file.c
ssl_lib.c Test SSL_select_next_proto and SSL_get_fd. 2017-06-16 13:47:04 +00:00
ssl_privkey_cc.cc
ssl_privkey.c Simplify ssl_private_key_* state machine points. 2017-06-20 19:37:05 +00:00
ssl_session.c Adding support for sending early data on the client. 2017-06-15 19:34:59 +00:00
ssl_stat.c Simplify ssl_private_key_* state machine points. 2017-06-20 19:37:05 +00:00
ssl_test.cc Test SSL_select_next_proto and SSL_get_fd. 2017-06-16 13:47:04 +00:00
ssl_transcript.c
ssl_x509.c Move ssl_verify_alarm_type into ssl_x509.c. 2017-03-07 23:14:16 +00:00
t1_enc.c Enforce incrementing counter for TLS 1.2 AES-GCM. 2017-05-26 20:06:36 +00:00
t1_lib.c Clear out f_err pattern from handshake_client.c. 2017-06-16 19:21:08 +00:00
tls13_both.c Simplify ssl_private_key_* state machine points. 2017-06-20 19:37:05 +00:00
tls13_client.c Simplify ssl_private_key_* state machine points. 2017-06-20 19:37:05 +00:00
tls13_enc.c Enforce incrementing counter for TLS 1.2 AES-GCM. 2017-05-26 20:06:36 +00:00
tls13_server.c Simplify ssl_private_key_* state machine points. 2017-06-20 19:37:05 +00:00
tls_method.c Adding support for receiving early data on the server. 2017-03-26 19:30:27 +00:00
tls_record.c Enforce max_early_data_size on the server. 2017-04-19 17:21:01 +00:00