summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib/libssl/tls13_handshake.c86
-rw-r--r--src/lib/libssl/tls13_internal.h5
2 files changed, 47 insertions, 44 deletions
diff --git a/src/lib/libssl/tls13_handshake.c b/src/lib/libssl/tls13_handshake.c
index 77e59f1930..b566ed2298 100644
--- a/src/lib/libssl/tls13_handshake.c
+++ b/src/lib/libssl/tls13_handshake.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tls13_handshake.c,v 1.8 2019/01/18 06:51:29 tb Exp $ */ 1/* $OpenBSD: tls13_handshake.c,v 1.9 2019/01/19 03:32:03 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2018-2019 Theo Buehler <tb@openbsd.org> 3 * Copyright (c) 2018-2019 Theo Buehler <tb@openbsd.org>
4 * Copyright (c) 2019 Joel Sing <jsing@openbsd.org> 4 * Copyright (c) 2019 Joel Sing <jsing@openbsd.org>
@@ -279,26 +279,27 @@ int
279tls13_connect(struct tls13_ctx *ctx) 279tls13_connect(struct tls13_ctx *ctx)
280{ 280{
281 struct tls13_handshake_action *action; 281 struct tls13_handshake_action *action;
282 int ret;
282 283
283 ctx->mode = TLS13_HS_CLIENT; 284 ctx->mode = TLS13_HS_CLIENT;
284 285
285 for (;;) { 286 for (;;) {
286 if ((action = tls13_handshake_active_action(ctx)) == NULL) 287 if ((action = tls13_handshake_active_action(ctx)) == NULL)
287 return -1; 288 return TLS13_IO_FAILURE;
288 289
289 if (action->sender == TLS13_HS_BOTH) 290 if (action->sender == TLS13_HS_BOTH)
290 return 1; 291 return TLS13_IO_SUCCESS;
291 292
292 if (action->sender == TLS13_HS_CLIENT) { 293 if (action->sender == TLS13_HS_CLIENT) {
293 if (!tls13_handshake_send_action(ctx, action)) 294 if ((ret = tls13_handshake_send_action(ctx, action)) <= 0)
294 return 0; 295 return ret;
295 } else { 296 } else {
296 if (!tls13_handshake_recv_action(ctx, action)) 297 if ((ret = tls13_handshake_recv_action(ctx, action)) <= 0)
297 return 0; 298 return ret;
298 } 299 }
299 300
300 if (!tls13_handshake_advance_state_machine(ctx)) 301 if (!tls13_handshake_advance_state_machine(ctx))
301 return 0; 302 return TLS13_IO_FAILURE;
302 } 303 }
303} 304}
304 305
@@ -306,26 +307,27 @@ int
306tls13_accept(struct tls13_ctx *ctx) 307tls13_accept(struct tls13_ctx *ctx)
307{ 308{
308 struct tls13_handshake_action *action; 309 struct tls13_handshake_action *action;
310 int ret;
309 311
310 ctx->mode = TLS13_HS_SERVER; 312 ctx->mode = TLS13_HS_SERVER;
311 313
312 for (;;) { 314 for (;;) {
313 if ((action = tls13_handshake_active_action(ctx)) == NULL) 315 if ((action = tls13_handshake_active_action(ctx)) == NULL)
314 return -1; 316 return TLS13_IO_FAILURE;
315 317
316 if (action->sender == TLS13_HS_BOTH) 318 if (action->sender == TLS13_HS_BOTH)
317 return 1; 319 return TLS13_IO_SUCCESS;
318 320
319 if (action->sender == TLS13_HS_SERVER) { 321 if (action->sender == TLS13_HS_SERVER) {
320 if (!tls13_handshake_send_action(ctx, action)) 322 if ((ret = tls13_handshake_send_action(ctx, action)) <= 0)
321 return 0; 323 return ret;
322 } else { 324 } else {
323 if (!tls13_handshake_recv_action(ctx, action)) 325 if ((ret = tls13_handshake_recv_action(ctx, action)) <= 0)
324 return 0; 326 return ret;
325 } 327 }
326 328
327 if (!tls13_handshake_advance_state_machine(ctx)) 329 if (!tls13_handshake_advance_state_machine(ctx))
328 return 0; 330 return TLS13_IO_FAILURE;
329 } 331 }
330 332
331 return 1; 333 return 1;
@@ -335,7 +337,7 @@ int
335tls13_handshake_advance_state_machine(struct tls13_ctx *ctx) 337tls13_handshake_advance_state_machine(struct tls13_ctx *ctx)
336{ 338{
337 ctx->handshake.message_number++; 339 ctx->handshake.message_number++;
338 return 1; 340 return 0;
339} 341}
340 342
341int 343int
@@ -355,86 +357,86 @@ tls13_handshake_recv_action(struct tls13_ctx *ctx,
355int 357int
356tls13_client_hello_send(struct tls13_ctx *ctx) 358tls13_client_hello_send(struct tls13_ctx *ctx)
357{ 359{
358 return 1; 360 return 0;
359} 361}
360 362
361int 363int
362tls13_client_hello_recv(struct tls13_ctx *ctx) 364tls13_client_hello_recv(struct tls13_ctx *ctx)
363{ 365{
364 return 1; 366 return 0;
365} 367}
366 368
367int 369int
368tls13_client_hello_retry_send(struct tls13_ctx *ctx) 370tls13_client_hello_retry_send(struct tls13_ctx *ctx)
369{ 371{
370 return 1; 372 return 0;
371} 373}
372 374
373int 375int
374tls13_client_hello_retry_recv(struct tls13_ctx *ctx) 376tls13_client_hello_retry_recv(struct tls13_ctx *ctx)
375{ 377{
376 return 1; 378 return 0;
377} 379}
378 380
379 381
380int 382int
381tls13_client_end_of_early_data_send(struct tls13_ctx *ctx) 383tls13_client_end_of_early_data_send(struct tls13_ctx *ctx)
382{ 384{
383 return 1; 385 return 0;
384} 386}
385 387
386int 388int
387tls13_client_end_of_early_data_recv(struct tls13_ctx *ctx) 389tls13_client_end_of_early_data_recv(struct tls13_ctx *ctx)
388{ 390{
389 return 1; 391 return 0;
390} 392}
391 393
392int 394int
393tls13_client_certificate_send(struct tls13_ctx *ctx) 395tls13_client_certificate_send(struct tls13_ctx *ctx)
394{ 396{
395 return 1; 397 return 0;
396} 398}
397 399
398int 400int
399tls13_client_certificate_recv(struct tls13_ctx *ctx) 401tls13_client_certificate_recv(struct tls13_ctx *ctx)
400{ 402{
401 return 1; 403 return 0;
402} 404}
403 405
404int 406int
405tls13_client_certificate_verify_send(struct tls13_ctx *ctx) 407tls13_client_certificate_verify_send(struct tls13_ctx *ctx)
406{ 408{
407 return 1; 409 return 0;
408} 410}
409 411
410int 412int
411tls13_client_certificate_verify_recv(struct tls13_ctx *ctx) 413tls13_client_certificate_verify_recv(struct tls13_ctx *ctx)
412{ 414{
413 return 1; 415 return 0;
414} 416}
415 417
416int 418int
417tls13_client_finished_recv(struct tls13_ctx *ctx) 419tls13_client_finished_recv(struct tls13_ctx *ctx)
418{ 420{
419 return 1; 421 return 0;
420} 422}
421 423
422int 424int
423tls13_client_finished_send(struct tls13_ctx *ctx) 425tls13_client_finished_send(struct tls13_ctx *ctx)
424{ 426{
425 return 1; 427 return 0;
426} 428}
427 429
428int 430int
429tls13_client_key_update_send(struct tls13_ctx *ctx) 431tls13_client_key_update_send(struct tls13_ctx *ctx)
430{ 432{
431 return 1; 433 return 0;
432} 434}
433 435
434int 436int
435tls13_client_key_update_recv(struct tls13_ctx *ctx) 437tls13_client_key_update_recv(struct tls13_ctx *ctx)
436{ 438{
437 return 1; 439 return 0;
438} 440}
439 441
440int 442int
@@ -442,7 +444,7 @@ tls13_server_hello_recv(struct tls13_ctx *ctx)
442{ 444{
443 ctx->handshake.hs_type |= NEGOTIATED; 445 ctx->handshake.hs_type |= NEGOTIATED;
444 446
445 return 1; 447 return 0;
446} 448}
447 449
448int 450int
@@ -450,65 +452,65 @@ tls13_server_hello_send(struct tls13_ctx *ctx)
450{ 452{
451 ctx->handshake.hs_type |= NEGOTIATED; 453 ctx->handshake.hs_type |= NEGOTIATED;
452 454
453 return 1; 455 return 0;
454} 456}
455 457
456int 458int
457tls13_server_encrypted_extensions_recv(struct tls13_ctx *ctx) 459tls13_server_encrypted_extensions_recv(struct tls13_ctx *ctx)
458{ 460{
459 return 1; 461 return 0;
460} 462}
461 463
462int 464int
463tls13_server_encrypted_extensions_send(struct tls13_ctx *ctx) 465tls13_server_encrypted_extensions_send(struct tls13_ctx *ctx)
464{ 466{
465 return 1; 467 return 0;
466} 468}
467 469
468int 470int
469tls13_server_certificate_recv(struct tls13_ctx *ctx) 471tls13_server_certificate_recv(struct tls13_ctx *ctx)
470{ 472{
471 return 1; 473 return 0;
472} 474}
473 475
474int 476int
475tls13_server_certificate_send(struct tls13_ctx *ctx) 477tls13_server_certificate_send(struct tls13_ctx *ctx)
476{ 478{
477 return 1; 479 return 0;
478} 480}
479 481
480int 482int
481tls13_server_certificate_request_recv(struct tls13_ctx *ctx) 483tls13_server_certificate_request_recv(struct tls13_ctx *ctx)
482{ 484{
483 return 1; 485 return 0;
484} 486}
485 487
486int 488int
487tls13_server_certificate_request_send(struct tls13_ctx *ctx) 489tls13_server_certificate_request_send(struct tls13_ctx *ctx)
488{ 490{
489 return 1; 491 return 0;
490} 492}
491 493
492int 494int
493tls13_server_certificate_verify_send(struct tls13_ctx *ctx) 495tls13_server_certificate_verify_send(struct tls13_ctx *ctx)
494{ 496{
495 return 1; 497 return 0;
496} 498}
497 499
498int 500int
499tls13_server_certificate_verify_recv(struct tls13_ctx *ctx) 501tls13_server_certificate_verify_recv(struct tls13_ctx *ctx)
500{ 502{
501 return 1; 503 return 0;
502} 504}
503 505
504int 506int
505tls13_server_finished_recv(struct tls13_ctx *ctx) 507tls13_server_finished_recv(struct tls13_ctx *ctx)
506{ 508{
507 return 1; 509 return 0;
508} 510}
509 511
510int 512int
511tls13_server_finished_send(struct tls13_ctx *ctx) 513tls13_server_finished_send(struct tls13_ctx *ctx)
512{ 514{
513 return 1; 515 return 0;
514} 516}
diff --git a/src/lib/libssl/tls13_internal.h b/src/lib/libssl/tls13_internal.h
index e672df37e3..876f339c80 100644
--- a/src/lib/libssl/tls13_internal.h
+++ b/src/lib/libssl/tls13_internal.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: tls13_internal.h,v 1.7 2019/01/18 06:51:29 tb Exp $ */ 1/* $OpenBSD: tls13_internal.h,v 1.8 2019/01/19 03:32:03 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2018 Bob Beck <beck@openbsd.org> 3 * Copyright (c) 2018 Bob Beck <beck@openbsd.org>
4 * Copyright (c) 2018 Theo Buehler <tb@openbsd.org> 4 * Copyright (c) 2018 Theo Buehler <tb@openbsd.org>
@@ -25,7 +25,8 @@
25 25
26__BEGIN_HIDDEN_DECLS 26__BEGIN_HIDDEN_DECLS
27 27
28#define TLS13_IO_EOF 0 28#define TLS13_IO_SUCCESS 1
29#define TLS13_IO_EOF 0
29#define TLS13_IO_FAILURE -1 30#define TLS13_IO_FAILURE -1
30#define TLS13_IO_WANT_POLLIN -2 31#define TLS13_IO_WANT_POLLIN -2
31#define TLS13_IO_WANT_POLLOUT -3 32#define TLS13_IO_WANT_POLLOUT -3