Skip to content

Commit 23628d1

Browse files
committed
Fix for MDEV-11174:
A GCM encrypted ciphertext must contain an authentication tag with AES_BLOCK_SIZE length, so we need to check that the length of ciphertext is at least AES_BLOCK_SIZE.
1 parent e197771 commit 23628d1

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

mysys_ssl/my_crypt.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,9 @@ class MyCTX_gcm : public MyCTX
168168
*/
169169
if (!ctx.encrypt)
170170
{
171+
/* encrypted string must contain authenticaton tag (see MDEV-11174) */
172+
if (slen < MY_AES_BLOCK_SIZE)
173+
return MY_AES_BAD_DATA;
171174
slen-= MY_AES_BLOCK_SIZE;
172175
if(!EVP_CIPHER_CTX_ctrl(&ctx, EVP_CTRL_GCM_SET_TAG, MY_AES_BLOCK_SIZE,
173176
(void*)(src + slen)))

0 commit comments

Comments
 (0)