summaryrefslogtreecommitdiff
path: root/src/lib/libssl/t1_lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libssl/t1_lib.c')
-rw-r--r--src/lib/libssl/t1_lib.c14
1 files changed, 8 insertions, 6 deletions
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)))