blob: ec6213f866c50288b3241de94cba899e7ff4d6ee [file] [log] [blame]
Steven Valdez4d71a9a2017-08-14 15:08:34 -04001/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
2 * All rights reserved.
3 *
4 * This package is an SSL implementation written
5 * by Eric Young (eay@cryptsoft.com).
6 * The implementation was written so as to conform with Netscapes SSL.
7 *
8 * This library is free for commercial and non-commercial use as long as
9 * the following conditions are aheared to. The following conditions
10 * apply to all code found in this distribution, be it the RC4, RSA,
11 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
12 * included with this distribution is covered by the same copyright terms
13 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
14 *
15 * Copyright remains Eric Young's, and as such any Copyright notices in
16 * the code are not to be removed.
17 * If this package is used in a product, Eric Young should be given attribution
18 * as the author of the parts of the library used.
19 * This can be in the form of a textual message at program startup or
20 * in documentation (online or textual) provided with the package.
21 *
22 * Redistribution and use in source and binary forms, with or without
23 * modification, are permitted provided that the following conditions
24 * are met:
25 * 1. Redistributions of source code must retain the copyright
26 * notice, this list of conditions and the following disclaimer.
27 * 2. Redistributions in binary form must reproduce the above copyright
28 * notice, this list of conditions and the following disclaimer in the
29 * documentation and/or other materials provided with the distribution.
30 * 3. All advertising materials mentioning features or use of this software
31 * must display the following acknowledgement:
32 * "This product includes cryptographic software written by
33 * Eric Young (eay@cryptsoft.com)"
34 * The word 'cryptographic' can be left out if the rouines from the library
35 * being used are not cryptographic related :-).
36 * 4. If you include any Windows specific code (or a derivative thereof) from
37 * the apps directory (application code) you must include an acknowledgement:
38 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
39 *
40 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
41 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
42 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
43 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
44 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
45 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
46 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
48 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
49 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
50 * SUCH DAMAGE.
51 *
52 * The licence and distribution terms for any publically available version or
53 * derivative of this code cannot be changed. i.e. this code cannot simply be
54 * copied and put under another distribution licence
55 * [including the GNU Public Licence.]
56 */
57/* ====================================================================
58 * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
59 *
60 * Redistribution and use in source and binary forms, with or without
61 * modification, are permitted provided that the following conditions
62 * are met:
63 *
64 * 1. Redistributions of source code must retain the above copyright
65 * notice, this list of conditions and the following disclaimer.
66 *
67 * 2. Redistributions in binary form must reproduce the above copyright
68 * notice, this list of conditions and the following disclaimer in
69 * the documentation and/or other materials provided with the
70 * distribution.
71 *
72 * 3. All advertising materials mentioning features or use of this
73 * software must display the following acknowledgment:
74 * "This product includes software developed by the OpenSSL Project
75 * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
76 *
77 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
78 * endorse or promote products derived from this software without
79 * prior written permission. For written permission, please contact
80 * openssl-core@openssl.org.
81 *
82 * 5. Products derived from this software may not be called "OpenSSL"
83 * nor may "OpenSSL" appear in their names without prior written
84 * permission of the OpenSSL Project.
85 *
86 * 6. Redistributions of any form whatsoever must retain the following
87 * acknowledgment:
88 * "This product includes software developed by the OpenSSL Project
89 * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
90 *
91 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
92 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
93 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
94 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
95 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
96 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
97 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
98 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
99 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
100 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
101 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
102 * OF THE POSSIBILITY OF SUCH DAMAGE.
103 * ====================================================================
104 *
105 * This product includes cryptographic software written by Eric Young
106 * (eay@cryptsoft.com). This product includes software written by Tim
107 * Hudson (tjh@cryptsoft.com). */
108/* ====================================================================
109 * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
110 * ECC cipher suite support in OpenSSL originally developed by
111 * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project. */
112
113#include <openssl/ssl.h>
114
115#include <assert.h>
116
117#include "../crypto/internal.h"
118#include "internal.h"
119
120
121namespace bssl {
122
123SSL_HANDSHAKE::SSL_HANDSHAKE(SSL *ssl_arg)
124 : ssl(ssl_arg),
125 scts_requested(0),
126 needs_psk_binder(0),
127 received_hello_retry_request(0),
128 received_custom_extension(0),
129 accept_psk_mode(0),
130 cert_request(0),
131 certificate_status_expected(0),
132 ocsp_stapling_requested(0),
133 should_ack_sni(0),
134 in_false_start(0),
135 in_early_data(0),
136 early_data_offered(0),
137 can_early_read(0),
138 can_early_write(0),
139 next_proto_neg_seen(0),
140 ticket_expected(0),
141 extended_master_secret(0),
142 pending_private_key_op(0) {
143}
144
145SSL_HANDSHAKE::~SSL_HANDSHAKE() {
146 OPENSSL_cleanse(secret, sizeof(secret));
147 OPENSSL_cleanse(early_traffic_secret, sizeof(early_traffic_secret));
148 OPENSSL_cleanse(client_handshake_secret, sizeof(client_handshake_secret));
149 OPENSSL_cleanse(server_handshake_secret, sizeof(server_handshake_secret));
150 OPENSSL_cleanse(client_traffic_secret_0, sizeof(client_traffic_secret_0));
151 OPENSSL_cleanse(server_traffic_secret_0, sizeof(server_traffic_secret_0));
152 OPENSSL_free(cookie);
153 OPENSSL_free(key_share_bytes);
154 OPENSSL_free(ecdh_public_key);
155 OPENSSL_free(peer_sigalgs);
156 OPENSSL_free(peer_supported_group_list);
157 OPENSSL_free(peer_key);
158 OPENSSL_free(server_params);
159 ssl->ctx->x509_method->hs_flush_cached_ca_names(this);
160 OPENSSL_free(certificate_types);
161
162 if (key_block != NULL) {
163 OPENSSL_cleanse(key_block, key_block_len);
164 OPENSSL_free(key_block);
165 }
166}
167
168SSL_HANDSHAKE *ssl_handshake_new(SSL *ssl) {
169 UniquePtr<SSL_HANDSHAKE> hs = MakeUnique<SSL_HANDSHAKE>(ssl);
170 if (!hs ||
171 !hs->transcript.Init()) {
172 return nullptr;
173 }
174 return hs.release();
175}
176
177void ssl_handshake_free(SSL_HANDSHAKE *hs) { Delete(hs); }
178
179int ssl_check_message_type(SSL *ssl, const SSLMessage &msg, int type) {
180 if (msg.type != type) {
181 ssl3_send_alert(ssl, SSL3_AL_FATAL, SSL_AD_UNEXPECTED_MESSAGE);
182 OPENSSL_PUT_ERROR(SSL, SSL_R_UNEXPECTED_MESSAGE);
183 ERR_add_error_dataf("got type %d, wanted type %d", msg.type, type);
184 return 0;
185 }
186
187 return 1;
188}
189
190int ssl_add_message_cbb(SSL *ssl, CBB *cbb) {
191 uint8_t *msg;
192 size_t len;
193 if (!ssl->method->finish_message(ssl, cbb, &msg, &len) ||
194 !ssl->method->add_message(ssl, msg, len)) {
195 return 0;
196 }
197
198 return 1;
199}
200
201size_t ssl_max_handshake_message_len(const SSL *ssl) {
202 /* kMaxMessageLen is the default maximum message size for handshakes which do
203 * not accept peer certificate chains. */
204 static const size_t kMaxMessageLen = 16384;
205
206 if (SSL_in_init(ssl)) {
207 if ((!ssl->server || (ssl->verify_mode & SSL_VERIFY_PEER)) &&
208 kMaxMessageLen < ssl->max_cert_list) {
209 return ssl->max_cert_list;
210 }
211 return kMaxMessageLen;
212 }
213
214 if (ssl3_protocol_version(ssl) < TLS1_3_VERSION) {
215 /* In TLS 1.2 and below, the largest acceptable post-handshake message is
216 * a HelloRequest. */
217 return 0;
218 }
219
220 if (ssl->server) {
221 /* The largest acceptable post-handshake message for a server is a
222 * KeyUpdate. We will never initiate post-handshake auth. */
223 return 1;
224 }
225
226 /* Clients must accept NewSessionTicket and CertificateRequest, so allow the
227 * default size. */
228 return kMaxMessageLen;
229}
230
231bool ssl_hash_message(SSL_HANDSHAKE *hs, const SSLMessage &msg) {
232 /* V2ClientHello messages are pre-hashed. */
233 if (msg.is_v2_hello) {
234 return true;
235 }
236
237 return hs->transcript.Update(CBS_data(&msg.raw), CBS_len(&msg.raw));
238}
239
240int ssl_parse_extensions(const CBS *cbs, uint8_t *out_alert,
241 const SSL_EXTENSION_TYPE *ext_types,
242 size_t num_ext_types, int ignore_unknown) {
243 /* Reset everything. */
244 for (size_t i = 0; i < num_ext_types; i++) {
245 *ext_types[i].out_present = 0;
246 CBS_init(ext_types[i].out_data, NULL, 0);
247 }
248
249 CBS copy = *cbs;
250 while (CBS_len(&copy) != 0) {
251 uint16_t type;
252 CBS data;
253 if (!CBS_get_u16(&copy, &type) ||
254 !CBS_get_u16_length_prefixed(&copy, &data)) {
255 OPENSSL_PUT_ERROR(SSL, SSL_R_PARSE_TLSEXT);
256 *out_alert = SSL_AD_DECODE_ERROR;
257 return 0;
258 }
259
260 const SSL_EXTENSION_TYPE *ext_type = NULL;
261 for (size_t i = 0; i < num_ext_types; i++) {
262 if (type == ext_types[i].type) {
263 ext_type = &ext_types[i];
264 break;
265 }
266 }
267
268 if (ext_type == NULL) {
269 if (ignore_unknown) {
270 continue;
271 }
272 OPENSSL_PUT_ERROR(SSL, SSL_R_UNEXPECTED_EXTENSION);
273 *out_alert = SSL_AD_UNSUPPORTED_EXTENSION;
274 return 0;
275 }
276
277 /* Duplicate ext_types are forbidden. */
278 if (*ext_type->out_present) {
279 OPENSSL_PUT_ERROR(SSL, SSL_R_DUPLICATE_EXTENSION);
280 *out_alert = SSL_AD_ILLEGAL_PARAMETER;
281 return 0;
282 }
283
284 *ext_type->out_present = 1;
285 *ext_type->out_data = data;
286 }
287
288 return 1;
289}
290
291static void set_crypto_buffer(CRYPTO_BUFFER **dest, CRYPTO_BUFFER *src) {
292 /* TODO(davidben): Remove this helper once |SSL_SESSION| can use |UniquePtr|
293 * and |UniquePtr| has up_ref helpers. */
294 CRYPTO_BUFFER_free(*dest);
295 *dest = src;
296 if (src != nullptr) {
297 CRYPTO_BUFFER_up_ref(src);
298 }
299}
300
301enum ssl_verify_result_t ssl_verify_peer_cert(SSL_HANDSHAKE *hs) {
302 SSL *const ssl = hs->ssl;
303 const SSL_SESSION *prev_session = ssl->s3->established_session;
304 if (prev_session != NULL) {
305 /* If renegotiating, the server must not change the server certificate. See
306 * https://mitls.org/pages/attacks/3SHAKE. We never resume on renegotiation,
307 * so this check is sufficient to ensure the reported peer certificate never
308 * changes on renegotiation. */
309 assert(!ssl->server);
310 if (sk_CRYPTO_BUFFER_num(prev_session->certs) !=
311 sk_CRYPTO_BUFFER_num(hs->new_session->certs)) {
312 OPENSSL_PUT_ERROR(SSL, SSL_R_SERVER_CERT_CHANGED);
313 ssl3_send_alert(ssl, SSL3_AL_FATAL, SSL_AD_ILLEGAL_PARAMETER);
314 return ssl_verify_invalid;
315 }
316
317 for (size_t i = 0; i < sk_CRYPTO_BUFFER_num(hs->new_session->certs); i++) {
318 const CRYPTO_BUFFER *old_cert =
319 sk_CRYPTO_BUFFER_value(prev_session->certs, i);
320 const CRYPTO_BUFFER *new_cert =
321 sk_CRYPTO_BUFFER_value(hs->new_session->certs, i);
322 if (CRYPTO_BUFFER_len(old_cert) != CRYPTO_BUFFER_len(new_cert) ||
323 OPENSSL_memcmp(CRYPTO_BUFFER_data(old_cert),
324 CRYPTO_BUFFER_data(new_cert),
325 CRYPTO_BUFFER_len(old_cert)) != 0) {
326 OPENSSL_PUT_ERROR(SSL, SSL_R_SERVER_CERT_CHANGED);
327 ssl3_send_alert(ssl, SSL3_AL_FATAL, SSL_AD_ILLEGAL_PARAMETER);
328 return ssl_verify_invalid;
329 }
330 }
331
332 /* The certificate is identical, so we may skip re-verifying the
333 * certificate. Since we only authenticated the previous one, copy other
334 * authentication from the established session and ignore what was newly
335 * received. */
336 set_crypto_buffer(&hs->new_session->ocsp_response,
337 prev_session->ocsp_response);
338 set_crypto_buffer(&hs->new_session->signed_cert_timestamp_list,
339 prev_session->signed_cert_timestamp_list);
340 hs->new_session->verify_result = prev_session->verify_result;
341 return ssl_verify_ok;
342 }
343
344 uint8_t alert = SSL_AD_CERTIFICATE_UNKNOWN;
345 enum ssl_verify_result_t ret;
346 if (ssl->custom_verify_callback != nullptr) {
347 ret = ssl->custom_verify_callback(ssl, &alert);
348 switch (ret) {
349 case ssl_verify_ok:
350 hs->new_session->verify_result = X509_V_OK;
351 break;
352 case ssl_verify_invalid:
353 hs->new_session->verify_result = X509_V_ERR_APPLICATION_VERIFICATION;
354 break;
355 case ssl_verify_retry:
356 break;
357 }
358 } else {
359 ret = ssl->ctx->x509_method->session_verify_cert_chain(
360 hs->new_session.get(), ssl, &alert)
361 ? ssl_verify_ok
362 : ssl_verify_invalid;
363 }
364
365 if (ret == ssl_verify_invalid) {
366 OPENSSL_PUT_ERROR(SSL, SSL_R_CERTIFICATE_VERIFY_FAILED);
367 ssl3_send_alert(ssl, SSL3_AL_FATAL, alert);
368 }
369
370 return ret;
371}
372
373uint16_t ssl_get_grease_value(const SSL *ssl, enum ssl_grease_index_t index) {
374 /* Use the client_random or server_random for entropy. This both avoids
375 * calling |RAND_bytes| on a single byte repeatedly and ensures the values are
376 * deterministic. This allows the same ClientHello be sent twice for a
377 * HelloRetryRequest or the same group be advertised in both supported_groups
378 * and key_shares. */
379 uint16_t ret = ssl->server ? ssl->s3->server_random[index]
380 : ssl->s3->client_random[index];
381 /* The first four bytes of server_random are a timestamp prior to TLS 1.3, but
382 * servers have no fields to GREASE until TLS 1.3. */
383 assert(!ssl->server || ssl3_protocol_version(ssl) >= TLS1_3_VERSION);
384 /* This generates a random value of the form 0xωaωa, for all 0 ≤ ω < 16. */
385 ret = (ret & 0xf0) | 0x0a;
386 ret |= ret << 8;
387 return ret;
388}
389
390enum ssl_hs_wait_t ssl_get_finished(SSL_HANDSHAKE *hs) {
391 SSL *const ssl = hs->ssl;
392 SSLMessage msg;
393 if (!ssl->method->get_message(ssl, &msg)) {
394 return ssl_hs_read_message;
395 }
396
397 if (!ssl_check_message_type(ssl, msg, SSL3_MT_FINISHED)) {
398 return ssl_hs_error;
399 }
400
401 /* Snapshot the finished hash before incorporating the new message. */
402 uint8_t finished[EVP_MAX_MD_SIZE];
403 size_t finished_len;
404 if (!hs->transcript.GetFinishedMAC(finished, &finished_len,
405 SSL_get_session(ssl), !ssl->server,
406 ssl3_protocol_version(ssl)) ||
407 !ssl_hash_message(hs, msg)) {
408 return ssl_hs_error;
409 }
410
411 int finished_ok = CBS_mem_equal(&msg.body, finished, finished_len);
412#if defined(BORINGSSL_UNSAFE_FUZZER_MODE)
413 finished_ok = 1;
414#endif
415 if (!finished_ok) {
416 ssl3_send_alert(ssl, SSL3_AL_FATAL, SSL_AD_DECRYPT_ERROR);
417 OPENSSL_PUT_ERROR(SSL, SSL_R_DIGEST_CHECK_FAILED);
418 return ssl_hs_error;
419 }
420
421 /* Copy the Finished so we can use it for renegotiation checks. */
422 if (ssl->version != SSL3_VERSION) {
423 if (finished_len > sizeof(ssl->s3->previous_client_finished) ||
424 finished_len > sizeof(ssl->s3->previous_server_finished)) {
425 OPENSSL_PUT_ERROR(SSL, ERR_R_INTERNAL_ERROR);
426 return ssl_hs_error;
427 }
428
429 if (ssl->server) {
430 OPENSSL_memcpy(ssl->s3->previous_client_finished, finished, finished_len);
431 ssl->s3->previous_client_finished_len = finished_len;
432 } else {
433 OPENSSL_memcpy(ssl->s3->previous_server_finished, finished, finished_len);
434 ssl->s3->previous_server_finished_len = finished_len;
435 }
436 }
437
438 ssl->method->next_message(ssl);
439 return ssl_hs_ok;
440}
441
442int ssl_run_handshake(SSL_HANDSHAKE *hs, int *out_early_return) {
443 SSL *const ssl = hs->ssl;
444 for (;;) {
445 /* Resolve the operation the handshake was waiting on. */
446 switch (hs->wait) {
447 case ssl_hs_error:
448 OPENSSL_PUT_ERROR(SSL, SSL_R_SSL_HANDSHAKE_FAILURE);
449 return -1;
450
451 case ssl_hs_flush: {
452 int ret = ssl->method->flush_flight(ssl);
453 if (ret <= 0) {
454 return ret;
455 }
456 break;
457 }
458
459 case ssl_hs_read_server_hello:
460 case ssl_hs_read_message: {
461 int ret = ssl->method->read_message(ssl);
462 if (ret <= 0) {
463 uint32_t err = ERR_peek_error();
464 if (hs->wait == ssl_hs_read_server_hello &&
465 ERR_GET_LIB(err) == ERR_LIB_SSL &&
466 ERR_GET_REASON(err) == SSL_R_SSLV3_ALERT_HANDSHAKE_FAILURE) {
467 /* Add a dedicated error code to the queue for a handshake_failure
468 * alert in response to ClientHello. This matches NSS's client
469 * behavior and gives a better error on a (probable) failure to
470 * negotiate initial parameters. Note: this error code comes after
471 * the original one.
472 *
473 * See https://crbug.com/446505. */
474 OPENSSL_PUT_ERROR(SSL, SSL_R_HANDSHAKE_FAILURE_ON_CLIENT_HELLO);
475 }
476 return ret;
477 }
478 break;
479 }
480
481 case ssl_hs_read_change_cipher_spec: {
482 int ret = ssl->method->read_change_cipher_spec(ssl);
483 if (ret <= 0) {
484 return ret;
485 }
486 break;
487 }
488
489 case ssl_hs_read_end_of_early_data: {
490 if (ssl->s3->hs->can_early_read) {
491 /* While we are processing early data, the handshake returns early. */
492 *out_early_return = 1;
493 return 1;
494 }
495 hs->wait = ssl_hs_ok;
496 break;
497 }
498
499 case ssl_hs_certificate_selection_pending:
500 ssl->rwstate = SSL_CERTIFICATE_SELECTION_PENDING;
501 hs->wait = ssl_hs_ok;
502 return -1;
503
504 case ssl_hs_x509_lookup:
505 ssl->rwstate = SSL_X509_LOOKUP;
506 hs->wait = ssl_hs_ok;
507 return -1;
508
509 case ssl_hs_channel_id_lookup:
510 ssl->rwstate = SSL_CHANNEL_ID_LOOKUP;
511 hs->wait = ssl_hs_ok;
512 return -1;
513
514 case ssl_hs_private_key_operation:
515 ssl->rwstate = SSL_PRIVATE_KEY_OPERATION;
516 hs->wait = ssl_hs_ok;
517 return -1;
518
519 case ssl_hs_pending_session:
520 ssl->rwstate = SSL_PENDING_SESSION;
521 hs->wait = ssl_hs_ok;
522 return -1;
523
524 case ssl_hs_pending_ticket:
525 ssl->rwstate = SSL_PENDING_TICKET;
526 hs->wait = ssl_hs_ok;
527 return -1;
528
529 case ssl_hs_certificate_verify:
530 ssl->rwstate = SSL_CERTIFICATE_VERIFY;
531 hs->wait = ssl_hs_ok;
532 return -1;
533
534 case ssl_hs_early_data_rejected:
535 ssl->rwstate = SSL_EARLY_DATA_REJECTED;
536 /* Cause |SSL_write| to start failing immediately. */
537 hs->can_early_write = 0;
538 return -1;
539
540 case ssl_hs_early_return:
541 *out_early_return = 1;
542 hs->wait = ssl_hs_ok;
543 return 1;
544
545 case ssl_hs_ok:
546 break;
547 }
548
549 /* Run the state machine again. */
550 hs->wait = ssl->do_handshake(hs);
551 if (hs->wait == ssl_hs_error) {
552 /* Don't loop around to avoid a stray |SSL_R_SSL_HANDSHAKE_FAILURE| the
553 * first time around. */
554 return -1;
555 }
556 if (hs->wait == ssl_hs_ok) {
557 /* The handshake has completed. */
558 return 1;
559 }
560
561 /* Otherwise, loop to the beginning and resolve what was blocking the
562 * handshake. */
563 }
564}
565
566} // namespace bssl