From: Nikos Mavrogiannopoulos Date: Wed, 5 Nov 2014 13:13:55 +0000 (+0100) Subject: corrected calculation for max send data and other uses of _gnutls_cipher_type() X-Git-Tag: gnutls_3_4_0~680 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=146e57ab3c3f0d5209596fb308762403206e239d;p=thirdparty%2Fgnutls.git corrected calculation for max send data and other uses of _gnutls_cipher_type() --- diff --git a/lib/gnutls_constate.c b/lib/gnutls_constate.c index 8f7cffba3c..f0cde32fda 100644 --- a/lib/gnutls_constate.c +++ b/lib/gnutls_constate.c @@ -199,8 +199,7 @@ _gnutls_init_record_state(record_parameters_st * params, gnutls_datum_t *iv = NULL; if (!_gnutls_version_has_explicit_iv(ver)) { - if (_gnutls_cipher_type(params->cipher) != - CIPHER_STREAM) + if (_gnutls_cipher_type(params->cipher) == CIPHER_BLOCK) iv = &state->IV; } @@ -344,13 +343,12 @@ int _gnutls_epoch_set_keys(gnutls_session_t session, uint16_t epoch) gnutls_assert_val (GNUTLS_E_UNKNOWN_COMPRESSION_ALGORITHM); - if (!_gnutls_version_has_explicit_iv(ver)) { - if (_gnutls_cipher_type(params->cipher) != CIPHER_STREAM) { - IV_size = _gnutls_cipher_get_iv_size(params->cipher); - } else - IV_size = _gnutls_cipher_get_implicit_iv_size(params->cipher); - } else + if (!_gnutls_version_has_explicit_iv(ver) && + _gnutls_cipher_type(params->cipher) == CIPHER_BLOCK) { + IV_size = _gnutls_cipher_get_iv_size(params->cipher); + } else { IV_size = _gnutls_cipher_get_implicit_iv_size(params->cipher); + } key_size = _gnutls_cipher_get_key_size(params->cipher); hash_size = _gnutls_mac_get_key_size(params->mac); diff --git a/lib/gnutls_int.h b/lib/gnutls_int.h index 0bf16aa7fa..43f58d51a0 100644 --- a/lib/gnutls_int.h +++ b/lib/gnutls_int.h @@ -1084,7 +1084,7 @@ inline static size_t max_user_send_size(gnutls_session_t session, max = session->security_parameters.max_record_send_size; /* DTLS data MTU accounts for those */ - if (_gnutls_cipher_type(record_params->cipher) != CIPHER_STREAM) + if (_gnutls_cipher_type(record_params->cipher) == CIPHER_BLOCK) max -= _gnutls_cipher_get_block_size(record_params-> cipher);