-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
clang-format almost all first-party code
Added a .clang-format file and auto-formatted almost all first-party code (all except core/include/config.h). Required some additional #include directives in a few headers, due to changes in #include ordering. Also fixed up CMakeLists.txt: - aes_gcm_dev.h is only included in dev builds - aes_gcm_ncipher.h is only included in ncipher builds. Required some additional #include directives in a few headers, due to changes in #include ordering.
- Loading branch information
Showing
61 changed files
with
1,011 additions
and
786 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,225 @@ | ||
# see https://clang.llvm.org/docs/ClangFormatStyleOptions.html | ||
--- | ||
# BasedOnStyle: Mozilla | ||
|
||
Language: Cpp | ||
AccessModifierOffset: -2 | ||
AlignAfterOpenBracket: AlwaysBreak | ||
AlignArrayOfStructures: None | ||
AlignConsecutiveAssignments: | ||
Enabled: false | ||
AcrossEmptyLines: false | ||
AcrossComments: false | ||
AlignCompound: false | ||
PadOperators: true | ||
AlignConsecutiveBitFields: | ||
Enabled: false | ||
AcrossEmptyLines: false | ||
AcrossComments: false | ||
AlignCompound: false | ||
PadOperators: false | ||
AlignConsecutiveDeclarations: | ||
Enabled: false | ||
AcrossEmptyLines: false | ||
AcrossComments: false | ||
AlignCompound: false | ||
PadOperators: false | ||
AlignConsecutiveMacros: | ||
Enabled: false | ||
AcrossEmptyLines: false | ||
AcrossComments: false | ||
AlignCompound: false | ||
PadOperators: false | ||
AlignEscapedNewlines: Left | ||
AlignOperands: Align | ||
AlignTrailingComments: | ||
Kind: Always | ||
OverEmptyLines: 0 | ||
AllowAllArgumentsOnNextLine: true | ||
AllowAllParametersOfDeclarationOnNextLine: false | ||
AllowShortBlocksOnASingleLine: Never | ||
AllowShortCaseLabelsOnASingleLine: false | ||
AllowShortEnumsOnASingleLine: true | ||
AllowShortFunctionsOnASingleLine: Inline | ||
AllowShortIfStatementsOnASingleLine: Never | ||
AllowShortLambdasOnASingleLine: All | ||
AllowShortLoopsOnASingleLine: false | ||
AlwaysBreakAfterDefinitionReturnType: None | ||
AlwaysBreakAfterReturnType: None | ||
AlwaysBreakBeforeMultilineStrings: false | ||
AlwaysBreakTemplateDeclarations: Yes | ||
AttributeMacros: | ||
- __capability | ||
BinPackArguments: false | ||
BinPackParameters: false | ||
BitFieldColonSpacing: Both | ||
BraceWrapping: | ||
AfterCaseLabel: false | ||
AfterClass: true | ||
AfterControlStatement: Never | ||
AfterEnum: true | ||
AfterExternBlock: true | ||
AfterFunction: false | ||
AfterNamespace: false | ||
AfterObjCDeclaration: false | ||
AfterStruct: false | ||
AfterUnion: false | ||
BeforeCatch: false | ||
BeforeElse: true | ||
BeforeLambdaBody: false | ||
BeforeWhile: false | ||
IndentBraces: false | ||
SplitEmptyFunction: false | ||
SplitEmptyRecord: false | ||
SplitEmptyNamespace: true | ||
BreakAfterAttributes: Never | ||
BreakAfterJavaFieldAnnotations: false | ||
BreakArrays: true | ||
BreakBeforeBinaryOperators: None | ||
BreakBeforeConceptDeclarations: Always | ||
BreakBeforeBraces: Attach | ||
BreakBeforeInlineASMColon: OnlyMultiline | ||
BreakBeforeTernaryOperators: true | ||
BreakConstructorInitializers: BeforeComma | ||
BreakInheritanceList: BeforeComma | ||
BreakStringLiterals: true | ||
ColumnLimit: 120 | ||
CommentPragmas: '^ IWYU pragma:' | ||
CompactNamespaces: false | ||
ConstructorInitializerIndentWidth: 2 | ||
ContinuationIndentWidth: 4 | ||
Cpp11BracedListStyle: false | ||
DerivePointerAlignment: false | ||
DisableFormat: false | ||
EmptyLineAfterAccessModifier: Never | ||
EmptyLineBeforeAccessModifier: LogicalBlock | ||
ExperimentalAutoDetectBinPacking: false | ||
FixNamespaceComments: false | ||
ForEachMacros: | ||
- foreach | ||
- Q_FOREACH | ||
- BOOST_FOREACH | ||
IfMacros: | ||
- KJ_IF_MAYBE | ||
IncludeBlocks: Regroup | ||
IncludeCategories: | ||
- Regex: '^"(llvm|llvm-c|clang|clang-c)/' | ||
Priority: 2 | ||
SortPriority: 0 | ||
CaseSensitive: false | ||
- Regex: '^(<|"(gtest|gmock|isl|json)/)' | ||
Priority: 3 | ||
SortPriority: 0 | ||
CaseSensitive: false | ||
- Regex: '.*' | ||
Priority: 1 | ||
SortPriority: 0 | ||
CaseSensitive: false | ||
IncludeIsMainRegex: '(Test)?$' | ||
IncludeIsMainSourceRegex: '' | ||
IndentAccessModifiers: false | ||
IndentCaseBlocks: false | ||
IndentCaseLabels: false | ||
IndentExternBlock: AfterExternBlock | ||
IndentGotoLabels: true | ||
IndentPPDirectives: BeforeHash | ||
IndentRequiresClause: true | ||
IndentWidth: 2 | ||
IndentWrappedFunctionNames: false | ||
InsertBraces: true | ||
InsertNewlineAtEOF: true | ||
InsertTrailingCommas: None | ||
IntegerLiteralSeparator: | ||
Binary: 0 | ||
BinaryMinDigits: 0 | ||
Decimal: 0 | ||
DecimalMinDigits: 0 | ||
Hex: 0 | ||
HexMinDigits: 0 | ||
JavaScriptQuotes: Leave | ||
JavaScriptWrapImports: true | ||
KeepEmptyLinesAtTheStartOfBlocks: false | ||
LambdaBodyIndentation: Signature | ||
LineEnding: DeriveLF | ||
MacroBlockBegin: '' | ||
MacroBlockEnd: '' | ||
MaxEmptyLinesToKeep: 1 | ||
NamespaceIndentation: None | ||
ObjCBinPackProtocolList: Auto | ||
ObjCBlockIndentWidth: 2 | ||
ObjCBreakBeforeNestedBlockParam: true | ||
ObjCSpaceAfterProperty: true | ||
ObjCSpaceBeforeProtocolList: false | ||
PackConstructorInitializers: BinPack | ||
PenaltyBreakAssignment: 2 | ||
PenaltyBreakBeforeFirstCallParameter: 19 | ||
PenaltyBreakComment: 300 | ||
PenaltyBreakFirstLessLess: 120 | ||
PenaltyBreakOpenParenthesis: 0 | ||
PenaltyBreakString: 1000 | ||
PenaltyBreakTemplateDeclaration: 10 | ||
PenaltyExcessCharacter: 1000000 | ||
PenaltyIndentedWhitespace: 0 | ||
PenaltyReturnTypeOnItsOwnLine: 200 | ||
PointerAlignment: Left | ||
PPIndentWidth: -1 | ||
QualifierAlignment: Leave | ||
ReferenceAlignment: Pointer | ||
ReflowComments: true | ||
RemoveBracesLLVM: false | ||
RemoveSemicolon: true | ||
RequiresClausePosition: OwnLine | ||
RequiresExpressionIndentation: OuterScope | ||
SeparateDefinitionBlocks: Always | ||
ShortNamespaceLines: 1 | ||
SortIncludes: CaseSensitive | ||
SortJavaStaticImport: Before | ||
SortUsingDeclarations: LexicographicNumeric | ||
SpaceAfterCStyleCast: true | ||
SpaceAfterLogicalNot: false | ||
SpaceAfterTemplateKeyword: false | ||
SpaceAroundPointerQualifiers: Default | ||
SpaceBeforeAssignmentOperators: true | ||
SpaceBeforeCaseColon: false | ||
SpaceBeforeCpp11BracedList: false | ||
SpaceBeforeCtorInitializerColon: true | ||
SpaceBeforeInheritanceColon: true | ||
SpaceBeforeParens: ControlStatements | ||
SpaceBeforeParensOptions: | ||
AfterControlStatements: true | ||
AfterForeachMacros: true | ||
AfterFunctionDefinitionName: false | ||
AfterFunctionDeclarationName: false | ||
AfterIfMacros: true | ||
AfterOverloadedOperator: false | ||
AfterRequiresInClause: false | ||
AfterRequiresInExpression: false | ||
BeforeNonEmptyParentheses: false | ||
SpaceBeforeRangeBasedForLoopColon: true | ||
SpaceBeforeSquareBrackets: false | ||
SpaceInEmptyBlock: false | ||
SpaceInEmptyParentheses: false | ||
SpacesBeforeTrailingComments: 1 | ||
SpacesInAngles: Never | ||
SpacesInConditionalStatement: false | ||
SpacesInContainerLiterals: false | ||
SpacesInCStyleCastParentheses: false | ||
SpacesInLineCommentPrefix: | ||
Minimum: 1 | ||
Maximum: -1 | ||
SpacesInParentheses: false | ||
SpacesInSquareBrackets: false | ||
Standard: Latest | ||
StatementAttributeLikeMacros: | ||
- Q_EMIT | ||
StatementMacros: | ||
- Q_UNUSED | ||
- QT_REQUIRE_VERSION | ||
TabWidth: 8 | ||
UseTab: Never | ||
WhitespaceSensitiveMacros: | ||
- BOOST_PP_STRINGIZE | ||
- CF_SWIFT_NAME | ||
- NS_SWIFT_NAME | ||
- PP_STRINGIZE | ||
- STRINGIZE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
DisableFormat: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,27 @@ | ||
#pragma once | ||
|
||
#include <nfastapp.h> | ||
#include <squareup/subzero/internal.pb.h> // For error codes | ||
#include <stdint.h> | ||
|
||
/* This header is meant for the nCipher target, and should only be included in the | ||
* codesafe/ncipher implementation */ | ||
|
||
// magic string for binary static analysis | ||
// aes_gcm_ncipher:$(echo -n "aes_gcm_ncipher" | sha256sum | cut -c1-16) | ||
#define MAGIC "aes_gcm_ncipher:ffb944993c73a1d3" | ||
|
||
Result aes_gcm_encrypt(M_KeyID keyId, uint8_t *plaintext, size_t plaintext_len, | ||
uint8_t *ciphertext, size_t ciphertext_len, | ||
size_t *bytes_written); | ||
Result aes_gcm_decrypt(M_KeyID keyId, const uint8_t *ciphertext, | ||
size_t ciphertext_len, uint8_t *plaintext, | ||
size_t plaintext_len, size_t *bytes_written); | ||
Result aes_gcm_encrypt( | ||
M_KeyID keyId, | ||
uint8_t* plaintext, | ||
size_t plaintext_len, | ||
uint8_t* ciphertext, | ||
size_t ciphertext_len, | ||
size_t* bytes_written); | ||
Result aes_gcm_decrypt( | ||
M_KeyID keyId, | ||
const uint8_t* ciphertext, | ||
size_t ciphertext_len, | ||
uint8_t* plaintext, | ||
size_t plaintext_len, | ||
size_t* bytes_written); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,4 +41,4 @@ int verify_conv_btc_to_satoshi(void); | |
ERROR("got: %s", value); \ | ||
return -1; \ | ||
} \ | ||
} while(0) | ||
} while (0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
#pragma once | ||
|
||
#include "config.h" | ||
|
||
#include <squareup/subzero/common.pb.h> | ||
#include <squareup/subzero/internal.pb.h> | ||
#include <stdint.h> | ||
|
||
#include "config.h" | ||
|
||
Result mix_entropy(uint8_t wallet_entropy[static MASTER_SEED_SIZE], | ||
const InternalCommandRequest* const in); | ||
Result mix_entropy(uint8_t wallet_entropy[static MASTER_SEED_SIZE], const InternalCommandRequest* const in); |
Oops, something went wrong.