diff options
author | Sergei Golubchik <serg@mariadb.org> | 2015-05-27 19:41:29 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2015-06-02 19:00:23 +0200 |
commit | ebc5e00641ea63d91a65921ea827f448064f9a7e (patch) | |
tree | e8d92d73e460d48e0b49e0bdb4e2de5f25b74554 /mysys_ssl | |
parent | 487e5f45908c04d63a9becf1078ecaeaf658f0ae (diff) | |
download | mariadb-git-ebc5e00641ea63d91a65921ea827f448064f9a7e.tar.gz |
my_aes_get_size()
return unsigned, not signed.
return a value large enough for GCM
Diffstat (limited to 'mysys_ssl')
-rw-r--r-- | mysys_ssl/my_crypt.cc | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/mysys_ssl/my_crypt.cc b/mysys_ssl/my_crypt.cc index 7ca65b253e6..04771aeb954 100644 --- a/mysys_ssl/my_crypt.cc +++ b/mysys_ssl/my_crypt.cc @@ -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(uint source_length) { - return MY_AES_BLOCK_SIZE * (source_length / MY_AES_BLOCK_SIZE) - + MY_AES_BLOCK_SIZE; + return source_length + MY_AES_BLOCK_SIZE; } |