Skip to content

cmek split 1/8: encryption primitives and wire format (#4569) - #5835

Merged
ti-chi-bot[bot] merged 4 commits into
pingcap:release-8.5from
ti-chi-bot:cherry-pick-4569-to-release-8.5
Aug 1, 2026
Merged

cmek split 1/8: encryption primitives and wire format (#4569)#5835
ti-chi-bot[bot] merged 4 commits into
pingcap:release-8.5from
ti-chi-bot:cherry-pick-4569-to-release-8.5

Conversation

@ti-chi-bot

Copy link
Copy Markdown
Member

This is an automated cherry-pick of #4569

What problem does this PR solve?

Issue Number: ref #3943

This is split PR 1/8 from #3955.

What is changed and how it works?

This PR introduces the foundational encryption primitives used by later CMEK integration PRs:

  • Add encryption data model types aligned with TiKV keyspace encryption metadata.
  • Add AES-CTR cipher helpers and IV generation/validation.
  • Add encrypted payload wire format with version + data key ID header.
  • Add 24-bit data key ID encode/decode helpers.
  • Add unit tests for cipher and wire format behavior.

This PR is intentionally limited to reusable primitives and does not wire runtime components yet.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Questions

Will it cause performance regression or break compatibility?

No behavior change for runtime components in this split. It only adds reusable encryption primitives.

Do you need to update user documentation, design documentation or monitoring documentation?

No.

Release note

None

Summary by CodeRabbit

  • New Features

    • Added AES-256-CTR encryption/decryption and secure IV generation.
    • Introduced a versioned encrypted data format with 3-byte data key identifiers.
    • Added types and utilities for managing encryption metadata, keys, and epochs.
  • Tests

    • Added unit tests for cipher operations and the encryption data format.
  • Chores

    • Added normalized encryption-related error types for clearer error reporting.

tenfyzhong and others added 4 commits July 31, 2026 11:29
Signed-off-by: tenfyzhong <tenfy@tenfy.cn>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: nhsmw <nhsmwk@gmail.com>
Signed-off-by: tenfyzhong <tenfy@tenfy.cn>
@ti-chi-bot ti-chi-bot added lgtm release-note-none Denotes a PR that doesn't merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. type/cherry-pick-for-release-8.5 This PR is cherry-picked to release-8.5 from a source PR. labels Jul 31, 2026
@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 9e120da2-0303-4f8a-a59c-d5cb1662349e

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ti-chi-bot

ti-chi-bot Bot commented Jul 31, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: tenfyzhong

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot Bot added approved cherry-pick-approved Cherry pick PR approved by release team. and removed do-not-merge/cherry-pick-not-approved labels Jul 31, 2026
@ti-chi-bot
ti-chi-bot Bot merged commit c9a7c99 into pingcap:release-8.5 Aug 1, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved cherry-pick-approved Cherry pick PR approved by release team. lgtm release-note-none Denotes a PR that doesn't merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. type/cherry-pick-for-release-8.5 This PR is cherry-picked to release-8.5 from a source PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants