Bug #9576 AES_DECRYPT results inconsistent
Submitted: 2 Apr 2005 4:40 Modified: 5 Apr 2005 13:08
Reporter: Peter Zaitsev (Basic Quality Contributor) Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.1.10 OS:Any (*)
Assigned to: CPU Architecture:Any

[2 Apr 2005 4:40] Peter Zaitsev
Description:
AES_DECRYPT   returns  NULL   with invalid password, but fails to set one if temporary table is used and column declared not null:

CREATE TABLE `aes` (
  `x` text NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8

mysql> insert into aes values (AES_ENCRYPT("1","a"));
Query OK, 1 row affected, 1 warning (0.00 sec)

mysql> insert into aes values (AES_ENCRYPT("2","a"));
Query OK, 1 row affected, 1 warning (0.00 sec)

mysql> select AES_DECRYPT(x,"b") from aes;;
+--------------------+
| AES_DECRYPT(x,"b") |
+--------------------+
| NULL               |
| NULL               |
+--------------------+
2 rows in set (0.00 sec)

mysql> select AES_DECRYPT(x,"b") from aes order by rand();
+--------------------+
| AES_DECRYPT(x,"b") |
+--------------------+
|                    |
|                    |
+--------------------+
2 rows in set (0.00 sec)

How to repeat:
See above
[3 Apr 2005 19:53] Aleksey Kishkin
tested on winxp sp2 also
[5 Apr 2005 13:08] Matthew Lord
Duplicate of 8669.  Fixed in 4.1.11.