Skip to content

legacy: move hardlink helpers, NSIndex1, AES, and PBKDF2 key file methods to borg.legacy, refs #9556#9664

Merged
ThomasWaldmann merged 5 commits into
borgbackup:masterfrom
mr-raj12:legacy-phase6-crypto
May 26, 2026
Merged

legacy: move hardlink helpers, NSIndex1, AES, and PBKDF2 key file methods to borg.legacy, refs #9556#9664
ThomasWaldmann merged 5 commits into
borgbackup:masterfrom
mr-raj12:legacy-phase6-crypto

Conversation

@mr-raj12

@mr-raj12 mr-raj12 commented May 23, 2026

Copy link
Copy Markdown
Contributor

Description

Moves four borg 1.x components into borg.legacy, refs #9556.

  • helpers/fs.pylegacy/helpers.py: hardlink helper functions
  • hashindex.pyxlegacy/hashindex.py: NSIndex1 (borg 1.x hash index format)
  • crypto/low_level.pyxlegacy/crypto/low_level.pyx: cdef class AES (AES-256-CTR for borg 1.x key file encryption)
  • crypto/key.pylegacy/crypto/key.py: PBKDF2 key file methods extracted into Pbkdf2FileMixin

AES needs its own .pyx , cdef types can't live in a .py file and can't be shared across binary extensions. ro_buffer (a cdef helper) is duplicated rather than imported.

setup.py and pyproject.toml updated to build and type-check borg.legacy.crypto.low_level. All consumer imports updated. No logic changes.

Refs #9556

Checklist

  • PR is against master
  • New code has tests
  • Tests pass
  • Commit message references related issue

@codecov

codecov Bot commented May 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.00000% with 28 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.78%. Comparing base (b0f3096) to head (228ac45).
⚠️ Report is 22 commits behind head on master.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/borg/legacy/hashindex.py 83.52% 7 Missing and 7 partials ⚠️
src/borg/legacy/crypto/key.py 68.29% 10 Missing and 3 partials ⚠️
src/borg/crypto/key.py 66.66% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9664      +/-   ##
==========================================
+ Coverage   83.00%   83.78%   +0.77%     
==========================================
  Files          90       92       +2     
  Lines       15549    15653     +104     
  Branches     2340     2356      +16     
==========================================
+ Hits        12907    13115     +208     
+ Misses       1887     1796      -91     
+ Partials      755      742      -13     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ThomasWaldmann

Copy link
Copy Markdown
Member

Somehow the tests didn't pass in CI.

@mr-raj12

Copy link
Copy Markdown
Contributor Author

Somehow the tests didn't pass in CI.

Fixing

Comment thread src/borg/testsuite/crypto/crypto_test.py

@ThomasWaldmann ThomasWaldmann left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

About the kdf benchmarking: thinking about it, guess we should just not do that.

kdfs are supposed to be slow, so not much point in benchmarking them.

IIRC the benchmark outputs even a note about that.

@mr-raj12

Copy link
Copy Markdown
Contributor Author

LGTM.

About the kdf benchmarking: thinking about it, guess we should just not do that.

kdfs are supposed to be slow, so not much point in benchmarking them.

IIRC the benchmark outputs even a note about that.

Should I remove the KDF section here or handle it in a follow-up PR?

@ThomasWaldmann

ThomasWaldmann commented May 23, 2026 via email

Copy link
Copy Markdown
Member

@mr-raj12 mr-raj12 mentioned this pull request May 24, 2026
4 tasks
@ThomasWaldmann

Copy link
Copy Markdown
Member

pbkdf2 stays in FlexiKey since benchmark_cmd.py calls it directly.

Not anymore. :)

@ThomasWaldmann

Copy link
Copy Markdown
Member

@mr-raj12 are you working on moving the pbkdf2 related code?

@mr-raj12

Copy link
Copy Markdown
Contributor Author

@mr-raj12 are you working on moving the pbkdf2 related code?

Yes, will raise a PR for shortly

@ThomasWaldmann

Copy link
Copy Markdown
Member

If you don't want to put it into this PR, shall we merge this first?

@mr-raj12

Copy link
Copy Markdown
Contributor Author

If you don't want to put it into this PR, shall we merge this first?

Yaa, I'm working on it on a seperate branch

@ThomasWaldmann
ThomasWaldmann merged commit a461d72 into borgbackup:master May 26, 2026
19 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants