Page MenuHomePhabricator

Implement log encryption using native AES utilities
ClosedPublic

Authored by marcin on Jan 26 2024, 7:26 AM.
Tags
None
Referenced Files
F3352466: D10838.diff
Sat, Nov 23, 6:03 AM
Unknown Object (File)
Thu, Nov 14, 9:42 PM
Unknown Object (File)
Wed, Nov 13, 3:05 PM
Unknown Object (File)
Wed, Nov 6, 5:52 PM
Unknown Object (File)
Oct 15 2024, 1:04 PM
Unknown Object (File)
Oct 15 2024, 1:03 PM
Unknown Object (File)
Oct 15 2024, 1:03 PM
Unknown Object (File)
Oct 15 2024, 1:03 PM
Subscribers

Details

Summary

This differential:

  1. Refactors our native AES crypto API so that it can work both with std::vector<std::uint8_t>& and rust::Slice<std::uint8_t>.
  2. Uses AES crypto API to encrypt log files.
  3. Introduces additional encryption key to encrypt log files. This key lifecycle is tightly coupled with encryption key lifecycle used to encrypt latest compaction.

Why new encryption key? Cutting SQLCipher encryption key in half to make it 32 bytes is incorrect - keys should be created from each other using KDF. In order to correctly use KDF to create 32 byte key for logs from 64 byte SQLCipher key we would have to:

  1. Implement creation of master key that is not used to encrypt anything.
  2. Dig into native crypto API to expose to common C++ some KDF (SHA256 could be fine).
  3. Refactor SQLCipher encryption key to be derived from master key.
  4. Derive logs encryption key from master key.

For now it is too much work we don't have cycles for so we are just creating brand new 32 key and make sure its lifecycle is strictly coupled with SQLCipher encryption key.
It was discussed with Yiannis.

Test Plan

Same as for parent differential but this time ensure that logs don't have any human-readable content (not attachments - they remain unencrypted)

Diff Detail

Repository
rCOMM Comm
Branch
marcin/eng-5264
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

Harbormaster returned this revision to the author for changes because remote builds failed.Jan 26 2024, 7:33 AM
Harbormaster failed remote builds in B26187: Diff 36169!

I forgot to re-build WASM - fixing that

Harbormaster returned this revision to the author for changes because remote builds failed.Jan 26 2024, 8:15 AM
Harbormaster failed remote builds in B26191: Diff 36173!
This revision is now accepted and ready to land.Feb 2 2024, 10:01 AM