From 852e261ece0b5989b96aa12e671c90fa6e661186 Mon Sep 17 00:00:00 2001 From: Nikos Mavrogiannopoulos Date: Sat, 31 Aug 2013 23:01:19 +0300 Subject: simplified pad calculation --- lib/gnutls_cipher.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/gnutls_cipher.c b/lib/gnutls_cipher.c index bc3af51f8b..db09a1b427 100644 --- a/lib/gnutls_cipher.c +++ b/lib/gnutls_cipher.c @@ -310,7 +310,7 @@ compressed_to_ciphertext (gnutls_session_t session, content_type_t type, record_parameters_st * params) { - uint8_t pad = target_size - compressed->size; + uint8_t pad; int length, ret; uint8_t preamble[MAX_PREAMBLE_SIZE]; int preamble_size; @@ -349,12 +349,15 @@ compressed_to_ciphertext (gnutls_session_t session, if (ret < 0) return gnutls_assert_val(ret); + pad = target_size - compressed->size; + length = calc_enc_length_block (session, ver, compressed->size, tag_size, &pad, auth_cipher, blocksize); } else { + pad = 0; length = calc_enc_length_stream (session, compressed->size, tag_size, auth_cipher); -- cgit v1.2.1