diff options
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libssl/t1_enc.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/lib/libssl/t1_enc.c b/src/lib/libssl/t1_enc.c index 5cd1688a37..a3a5d4dd7d 100644 --- a/src/lib/libssl/t1_enc.c +++ b/src/lib/libssl/t1_enc.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: t1_enc.c,v 1.79 2015/07/17 07:04:41 doug Exp $ */ | 1 | /* $OpenBSD: t1_enc.c,v 1.80 2015/08/27 14:16:57 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 | * |
| @@ -698,7 +698,7 @@ tls1_enc(SSL *s, int send) | |||
| 698 | if (aead) { | 698 | if (aead) { |
| 699 | unsigned char ad[13], *in, *out, nonce[16]; | 699 | unsigned char ad[13], *in, *out, nonce[16]; |
| 700 | unsigned nonce_used; | 700 | unsigned nonce_used; |
| 701 | ssize_t n; | 701 | size_t out_len; |
| 702 | 702 | ||
| 703 | if (SSL_IS_DTLS(s)) { | 703 | if (SSL_IS_DTLS(s)) { |
| 704 | dtls1_build_sequence_number(ad, seq, | 704 | dtls1_build_sequence_number(ad, seq, |
| @@ -753,11 +753,11 @@ tls1_enc(SSL *s, int send) | |||
| 753 | ad[12] = len & 0xff; | 753 | ad[12] = len & 0xff; |
| 754 | 754 | ||
| 755 | if (!EVP_AEAD_CTX_seal(&aead->ctx, | 755 | if (!EVP_AEAD_CTX_seal(&aead->ctx, |
| 756 | out + eivlen, &n, len + aead->tag_len, nonce, | 756 | out + eivlen, &out_len, len + aead->tag_len, nonce, |
| 757 | nonce_used, in + eivlen, len, ad, sizeof(ad))) | 757 | nonce_used, in + eivlen, len, ad, sizeof(ad))) |
| 758 | return -1; | 758 | return -1; |
| 759 | if (n >= 0 && aead->variable_nonce_in_record) | 759 | if (aead->variable_nonce_in_record) |
| 760 | n += aead->variable_nonce_len; | 760 | out_len += aead->variable_nonce_len; |
| 761 | } else { | 761 | } else { |
| 762 | /* receive */ | 762 | /* receive */ |
| 763 | size_t len = rec->length; | 763 | size_t len = rec->length; |
| @@ -786,17 +786,15 @@ tls1_enc(SSL *s, int send) | |||
| 786 | ad[11] = len >> 8; | 786 | ad[11] = len >> 8; |
| 787 | ad[12] = len & 0xff; | 787 | ad[12] = len & 0xff; |
| 788 | 788 | ||
| 789 | if (!EVP_AEAD_CTX_open(&aead->ctx, out, &n, len, nonce, | 789 | if (!EVP_AEAD_CTX_open(&aead->ctx, out, &out_len, len, |
| 790 | nonce_used, in, len + aead->tag_len, ad, | 790 | nonce, nonce_used, in, len + aead->tag_len, ad, |
| 791 | sizeof(ad))) | 791 | sizeof(ad))) |
| 792 | return -1; | 792 | return -1; |
| 793 | 793 | ||
| 794 | rec->data = rec->input = out; | 794 | rec->data = rec->input = out; |
| 795 | } | 795 | } |
| 796 | 796 | ||
| 797 | if (n == -1) | 797 | rec->length = out_len; |
| 798 | return -1; | ||
| 799 | rec->length = n; | ||
| 800 | 798 | ||
| 801 | return 1; | 799 | return 1; |
| 802 | } | 800 | } |
