summaryrefslogtreecommitdiff
path: root/sql/mf_iocache_encr.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/mf_iocache_encr.cc')
-rw-r--r--sql/mf_iocache_encr.cc13
1 files changed, 7 insertions, 6 deletions
diff --git a/sql/mf_iocache_encr.cc b/sql/mf_iocache_encr.cc
index 546e0fe03a0..9724ca4e19e 100644
--- a/sql/mf_iocache_encr.cc
+++ b/sql/mf_iocache_encr.cc
@@ -145,9 +145,10 @@ static int my_b_encr_write(IO_CACHE *info, const uchar *Buffer, size_t Count)
if (info->seek_not_done)
{
- DBUG_ASSERT(info->pos_in_file == 0);
+ DBUG_ASSERT(info->pos_in_file % info->buffer_length == 0);
+ my_off_t wpos= info->pos_in_file / info->buffer_length * crypt_data->block_length;
- if ((mysql_file_seek(info->file, 0, MY_SEEK_SET, MYF(0)) == MY_FILEPOS_ERROR))
+ if ((mysql_file_seek(info->file, wpos, MY_SEEK_SET, MYF(0)) == MY_FILEPOS_ERROR))
{
info->error= -1;
DBUG_RETURN(1);
@@ -176,9 +177,9 @@ static int my_b_encr_write(IO_CACHE *info, const uchar *Buffer, size_t Count)
crypt_data->inbuf_counter= crypt_data->counter;
set_iv(iv, info->pos_in_file, crypt_data->inbuf_counter);
- if (encryption_crypt(Buffer, length, ebuffer, &elength,
- crypt_data->key, sizeof(crypt_data->key),
- iv, sizeof(iv), ENCRYPTION_FLAG_ENCRYPT,
+ if (encryption_crypt(Buffer, (uint)length, ebuffer, &elength,
+ crypt_data->key, (uint) sizeof(crypt_data->key),
+ iv, (uint) sizeof(iv), ENCRYPTION_FLAG_ENCRYPT,
keyid, keyver))
{
my_errno= 1;
@@ -193,7 +194,7 @@ static int my_b_encr_write(IO_CACHE *info, const uchar *Buffer, size_t Count)
buffer_length bytes should *always* produce block_length bytes
*/
DBUG_ASSERT(crypt_data->block_length == 0 || crypt_data->block_length == wlength);
- DBUG_ASSERT(elength <= encryption_encrypted_length(length, keyid, keyver));
+ DBUG_ASSERT(elength <= encryption_encrypted_length((uint)length, keyid, keyver));
crypt_data->block_length= wlength;
}
else