Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
ebc5e006
Commit
ebc5e006
authored
May 27, 2015
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
my_aes_get_size()
return unsigned, not signed. return a value large enough for GCM
parent
487e5f45
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
11 deletions
+13
-11
include/my_crypt.h
include/my_crypt.h
+1
-1
mysys/mf_iocache.c
mysys/mf_iocache.c
+1
-1
mysys_ssl/my_crypt.cc
mysys_ssl/my_crypt.cc
+10
-8
sql/mf_iocache_encr.cc
sql/mf_iocache_encr.cc
+1
-1
No files found.
include/my_crypt.h
View file @
ebc5e006
...
...
@@ -73,7 +73,7 @@ int my_aes_decrypt_ecb(const uchar* source, uint source_length,
int
my_random_bytes
(
uchar
*
buf
,
int
num
);
int
my_aes_get_size
(
int
source_length
);
uint
my_aes_get_size
(
u
int
source_length
);
#ifdef __cplusplus
}
...
...
mysys/mf_iocache.c
View file @
ebc5e006
...
...
@@ -265,7 +265,7 @@ int init_io_cache(IO_CACHE *info, File file, size_t cachesize,
if
(
type
==
SEQ_READ_APPEND
)
buffer_block
*=
2
;
else
if
(
cache_myflags
&
MY_ENCRYPT
)
buffer_block
=
2
*
(
buffer_block
+
MY_AES_BLOCK_SIZE
)
+
sizeof
(
IO_CACHE_CRYPT
);
buffer_block
=
2
*
my_aes_get_size
(
buffer_block
)
+
sizeof
(
IO_CACHE_CRYPT
);
if
(
cachesize
==
min_cache
)
flags
|=
(
myf
)
MY_WME
;
...
...
mysys_ssl/my_crypt.cc
View file @
ebc5e006
...
...
@@ -292,16 +292,18 @@ C_MODE_END
/**
Get size of buffer which will be large enough for encrypted data
SYNOPSIS
my_aes_get_size()
@param source_length [in] Length of data to be encrypted
The buffer should be sufficiently large to fit encrypted data
independently from the encryption algorithm and mode. With padding up to
MY_AES_BLOCK_SIZE bytes can be added. With GCM, exactly MY_AES_BLOCK_SIZE
bytes are added.
@return
Size of buffer required to store encrypted data
The actual length of the encrypted data is returned from the encryption
function (e.g. from my_aes_encrypt_cbc).
@return required buffer size
*/
int
my_aes_get_size
(
int
source_length
)
uint
my_aes_get_size
(
u
int
source_length
)
{
return
MY_AES_BLOCK_SIZE
*
(
source_length
/
MY_AES_BLOCK_SIZE
)
+
MY_AES_BLOCK_SIZE
;
return
source_length
+
MY_AES_BLOCK_SIZE
;
}
sql/mf_iocache_encr.cc
View file @
ebc5e006
...
...
@@ -191,7 +191,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
<=
length
+
MY_AES_BLOCK_SIZE
);
DBUG_ASSERT
(
elength
<=
my_aes_get_size
(
length
)
);
crypt_data
->
block_length
=
wlength
;
}
else
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment