Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: authentication primitives: improved security and performance infos (master) #6667

Merged
merged 5 commits into from
May 14, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions docs/internals/security.rst
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ Depending on the chosen mode (see :ref:`borg_init`) different AEAD ciphers are u

The chunk ID is derived via a MAC over the plaintext (mac key taken from borg key):

- HMAC-SHA256 - super fast IF you have hw accelerated SHA256.
- HMAC-SHA256 - super fast IF you have hw accelerated SHA256 (see section "Encryption" below).
- Blake2b - very fast, purely software based algorithm.

For each borg invocation, a new session id is generated by `os.urandom`_.
Expand Down Expand Up @@ -223,14 +223,17 @@ Depending on the chosen mode (see :ref:`borg_init`) different primitives are use
and is also tracked locally on the client to avoid counter reuse.

- The authentication primitive is either HMAC-SHA-256 or BLAKE2b-256
in a keyed mode. HMAC-SHA-256 uses 256 bit keys, while BLAKE2b-256
uses 512 bit keys.

The latter is secure not only because BLAKE2b itself is not
susceptible to `length extension`_, but also since it truncates the
hash output from 512 bits to 256 bits, which would make the
construction safe even if BLAKE2b were broken regarding length
extension or similar attacks.
in a keyed mode.

Both HMAC-SHA-256 and BLAKE2b have undergone extensive cryptanalysis
and have proven secure against known attacks. The known vulnerability
of SHA-256 against length extension attacks does not apply to HMAC-SHA-256.

The authentication primitive should be chosen based upon SHA hardware support:
AMD Ryzen and new 12th+ Generation Intel Core processors (beginning with
ThomasWaldmann marked this conversation as resolved.
Show resolved Hide resolved
the Alder Lake architecture) support SHA extensions and are likely to perform
best with HMAC-SHA-256. Among ARM processors, support for SHA extensions varies.
ThomasWaldmann marked this conversation as resolved.
Show resolved Hide resolved
64-bit CPUs without SHA extensions are likely to perform best with BLAKE2b.

- The primitive used for authentication is always the same primitive
that is used for deriving the chunk ID, but they are always
Expand Down