Merge branch 'each-style-tweak' into 'master'

adjust clang-format options to get closer to ISC style

See merge request isc-projects/bind9!3061

(cherry picked from commit d3b49b6675)

0255a974 revise .clang-format and add a C formatting script in util
e851ed0b apply the modified style
This commit is contained in:
Ondřej Surý
2020-02-14 05:35:17 +00:00
parent c646c20e79
commit cdef20bb66
672 changed files with 36044 additions and 42228 deletions

View File

@@ -61,14 +61,12 @@
#define CLOCK_REALTIME 0
#endif /* ifndef CLOCK_REALTIME */
static int
clock_gettime(int32_t id, struct timespec *tp);
static int clock_gettime(int32_t id, struct timespec *tp);
static int
clock_gettime(int32_t id, struct timespec *tp)
{
clock_gettime(int32_t id, struct timespec *tp) {
struct timeval tv;
int result;
int result;
UNUSED(id);
@@ -85,28 +83,27 @@ static CK_BBOOL truevalue = TRUE;
static CK_BBOOL falsevalue = FALSE;
int
main(int argc, char *argv[])
{
isc_result_t result;
CK_RV rv;
CK_SLOT_ID slot = 0;
main(int argc, char *argv[]) {
isc_result_t result;
CK_RV rv;
CK_SLOT_ID slot = 0;
CK_SESSION_HANDLE hSession = CK_INVALID_HANDLE;
CK_MECHANISM mech = { CKM_RSA_PKCS_KEY_PAIR_GEN, NULL, 0 };
CK_MECHANISM mech = { CKM_RSA_PKCS_KEY_PAIR_GEN, NULL, 0 };
CK_OBJECT_HANDLE *pubKey;
CK_OBJECT_HANDLE *privKey;
CK_OBJECT_CLASS pubClass = CKO_PUBLIC_KEY;
CK_OBJECT_CLASS privClass = CKO_PRIVATE_KEY;
CK_KEY_TYPE kType = CKK_RSA;
CK_ULONG bits = 1024;
CK_BYTE exponent[] = { 0x01, 0x00, 0x01 };
CK_ATTRIBUTE pubTemplate[] = {
{ CKA_CLASS, &pubClass, (CK_ULONG)sizeof(pubClass) },
{ CKA_KEY_TYPE, &kType, (CK_ULONG)sizeof(kType) },
{ CKA_TOKEN, &falsevalue, (CK_ULONG)sizeof(falsevalue) },
{ CKA_PRIVATE, &falsevalue, (CK_ULONG)sizeof(falsevalue) },
{ CKA_VERIFY, &truevalue, (CK_ULONG)sizeof(truevalue) },
{ CKA_MODULUS_BITS, &bits, (CK_ULONG)sizeof(bits) },
{ CKA_PUBLIC_EXPONENT, exponent, (CK_ULONG)sizeof(exponent) }
CK_OBJECT_CLASS pubClass = CKO_PUBLIC_KEY;
CK_OBJECT_CLASS privClass = CKO_PRIVATE_KEY;
CK_KEY_TYPE kType = CKK_RSA;
CK_ULONG bits = 1024;
CK_BYTE exponent[] = { 0x01, 0x00, 0x01 };
CK_ATTRIBUTE pubTemplate[] = {
{ CKA_CLASS, &pubClass, (CK_ULONG)sizeof(pubClass) },
{ CKA_KEY_TYPE, &kType, (CK_ULONG)sizeof(kType) },
{ CKA_TOKEN, &falsevalue, (CK_ULONG)sizeof(falsevalue) },
{ CKA_PRIVATE, &falsevalue, (CK_ULONG)sizeof(falsevalue) },
{ CKA_VERIFY, &truevalue, (CK_ULONG)sizeof(truevalue) },
{ CKA_MODULUS_BITS, &bits, (CK_ULONG)sizeof(bits) },
{ CKA_PUBLIC_EXPONENT, exponent, (CK_ULONG)sizeof(exponent) }
};
CK_ATTRIBUTE privTemplate[] = {
{ CKA_CLASS, &privClass, (CK_ULONG)sizeof(privClass) },
@@ -115,15 +112,15 @@ main(int argc, char *argv[])
{ CKA_PRIVATE, &truevalue, (CK_ULONG)sizeof(truevalue) },
{ CKA_SIGN, &truevalue, (CK_ULONG)sizeof(truevalue) },
};
pk11_context_t pctx;
pk11_optype_t op_type = OP_RSA;
char * lib_name = NULL;
char * pin = NULL;
int error = 0;
int c, errflg = 0;
int ontoken = 0;
unsigned int count = 1000;
unsigned int i;
pk11_context_t pctx;
pk11_optype_t op_type = OP_RSA;
char *lib_name = NULL;
char *pin = NULL;
int error = 0;
int c, errflg = 0;
int ontoken = 0;
unsigned int count = 1000;
unsigned int i;
struct timespec starttime;
struct timespec endtime;
@@ -201,7 +198,8 @@ main(int argc, char *argv[])
(const char *)pin, slot);
if ((result != ISC_R_SUCCESS) && (result != PK11_R_NORANDOMSERVICE) &&
(result != PK11_R_NODIGESTSERVICE) &&
(result != PK11_R_NOAESSERVICE)) {
(result != PK11_R_NOAESSERVICE))
{
fprintf(stderr, "Error initializing PKCS#11: %s\n",
isc_result_totext(result));
exit(1);