aboutsummaryrefslogtreecommitdiff
path: root/.clang-format
AgeCommit message (Collapse)AuthorFilesLines
2023-11-21Use InsertBraces - and reformat pki as suchBob Beck1-0/+1
Bug: 659 Change-Id: I48eeda0bcd0de45d70644c321138225f83cb6c60 Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/64107 Reviewed-by: David Benjamin <davidben@google.com> Commit-Queue: Bob Beck <bbe@google.com> Auto-Submit: Bob Beck <bbe@google.com>
2023-02-03Fix some clang-format formatting.David Benjamin1-1/+1
I forgot to put ASN1_CHOICE_END_cb in the StatementMacros list, which caused it to mangle the formatting a bit. Also remove the duplicate ASN1_SEQUENCE_END. Change-Id: I58b6c6f028b81fb717722e02260f3dfaa4d17e4b Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/56665 Reviewed-by: Bob Beck <bbe@google.com> Commit-Queue: David Benjamin <davidben@google.com>
2022-07-11Const-correct the i2d/dup functions we can.David Benjamin1-0/+1
Types which do not contain an X509_NAME can be const. X509_NAME still requires some thought. (i2d_X509_NAME can mutate the object and isn't even thread-safe when modified.) Bug: 407 Change-Id: Iceafa2b4ea9c4194cfcc3044d90393b5d91f7c11 Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/53305 Reviewed-by: Bob Beck <bbe@google.com> Commit-Queue: Bob Beck <bbe@google.com>
2022-05-30Convince clang-format to handle ASN1_ITEM definitions betterDavid Benjamin1-0/+11
Adding the ending macros to StatementMacros tells clang-format the macro terminates a statement. Adding trailing commas in the middle keeps it from trying to bundle the curly brace with the next statement. Also add a few other trailing commas that clang-format otherwise indents awkwardly. Change-Id: I0b2ba9cf07bc775649fa1e92de3e5bb2e2b0b20b Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/52728 Reviewed-by: Bob Beck <bbe@google.com> Commit-Queue: Bob Beck <bbe@google.com>
2021-10-05Remove remnants of ASN.1 print function generators.David Benjamin1-2/+0
This was removed in https://boringssl-review.googlesource.com/c/boringssl/+/8242/, but I missed the function declaration macros. Change-Id: I1caca90b8d2fa95791402de32ff2be4a6f4fbe75 Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49785 Reviewed-by: Adam Langley <agl@google.com>
2021-09-09Reject missing required fields in i2d functions.David Benjamin1-0/+1
See also 006906cddda37e24a66443199444ef4476697477 from OpenSSL, though this CL uses a different strategy from upstream. Upstream makes ASN1_item_ex_i2d continue to allow optionals and checks afterwards at every non-optional call site. This CL pushes down an optional parameter and says functions cannot omit items unless explicitly allowed. I think this is a better default, though it is a larger change. Fields are only optional when they come from an ASN1_TEMPLATE with the OPTIONAL flag. Upstream's strategy misses top-level calls. This CL additionally adds checks for optional ASN1_TEMPLATEs in contexts where it doesn't make sense. Only fields of SEQUENCEs and SETs may be OPTIONAL, but the ASN1_ITEM/ASN1_TEMPLATE split doesn't quite match ASN.1 itself. ASN1_TEMPLATE is additionally responsible for explicit/implicit tagging, and SEQUENCE/SET OF. That means CHOICE arms and the occasional top-level type (ASN1_ITEM_TEMPLATE) use ASN1_TEMPLATE but will get confused if marked optional. As part of this, i2d_FOO(NULL) now returns -1 rather than "successfully" writing 0 bytes. If we want to allow NULL at the top-level, that's not too hard to arrange, but our CBB-based i2d functions do not. Update-Note: Structures with missing mandatory fields can no longer be encoded. Note that, apart from the cases already handled by preceding CLs, tasn_new.c will fill in non-NULL empty objects everywhere. The main downstream impact I've seen of this particular change is in combination with other bugs. Consider a caller that does: GENERAL_NAME *name = GENERAL_NAME_new(); name->type = GEN_DNS; name->d.dNSName = DoSomethingComplicated(...); Suppose DoSomethingComplicated() was actually fallible and returned NULL, but the caller forgot to check. They'd now construct a GENERAL_NAME with a missing field. Previously, this would silently serialize some garbage (omitted field) or empty string. Now we fail to encode, but the true error was the uncaught DoSomethingComplicated() failure. (Which likely was itself a bug.) Bug: 429 Change-Id: I37fe618761be64a619be9fdc8d416f24ecbb8c46 Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49350 Commit-Queue: David Benjamin <davidben@google.com> Reviewed-by: Adam Langley <agl@google.com>
2020-12-08Reject bad ASN.1 templates with implicitly-tagged CHOICEs.David Benjamin1-0/+13
This imports 1ecc76f6746cefd502c7e9000bdfa4e5d7911386 and 41d62636fd996c031c0c7cef746476278583dc9e from upstream. These would have rejected the mistake in OpenSSL's EDIPartyName sturcture. Change-Id: I4eb218f9372bea0f7ff302321b9dc1992ef0c13a Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/44424 Commit-Queue: David Benjamin <davidben@google.com> Reviewed-by: Adam Langley <agl@google.com>
2020-11-12Reformat and convert comments in asn1.h.David Benjamin1-0/+10
Some of the X509 functions are hard to document without first documenting the ASN.1 types themselves. (ASN1_TYPE's goofy representation is leaked everywhere.) Change-Id: I0adcf055414925f9e39c8293cbd42d29f0db3143 Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/44044 Reviewed-by: Adam Langley <agl@google.com>
2020-10-09clang-format pem.h and convert comments.David Benjamin1-1/+34
Change-Id: Ic35a94eaeff96083ef727907166fb96daed9f8e8 Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/43425 Reviewed-by: Adam Langley <agl@google.com>
2020-09-29Tell clang-format that STACK_OF and LHASH_OF are types.David Benjamin1-0/+1
If clang-format sees STACK_OF(T) *foo, it has a hard time telling whether * is a multiplication or a pointer and often indents things wrong. There is now a TypenameMacros option to fix this. Change-Id: I235f2f40ef32760e0232da265e78a4fbd5f187a0 Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/43145 Reviewed-by: Adam Langley <agl@google.com>
2020-07-23Switch clang-format IncludeBlocks to Preserve.David Benjamin1-0/+4
clang-format now reorders includes. It used to simply sort within blocks, but later it added a "regroup" option. The regroup option is a bit aggressive and does not take into account our project headers being referenced in <system/header.h> style. (It also won't be able to recognize the header corresponding to the source file, but perhaps we should drop that rule.) For now, just revert it to Preserve. Change-Id: Ief82b5c3f91c16a8def14f91ef6bf6cde502bb79 Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/42265 Reviewed-by: Adam Langley <agl@google.com>
2016-04-26Import `newhope' (post-quantum key exchange).Matt Braithwaite1-0/+3
This derives from the reference implementation: Source: https://github.com/tpoeppelmann/newhope/tree/master/ref at bc06c1ac Paper: https://eprint.iacr.org/2015/1092 However, it does not interoperate, due to the replacement of SHAKE-128 with AES-CTR (for polynomial generation) and the replacement of SHA-3 with SHA-256 (for key whitening). Change-Id: I6a55507aea85331245e2fbd41bae5cc049fdca3c Reviewed-on: https://boringssl-review.googlesource.com/7690 Reviewed-by: Adam Langley <agl@google.com>
2014-06-20Inital import.Adam Langley1-0/+4
Initial fork from f2d678e6e89b6508147086610e985d4e8416e867 (1.0.2 beta). (This change contains substantial changes from the original and effectively starts a new history.)