diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2001-06-22 21:19:04 +0000 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2001-06-22 21:19:04 +0000 |
commit | aebc6f135efffd23ccbfa54ab9191f50ffa8c37a (patch) | |
tree | 30e40e5a47512362fbf5b323d99585fba267cd91 /lib/gnutls_cipher.c | |
parent | e43dcec49d3b4a656e5c3c43a29b5f0f50b3bc2a (diff) | |
download | gnutls-aebc6f135efffd23ccbfa54ab9191f50ffa8c37a.tar.gz |
corrected bug in stream decryption..
Diffstat (limited to 'lib/gnutls_cipher.c')
-rw-r--r-- | lib/gnutls_cipher.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/lib/gnutls_cipher.c b/lib/gnutls_cipher.c index 41b451d2c0..9f14cbfad4 100644 --- a/lib/gnutls_cipher.c +++ b/lib/gnutls_cipher.c @@ -310,11 +310,11 @@ int _gnutls_connection_state_init(GNUTLS_STATE state) } if (state->connection_state.mac_secret_size > 0) { - memmove(state->connection_state.read_mac_secret, + memcpy(state->connection_state.read_mac_secret, state-> cipher_specs.client_write_mac_secret, state->connection_state.mac_secret_size); - memmove(state->connection_state.write_mac_secret, + memcpy(state->connection_state.write_mac_secret, state->cipher_specs. server_write_mac_secret, state->connection_state.mac_secret_size); @@ -356,11 +356,11 @@ int _gnutls_connection_state_init(GNUTLS_STATE state) } if (state->connection_state.mac_secret_size > 0) { - memmove(state->connection_state.read_mac_secret, + memcpy(state->connection_state.read_mac_secret, state-> cipher_specs.server_write_mac_secret, state->connection_state.mac_secret_size); - memmove(state->connection_state.write_mac_secret, + memcpy(state->connection_state.write_mac_secret, state-> cipher_specs.client_write_mac_secret, state->connection_state.mac_secret_size); @@ -470,8 +470,8 @@ int _gnutls_compressed2TLSCiphertext(GNUTLS_STATE state, gnutls_assert(); return GNUTLS_E_MEMORY_ERROR; } - memmove(data, compressed.data, compressed.size); - memmove(&data[compressed.size], MAC, + memcpy(data, compressed.data, compressed.size); + memcpy(&data[compressed.size], MAC, state->security_parameters.hash_size); gnutls_cipher_encrypt(state->connection_state. @@ -510,8 +510,8 @@ int _gnutls_compressed2TLSCiphertext(GNUTLS_STATE state, return GNUTLS_E_MEMORY_ERROR; } memset(&data[length - pad], pad - 1, pad); - memmove(data, compressed.data, compressed.size); - memmove(&data[compressed.size], MAC, + memcpy(data, compressed.data, compressed.size); + memcpy(&data[compressed.size], MAC, state->security_parameters.hash_size); gnutls_cipher_encrypt(state->connection_state. @@ -587,7 +587,11 @@ int _gnutls_ciphertext2TLSCompressed(GNUTLS_STATE state, return GNUTLS_E_MEMORY_ERROR; } - memmove(data, ciphertext.data, length); + gnutls_cipher_decrypt(state->connection_state. + read_cipher_state, ciphertext.data, + ciphertext.size); + + memcpy(data, ciphertext.data, length); compress->data = data; compress->size = length; @@ -619,7 +623,7 @@ int _gnutls_ciphertext2TLSCompressed(GNUTLS_STATE state, return GNUTLS_E_MEMORY_ERROR; } - memmove(data, ciphertext.data, length); + memcpy(data, ciphertext.data, length); compress->data = data; compress->size = length; break; |