From: Jonathan Bastien-Filiatrault Date: Sun, 5 Sep 2010 05:29:57 +0000 (-0400) Subject: dtls: Use proper record sequence for DTLS decrypt. X-Git-Tag: gnutls_2_99_0~239 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=af566cf29a1d7e715f1d9f004bbddf412bdc2e67;p=thirdparty%2Fgnutls.git dtls: Use proper record sequence for DTLS decrypt. Signed-off-by: Nikos Mavrogiannopoulos --- diff --git a/lib/gnutls_cipher.c b/lib/gnutls_cipher.c index 4ba03bfb39..5818394f3e 100644 --- a/lib/gnutls_cipher.c +++ b/lib/gnutls_cipher.c @@ -142,7 +142,7 @@ int _gnutls_decrypt (gnutls_session_t session, opaque * ciphertext, size_t ciphertext_size, uint8_t * data, size_t max_data_size, content_type_t type, - record_parameters_st * params) + record_parameters_st * params, uint64 *sequence) { gnutls_datum_t gtxt; gnutls_datum_t gcipher; @@ -161,7 +161,7 @@ _gnutls_decrypt (gnutls_session_t session, opaque * ciphertext, ret = _gnutls_ciphertext2compressed (session, data, max_data_size, - gcipher, type, params); + gcipher, type, params, sequence); if (ret < 0) { return ret; @@ -439,7 +439,7 @@ _gnutls_ciphertext2compressed (gnutls_session_t session, opaque * compress_data, int compress_size, gnutls_datum_t ciphertext, uint8_t type, - record_parameters_st * params) + record_parameters_st * params, uint64* sequence) { uint8_t tag[MAX_HASH_SIZE]; uint8_t pad; @@ -497,8 +497,7 @@ _gnutls_ciphertext2compressed (gnutls_session_t session, * MAC. */ preamble_size = - make_preamble (UINT64DATA - (params->read.sequence_number), type, + make_preamble (UINT64DATA(*sequence), type, length, ver, preamble); _gnutls_auth_cipher_add_auth (¶ms->read.cipher_state, preamble, preamble_size); diff --git a/lib/gnutls_cipher.h b/lib/gnutls_cipher.h index 5a47f20856..19667de4bb 100644 --- a/lib/gnutls_cipher.h +++ b/lib/gnutls_cipher.h @@ -31,4 +31,5 @@ int _gnutls_encrypt (gnutls_session_t session, const opaque * headers, int _gnutls_decrypt (gnutls_session_t session, opaque * ciphertext, size_t ciphertext_size, uint8_t * data, size_t data_size, - content_type_t type, record_parameters_st * params); + content_type_t type, record_parameters_st * params, + uint64* sequence);