summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/libssl/ssl_srvr.c8
-rw-r--r--src/lib/libssl/t1_lib.c14
2 files changed, 13 insertions, 9 deletions
diff --git a/src/lib/libssl/ssl_srvr.c b/src/lib/libssl/ssl_srvr.c
index a518e1ac91..a571549b64 100644
--- a/src/lib/libssl/ssl_srvr.c
+++ b/src/lib/libssl/ssl_srvr.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_srvr.c,v 1.156 2023/07/08 16:40:13 beck Exp $ */ 1/* $OpenBSD: ssl_srvr.c,v 1.157 2023/11/18 10:51:09 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -2343,7 +2343,7 @@ ssl3_send_newsession_ticket(SSL *s)
2343 unsigned int hlen; 2343 unsigned int hlen;
2344 EVP_CIPHER_CTX *ctx = NULL; 2344 EVP_CIPHER_CTX *ctx = NULL;
2345 HMAC_CTX *hctx = NULL; 2345 HMAC_CTX *hctx = NULL;
2346 int len; 2346 int iv_len, len;
2347 2347
2348 /* 2348 /*
2349 * New Session Ticket - RFC 5077, section 3.3. 2349 * New Session Ticket - RFC 5077, section 3.3.
@@ -2426,7 +2426,9 @@ ssl3_send_newsession_ticket(SSL *s)
2426 goto err; 2426 goto err;
2427 if (!CBB_add_bytes(&ticket, key_name, sizeof(key_name))) 2427 if (!CBB_add_bytes(&ticket, key_name, sizeof(key_name)))
2428 goto err; 2428 goto err;
2429 if (!CBB_add_bytes(&ticket, iv, EVP_CIPHER_CTX_iv_length(ctx))) 2429 if ((iv_len = EVP_CIPHER_CTX_iv_length(ctx)) < 0)
2430 goto err;
2431 if (!CBB_add_bytes(&ticket, iv, iv_len))
2430 goto err; 2432 goto err;
2431 if (!CBB_add_bytes(&ticket, enc_session, enc_session_len)) 2433 if (!CBB_add_bytes(&ticket, enc_session, enc_session_len))
2432 goto err; 2434 goto err;
diff --git a/src/lib/libssl/t1_lib.c b/src/lib/libssl/t1_lib.c
index 85d5eaa633..9680c8d213 100644
--- a/src/lib/libssl/t1_lib.c
+++ b/src/lib/libssl/t1_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: t1_lib.c,v 1.197 2022/11/26 16:08:56 tb Exp $ */ 1/* $OpenBSD: t1_lib.c,v 1.198 2023/11/18 10:51:09 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -987,7 +987,7 @@ tls_decrypt_ticket(SSL *s, CBS *ticket, int *alert, SSL_SESSION **psess)
987 HMAC_CTX *hctx = NULL; 987 HMAC_CTX *hctx = NULL;
988 EVP_CIPHER_CTX *cctx = NULL; 988 EVP_CIPHER_CTX *cctx = NULL;
989 SSL_CTX *tctx = s->initial_ctx; 989 SSL_CTX *tctx = s->initial_ctx;
990 int slen, hlen; 990 int slen, hlen, iv_len;
991 int alert_desc = SSL_AD_INTERNAL_ERROR; 991 int alert_desc = SSL_AD_INTERNAL_ERROR;
992 int ret = TLS1_TICKET_FATAL_ERROR; 992 int ret = TLS1_TICKET_FATAL_ERROR;
993 993
@@ -1027,12 +1027,13 @@ tls_decrypt_ticket(SSL *s, CBS *ticket, int *alert, SSL_SESSION **psess)
1027 s->tlsext_ticket_expected = 1; 1027 s->tlsext_ticket_expected = 1;
1028 } 1028 }
1029 1029
1030 if ((iv_len = EVP_CIPHER_CTX_iv_length(cctx)) < 0)
1031 goto err;
1030 /* 1032 /*
1031 * Now that the cipher context is initialised, we can extract 1033 * Now that the cipher context is initialised, we can extract
1032 * the IV since its length is known. 1034 * the IV since its length is known.
1033 */ 1035 */
1034 if (!CBS_get_bytes(ticket, &ticket_iv, 1036 if (!CBS_get_bytes(ticket, &ticket_iv, iv_len))
1035 EVP_CIPHER_CTX_iv_length(cctx)))
1036 goto derr; 1037 goto derr;
1037 } else { 1038 } else {
1038 /* Check that the key name matches. */ 1039 /* Check that the key name matches. */
@@ -1040,8 +1041,9 @@ tls_decrypt_ticket(SSL *s, CBS *ticket, int *alert, SSL_SESSION **psess)
1040 tctx->tlsext_tick_key_name, 1041 tctx->tlsext_tick_key_name,
1041 sizeof(tctx->tlsext_tick_key_name))) 1042 sizeof(tctx->tlsext_tick_key_name)))
1042 goto derr; 1043 goto derr;
1043 if (!CBS_get_bytes(ticket, &ticket_iv, 1044 if ((iv_len = EVP_CIPHER_iv_length(EVP_aes_128_cbc())) < 0)
1044 EVP_CIPHER_iv_length(EVP_aes_128_cbc()))) 1045 goto err;
1046 if (!CBS_get_bytes(ticket, &ticket_iv, iv_len))
1045 goto derr; 1047 goto derr;
1046 if (!EVP_DecryptInit_ex(cctx, EVP_aes_128_cbc(), NULL, 1048 if (!EVP_DecryptInit_ex(cctx, EVP_aes_128_cbc(), NULL,
1047 tctx->tlsext_tick_aes_key, CBS_data(&ticket_iv))) 1049 tctx->tlsext_tick_aes_key, CBS_data(&ticket_iv)))