diff options
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libssl/t1_lib.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/lib/libssl/t1_lib.c b/src/lib/libssl/t1_lib.c index 2147908819..2421227c8a 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.155 2019/04/21 10:17:25 jsing Exp $ */ | 1 | /* $OpenBSD: t1_lib.c,v 1.156 2019/04/21 14:38:32 jsing 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 | * |
| @@ -955,12 +955,14 @@ tls_decrypt_ticket(SSL *s, const unsigned char *etick, int eticklen, | |||
| 955 | /* Move p after IV to start of encrypted ticket, update length */ | 955 | /* Move p after IV to start of encrypted ticket, update length */ |
| 956 | p = etick + 16 + EVP_CIPHER_CTX_iv_length(&ctx); | 956 | p = etick + 16 + EVP_CIPHER_CTX_iv_length(&ctx); |
| 957 | eticklen -= 16 + EVP_CIPHER_CTX_iv_length(&ctx); | 957 | eticklen -= 16 + EVP_CIPHER_CTX_iv_length(&ctx); |
| 958 | sdec = malloc(eticklen); | 958 | if ((sdec = malloc(eticklen)) == NULL) { |
| 959 | if (sdec == NULL || | ||
| 960 | EVP_DecryptUpdate(&ctx, sdec, &slen, p, eticklen) <= 0) { | ||
| 961 | ret = -1; | 959 | ret = -1; |
| 962 | goto done; | 960 | goto done; |
| 963 | } | 961 | } |
| 962 | if (EVP_DecryptUpdate(&ctx, sdec, &slen, p, eticklen) <= 0) { | ||
| 963 | ret = 2; | ||
| 964 | goto done; | ||
| 965 | } | ||
| 964 | if (EVP_DecryptFinal_ex(&ctx, sdec + slen, &mlen) <= 0) { | 966 | if (EVP_DecryptFinal_ex(&ctx, sdec + slen, &mlen) <= 0) { |
| 965 | ret = 2; | 967 | ret = 2; |
| 966 | goto done; | 968 | goto done; |
| @@ -973,7 +975,6 @@ tls_decrypt_ticket(SSL *s, const unsigned char *etick, int eticklen, | |||
| 973 | * For session parse failure, indicate that we need to send a | 975 | * For session parse failure, indicate that we need to send a |
| 974 | * new ticket. | 976 | * new ticket. |
| 975 | */ | 977 | */ |
| 976 | ERR_clear_error(); | ||
| 977 | ret = 2; | 978 | ret = 2; |
| 978 | goto done; | 979 | goto done; |
| 979 | } | 980 | } |
| @@ -1002,5 +1003,8 @@ tls_decrypt_ticket(SSL *s, const unsigned char *etick, int eticklen, | |||
| 1002 | HMAC_CTX_cleanup(&hctx); | 1003 | HMAC_CTX_cleanup(&hctx); |
| 1003 | EVP_CIPHER_CTX_cleanup(&ctx); | 1004 | EVP_CIPHER_CTX_cleanup(&ctx); |
| 1004 | 1005 | ||
| 1006 | if (ret == 2) | ||
| 1007 | ERR_clear_error(); | ||
| 1008 | |||
| 1005 | return ret; | 1009 | return ret; |
| 1006 | } | 1010 | } |
