doris icon indicating copy to clipboard operation
doris copied to clipboard

[fix](function) fix AES/SM3/SM4 encrypt/ decrypt algorithm initialization vector bug

Open xinyiZzz opened this issue 2 years ago • 1 comments

Proposed changes

Issue Number: close #xxx

Problem summary

  1. ECB algorithm, block_encryption_mode does not take effect, it only takes effect when init vector is provided. Solved: 192/256 supports calculation without init vector

  2. For other algorithms, an error should be reported when there is no init vector

Initialization Vector. The default value for the block_encryption_mode system variable is aes-128-ecb, or ECB mode, which does not require an initialization vector. The alternative permitted block encryption modes CBC, CFB1, CFB8, CFB128, and OFB all require an initialization vector.

Reference: https://dev.mysql.com/doc/refman/8.0/en/encryption-functions.html#function_aes-decrypt

Checklist(Required)

  • [ ] Does it affect the original behavior
  • [ ] Has unit tests been added
  • [ ] Has document been added or modified
  • [ ] Does it need to update dependencies
  • [ ] Is this PR support rollback (If NO, please explain WHY)

Further comments

If this is a relatively large or complex change, kick off the discussion at [email protected] by explaining why you chose the solution you did and what alternatives you considered, etc...

xinyiZzz avatar Mar 04 '23 15:03 xinyiZzz

clang-tidy review says "All clean, LGTM! :+1:"

github-actions[bot] avatar Mar 04 '23 15:03 github-actions[bot]

clang-tidy review says "All clean, LGTM! :+1:"

github-actions[bot] avatar Mar 05 '23 19:03 github-actions[bot]

run buildall

xinyiZzz avatar Mar 05 '23 19:03 xinyiZzz

run buildall

xinyiZzz avatar Mar 06 '23 02:03 xinyiZzz

run buildall

xinyiZzz avatar Mar 07 '23 08:03 xinyiZzz

clang-tidy review says "All clean, LGTM! :+1:"

github-actions[bot] avatar Mar 07 '23 08:03 github-actions[bot]

clang-tidy review says "All clean, LGTM! :+1:"

github-actions[bot] avatar Mar 07 '23 16:03 github-actions[bot]

./run buildall

yiguolei avatar Mar 08 '23 01:03 yiguolei

run buildall

xinyiZzz avatar Mar 08 '23 01:03 xinyiZzz

PR approved by anyone and no changes requested.

github-actions[bot] avatar Mar 08 '23 11:03 github-actions[bot]