Skip to content

Commit

Permalink
Intergate native_rust_library C++ fiels with clang formatting
Browse files Browse the repository at this point in the history
Summary: This differential integrates `native_rust_library` with clang formatting. Formatting of generated files is avoided.

Test Plan:
1. Apply this diff.
2. Run `git reset --soft HEAD~1` to undo the commit but keep changes.
3. Undo file changes in C++ files.
4. Run `yarn clang-format-all` end expect that file changes are back.

Reviewers: varun, michal, bartek

Reviewed By: bartek

Subscribers: ashoat, tomek

Differential Revision: https://phab.comm.dev/D10330
  • Loading branch information
marcinwasowicz committed Dec 14, 2023
1 parent 3200406 commit 1158f5b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
14 changes: 10 additions & 4 deletions native/native_rust_library/RustAESCrypto.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,22 @@

namespace comm {

void aesGenerateKey(rust::Slice<uint8_t> buffer){
void aesGenerateKey(rust::Slice<uint8_t> buffer) {
AESCrypto::generateKey(buffer);
}

void aesEncrypt(rust::Slice<uint8_t> key, rust::Slice<uint8_t> plaintext, rust::Slice<uint8_t> sealedData){
void aesEncrypt(
rust::Slice<uint8_t> key,
rust::Slice<uint8_t> plaintext,
rust::Slice<uint8_t> sealedData) {
AESCrypto::encrypt(key, plaintext, sealedData);
}

void aesDecrypt(rust::Slice<uint8_t> key, rust::Slice<uint8_t> sealedData, rust::Slice<uint8_t> plaintext){
void aesDecrypt(
rust::Slice<uint8_t> key,
rust::Slice<uint8_t> sealedData,
rust::Slice<uint8_t> plaintext) {
AESCrypto::decrypt(key, sealedData, plaintext);
}

}
} // namespace comm
10 changes: 8 additions & 2 deletions native/native_rust_library/RustAESCrypto.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@
namespace comm {

void aesGenerateKey(rust::Slice<uint8_t> buffer);
void aesEncrypt(rust::Slice<uint8_t> key, rust::Slice<uint8_t> plaintext, rust::Slice<uint8_t> sealedData);
void aesDecrypt(rust::Slice<uint8_t> key, rust::Slice<uint8_t> sealedData, rust::Slice<uint8_t> plaintext);
void aesEncrypt(
rust::Slice<uint8_t> key,
rust::Slice<uint8_t> plaintext,
rust::Slice<uint8_t> sealedData);
void aesDecrypt(
rust::Slice<uint8_t> key,
rust::Slice<uint8_t> sealedData,
rust::Slice<uint8_t> plaintext);

} // namespace comm
5 changes: 5 additions & 0 deletions scripts/get_clang_paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ const clangPaths = [
extensions: ['java'],
excludes: ['generated'],
},
{
path: 'native/native_rust_library',
extensions: ['cpp', 'h'],
excludes: ['target', 'lib.rs.h', 'cxx.h'],
},
{
path: 'web/cpp',
extensions: ['cpp', 'h'],
Expand Down

0 comments on commit 1158f5b

Please sign in to comment.