matrixorigin / matrixorigin/matrixone

[Compatibility]: AES_ENCRYPT and AES_DECRYPT lack MySQL KDF arguments

Open
#28,224 0 comments 0 reactions 1 assignee Claimed by @XuPeng-SH View on GitHub
kind/bug needs-triage
Dominant language
Go
Stars
1.9k
Forks
311
Avg merge
1d 3h
Merged PRs (30d)
768

Description

### Is there an existing issue for the same bug?

- [x] I have checked the existing issues.

No issue was found for the MySQL AES KDF arguments.

### Branch Name

main

### Commit ID

`e7bb0572235ec4bac81eb098eb0ad8900f0065ab`

### Other Environment Information

- Local standalone MatrixOne
- Reference: MySQL 8.3.0

### Actual Behavior

MatrixOne exposes only the two- and three-argument forms of `AES_ENCRYPT()`/`AES_DECRYPT()`. MySQL's optional key-derivation arguments are rejected during function binding:

```sql
SET block_encryption_mode='aes-128-ecb';

SELECT LENGTH(AES_ENCRYPT('hello','key','','hkdf','salt','info'));
-- MatrixOne: ERROR 20203: invalid argument function aes_encrypt,
-- bad value [VARCHAR VARCHAR CHAR VARCHAR VARCHAR VARCHAR]
-- MySQL: 16

SELECT LENGTH(AES_ENCRYPT('hello','key','','pbkdf2_hmac','salt',1000));
-- MatrixOne: ERROR 20203: invalid argument function aes_encrypt,
-- bad value [VARCHAR VARCHAR CHAR VARCHAR VARCHAR BIGINT]
-- MySQL: 16
```

Both HKDF and PBKDF2-HMAC forms reproduced identically in three runs.

### Expected Behavior

`AES_ENCRYPT()` and `AES_DECRYPT()` should accept MySQL's optional `kdf_name`, `salt`, and `info`/`iterations` arguments and derive the encryption key using HKDF or PBKDF2-HMAC as requested.

### Steps to Reproduce

```sql
SET block_encryption_mode='aes-128-ecb';
SELECT LENGTH(AES_ENCRYPT('hello','key','','hkdf','salt','info'));
SELECT LENGTH(AES_ENCRYPT('hello','key','','pbkdf2_hmac','salt',1000));
```

### Additional information

The function registry defines only 2-argument and 3-argument overloads. The executor consequently has no KDF parameters or key-derivation implementation.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.