Leaflet icon indicating copy to clipboard operation
Leaflet copied to clipboard

Migrate cryptography to rust

Open gargakshit opened this issue 3 years ago • 0 comments

This comes with many benefits such as:

  • Speed. In fact, in our testing, backup times are slashed to under a second for 100 notes in debug mode. This can be improved by reducing memory copying and enabling hardware AES and SIMD in rustc flags.

  • Auditability. We use audited cryptography libraries such as ring and aes-gcm which provide better security.

  • Predictability. Due to the lack of a runtime, boxing and unboxing, the speed is predictable reducing many attacks which depend on timing information. The libraries are made to be run in constant-time which further improves security.

Todo

  • [ ] Setup build scripts to use hardware AES, SIMD and LTO when available
    • [X] x86_64-pc-msvc-windows
    • [X] x86_64-linux-android
    • [X] aarch64-linux-android
    • [X] armv7-linux-androideabi
    • [X] x86_64-apple-ios
    • [X] x86_64-apple-darwin
    • [X] aarch64-apple-ios
    • [X] aarch64-apple-ios-sim
  • [x] Remove debug log statements I added for testing
  • [x] Improve error checking on the rust side
  • [ ] ~~Perform final compatibility testing (some old backups fail to restore, List<int> to Uint8List issue migration suspected).~~ Implementations are 100% compatible. The system errors out with null folder, last_changed. Need to retain backwards compatibility with old backups @HrX03
  • [ ] Integrate cargo with build systems for
    • [X] Windows
    • [X] Android
    • [ ] Linux
    • [x] iOS
    • [x] macOS
  • [x] Add documentation for
    • [x] How to build
    • [x] Algorithm and file format

Signed-off-by: Akshit Garg [email protected]

gargakshit avatar Mar 03 '22 19:03 gargakshit