From 1287dabd0b23326be491125698dd982e4ae28887 Mon Sep 17 00:00:00 2001 From: x2018 Date: Tue, 26 Oct 2021 15:16:18 +0800 Subject: [PATCH] fix some code with obvious wrong coding style Reviewed-by: Tomas Mraz Reviewed-by: Richard Levitte Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/16918) --- apps/dgst.c | 2 +- apps/lib/app_libctx.c | 2 +- apps/lib/app_rand.c | 2 +- apps/lib/apps.c | 8 +++--- apps/lib/cmp_mock_srv.c | 2 +- apps/lib/s_cb.c | 2 +- apps/lib/vms_term_sock.c | 14 +++++----- apps/mac.c | 2 +- apps/ocsp.c | 2 +- apps/passwd.c | 2 +- apps/pkeyutl.c | 4 +-- apps/req.c | 2 +- apps/s_client.c | 4 +-- crypto/LPdir_unix.c | 2 +- crypto/aes/aes_x86core.c | 5 ++-- crypto/aria/aria.c | 2 +- crypto/bio/bio_addr.c | 12 ++++----- crypto/bn/asm/sparcv8.S | 8 +++--- crypto/bn/asm/sparcv8plus.S | 6 ++--- crypto/bn/bn_rsa_fips186_4.c | 2 +- crypto/cmp/cmp_msg.c | 2 +- crypto/cms/cms_env.c | 2 +- crypto/cpuid.c | 4 +-- crypto/ec/ec2_smpl.c | 2 +- crypto/ec/ec_ameth.c | 2 +- crypto/ec/ec_backend.c | 2 +- crypto/ec/ecp_nistz256.c | 2 +- crypto/ec/ecp_smpl.c | 4 +-- crypto/ec/ecx_meth.c | 2 +- crypto/evp/asymcipher.c | 2 +- crypto/evp/e_aes.c | 2 +- crypto/evp/e_aria.c | 26 +++++++++---------- crypto/evp/e_camellia.c | 16 ++++++------ crypto/evp/e_chacha20_poly1305.c | 2 +- crypto/evp/e_idea.c | 6 ++--- crypto/evp/e_seed.c | 2 +- crypto/evp/pmeth_lib.c | 8 +++--- crypto/ffc/ffc_params_generate.c | 8 +++--- crypto/lhash/lhash.c | 2 +- crypto/pkcs12/p12_sbag.c | 4 +-- crypto/ppccap.c | 2 +- crypto/property/property_parse.c | 8 +++--- crypto/rand/rand_egd.c | 6 ++--- crypto/rand/randfile.c | 4 +-- crypto/rsa/rsa_ameth.c | 2 +- crypto/rsa/rsa_backend.c | 2 +- crypto/rsa/rsa_pmeth.c | 2 +- crypto/rsa/rsa_sp800_56b_gen.c | 2 +- crypto/sha/keccak1600.c | 6 ++--- crypto/sm2/sm2_key.c | 2 +- crypto/srp/srp_vfy.c | 2 +- crypto/store/store_lib.c | 4 +-- crypto/x509/pcy_cache.c | 2 +- crypto/x509/pcy_node.c | 2 +- crypto/x509/v3_admis.c | 2 +- crypto/x509/v3_pcia.c | 14 +++++----- crypto/x509/x509_vfy.c | 2 +- crypto/x509/x_crl.c | 6 ++--- demos/digest/BIO_f_md.c | 16 ++++++------ demos/digest/EVP_MD_stdin.c | 2 +- demos/kdf/pbkdf2.c | 2 +- engines/e_afalg.c | 4 +-- engines/e_capi.c | 4 +-- engines/e_devcrypto.c | 2 +- engines/e_ossltest.c | 2 +- include/openssl/ct.h.in | 2 +- providers/common/provider_seeding.c | 2 +- .../implementations/ciphers/cipher_chacha20.c | 2 +- .../ciphers/ciphercommon_block.c | 2 +- .../encode_decode/encode_key2any.c | 2 +- providers/implementations/exchange/dh_exch.c | 2 +- .../implementations/exchange/ecdh_exch.c | 4 +-- providers/implementations/kdfs/pbkdf1.c | 2 +- providers/implementations/kdfs/pbkdf2.c | 2 +- providers/implementations/kdfs/pkcs12kdf.c | 2 +- providers/implementations/kdfs/pvkkdf.c | 2 +- providers/implementations/keymgmt/ec_kmgmt.c | 2 +- providers/implementations/rands/drbg_hash.c | 4 +-- .../implementations/rands/seeding/rand_unix.c | 2 +- .../implementations/rands/seeding/rand_vms.c | 2 +- .../rands/seeding/rand_vxworks.c | 2 +- providers/implementations/signature/rsa_sig.c | 6 ++--- ssl/d1_msg.c | 2 +- ssl/ssl_ciph.c | 4 +-- ssl/ssl_init.c | 2 +- ssl/ssl_lib.c | 2 +- ssl/statem/extensions_srvr.c | 2 +- ssl/statem/statem_clnt.c | 2 +- ssl/statem/statem_srvr.c | 2 +- ssl/tls13_enc.c | 2 +- test/bftest.c | 2 +- test/bio_enc_test.c | 2 +- test/bntest.c | 16 ++++++------ test/clienthellotest.c | 2 +- test/constant_time_test.c | 4 +-- test/defltfips_test.c | 2 +- test/dhtest.c | 2 +- test/ectest.c | 4 +-- test/evp_extra_test.c | 10 +++---- test/evp_kdf_test.c | 2 +- test/evp_test.c | 12 ++++----- test/helpers/handshake.c | 2 +- test/helpers/pkcs12.c | 2 +- test/helpers/ssltestlib.c | 8 +++--- test/modes_internal_test.c | 2 +- test/ossl_store_test.c | 2 +- test/param_build_test.c | 6 ++--- test/params_api_test.c | 4 +-- test/pkcs12_format_test.c | 10 +++---- test/provfetchtest.c | 2 +- test/ssl_old_test.c | 2 +- test/sslapitest.c | 4 +-- test/sslcorrupttest.c | 2 +- test/stack_test.c | 2 +- test/tls13ccstest.c | 4 +-- test/uitest.c | 2 +- 116 files changed, 229 insertions(+), 230 deletions(-) diff --git a/apps/dgst.c b/apps/dgst.c index bd23b76996..e75dd72521 100644 --- a/apps/dgst.c +++ b/apps/dgst.c @@ -503,7 +503,7 @@ static const char *newline_escape_filename(const char *file, int * backslash) file_cpy = app_malloc(mem_len, file); i = 0; - while(e < length) { + while (e < length) { const char c = file[e]; if (c == '\n') { file_cpy[i++] = '\\'; diff --git a/apps/lib/app_libctx.c b/apps/lib/app_libctx.c index 4b9ec40e85..2f68cb0a75 100644 --- a/apps/lib/app_libctx.c +++ b/apps/lib/app_libctx.c @@ -36,7 +36,7 @@ OSSL_LIB_CTX *app_create_libctx(void) */ if (app_libctx == NULL) { if (!app_provider_load(NULL, "null")) { - opt_printf_stderr( "Failed to create null provider\n"); + opt_printf_stderr("Failed to create null provider\n"); return NULL; } app_libctx = OSSL_LIB_CTX_new(); diff --git a/apps/lib/app_rand.c b/apps/lib/app_rand.c index e38d3a72fc..d3181e56fa 100644 --- a/apps/lib/app_rand.c +++ b/apps/lib/app_rand.c @@ -37,7 +37,7 @@ static int loadfiles(char *name) char *p; int last, ret = 1; - for ( ; ; ) { + for (;;) { last = 0; for (p = name; *p != '\0' && *p != LIST_SEPARATOR_CHAR; p++) continue; diff --git a/apps/lib/apps.c b/apps/lib/apps.c index 6fe99422b9..b15abac857 100644 --- a/apps/lib/apps.c +++ b/apps/lib/apps.c @@ -823,7 +823,7 @@ int load_crls(const char *uri, STACK_OF(X509_CRL) **crls, static const char *format2string(int format) { - switch(format) { + switch (format) { case FORMAT_PEM: return "PEM"; case FORMAT_ASN1: @@ -1942,7 +1942,7 @@ X509_NAME *parse_name(const char *cp, int chtype, int canmulti, ERR_print_errors(bio_err); BIO_printf(bio_err, "%s: Error adding %s name attribute \"/%s=%s\"\n", - opt_getprog(), desc, typestr ,valstr); + opt_getprog(), desc, typestr, valstr); goto err; } } @@ -2845,9 +2845,9 @@ int raw_write_stdout(const void *buf, int siz) # include # endif # endif -int raw_write_stdout(const void *buf,int siz) +int raw_write_stdout(const void *buf, int siz) { - return write(fileno(stdout),(void*)buf,siz); + return write(fileno(stdout), (void*)buf, siz); } #else # if defined(__TANDEM) diff --git a/apps/lib/cmp_mock_srv.c b/apps/lib/cmp_mock_srv.c index 1fb5adca1a..419b74ce6a 100644 --- a/apps/lib/cmp_mock_srv.c +++ b/apps/lib/cmp_mock_srv.c @@ -14,7 +14,7 @@ #include #include #include - + /* the context for the CMP mock server */ typedef struct { diff --git a/apps/lib/s_cb.c b/apps/lib/s_cb.c index c9a611aa3a..1d318027d2 100644 --- a/apps/lib/s_cb.c +++ b/apps/lib/s_cb.c @@ -1537,7 +1537,7 @@ void print_ca_names(BIO *bio, SSL *s) return; } - BIO_printf(bio, "---\nAcceptable %s certificate CA names\n",cs); + BIO_printf(bio, "---\nAcceptable %s certificate CA names\n", cs); for (i = 0; i < sk_X509_NAME_num(sk); i++) { X509_NAME_print_ex(bio, sk_X509_NAME_value(sk, i), 0, get_nameopt()); BIO_write(bio, "\n", 1); diff --git a/apps/lib/vms_term_sock.c b/apps/lib/vms_term_sock.c index 1b27699b9d..a1aeb6df06 100644 --- a/apps/lib/vms_term_sock.c +++ b/apps/lib/vms_term_sock.c @@ -120,7 +120,7 @@ typedef struct _SocketPairTimeoutBlock { } SPTB; # ifdef TERM_SOCK_TEST - + /*----------------------------------------------------------------------------*/ /* */ /*----------------------------------------------------------------------------*/ @@ -160,7 +160,7 @@ int main (int argc, char *argv[], char *envp[]) } # endif - + /*----------------------------------------------------------------------------*/ /* */ /*----------------------------------------------------------------------------*/ @@ -275,7 +275,7 @@ int TerminalSocket (int FunctionCode, int *ReturnSocket) return TERM_SOCK_SUCCESS; } - + /*----------------------------------------------------------------------------*/ /* */ /*----------------------------------------------------------------------------*/ @@ -441,7 +441,7 @@ static int CreateSocketPair (int SocketFamily, sin.sin_port = LocalHostPort ; status = connect (SockDesc2, (struct sockaddr *) &sin, sizeof(sin)); - if (status < 0 ) { + if (status < 0) { LogMessage ("CreateSocketPair: connect () - %d", errno); sys$cantim (&sptb, 0); sys$cancel (TcpAcceptChan); @@ -485,7 +485,7 @@ static int CreateSocketPair (int SocketFamily, return (0) ; } - + /*----------------------------------------------------------------------------*/ /* */ /*----------------------------------------------------------------------------*/ @@ -499,7 +499,7 @@ static void SocketPairTimeoutAst (int astparm) return; } - + /*----------------------------------------------------------------------------*/ /* */ /*----------------------------------------------------------------------------*/ @@ -538,7 +538,7 @@ static int TerminalDeviceAst (int astparm) return status; } - + /*----------------------------------------------------------------------------*/ /* */ /*----------------------------------------------------------------------------*/ diff --git a/apps/mac.c b/apps/mac.c index 5f80ca22c7..08f06be867 100644 --- a/apps/mac.c +++ b/apps/mac.c @@ -221,7 +221,7 @@ opthelp: for (i = 0; i < (int)len; ++i) BIO_printf(out, "%02X", buf[i]); if (outfile == NULL) - BIO_printf(out,"\n"); + BIO_printf(out, "\n"); } ret = 0; diff --git a/apps/ocsp.c b/apps/ocsp.c index 7a5f84e527..8f0eacad2b 100644 --- a/apps/ocsp.c +++ b/apps/ocsp.c @@ -1132,7 +1132,7 @@ static void make_ocsp_response(BIO *err, OCSP_RESPONSE **resp, OCSP_REQUEST *req OCSP_copy_nonce(bs, req); mctx = EVP_MD_CTX_new(); - if ( mctx == NULL || !EVP_DigestSignInit(mctx, &pkctx, rmd, NULL, rkey)) { + if (mctx == NULL || !EVP_DigestSignInit(mctx, &pkctx, rmd, NULL, rkey)) { *resp = OCSP_response_create(OCSP_RESPONSE_STATUS_INTERNALERROR, NULL); goto end; } diff --git a/apps/passwd.c b/apps/passwd.c index 65cbd9e493..bcb8804114 100644 --- a/apps/passwd.c +++ b/apps/passwd.c @@ -601,7 +601,7 @@ static char *shacrypt(const char *passwd, const char *magic, const char *salt) OPENSSL_strlcat(out_buf, ascii_salt, sizeof(out_buf)); /* assert "$5$rounds=999999999$......salt......" */ - if (strlen(out_buf) > 3 + 17 * rounds_custom + salt_len ) + if (strlen(out_buf) > 3 + 17 * rounds_custom + salt_len) goto err; md = EVP_MD_CTX_new(); diff --git a/apps/pkeyutl.c b/apps/pkeyutl.c index 73012e3069..d7290f7d48 100644 --- a/apps/pkeyutl.c +++ b/apps/pkeyutl.c @@ -729,7 +729,7 @@ static int do_raw_keyop(int pkey_op, EVP_MD_CTX *mctx, goto end; } mbuf = app_malloc(filesize, "oneshot sign/verify buffer"); - switch(pkey_op) { + switch (pkey_op) { case EVP_PKEY_OP_VERIFY: buf_len = BIO_read(in, mbuf, filesize); if (buf_len != filesize) { @@ -754,7 +754,7 @@ static int do_raw_keyop(int pkey_op, EVP_MD_CTX *mctx, goto end; } - switch(pkey_op) { + switch (pkey_op) { case EVP_PKEY_OP_VERIFY: for (;;) { buf_len = BIO_read(in, tbuf, TBUF_MAXSIZE); diff --git a/apps/req.c b/apps/req.c index 84ea9baeff..7997ea7649 100644 --- a/apps/req.c +++ b/apps/req.c @@ -781,7 +781,7 @@ int req_main(int argc, char **argv) goto end; } - if (!make_REQ(req, pkey, fsubj, multirdn, !gen_x509, chtype)){ + if (!make_REQ(req, pkey, fsubj, multirdn, !gen_x509, chtype)) { BIO_printf(bio_err, "Error making certificate request\n"); goto end; } diff --git a/apps/s_client.c b/apps/s_client.c index 760d2de550..f23919bb8d 100644 --- a/apps/s_client.c +++ b/apps/s_client.c @@ -1971,7 +1971,7 @@ int s_client_main(int argc, char **argv) if (!noservername && (servername != NULL || dane_tlsa_domain == NULL)) { if (servername == NULL) { - if(host == NULL || is_dNS_name(host)) + if (host == NULL || is_dNS_name(host)) servername = (host == NULL) ? "localhost" : host; } if (servername != NULL && !SSL_set_tlsext_host_name(con, servername)) { @@ -2984,7 +2984,7 @@ int s_client_main(int argc, char **argv) BIO_printf(bio_err, "RENEGOTIATING\n"); SSL_renegotiate(con); cbuf_len = 0; - } else if (!c_ign_eof && (cbuf[0] == 'K' || cbuf[0] == 'k' ) + } else if (!c_ign_eof && (cbuf[0] == 'K' || cbuf[0] == 'k') && cmdletters) { BIO_printf(bio_err, "KEYUPDATE\n"); SSL_key_update(con, diff --git a/crypto/LPdir_unix.c b/crypto/LPdir_unix.c index ddf68b576f..4151d1bd85 100644 --- a/crypto/LPdir_unix.c +++ b/crypto/LPdir_unix.c @@ -137,7 +137,7 @@ const char *LP_find_file(LP_DIR_CTX **ctx, const char *directory) if ((*ctx)->expect_file_generations) { char *p = (*ctx)->entry_name + strlen((*ctx)->entry_name); - while(p > (*ctx)->entry_name && isdigit(p[-1])) + while (p > (*ctx)->entry_name && isdigit(p[-1])) p--; if (p > (*ctx)->entry_name && p[-1] == ';') p[-1] = '\0'; diff --git a/crypto/aes/aes_x86core.c b/crypto/aes/aes_x86core.c index da525b6566..8e54e80a6c 100644 --- a/crypto/aes/aes_x86core.c +++ b/crypto/aes/aes_x86core.c @@ -63,12 +63,13 @@ #if 1 static void prefetch256(const void *table) { - volatile unsigned long *t=(void *)table,ret; + volatile unsigned long *t = (void *)table, ret; unsigned long sum; int i; /* 32 is common least cache-line size */ - for (sum=0,i=0;i<256/sizeof(t[0]);i+=32/sizeof(t[0])) sum ^= t[i]; + for (sum = 0, i = 0; i < 256/sizeof(t[0]); i += 32/sizeof(t[0])) + sum ^= t[i]; ret = sum; } diff --git a/crypto/aria/aria.c b/crypto/aria/aria.c index 5e60bc5210..6a1d713c45 100644 --- a/crypto/aria/aria.c +++ b/crypto/aria/aria.c @@ -498,7 +498,7 @@ void ossl_aria_encrypt(const unsigned char *in, unsigned char *out, ARIA_ADD_ROUND_KEY(rk, reg0, reg1, reg2, reg3); rk++; - while(Nr -= 2){ + while (Nr -= 2) { ARIA_SUBST_DIFF_EVEN(reg0, reg1, reg2, reg3); ARIA_ADD_ROUND_KEY(rk, reg0, reg1, reg2, reg3); rk++; diff --git a/crypto/bio/bio_addr.c b/crypto/bio/bio_addr.c index d18c849ade..dd180387e6 100644 --- a/crypto/bio/bio_addr.c +++ b/crypto/bio/bio_addr.c @@ -654,7 +654,7 @@ int BIO_lookup_ex(const char *host, const char *service, int lookup_type, { int ret = 0; /* Assume failure */ - switch(family) { + switch (family) { case AF_INET: #ifdef AF_INET6 case AF_INET6: @@ -789,7 +789,7 @@ int BIO_lookup_ex(const char *host, const char *service, int lookup_type, he_fallback_address = INADDR_ANY; if (host == NULL) { he = &he_fallback; - switch(lookup_type) { + switch (lookup_type) { case BIO_LOOKUP_CLIENT: he_fallback_address = INADDR_LOOPBACK; break; @@ -906,12 +906,12 @@ int BIO_lookup_ex(const char *host, const char *service, int lookup_type, /* The easiest way to create a linked list from an array is to start from the back */ - for(addrlistp = he->h_addr_list; *addrlistp != NULL; - addrlistp++) + for (addrlistp = he->h_addr_list; *addrlistp != NULL; + addrlistp++) ; - for(addresses = addrlistp - he->h_addr_list; - addrlistp--, addresses-- > 0; ) { + for (addresses = addrlistp - he->h_addr_list; + addrlistp--, addresses-- > 0; ) { if (!addrinfo_wrap(he->h_addrtype, socktype, *addrlistp, he->h_length, se->s_port, &tmp_bai)) diff --git a/crypto/bn/asm/sparcv8.S b/crypto/bn/asm/sparcv8.S index 9448700844..e5402cc4e2 100644 --- a/crypto/bn/asm/sparcv8.S +++ b/crypto/bn/asm/sparcv8.S @@ -381,7 +381,7 @@ bn_add_words: inc 16,%o1 addxcc %g3,%g4,%g3 st %g3,[%o0+4] - + ld [%o1-4],%g3 ld [%o2+12],%g4 inc 16,%o2 @@ -469,7 +469,7 @@ bn_sub_words: inc 16,%o1 subxcc %g3,%g4,%g4 st %g4,[%o0+4] - + ld [%o1-4],%g3 ld [%o2+12],%g4 inc 16,%o2 @@ -1040,7 +1040,7 @@ bn_mul_comba4: addxcc c_2,t_2,c_2 != st c_1,rp(6) !r[6]=c1; st c_2,rp(7) !r[7]=c2; - + ret restore %g0,%g0,%o0 @@ -1448,7 +1448,7 @@ bn_sqr_comba4: addxcc c_2,t_2,c_2 != st c_1,rp(6) !r[6]=c1; st c_2,rp(7) !r[7]=c2; - + ret restore %g0,%g0,%o0 diff --git a/crypto/bn/asm/sparcv8plus.S b/crypto/bn/asm/sparcv8plus.S index 696dc7b5fe..8a936f1c72 100644 --- a/crypto/bn/asm/sparcv8plus.S +++ b/crypto/bn/asm/sparcv8plus.S @@ -496,7 +496,7 @@ bn_add_words: inc 16,%o1 addccc %g1,%g2,%g1 stuw %g1,[%o0+4] - + inc 16,%o2 addccc %g3,%g4,%g3 stuw %g3,[%o0+8] @@ -1126,7 +1126,7 @@ bn_mul_comba4: srlx t_1,32,c_12 != stuw t_1,rp(6) !r[6]=c1; stuw c_12,rp(7) !r[7]=c2; - + ret restore %g0,%g0,%o0 @@ -1548,7 +1548,7 @@ bn_sqr_comba4: srlx t_1,32,c_12 stuw t_1,rp(6) !r[6]=c1; stuw c_12,rp(7) !r[7]=c2; - + ret restore %g0,%g0,%o0 diff --git a/crypto/bn/bn_rsa_fips186_4.c b/crypto/bn/bn_rsa_fips186_4.c index 794e008390..bde9ffa043 100644 --- a/crypto/bn/bn_rsa_fips186_4.c +++ b/crypto/bn/bn_rsa_fips186_4.c @@ -112,7 +112,7 @@ static int bn_rsa_fips186_4_find_aux_prob_prime(const BIGNUM *Xp1, BN_set_flags(p1, BN_FLG_CONSTTIME); /* Find the first odd number >= Xp1 that is probably prime */ - for(;;) { + for (;;) { i++; BN_GENCB_call(cb, 0, i); /* MR test with trial division */ diff --git a/crypto/cmp/cmp_msg.c b/crypto/cmp/cmp_msg.c index 10ef4cd922..51b0998bdc 100644 --- a/crypto/cmp/cmp_msg.c +++ b/crypto/cmp/cmp_msg.c @@ -1095,7 +1095,7 @@ OSSL_CMP_MSG *OSSL_CMP_MSG_read(const char *file, OSSL_LIB_CTX *libctx, } msg = OSSL_CMP_MSG_new(libctx, propq); - if (msg == NULL){ + if (msg == NULL) { ERR_raise(ERR_LIB_CMP, ERR_R_MALLOC_FAILURE); return NULL; } diff --git a/crypto/cms/cms_env.c b/crypto/cms/cms_env.c index 51a1d7df84..ca8f84f14a 100644 --- a/crypto/cms/cms_env.c +++ b/crypto/cms/cms_env.c @@ -795,7 +795,7 @@ static EVP_CIPHER *cms_get_key_wrap_cipher(size_t keylen, const CMS_CTX *ctx) { const char *alg = NULL; - switch(keylen) { + switch (keylen) { case 16: alg = "AES-128-WRAP"; break; diff --git a/crypto/cpuid.c b/crypto/cpuid.c index 090f6fe03e..048689f410 100644 --- a/crypto/cpuid.c +++ b/crypto/cpuid.c @@ -71,7 +71,7 @@ static uint64_t ossl_strtouint64(const variant_char *str) base = 16, str++; } - while((digit = todigit(*str++)) < base) + while ((digit = todigit(*str++)) < base) ret = ret * base + digit; return ret; @@ -80,7 +80,7 @@ static uint64_t ossl_strtouint64(const variant_char *str) static variant_char *ossl_strchr(const variant_char *str, char srch) { variant_char c; - while((c = *str)) { + while ((c = *str)) { if (c == srch) return (variant_char *)str; str++; diff --git a/crypto/ec/ec2_smpl.c b/crypto/ec/ec2_smpl.c index 3a59544c8b..79884c72bb 100644 --- a/crypto/ec/ec2_smpl.c +++ b/crypto/ec/ec2_smpl.c @@ -545,7 +545,7 @@ int ossl_ec_GF2m_simple_is_on_curve(const EC_GROUP *group, const EC_POINT *point * We have a curve defined by a Weierstrass equation * y^2 + x*y = x^3 + a*x^2 + b. * <=> x^3 + a*x^2 + x*y + b + y^2 = 0 - * <=> ((x + a) * x + y ) * x + b + y^2 = 0 + * <=> ((x + a) * x + y) * x + b + y^2 = 0 */ if (!BN_GF2m_add(lh, point->X, group->a)) goto err; diff --git a/crypto/ec/ec_ameth.c b/crypto/ec/ec_ameth.c index 9ca023bbe3..69922380e1 100644 --- a/crypto/ec/ec_ameth.c +++ b/crypto/ec/ec_ameth.c @@ -574,7 +574,7 @@ int ec_pkey_export_to(const EVP_PKEY *from, void *to_keydata, if (ecbits <= 0) goto err; - sz = (ecbits + 7 ) / 8; + sz = (ecbits + 7) / 8; if (!OSSL_PARAM_BLD_push_BN_pad(tmpl, OSSL_PKEY_PARAM_PRIV_KEY, priv_key, sz)) diff --git a/crypto/ec/ec_backend.c b/crypto/ec/ec_backend.c index 381da71f33..2db1c1380e 100644 --- a/crypto/ec/ec_backend.c +++ b/crypto/ec/ec_backend.c @@ -295,7 +295,7 @@ int ossl_ec_group_todata(const EC_GROUP *group, OSSL_PARAM_BLD *tmpl, point_conversion_form_t genform; if (group == NULL) { - ERR_raise(ERR_LIB_EC,EC_R_PASSED_NULL_PARAMETER); + ERR_raise(ERR_LIB_EC, EC_R_PASSED_NULL_PARAMETER); return 0; } diff --git a/crypto/ec/ecp_nistz256.c b/crypto/ec/ecp_nistz256.c index a9982caef6..ccd6895cc5 100644 --- a/crypto/ec/ecp_nistz256.c +++ b/crypto/ec/ecp_nistz256.c @@ -1377,7 +1377,7 @@ static int ecp_nistz256_inv_mod_ord(const EC_GROUP *group, BIGNUM *r, /* * The bottom 128 bit of the exponent are processed with fixed 4-bit window */ - for(i = 0; i < 32; i++) { + for (i = 0; i < 32; i++) { /* expLo - the low 128 bits of the exponent we use (ord(p256) - 2), * split into nibbles */ static const unsigned char expLo[32] = { diff --git a/crypto/ec/ecp_smpl.c b/crypto/ec/ecp_smpl.c index bde8cad346..13ce9bfc42 100644 --- a/crypto/ec/ecp_smpl.c +++ b/crypto/ec/ecp_smpl.c @@ -1423,8 +1423,8 @@ int ossl_ec_GFp_simple_field_inv(const EC_GROUP *group, BIGNUM *r, /*- * Apply randomization of EC point projective coordinates: * - * (X, Y ,Z ) = (lambda^2*X, lambda^3*Y, lambda*Z) - * lambda = [1,group->field) + * (X, Y, Z) = (lambda^2*X, lambda^3*Y, lambda*Z) + * lambda = [1, group->field) * */ int ossl_ec_GFp_simple_blind_coordinates(const EC_GROUP *group, EC_POINT *p, diff --git a/crypto/ec/ecx_meth.c b/crypto/ec/ecx_meth.c index 9098decf2f..9f9bf75aed 100644 --- a/crypto/ec/ecx_meth.c +++ b/crypto/ec/ecx_meth.c @@ -138,7 +138,7 @@ static int ecx_bits(const EVP_PKEY *pkey) { if (IS25519(pkey->ameth->pkey_id)) { return X25519_BITS; - } else if(ISX448(pkey->ameth->pkey_id)) { + } else if (ISX448(pkey->ameth->pkey_id)) { return X448_BITS; } else { return ED448_BITS; diff --git a/crypto/evp/asymcipher.c b/crypto/evp/asymcipher.c index b7784c8994..b08e121014 100644 --- a/crypto/evp/asymcipher.c +++ b/crypto/evp/asymcipher.c @@ -189,7 +189,7 @@ static int evp_pkey_asym_cipher_init(EVP_PKEY_CTX *ctx, int operation, ERR_raise(ERR_LIB_EVP, EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE); return -2; } - switch(ctx->operation) { + switch (ctx->operation) { case EVP_PKEY_OP_ENCRYPT: if (ctx->pmeth->encrypt_init == NULL) return 1; diff --git a/crypto/evp/e_aes.c b/crypto/evp/e_aes.c index 52b9e87c1e..445a28445a 100644 --- a/crypto/evp/e_aes.c +++ b/crypto/evp/e_aes.c @@ -2149,7 +2149,7 @@ static int s390x_aes_ccm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) if (!enc || !cctx->aes.ccm.tag_set) return 0; - if(arg < cctx->aes.ccm.m) + if (arg < cctx->aes.ccm.m) return 0; memcpy(ptr, cctx->aes.ccm.kmac_param.icv.b, cctx->aes.ccm.m); diff --git a/crypto/evp/e_aria.c b/crypto/evp/e_aria.c index 7e1fda33e1..4722f54873 100644 --- a/crypto/evp/e_aria.c +++ b/crypto/evp/e_aria.c @@ -73,7 +73,7 @@ static int aria_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, EVP_CIPHER_CTX_get_key_length(ctx) * 8, EVP_CIPHER_CTX_get_cipher_data(ctx)); if (ret < 0) { - ERR_raise(ERR_LIB_EVP,EVP_R_ARIA_KEY_SETUP_FAILED); + ERR_raise(ERR_LIB_EVP, EVP_R_ARIA_KEY_SETUP_FAILED); return 0; } return 1; @@ -216,7 +216,7 @@ static int aria_gcm_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, const unsigned char *iv, int enc) { int ret; - EVP_ARIA_GCM_CTX *gctx = EVP_C_DATA(EVP_ARIA_GCM_CTX,ctx); + EVP_ARIA_GCM_CTX *gctx = EVP_C_DATA(EVP_ARIA_GCM_CTX, ctx); if (!iv && !key) return 1; @@ -227,7 +227,7 @@ static int aria_gcm_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, CRYPTO_gcm128_init(&gctx->gcm, &gctx->ks, (block128_f) ossl_aria_encrypt); if (ret < 0) { - ERR_raise(ERR_LIB_EVP,EVP_R_ARIA_KEY_SETUP_FAILED); + ERR_raise(ERR_LIB_EVP, EVP_R_ARIA_KEY_SETUP_FAILED); return 0; } @@ -255,7 +255,7 @@ static int aria_gcm_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, static int aria_gcm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) { - EVP_ARIA_GCM_CTX *gctx = EVP_C_DATA(EVP_ARIA_GCM_CTX,c); + EVP_ARIA_GCM_CTX *gctx = EVP_C_DATA(EVP_ARIA_GCM_CTX, c); switch (type) { case EVP_CTRL_INIT: @@ -375,7 +375,7 @@ static int aria_gcm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) case EVP_CTRL_COPY: { EVP_CIPHER_CTX *out = ptr; - EVP_ARIA_GCM_CTX *gctx_out = EVP_C_DATA(EVP_ARIA_GCM_CTX,out); + EVP_ARIA_GCM_CTX *gctx_out = EVP_C_DATA(EVP_ARIA_GCM_CTX, out); if (gctx->gcm.key) { if (gctx->gcm.key != &gctx->ks) return 0; @@ -402,7 +402,7 @@ static int aria_gcm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) static int aria_gcm_tls_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t len) { - EVP_ARIA_GCM_CTX *gctx = EVP_C_DATA(EVP_ARIA_GCM_CTX,ctx); + EVP_ARIA_GCM_CTX *gctx = EVP_C_DATA(EVP_ARIA_GCM_CTX, ctx); int rv = -1; /* Encrypt/decrypt must be performed in place */ @@ -458,7 +458,7 @@ static int aria_gcm_tls_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, static int aria_gcm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t len) { - EVP_ARIA_GCM_CTX *gctx = EVP_C_DATA(EVP_ARIA_GCM_CTX,ctx); + EVP_ARIA_GCM_CTX *gctx = EVP_C_DATA(EVP_ARIA_GCM_CTX, ctx); /* If not set up, return error */ if (!gctx->key_set) @@ -513,7 +513,7 @@ static int aria_ccm_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, const unsigned char *iv, int enc) { int ret; - EVP_ARIA_CCM_CTX *cctx = EVP_C_DATA(EVP_ARIA_CCM_CTX,ctx); + EVP_ARIA_CCM_CTX *cctx = EVP_C_DATA(EVP_ARIA_CCM_CTX, ctx); if (!iv && !key) return 1; @@ -525,7 +525,7 @@ static int aria_ccm_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, CRYPTO_ccm128_init(&cctx->ccm, cctx->M, cctx->L, &cctx->ks, (block128_f) ossl_aria_encrypt); if (ret < 0) { - ERR_raise(ERR_LIB_EVP,EVP_R_ARIA_KEY_SETUP_FAILED); + ERR_raise(ERR_LIB_EVP, EVP_R_ARIA_KEY_SETUP_FAILED); return 0; } cctx->str = NULL; @@ -540,7 +540,7 @@ static int aria_ccm_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, static int aria_ccm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) { - EVP_ARIA_CCM_CTX *cctx = EVP_C_DATA(EVP_ARIA_CCM_CTX,c); + EVP_ARIA_CCM_CTX *cctx = EVP_C_DATA(EVP_ARIA_CCM_CTX, c); switch (type) { case EVP_CTRL_INIT: @@ -624,7 +624,7 @@ static int aria_ccm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) case EVP_CTRL_COPY: { EVP_CIPHER_CTX *out = ptr; - EVP_ARIA_CCM_CTX *cctx_out = EVP_C_DATA(EVP_ARIA_CCM_CTX,out); + EVP_ARIA_CCM_CTX *cctx_out = EVP_C_DATA(EVP_ARIA_CCM_CTX, out); if (cctx->ccm.key) { if (cctx->ccm.key != &cctx->ks) return 0; @@ -641,7 +641,7 @@ static int aria_ccm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) static int aria_ccm_tls_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t len) { - EVP_ARIA_CCM_CTX *cctx = EVP_C_DATA(EVP_ARIA_CCM_CTX,ctx); + EVP_ARIA_CCM_CTX *cctx = EVP_C_DATA(EVP_ARIA_CCM_CTX, ctx); CCM128_CONTEXT *ccm = &cctx->ccm; /* Encrypt/decrypt must be performed in place */ @@ -689,7 +689,7 @@ static int aria_ccm_tls_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, static int aria_ccm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t len) { - EVP_ARIA_CCM_CTX *cctx = EVP_C_DATA(EVP_ARIA_CCM_CTX,ctx); + EVP_ARIA_CCM_CTX *cctx = EVP_C_DATA(EVP_ARIA_CCM_CTX, ctx); CCM128_CONTEXT *ccm = &cctx->ccm; /* If not set up, return error */ diff --git a/crypto/evp/e_camellia.c b/crypto/evp/e_camellia.c index 4f1f4822dc..cb69516bde 100644 --- a/crypto/evp/e_camellia.c +++ b/crypto/evp/e_camellia.c @@ -193,7 +193,7 @@ static int camellia_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, const unsigned char *iv, int enc) { int ret, mode; - EVP_CAMELLIA_KEY *dat = EVP_C_DATA(EVP_CAMELLIA_KEY,ctx); + EVP_CAMELLIA_KEY *dat = EVP_C_DATA(EVP_CAMELLIA_KEY, ctx); ret = Camellia_set_key(key, EVP_CIPHER_CTX_get_key_length(ctx) * 8, &dat->ks); @@ -220,7 +220,7 @@ static int camellia_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, static int camellia_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t len) { - EVP_CAMELLIA_KEY *dat = EVP_C_DATA(EVP_CAMELLIA_KEY,ctx); + EVP_CAMELLIA_KEY *dat = EVP_C_DATA(EVP_CAMELLIA_KEY, ctx); if (dat->stream.cbc) (*dat->stream.cbc) (in, out, len, &dat->ks, ctx->iv, @@ -238,7 +238,7 @@ static int camellia_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, { size_t bl = EVP_CIPHER_CTX_get_block_size(ctx); size_t i; - EVP_CAMELLIA_KEY *dat = EVP_C_DATA(EVP_CAMELLIA_KEY,ctx); + EVP_CAMELLIA_KEY *dat = EVP_C_DATA(EVP_CAMELLIA_KEY, ctx); if (len < bl) return 1; @@ -252,7 +252,7 @@ static int camellia_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, static int camellia_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t len) { - EVP_CAMELLIA_KEY *dat = EVP_C_DATA(EVP_CAMELLIA_KEY,ctx); + EVP_CAMELLIA_KEY *dat = EVP_C_DATA(EVP_CAMELLIA_KEY, ctx); int num = EVP_CIPHER_CTX_get_num(ctx); CRYPTO_ofb128_encrypt(in, out, len, &dat->ks, ctx->iv, &num, dat->block); @@ -263,7 +263,7 @@ static int camellia_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, static int camellia_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t len) { - EVP_CAMELLIA_KEY *dat = EVP_C_DATA(EVP_CAMELLIA_KEY,ctx); + EVP_CAMELLIA_KEY *dat = EVP_C_DATA(EVP_CAMELLIA_KEY, ctx); int num = EVP_CIPHER_CTX_get_num(ctx); CRYPTO_cfb128_encrypt(in, out, len, &dat->ks, ctx->iv, &num, @@ -275,7 +275,7 @@ static int camellia_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, static int camellia_cfb8_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t len) { - EVP_CAMELLIA_KEY *dat = EVP_C_DATA(EVP_CAMELLIA_KEY,ctx); + EVP_CAMELLIA_KEY *dat = EVP_C_DATA(EVP_CAMELLIA_KEY, ctx); int num = EVP_CIPHER_CTX_get_num(ctx); CRYPTO_cfb128_8_encrypt(in, out, len, &dat->ks, ctx->iv, &num, @@ -287,7 +287,7 @@ static int camellia_cfb8_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, static int camellia_cfb1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t len) { - EVP_CAMELLIA_KEY *dat = EVP_C_DATA(EVP_CAMELLIA_KEY,ctx); + EVP_CAMELLIA_KEY *dat = EVP_C_DATA(EVP_CAMELLIA_KEY, ctx); if (EVP_CIPHER_CTX_test_flags(ctx, EVP_CIPH_FLAG_LENGTH_BITS)) { int num = EVP_CIPHER_CTX_get_num(ctx); @@ -326,7 +326,7 @@ static int camellia_ctr_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, { int snum = EVP_CIPHER_CTX_get_num(ctx); unsigned int num; - EVP_CAMELLIA_KEY *dat = EVP_C_DATA(EVP_CAMELLIA_KEY,ctx); + EVP_CAMELLIA_KEY *dat = EVP_C_DATA(EVP_CAMELLIA_KEY, ctx); if (snum < 0) return 0; diff --git a/crypto/evp/e_chacha20_poly1305.c b/crypto/evp/e_chacha20_poly1305.c index 18e1c0b5ac..103663ba8b 100644 --- a/crypto/evp/e_chacha20_poly1305.c +++ b/crypto/evp/e_chacha20_poly1305.c @@ -498,7 +498,7 @@ static int chacha20_poly1305_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, { EVP_CHACHA_AEAD_CTX *actx = aead_data(ctx); - switch(type) { + switch (type) { case EVP_CTRL_INIT: if (actx == NULL) actx = ctx->cipher_data diff --git a/crypto/evp/e_idea.c b/crypto/evp/e_idea.c index 4a4df4b925..93da93823d 100644 --- a/crypto/evp/e_idea.c +++ b/crypto/evp/e_idea.c @@ -42,7 +42,7 @@ static int idea_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl) { BLOCK_CIPHER_ecb_loop() - IDEA_ecb_encrypt(in + i, out + i, &EVP_C_DATA(EVP_IDEA_KEY,ctx)->ks); + IDEA_ecb_encrypt(in + i, out + i, &EVP_C_DATA(EVP_IDEA_KEY, ctx)->ks); return 1; } @@ -64,12 +64,12 @@ static int idea_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, enc = 1; } if (enc) - IDEA_set_encrypt_key(key, &EVP_C_DATA(EVP_IDEA_KEY,ctx)->ks); + IDEA_set_encrypt_key(key, &EVP_C_DATA(EVP_IDEA_KEY, ctx)->ks); else { IDEA_KEY_SCHEDULE tmp; IDEA_set_encrypt_key(key, &tmp); - IDEA_set_decrypt_key(&tmp, &EVP_C_DATA(EVP_IDEA_KEY,ctx)->ks); + IDEA_set_decrypt_key(&tmp, &EVP_C_DATA(EVP_IDEA_KEY, ctx)->ks); OPENSSL_cleanse((unsigned char *)&tmp, sizeof(IDEA_KEY_SCHEDULE)); } return 1; diff --git a/crypto/evp/e_seed.c b/crypto/evp/e_seed.c index 98c7385f61..65ddb57335 100644 --- a/crypto/evp/e_seed.c +++ b/crypto/evp/e_seed.c @@ -36,6 +36,6 @@ IMPLEMENT_BLOCK_CIPHER(seed, ks, SEED, EVP_SEED_KEY, NID_seed, static int seed_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, const unsigned char *iv, int enc) { - SEED_set_key(key, &EVP_C_DATA(EVP_SEED_KEY,ctx)->ks); + SEED_set_key(key, &EVP_C_DATA(EVP_SEED_KEY, ctx)->ks); return 1; } diff --git a/crypto/evp/pmeth_lib.c b/crypto/evp/pmeth_lib.c index 2b9c6c2351..a61876621a 100644 --- a/crypto/evp/pmeth_lib.c +++ b/crypto/evp/pmeth_lib.c @@ -614,7 +614,7 @@ int EVP_PKEY_meth_add0(const EVP_PKEY_METHOD *pmeth) { if (app_pkey_methods == NULL) { app_pkey_methods = sk_EVP_PKEY_METHOD_new(pmeth_cmp); - if (app_pkey_methods == NULL){ + if (app_pkey_methods == NULL) { ERR_raise(ERR_LIB_EVP, ERR_R_MALLOC_FAILURE); return 0; } @@ -866,7 +866,7 @@ int evp_pkey_ctx_set_params_strict(EVP_PKEY_CTX *ctx, OSSL_PARAM *params) for (p = params; p->key != NULL; p++) { /* Check the ctx actually understands this parameter */ - if (OSSL_PARAM_locate_const(settable, p->key) == NULL ) + if (OSSL_PARAM_locate_const(settable, p->key) == NULL) return -2; } } @@ -889,9 +889,9 @@ int evp_pkey_ctx_get_params_strict(EVP_PKEY_CTX *ctx, OSSL_PARAM *params) const OSSL_PARAM *gettable = EVP_PKEY_CTX_gettable_params(ctx); const OSSL_PARAM *p; - for (p = params; p->key != NULL; p++ ) { + for (p = params; p->key != NULL; p++) { /* Check the ctx actually understands this parameter */ - if (OSSL_PARAM_locate_const(gettable, p->key) == NULL ) + if (OSSL_PARAM_locate_const(gettable, p->key) == NULL) return -2; } } diff --git a/crypto/ffc/ffc_params_generate.c b/crypto/ffc/ffc_params_generate.c index f0601e1644..12a5252cfc 100644 --- a/crypto/ffc/ffc_params_generate.c +++ b/crypto/ffc/ffc_params_generate.c @@ -324,7 +324,7 @@ static int generate_q_fips186_4(BN_CTX *ctx, BIGNUM *q, const EVP_MD *evpmd, /* find q */ for (;;) { - if(!BN_GENCB_call(cb, 0, m++)) + if (!BN_GENCB_call(cb, 0, m++)) goto err; /* A.1.1.2 Step (5) : generate seed with size seed_len */ @@ -673,7 +673,7 @@ int ossl_ffc_params_FIPS186_4_gen_verify(OSSL_LIB_CTX *libctx, * A.1.1.3 Step (10) * n = floor(L / hash_outlen) - 1 */ - n = (L - 1 ) / (mdsize << 3); + n = (L - 1) / (mdsize << 3); /* Calculate 2^(L-1): Used in step A.1.1.2 Step (11.3) */ if (!BN_lshift(test, BN_value_one(), L - 1)) @@ -688,9 +688,9 @@ int ossl_ffc_params_FIPS186_4_gen_verify(OSSL_LIB_CTX *libctx, *res = FFC_CHECK_Q_MISMATCH; goto err; } - if(!BN_GENCB_call(cb, 2, 0)) + if (!BN_GENCB_call(cb, 2, 0)) goto err; - if(!BN_GENCB_call(cb, 3, 0)) + if (!BN_GENCB_call(cb, 3, 0)) goto err; memcpy(seed_tmp, seed, seedlen); diff --git a/crypto/lhash/lhash.c b/crypto/lhash/lhash.c index 63cf46af6e..b2fa4c518b 100644 --- a/crypto/lhash/lhash.c +++ b/crypto/lhash/lhash.c @@ -276,7 +276,7 @@ static void contract(OPENSSL_LHASH *lh) n = OPENSSL_realloc(lh->b, (unsigned int)(sizeof(OPENSSL_LH_NODE *) * lh->pmax)); if (n == NULL) { - /* fputs("realloc error in lhash",stderr); */ + /* fputs("realloc error in lhash", stderr); */ lh->error++; return; } diff --git a/crypto/pkcs12/p12_sbag.c b/crypto/pkcs12/p12_sbag.c index 7574c54120..4593d595ec 100644 --- a/crypto/pkcs12/p12_sbag.c +++ b/crypto/pkcs12/p12_sbag.c @@ -124,7 +124,7 @@ PKCS12_SAFEBAG *PKCS12_SAFEBAG_create_secret(int type, int vtype, const unsigned } bag->type = OBJ_nid2obj(type); - switch(vtype) { + switch (vtype) { case V_ASN1_OCTET_STRING: { ASN1_OCTET_STRING *strtmp = ASN1_OCTET_STRING_new(); @@ -161,7 +161,7 @@ PKCS12_SAFEBAG *PKCS12_SAFEBAG_create_secret(int type, int vtype, const unsigned safebag->value.bag = bag; safebag->type = OBJ_nid2obj(NID_secretBag); return safebag; - + err: PKCS12_BAGS_free(bag); return NULL; diff --git a/crypto/ppccap.c b/crypto/ppccap.c index 8bcfed25e0..dca3c5342b 100644 --- a/crypto/ppccap.c +++ b/crypto/ppccap.c @@ -263,7 +263,7 @@ void OPENSSL_cpuid_setup(void) sigaction(SIGILL, &ill_act, &ill_oact); #ifndef OSSL_IMPLEMENT_GETAUXVAL - if (sigsetjmp(ill_jmp,1) == 0) { + if (sigsetjmp(ill_jmp, 1) == 0) { OPENSSL_fpu_probe(); OPENSSL_ppccap_P |= PPC_FPU; diff --git a/crypto/property/property_parse.c b/crypto/property/property_parse.c index 3673fd7b05..3c0a6ff793 100644 --- a/crypto/property/property_parse.c +++ b/crypto/property/property_parse.c @@ -576,7 +576,7 @@ static void put_char(char ch, char **buf, size_t *remain, size_t *needed) ++*needed; return; } - if(*remain == 1) + if (*remain == 1) **buf = '\0'; else **buf = ch; @@ -595,16 +595,16 @@ static void put_str(const char *str, char **buf, size_t *remain, size_t *needed) if (*remain == 0) return; - if(*remain < len + 1) + if (*remain < len + 1) len = *remain - 1; - if(len > 0) { + if (len > 0) { strncpy(*buf, str, len); *buf += len; *remain -= len; } - if(len < olen && *remain == 1) { + if (len < olen && *remain == 1) { **buf = '\0'; ++*buf; --*remain; diff --git a/crypto/rand/rand_egd.c b/crypto/rand/rand_egd.c index dc1833169c..bb862f61ad 100644 --- a/crypto/rand/rand_egd.c +++ b/crypto/rand/rand_egd.c @@ -85,14 +85,14 @@ int hpns_socket(int family, socket_transport_name_get(AF_UNIX, current_transport, 20); - if (strcmp(current_transport,transport) == 0) + if (strcmp(current_transport, transport) == 0) return socket(family, type, protocol); /* set the requested socket transport */ if (socket_transport_name_set(AF_UNIX, transport)) return -1; - socket_rc = socket(family,type,protocol); + socket_rc = socket(family, type, protocol); /* set mode back to what it was */ if (socket_transport_name_set(AF_UNIX, current_transport)) @@ -135,7 +135,7 @@ int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes) setbuf(fp, NULL); /* Try to connect */ - for ( ; ; ) { + for (;;) { if (connect(fd, (struct sockaddr *)&addr, i) == 0) break; # ifdef EISCONN diff --git a/crypto/rand/randfile.c b/crypto/rand/randfile.c index 82f4163738..31edd4f560 100644 --- a/crypto/rand/randfile.c +++ b/crypto/rand/randfile.c @@ -144,14 +144,14 @@ int RAND_load_file(const char *file, long bytes) # pragma environment restore #endif - for ( ; ; ) { + for (;;) { if (bytes > 0) n = (bytes <= RAND_LOAD_BUF_SIZE) ? (int)bytes : RAND_BUF_SIZE; else n = RAND_LOAD_BUF_SIZE; i = fread(buf, 1, n, in); #ifdef EINTR - if (ferror(in) && errno == EINTR){ + if (ferror(in) && errno == EINTR) { clearerr(in); if (i == 0) continue; diff --git a/crypto/rsa/rsa_ameth.c b/crypto/rsa/rsa_ameth.c index b1580ca48c..043f509723 100644 --- a/crypto/rsa/rsa_ameth.c +++ b/crypto/rsa/rsa_ameth.c @@ -216,7 +216,7 @@ static int rsa_pss_param_print(BIO *bp, int pss_key, RSA_PSS_PARAMS *pss, return 0; } } else if (pss == NULL) { - if (BIO_puts(bp,"(INVALID PSS PARAMETERS)\n") <= 0) + if (BIO_puts(bp, "(INVALID PSS PARAMETERS)\n") <= 0) return 0; return 1; } diff --git a/crypto/rsa/rsa_backend.c b/crypto/rsa/rsa_backend.c index 46283265d2..dc397a6676 100644 --- a/crypto/rsa/rsa_backend.c +++ b/crypto/rsa/rsa_backend.c @@ -46,7 +46,7 @@ static int collect_numbers(STACK_OF(BIGNUM) *numbers, if (numbers == NULL) return 0; - for (i = 0; names[i] != NULL; i++){ + for (i = 0; names[i] != NULL; i++) { p = OSSL_PARAM_locate_const(params, names[i]); if (p != NULL) { BIGNUM *tmp = NULL; diff --git a/crypto/rsa/rsa_pmeth.c b/crypto/rsa/rsa_pmeth.c index 44c819a5c3..1eebfea2cc 100644 --- a/crypto/rsa/rsa_pmeth.c +++ b/crypto/rsa/rsa_pmeth.c @@ -394,7 +394,7 @@ static int check_padding_md(const EVP_MD *md, int padding) return 0; } } else { - switch(mdnid) { + switch (mdnid) { /* List of all supported RSA digests */ case NID_sha1: case NID_sha224: diff --git a/crypto/rsa/rsa_sp800_56b_gen.c b/crypto/rsa/rsa_sp800_56b_gen.c index df2240555b..0d9b8f4ed7 100644 --- a/crypto/rsa/rsa_sp800_56b_gen.c +++ b/crypto/rsa/rsa_sp800_56b_gen.c @@ -125,7 +125,7 @@ int ossl_rsa_fips186_4_gen_prob_primes(RSA *rsa, RSA_ACVP_TEST *test, if (!ossl_bn_rsa_fips186_4_gen_prob_primes(rsa->p, Xpo, p1, p2, Xp, Xp1, Xp2, nbits, e, ctx, cb)) goto err; - for(;;) { + for (;;) { /* (Step 5) Generate q, Xq*/ if (!ossl_bn_rsa_fips186_4_gen_prob_primes(rsa->q, Xqo, q1, q2, Xq, Xq1, Xq2, nbits, e, ctx, cb)) diff --git a/crypto/sha/keccak1600.c b/crypto/sha/keccak1600.c index ccbf12b1c6..17909a769b 100644 --- a/crypto/sha/keccak1600.c +++ b/crypto/sha/keccak1600.c @@ -1242,11 +1242,11 @@ int main() printf(++i % 16 && i != sizeof(out) ? " " : "\n"); } - if (memcmp(out,result,sizeof(out))) { - fprintf(stderr,"failure\n"); + if (memcmp(out, result, sizeof(out))) { + fprintf(stderr, "failure\n"); return 1; } else { - fprintf(stderr,"success\n"); + fprintf(stderr, "success\n"); return 0; } } diff --git a/crypto/sm2/sm2_key.c b/crypto/sm2/sm2_key.c index 9d0b9208fa..e3a10d38e7 100644 --- a/crypto/sm2/sm2_key.c +++ b/crypto/sm2/sm2_key.c @@ -29,7 +29,7 @@ int ossl_sm2_key_private_check(const EC_KEY *eckey) if (eckey == NULL || (group = EC_KEY_get0_group(eckey)) == NULL || (priv_key = EC_KEY_get0_private_key(eckey)) == NULL - || (order = EC_GROUP_get0_order(group)) == NULL ) { + || (order = EC_GROUP_get0_order(group)) == NULL) { ERR_raise(ERR_LIB_SM2, ERR_R_PASSED_NULL_PARAMETER); return 0; } diff --git a/crypto/srp/srp_vfy.c b/crypto/srp/srp_vfy.c index e8beb60d27..2f36b27744 100644 --- a/crypto/srp/srp_vfy.c +++ b/crypto/srp/srp_vfy.c @@ -628,7 +628,7 @@ char *SRP_create_verifier_ex(const char *user, const char *pass, char **salt, if (N_bn_alloc == NULL) goto err; N_bn = N_bn_alloc; - if ((len = t_fromb64(tmp, sizeof(tmp) ,g)) <= 0) + if ((len = t_fromb64(tmp, sizeof(tmp), g)) <= 0) goto err; g_bn_alloc = BN_bin2bn(tmp, len, NULL); if (g_bn_alloc == NULL) diff --git a/crypto/store/store_lib.c b/crypto/store/store_lib.c index 7dcb939066..833ec8ff9a 100644 --- a/crypto/store/store_lib.c +++ b/crypto/store/store_lib.c @@ -135,8 +135,8 @@ OSSL_STORE_open_ex(const char *uri, OSSL_LIB_CTX *libctx, const char *propq, if (loader_ctx == NULL) { OSSL_STORE_LOADER_free(fetched_loader); fetched_loader = NULL; - } else if(!loader_set_params(fetched_loader, loader_ctx, - params, propq)) { + } else if (!loader_set_params(fetched_loader, loader_ctx, + params, propq)) { (void)fetched_loader->p_close(loader_ctx); OSSL_STORE_LOADER_free(fetched_loader); fetched_loader = NULL; diff --git a/crypto/x509/pcy_cache.c b/crypto/x509/pcy_cache.c index 1339f994ae..79b16c905c 100644 --- a/crypto/x509/pcy_cache.c +++ b/crypto/x509/pcy_cache.c @@ -54,7 +54,7 @@ static int policy_cache_create(X509 *x, goto bad_policy; } cache->anyPolicy = data; - } else if (sk_X509_POLICY_DATA_find(cache->data, data) >=0 ) { + } else if (sk_X509_POLICY_DATA_find(cache->data, data) >=0) { ret = -1; goto bad_policy; } else if (!sk_X509_POLICY_DATA_push(cache->data, data)) { diff --git a/crypto/x509/pcy_node.c b/crypto/x509/pcy_node.c index 9d9a7ea179..04aba646be 100644 --- a/crypto/x509/pcy_node.c +++ b/crypto/x509/pcy_node.c @@ -93,7 +93,7 @@ X509_POLICY_NODE *ossl_policy_level_add_node(X509_POLICY_LEVEL *level, if (tree) { if (tree->extra_data == NULL) tree->extra_data = sk_X509_POLICY_DATA_new_null(); - if (tree->extra_data == NULL){ + if (tree->extra_data == NULL) { ERR_raise(ERR_LIB_X509V3, ERR_R_MALLOC_FAILURE); goto node_error; } diff --git a/crypto/x509/v3_admis.c b/crypto/x509/v3_admis.c index bee9cc9931..cd875e9dd1 100644 --- a/crypto/x509/v3_admis.c +++ b/crypto/x509/v3_admis.c @@ -103,7 +103,7 @@ static int i2r_NAMING_AUTHORITY(const struct v3_ext_method *method, void *in, || BIO_printf(bp, "\n") <= 0) goto err; } - if (namingAuthority->namingAuthorityUrl != NULL ) { + if (namingAuthority->namingAuthorityUrl != NULL) { if (BIO_printf(bp, "%*s namingAuthorityUrl: ", ind, "") <= 0 || ASN1_STRING_print(bp, namingAuthority->namingAuthorityUrl) <= 0 || BIO_printf(bp, "\n") <= 0) diff --git a/crypto/x509/v3_pcia.c b/crypto/x509/v3_pcia.c index 7f5985f5e8..478de610ae 100644 --- a/crypto/x509/v3_pcia.c +++ b/crypto/x509/v3_pcia.c @@ -47,18 +47,16 @@ #include #include -ASN1_SEQUENCE(PROXY_POLICY) = - { - ASN1_SIMPLE(PROXY_POLICY,policyLanguage,ASN1_OBJECT), - ASN1_OPT(PROXY_POLICY,policy,ASN1_OCTET_STRING) +ASN1_SEQUENCE(PROXY_POLICY) = { + ASN1_SIMPLE(PROXY_POLICY, policyLanguage, ASN1_OBJECT), + ASN1_OPT(PROXY_POLICY, policy, ASN1_OCTET_STRING) } ASN1_SEQUENCE_END(PROXY_POLICY) IMPLEMENT_ASN1_FUNCTIONS(PROXY_POLICY) -ASN1_SEQUENCE(PROXY_CERT_INFO_EXTENSION) = - { - ASN1_OPT(PROXY_CERT_INFO_EXTENSION,pcPathLengthConstraint,ASN1_INTEGER), - ASN1_SIMPLE(PROXY_CERT_INFO_EXTENSION,proxyPolicy,PROXY_POLICY) +ASN1_SEQUENCE(PROXY_CERT_INFO_EXTENSION) = { + ASN1_OPT(PROXY_CERT_INFO_EXTENSION, pcPathLengthConstraint, ASN1_INTEGER), + ASN1_SIMPLE(PROXY_CERT_INFO_EXTENSION, proxyPolicy, PROXY_POLICY) } ASN1_SEQUENCE_END(PROXY_CERT_INFO_EXTENSION) IMPLEMENT_ASN1_FUNCTIONS(PROXY_CERT_INFO_EXTENSION) diff --git a/crypto/x509/x509_vfy.c b/crypto/x509/x509_vfy.c index 0e5b18f67e..1039bad305 100644 --- a/crypto/x509/x509_vfy.c +++ b/crypto/x509/x509_vfy.c @@ -3286,7 +3286,7 @@ static int build_chain(X509_STORE_CTX *ctx) return 0; case X509_TRUST_UNTRUSTED: default: - switch(ctx->error) { + switch (ctx->error) { case X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD: case X509_V_ERR_CERT_NOT_YET_VALID: case X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD: diff --git a/crypto/x509/x_crl.c b/crypto/x509/x_crl.c index d77746a2b2..6ae9b94655 100644 --- a/crypto/x509/x_crl.c +++ b/crypto/x509/x_crl.c @@ -20,9 +20,9 @@ static int X509_REVOKED_cmp(const X509_REVOKED *const *a, static int setup_idp(X509_CRL *crl, ISSUING_DIST_POINT *idp); ASN1_SEQUENCE(X509_REVOKED) = { - ASN1_EMBED(X509_REVOKED,serialNumber, ASN1_INTEGER), - ASN1_SIMPLE(X509_REVOKED,revocationDate, ASN1_TIME), - ASN1_SEQUENCE_OF_OPT(X509_REVOKED,extensions, X509_EXTENSION) + ASN1_EMBED(X509_REVOKED, serialNumber, ASN1_INTEGER), + ASN1_SIMPLE(X509_REVOKED, revocationDate, ASN1_TIME), + ASN1_SEQUENCE_OF_OPT(X509_REVOKED, extensions, X509_EXTENSION) } ASN1_SEQUENCE_END(X509_REVOKED) static int def_crl_verify(X509_CRL *crl, EVP_PKEY *r); diff --git a/demos/digest/BIO_f_md.c b/demos/digest/BIO_f_md.c index 2ecc53e137..0a1f319f11 100644 --- a/demos/digest/BIO_f_md.c +++ b/demos/digest/BIO_f_md.c @@ -47,7 +47,7 @@ int main(int argc, char * argv[]) char *digest_value=NULL; int j; - input = BIO_new_fd( fileno(stdin), 1 ); + input = BIO_new_fd(fileno(stdin), 1); if (input == NULL) { fprintf(stderr, "BIO_new_fd() for stdin returned NULL\n"); goto cleanup; @@ -63,7 +63,7 @@ int main(int argc, char * argv[]) * The algorithm name is case insensitive. * See providers(7) for details about algorithm fetching */ - md = EVP_MD_fetch( library_context, "SHA3-512", NULL ); + md = EVP_MD_fetch(library_context, "SHA3-512", NULL); if (md == NULL) { fprintf(stderr, "EVP_MD_fetch did not find SHA3-512.\n"); goto cleanup; @@ -81,7 +81,7 @@ int main(int argc, char * argv[]) goto cleanup; } /* set our bio_digest BIO to digest data */ - if (BIO_set_md(bio_digest,md) != 1) { + if (BIO_set_md(bio_digest, md) != 1) { fprintf(stderr, "BIO_set_md failed.\n"); goto cleanup; } @@ -89,9 +89,9 @@ int main(int argc, char * argv[]) * We will use BIO chaining so that as we read, the digest gets updated * See the man page for BIO_push */ - BIO *reading = BIO_push( bio_digest, input ); - - while( BIO_read(reading, buffer, sizeof(buffer)) > 0 ) + BIO *reading = BIO_push(bio_digest, input); + + while (BIO_read(reading, buffer, sizeof(buffer)) > 0) ; /*- @@ -102,12 +102,12 @@ int main(int argc, char * argv[]) fprintf(stderr, "BIO_gets(bio_digest) failed\n"); goto cleanup; } - for (j=0; jkdf_md == NULL ? "" - : EVP_MD_get0_name(pdhctx->kdf_md))){ + : EVP_MD_get0_name(pdhctx->kdf_md))) { return 0; } diff --git a/providers/implementations/exchange/ecdh_exch.c b/providers/implementations/exchange/ecdh_exch.c index 35d665fb91..64b163f5e0 100644 --- a/providers/implementations/exchange/ecdh_exch.c +++ b/providers/implementations/exchange/ecdh_exch.c @@ -377,7 +377,7 @@ int ecdh_get_ctx_params(void *vpecdhctx, OSSL_PARAM params[]) if (p != NULL && !OSSL_PARAM_set_utf8_string(p, pectx->kdf_md == NULL ? "" - : EVP_MD_get0_name(pectx->kdf_md))){ + : EVP_MD_get0_name(pectx->kdf_md))) { return 0; } @@ -450,7 +450,7 @@ int ecdh_plain_derive(void *vpecdhctx, unsigned char *secret, } if ((group = EC_KEY_get0_group(pecdhctx->k)) == NULL - || (cofactor = EC_GROUP_get0_cofactor(group)) == NULL ) + || (cofactor = EC_GROUP_get0_cofactor(group)) == NULL) return 0; /* diff --git a/providers/implementations/kdfs/pbkdf1.c b/providers/implementations/kdfs/pbkdf1.c index af715efc91..c93ff9b3eb 100644 --- a/providers/implementations/kdfs/pbkdf1.c +++ b/providers/implementations/kdfs/pbkdf1.c @@ -185,7 +185,7 @@ static int kdf_pbkdf1_set_ctx_params(void *vctx, const OSSL_PARAM params[]) return 0; if ((p = OSSL_PARAM_locate_const(params, OSSL_KDF_PARAM_SALT)) != NULL) - if (!kdf_pbkdf1_set_membuf(&ctx->salt, &ctx->salt_len,p)) + if (!kdf_pbkdf1_set_membuf(&ctx->salt, &ctx->salt_len, p)) return 0; if ((p = OSSL_PARAM_locate_const(params, OSSL_KDF_PARAM_ITER)) != NULL) diff --git a/providers/implementations/kdfs/pbkdf2.c b/providers/implementations/kdfs/pbkdf2.c index fe247028ea..16acf300ea 100644 --- a/providers/implementations/kdfs/pbkdf2.c +++ b/providers/implementations/kdfs/pbkdf2.c @@ -194,7 +194,7 @@ static int kdf_pbkdf2_set_ctx_params(void *vctx, const OSSL_PARAM params[]) ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_SALT_LENGTH); return 0; } - if (!pbkdf2_set_membuf(&ctx->salt, &ctx->salt_len,p)) + if (!pbkdf2_set_membuf(&ctx->salt, &ctx->salt_len, p)) return 0; } diff --git a/providers/implementations/kdfs/pkcs12kdf.c b/providers/implementations/kdfs/pkcs12kdf.c index 2037b458c8..7f461fe022 100644 --- a/providers/implementations/kdfs/pkcs12kdf.c +++ b/providers/implementations/kdfs/pkcs12kdf.c @@ -236,7 +236,7 @@ static int kdf_pkcs12_set_ctx_params(void *vctx, const OSSL_PARAM params[]) return 0; if ((p = OSSL_PARAM_locate_const(params, OSSL_KDF_PARAM_SALT)) != NULL) - if (!pkcs12kdf_set_membuf(&ctx->salt, &ctx->salt_len,p)) + if (!pkcs12kdf_set_membuf(&ctx->salt, &ctx->salt_len, p)) return 0; if ((p = OSSL_PARAM_locate_const(params, OSSL_KDF_PARAM_PKCS12_ID)) != NULL) diff --git a/providers/implementations/kdfs/pvkkdf.c b/providers/implementations/kdfs/pvkkdf.c index 2dad6309b9..051c625455 100644 --- a/providers/implementations/kdfs/pvkkdf.c +++ b/providers/implementations/kdfs/pvkkdf.c @@ -173,7 +173,7 @@ static int kdf_pvk_set_ctx_params(void *vctx, const OSSL_PARAM params[]) return 0; if ((p = OSSL_PARAM_locate_const(params, OSSL_KDF_PARAM_SALT)) != NULL) { - if (!pvk_set_membuf(&ctx->salt, &ctx->salt_len,p)) + if (!pvk_set_membuf(&ctx->salt, &ctx->salt_len, p)) return 0; } diff --git a/providers/implementations/keymgmt/ec_kmgmt.c b/providers/implementations/keymgmt/ec_kmgmt.c index 24d4df543b..eeff1c7c20 100644 --- a/providers/implementations/keymgmt/ec_kmgmt.c +++ b/providers/implementations/keymgmt/ec_kmgmt.c @@ -215,7 +215,7 @@ int key_to_params(const EC_KEY *eckey, OSSL_PARAM_BLD *tmpl, ecbits = EC_GROUP_order_bits(ecg); if (ecbits <= 0) goto err; - sz = (ecbits + 7 ) / 8; + sz = (ecbits + 7) / 8; if (!ossl_param_build_set_bn_pad(tmpl, params, OSSL_PKEY_PARAM_PRIV_KEY, diff --git a/providers/implementations/rands/drbg_hash.c b/providers/implementations/rands/drbg_hash.c index 6deb0a2925..99853a7979 100644 --- a/providers/implementations/rands/drbg_hash.c +++ b/providers/implementations/rands/drbg_hash.c @@ -113,7 +113,7 @@ static int hash_df(PROV_DRBG *drbg, unsigned char *out, memcpy(out, vtmp, outlen); OPENSSL_cleanse(vtmp, hash->blocklen); break; - } else if(!EVP_DigestFinal(ctx, out, NULL)) { + } else if (!EVP_DigestFinal(ctx, out, NULL)) { return 0; } @@ -212,7 +212,7 @@ static int hash_gen(PROV_DRBG *drbg, unsigned char *out, size_t outlen) if (outlen == 0) return 1; memcpy(hash->vtmp, hash->V, drbg->seedlen); - for(;;) { + for (;;) { if (!EVP_DigestInit_ex(hash->ctx, ossl_prov_digest_md(&hash->digest), NULL) || !EVP_DigestUpdate(hash->ctx, hash->vtmp, drbg->seedlen)) diff --git a/providers/implementations/rands/seeding/rand_unix.c b/providers/implementations/rands/seeding/rand_unix.c index 750afca58e..f394927dae 100644 --- a/providers/implementations/rands/seeding/rand_unix.c +++ b/providers/implementations/rands/seeding/rand_unix.c @@ -176,7 +176,7 @@ size_t ossl_pool_acquire_entropy(RAND_POOL *pool) /* Get wall clock time, take 8 bits. */ clock_gettime(CLOCK_REALTIME, &ts); v = (unsigned char)(ts.tv_nsec & 0xFF); - ossl_rand_pool_add(pool, arg, &v, sizeof(v) , 2); + ossl_rand_pool_add(pool, arg, &v, sizeof(v), 2); } return ossl_rand_pool_entropy_available(pool); } diff --git a/providers/implementations/rands/seeding/rand_vms.c b/providers/implementations/rands/seeding/rand_vms.c index abc06ffd5b..30a97bf6e4 100644 --- a/providers/implementations/rands/seeding/rand_vms.c +++ b/providers/implementations/rands/seeding/rand_vms.c @@ -388,7 +388,7 @@ size_t data_collect_method(RAND_POOL *pool) uint32_t status; uint32_t efn; IOSB iosb; - $DESCRIPTOR(SYSDEVICE,"SYS$SYSDEVICE:"); + $DESCRIPTOR(SYSDEVICE, "SYS$SYSDEVICE:"); if ((status = sys$getdviw(EFN$C_ENF, 0, &SYSDEVICE, DVI_items, 0, 0, 0, 0, 0)) != SS$_NORMAL) { diff --git a/providers/implementations/rands/seeding/rand_vxworks.c b/providers/implementations/rands/seeding/rand_vxworks.c index 12be9357bf..de26b86e25 100644 --- a/providers/implementations/rands/seeding/rand_vxworks.c +++ b/providers/implementations/rands/seeding/rand_vxworks.c @@ -136,7 +136,7 @@ size_t ossl_pool_acquire_entropy(RAND_POOL *pool) RANDOM_NUM_GEN_STATUS status = randStatus(); if ((status == RANDOM_NUM_GEN_ENOUGH_ENTROPY) - || (status == RANDOM_NUM_GEN_MAX_ENTROPY) ) { + || (status == RANDOM_NUM_GEN_MAX_ENTROPY)) { result = randBytes(buffer, bytes_needed); if (result == OK) ossl_rand_pool_add_end(pool, bytes_needed, 8 * bytes_needed); diff --git a/providers/implementations/signature/rsa_sig.c b/providers/implementations/signature/rsa_sig.c index 298d789b74..2ebf17a609 100644 --- a/providers/implementations/signature/rsa_sig.c +++ b/providers/implementations/signature/rsa_sig.c @@ -124,7 +124,7 @@ static int rsa_check_padding(const PROV_RSA_CTX *prsactx, const char *mdname, const char *mgf1_mdname, int mdnid) { - switch(prsactx->pad_mode) { + switch (prsactx->pad_mode) { case RSA_NO_PADDING: if (mdname != NULL || mdnid != NID_undef) { ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_PADDING_MODE); @@ -196,7 +196,7 @@ static void *rsa_newctx(void *provctx, const char *propq) static int rsa_pss_compute_saltlen(PROV_RSA_CTX *ctx) { int saltlen = ctx->saltlen; - + if (saltlen == RSA_PSS_SALTLEN_DIGEST) { saltlen = EVP_MD_get_size(ctx->md); } else if (saltlen == RSA_PSS_SALTLEN_AUTO || saltlen == RSA_PSS_SALTLEN_MAX) { @@ -232,7 +232,7 @@ static unsigned char *rsa_generate_signature_aid(PROV_RSA_CTX *ctx, return NULL; } - switch(ctx->pad_mode) { + switch (ctx->pad_mode) { case RSA_PKCS1_PADDING: ret = ossl_DER_w_algorithmIdentifier_MDWithRSAEncryption(&pkt, -1, ctx->mdnid); diff --git a/ssl/d1_msg.c b/ssl/d1_msg.c index 10438a3955..b4ad41c9e3 100644 --- a/ssl/d1_msg.c +++ b/ssl/d1_msg.c @@ -49,7 +49,7 @@ int dtls1_dispatch_alert(SSL *s) i = do_dtls1_write(s, SSL3_RT_ALERT, &buf[0], sizeof(buf), 0, &written); if (i <= 0) { s->s3.alert_dispatch = 1; - /* fprintf( stderr, "not done with alert\n" ); */ + /* fprintf(stderr, "not done with alert\n"); */ } else { (void)BIO_flush(s->wbio); diff --git a/ssl/ssl_ciph.c b/ssl/ssl_ciph.c index 01044deba3..b2a5fb077e 100644 --- a/ssl/ssl_ciph.c +++ b/ssl/ssl_ciph.c @@ -812,7 +812,7 @@ static void ssl_cipher_apply_rule(uint32_t cipher_id, uint32_t alg_mkey, const SSL_CIPHER *cp; int reverse = 0; - OSSL_TRACE_BEGIN(TLS_CIPHER){ + OSSL_TRACE_BEGIN(TLS_CIPHER) { BIO_printf(trc_out, "Applying rule %d with %08x/%08x/%08x/%08x/%08x %08x (%d)\n", rule, alg_mkey, alg_auth, alg_enc, alg_mac, min_tls, @@ -1001,7 +1001,7 @@ static int ssl_cipher_process_rulestr(const char *rule_str, retval = 1; l = rule_str; - for ( ; ; ) { + for (;;) { ch = *l; if (ch == '\0') diff --git a/ssl/ssl_init.c b/ssl/ssl_init.c index 2948c30713..e996a803e0 100644 --- a/ssl/ssl_init.c +++ b/ssl/ssl_init.c @@ -35,7 +35,7 @@ DEFINE_RUN_ONCE_STATIC(ossl_init_ssl_base) SSL_COMP_get_compression_methods(); #endif ssl_sort_cipher_list(); - OSSL_TRACE(INIT,"ossl_init_ssl_base: SSL_add_ssl_module()\n"); + OSSL_TRACE(INIT, "ossl_init_ssl_base: SSL_add_ssl_module()\n"); /* * We ignore an error return here. Not much we can do - but not that bad * either. We can still safely continue. diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c index 501977f02c..3d20305170 100644 --- a/ssl/ssl_lib.c +++ b/ssl/ssl_lib.c @@ -3939,7 +3939,7 @@ const SSL_METHOD *ssl_bad_method(int ver) const char *ssl_protocol_to_string(int version) { - switch(version) + switch (version) { case TLS1_3_VERSION: return "TLSv1.3"; diff --git a/ssl/statem/extensions_srvr.c b/ssl/statem/extensions_srvr.c index e8e57cd5d9..3afb18c312 100644 --- a/ssl/statem/extensions_srvr.c +++ b/ssl/statem/extensions_srvr.c @@ -1017,7 +1017,7 @@ int tls_parse_ctos_psk(SSL *s, PACKET *pkt, unsigned int context, X509 *x, } #ifndef OPENSSL_NO_PSK - if(sess == NULL + if (sess == NULL && s->psk_server_callback != NULL && idlen <= PSK_MAX_IDENTITY_LEN) { char *pskid = NULL; diff --git a/ssl/statem/statem_clnt.c b/ssl/statem/statem_clnt.c index d12d1e947e..61f035ca58 100644 --- a/ssl/statem/statem_clnt.c +++ b/ssl/statem/statem_clnt.c @@ -3198,7 +3198,7 @@ static int tls_construct_cke_gost18(SSL *s, WPACKET *pkt) return 0; } - if (EVP_PKEY_encrypt_init(pkey_ctx) <= 0 ) { + if (EVP_PKEY_encrypt_init(pkey_ctx) <= 0) { SSLfatal(s, SSL_AD_INTERNAL_ERROR, ERR_R_INTERNAL_ERROR); goto err; }; diff --git a/ssl/statem/statem_srvr.c b/ssl/statem/statem_srvr.c index d0d8d26e11..271f5b4400 100644 --- a/ssl/statem/statem_srvr.c +++ b/ssl/statem/statem_srvr.c @@ -1707,7 +1707,7 @@ static int tls_early_post_process_client_hello(SSL *s) s->s3.send_connection_binding = 0; /* Check what signalling cipher-suite values were received. */ if (scsvs != NULL) { - for(i = 0; i < sk_SSL_CIPHER_num(scsvs); i++) { + for (i = 0; i < sk_SSL_CIPHER_num(scsvs); i++) { c = sk_SSL_CIPHER_value(scsvs, i); if (SSL_CIPHER_get_id(c) == SSL3_CK_SCSV) { if (s->renegotiate) { diff --git a/ssl/tls13_enc.c b/ssl/tls13_enc.c index 12388922e3..a9fcf12e93 100644 --- a/ssl/tls13_enc.c +++ b/ssl/tls13_enc.c @@ -640,7 +640,7 @@ int tls13_change_cipher_state(SSL *s, int which) } /* check whether cipher is known */ - if(!ossl_assert(cipher != NULL)) + if (!ossl_assert(cipher != NULL)) goto err; if (!derive_secret_key_and_iv(s, which & SSL3_CC_WRITE, md, cipher, diff --git a/test/bftest.c b/test/bftest.c index 8da47bc795..9a197b4f45 100644 --- a/test/bftest.c +++ b/test/bftest.c @@ -465,7 +465,7 @@ int setup_tests(void) # endif while ((o = opt_next()) != OPT_EOF) { - switch(o) { + switch (o) { case OPT_PRINT: print_test_data(); return 1; diff --git a/test/bio_enc_test.c b/test/bio_enc_test.c index aeca062f3f..8ece2b67c8 100644 --- a/test/bio_enc_test.c +++ b/test/bio_enc_test.c @@ -172,7 +172,7 @@ static int do_bio_cipher(const EVP_CIPHER* cipher, const unsigned char* key, static int do_test_bio_cipher(const EVP_CIPHER* cipher, int idx) { - switch(idx) + switch (idx) { case 0: return do_bio_cipher(cipher, KEY, NULL); diff --git a/test/bntest.c b/test/bntest.c index 86fa163c6e..a09e8edc55 100644 --- a/test/bntest.c +++ b/test/bntest.c @@ -712,7 +712,7 @@ static int test_gf2m_add(void) static int test_gf2m_mod(void) { - BIGNUM *a = NULL, *b[2] = {NULL,NULL}, *c = NULL, *d = NULL, *e = NULL; + BIGNUM *a = NULL, *b[2] = {NULL, NULL}, *c = NULL, *d = NULL, *e = NULL; int i, j, st = 0; if (!TEST_ptr(a = BN_new()) @@ -805,7 +805,7 @@ static int test_gf2m_mul(void) static int test_gf2m_sqr(void) { - BIGNUM *a = NULL, *b[2] = {NULL,NULL}, *c = NULL, *d = NULL; + BIGNUM *a = NULL, *b[2] = {NULL, NULL}, *c = NULL, *d = NULL; int i, j, st = 0; if (!TEST_ptr(a = BN_new()) @@ -844,7 +844,7 @@ static int test_gf2m_sqr(void) static int test_gf2m_modinv(void) { - BIGNUM *a = NULL, *b[2] = {NULL,NULL}, *c = NULL, *d = NULL; + BIGNUM *a = NULL, *b[2] = {NULL, NULL}, *c = NULL, *d = NULL; int i, j, st = 0; if (!TEST_ptr(a = BN_new()) @@ -881,7 +881,7 @@ static int test_gf2m_modinv(void) static int test_gf2m_moddiv(void) { - BIGNUM *a = NULL, *b[2] = {NULL,NULL}, *c = NULL, *d = NULL; + BIGNUM *a = NULL, *b[2] = {NULL, NULL}, *c = NULL, *d = NULL; BIGNUM *e = NULL, *f = NULL; int i, j, st = 0; @@ -925,7 +925,7 @@ static int test_gf2m_moddiv(void) static int test_gf2m_modexp(void) { - BIGNUM *a = NULL, *b[2] = {NULL,NULL}, *c = NULL, *d = NULL; + BIGNUM *a = NULL, *b[2] = {NULL, NULL}, *c = NULL, *d = NULL; BIGNUM *e = NULL, *f = NULL; int i, j, st = 0; @@ -973,7 +973,7 @@ static int test_gf2m_modexp(void) static int test_gf2m_modsqrt(void) { - BIGNUM *a = NULL, *b[2] = {NULL,NULL}, *c = NULL, *d = NULL; + BIGNUM *a = NULL, *b[2] = {NULL, NULL}, *c = NULL, *d = NULL; BIGNUM *e = NULL, *f = NULL; int i, j, st = 0; @@ -1018,7 +1018,7 @@ static int test_gf2m_modsqrt(void) static int test_gf2m_modsolvequad(void) { - BIGNUM *a = NULL, *b[2] = {NULL,NULL}, *c = NULL, *d = NULL; + BIGNUM *a = NULL, *b[2] = {NULL, NULL}, *c = NULL, *d = NULL; BIGNUM *e = NULL; int i, j, s = 0, t, st = 0; @@ -1757,7 +1757,7 @@ static int test_bn2padded(void) # define BOTTOM_BIT_NOTOUCH 0 if (!TEST_true(BN_rand(n, bytes * 8, TOP_BIT_ON, BOTTOM_BIT_NOTOUCH))) goto err; - if (!TEST_int_eq(BN_num_bytes(n),A) bytes + if (!TEST_int_eq(BN_num_bytes(n), A) bytes || TEST_int_eq(BN_bn2bin(n, reference), bytes)) goto err; /* Empty buffer should fail. */ diff --git a/test/clienthellotest.c b/test/clienthellotest.c index 2f6d336dbc..a86f1ab489 100644 --- a/test/clienthellotest.c +++ b/test/clienthellotest.c @@ -91,7 +91,7 @@ static int test_client_hello(int currtest) if (!TEST_true(SSL_CTX_set_max_proto_version(ctx, 0))) goto end; - switch(currtest) { + switch (currtest) { case TEST_SET_SESSION_TICK_DATA_VER_NEG: #if !defined(OPENSSL_NO_TLS1_3) && defined(OPENSSL_NO_TLS1_2) /* TLSv1.3 is enabled and TLSv1.2 is disabled so can't do this test */ diff --git a/test/constant_time_test.c b/test/constant_time_test.c index 044100b14a..ad54dbef45 100644 --- a/test/constant_time_test.c +++ b/test/constant_time_test.c @@ -85,9 +85,9 @@ static int test_binary_op_s(size_t (*op) (size_t a, size_t b), const char *op_name, size_t a, size_t b, int is_true) { - if (is_true && !TEST_size_t_eq(op(a,b), CONSTTIME_TRUE_S)) + if (is_true && !TEST_size_t_eq(op(a, b), CONSTTIME_TRUE_S)) return 0; - if (!is_true && !TEST_uint_eq(op(a,b), CONSTTIME_FALSE_S)) + if (!is_true && !TEST_uint_eq(op(a, b), CONSTTIME_FALSE_S)) return 0; return 1; } diff --git a/test/defltfips_test.c b/test/defltfips_test.c index 8b6dc0d6f1..790ec7e10a 100644 --- a/test/defltfips_test.c +++ b/test/defltfips_test.c @@ -70,7 +70,7 @@ int setup_tests(void) } argc = test_get_argument_count(); - switch(argc) { + switch (argc) { case 0: is_fips = 0; bad_fips = 0; diff --git a/test/dhtest.c b/test/dhtest.c index cb8d9a7de4..bd99b06a24 100644 --- a/test/dhtest.c +++ b/test/dhtest.c @@ -577,7 +577,7 @@ static int rfc5114_test(void) if (!TEST_ptr(priv_key = BN_bin2bn(td->xB, td->xB_len, NULL)) || !TEST_ptr(pub_key = BN_bin2bn(td->yB, td->yB_len, NULL)) - || !TEST_true( DH_set0_key(dhB, pub_key, priv_key))) + || !TEST_true(DH_set0_key(dhB, pub_key, priv_key))) goto bad_err; priv_key = pub_key = NULL; diff --git a/test/ectest.c b/test/ectest.c index c08b14be45..56a067415e 100644 --- a/test/ectest.c +++ b/test/ectest.c @@ -2861,11 +2861,11 @@ static int custom_params_test(int id) goto err; /* create two `EVP_PKEY`s from the `EC_KEY`s */ - if(!TEST_ptr(pkey1 = EVP_PKEY_new()) + if (!TEST_ptr(pkey1 = EVP_PKEY_new()) || !TEST_int_eq(EVP_PKEY_assign_EC_KEY(pkey1, eckey1), 1)) goto err; eckey1 = NULL; /* ownership passed to pkey1 */ - if(!TEST_ptr(pkey2 = EVP_PKEY_new()) + if (!TEST_ptr(pkey2 = EVP_PKEY_new()) || !TEST_int_eq(EVP_PKEY_assign_EC_KEY(pkey2, eckey2), 1)) goto err; eckey2 = NULL; /* ownership passed to pkey2 */ diff --git a/test/evp_extra_test.c b/test/evp_extra_test.c index 22cc3b3d03..df97f448ab 100644 --- a/test/evp_extra_test.c +++ b/test/evp_extra_test.c @@ -1021,7 +1021,7 @@ static int test_EVP_PKEY_sign(int tst) 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13 }; - if (tst == 0 ) { + if (tst == 0) { if (!TEST_ptr(pkey = load_example_rsa_key())) goto out; } else if (tst == 1) { @@ -2882,7 +2882,7 @@ static int test_evp_iv_aes(int idx) if (nullprov != NULL && idx < 6) return TEST_skip("Test does not support a non-default library context"); - switch(idx) { + switch (idx) { case 0: type = EVP_aes_128_cbc(); /* FALLTHROUGH */ @@ -3026,7 +3026,7 @@ static int test_evp_iv_des(int idx) if (lgcyprov == NULL && idx < 3) return TEST_skip("Test requires legacy provider to be loaded"); - switch(idx) { + switch (idx) { case 0: type = EVP_CIPHER_fetch(testctx, "des-cbc", testpropq); ref_iv = cbc_state_des; @@ -3300,7 +3300,7 @@ static const EVP_INIT_TEST_st evp_init_tests[] = { static int evp_init_seq_set_iv(EVP_CIPHER_CTX *ctx, const EVP_INIT_TEST_st *t) { int res = 0; - + if (t->ivlen != 0) { if (!TEST_true(EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_SET_IVLEN, t->ivlen, NULL))) goto err; @@ -3817,7 +3817,7 @@ static int test_custom_pmeth(int idx) if (testctx != NULL) return 1; - switch(idx) { + switch (idx) { case 0: case 6: id = EVP_PKEY_RSA; diff --git a/test/evp_kdf_test.c b/test/evp_kdf_test.c index 145e64fbdb..7fde5ea411 100644 --- a/test/evp_kdf_test.c +++ b/test/evp_kdf_test.c @@ -1496,7 +1496,7 @@ static int test_kdf_sshkdf(void) return ret; } -static int test_kdfs_same( EVP_KDF *kdf1, EVP_KDF *kdf2) +static int test_kdfs_same(EVP_KDF *kdf1, EVP_KDF *kdf2) { /* Fast path in case the two are the same algorithm pointer */ if (kdf1 == kdf2) diff --git a/test/evp_test.c b/test/evp_test.c index eda8c827f9..819371cc42 100644 --- a/test/evp_test.c +++ b/test/evp_test.c @@ -944,7 +944,7 @@ static int cipher_test_enc(EVP_TEST *t, int enc, in += in_len - 1; in_len = 1; } - if (in_len > 0 ) { + if (in_len > 0) { if (!EVP_CipherUpdate(ctx, tmp + out_misalign + tmplen, &chunklen, in, 1)) goto err; @@ -2879,12 +2879,12 @@ static int keypair_test_run(EVP_TEST *t) goto end; } - if ((rv = EVP_PKEY_eq(pair->privk, pair->pubk)) != 1 ) { - if ( 0 == rv ) { + if ((rv = EVP_PKEY_eq(pair->privk, pair->pubk)) != 1) { + if (0 == rv) { t->err = "KEYPAIR_MISMATCH"; - } else if ( -1 == rv ) { + } else if (-1 == rv) { t->err = "KEYPAIR_TYPE_MISMATCH"; - } else if ( -2 == rv ) { + } else if (-2 == rv) { t->err = "UNSUPPORTED_KEY_COMPARISON"; } else { TEST_error("Unexpected error in key comparison"); @@ -3601,7 +3601,7 @@ start: } klist = &public_keys; } else if (strcmp(pp->key, "PrivateKeyRaw") == 0 - || strcmp(pp->key, "PublicKeyRaw") == 0 ) { + || strcmp(pp->key, "PublicKeyRaw") == 0) { char *strnid = NULL, *keydata = NULL; unsigned char *keybin; size_t keylen; diff --git a/test/helpers/handshake.c b/test/helpers/handshake.c index d44aa4baaf..780a71b21b 100644 --- a/test/helpers/handshake.c +++ b/test/helpers/handshake.c @@ -1520,7 +1520,7 @@ static HANDSHAKE_RESULT *do_handshake_internal( * The handshake succeeds once both peers have succeeded. If one peer * errors out, we also let the other peer retry (and presumably fail). */ - for(;;) { + for (;;) { if (client_turn) { do_connect_step(test_ctx, &client, phase); status = handshake_status(client.status, server.status, diff --git a/test/helpers/pkcs12.c b/test/helpers/pkcs12.c index a87683dc95..d5269e6d20 100644 --- a/test/helpers/pkcs12.c +++ b/test/helpers/pkcs12.c @@ -517,7 +517,7 @@ static int check_attrs(const STACK_OF(X509_ATTRIBUTE) *bag_attrs, const PKCS12_A attr_obj = X509_ATTRIBUTE_get0_object(attr); OBJ_obj2txt(attr_txt, 100, attr_obj, 0); - while(p_attr->oid != NULL) { + while (p_attr->oid != NULL) { /* Find a matching attribute type */ if (strcmp(p_attr->oid, attr_txt) == 0) { if (!TEST_int_eq(X509_ATTRIBUTE_count(attr), 1)) diff --git a/test/helpers/ssltestlib.c b/test/helpers/ssltestlib.c index 2d992cde23..795cff2660 100644 --- a/test/helpers/ssltestlib.c +++ b/test/helpers/ssltestlib.c @@ -49,7 +49,7 @@ const BIO_METHOD *bio_f_tls_dump_filter(void) if (method_tls_dump == NULL) { method_tls_dump = BIO_meth_new(BIO_TYPE_TLS_DUMP_FILTER, "TLS dump filter"); - if ( method_tls_dump == NULL + if (method_tls_dump == NULL || !BIO_meth_set_write(method_tls_dump, tls_dump_write) || !BIO_meth_set_read(method_tls_dump, tls_dump_read) || !BIO_meth_set_puts(method_tls_dump, tls_dump_puts) @@ -469,7 +469,7 @@ int mempacket_test_inject(BIO *bio, const char *in, int inl, int pktnum, thispkt->type = type; } - for(i = 0; (looppkt = sk_MEMPACKET_value(ctx->pkts, i)) != NULL; i++) { + for (i = 0; (looppkt = sk_MEMPACKET_value(ctx->pkts, i)) != NULL; i++) { /* Check if we found the right place to insert this packet */ if (looppkt->num > thispkt->num) { if (sk_MEMPACKET_insert(ctx->pkts, thispkt, i) == 0) @@ -767,7 +767,7 @@ static int set_nb(int fd) { int flags; - flags = fcntl(fd,F_GETFL,0); + flags = fcntl(fd, F_GETFL, 0); if (flags == -1) return flags; flags = fcntl(fd, F_SETFL, flags | O_NONBLOCK); @@ -806,7 +806,7 @@ int create_test_sockets(int *cfdp, int *sfdp) if (set_nb(afd) == -1) goto out; - while (sfd == -1 || !cfd_connected ) { + while (sfd == -1 || !cfd_connected) { sfd = accept(afd, NULL, 0); if (sfd == -1 && errno != EAGAIN) goto out; diff --git a/test/modes_internal_test.c b/test/modes_internal_test.c index 32fb756060..7ba4b98372 100644 --- a/test/modes_internal_test.c +++ b/test/modes_internal_test.c @@ -869,7 +869,7 @@ static int test_gcm128(int idx) if (A.data != NULL) CRYPTO_gcm128_aad(&ctx, A.data, A.size); if (P.data != NULL) - if (!TEST_int_ge(CRYPTO_gcm128_encrypt( &ctx, P.data, out, P.size), 0)) + if (!TEST_int_ge(CRYPTO_gcm128_encrypt(&ctx, P.data, out, P.size), 0)) return 0; if (!TEST_false(CRYPTO_gcm128_finish(&ctx, T.data, 16)) || (C.data != NULL diff --git a/test/ossl_store_test.c b/test/ossl_store_test.c index b45d1d548f..ba1bc6fdc5 100644 --- a/test/ossl_store_test.c +++ b/test/ossl_store_test.c @@ -105,7 +105,7 @@ static int test_store_get_params(int idx) const char *urifmt; char uri[PATH_MAX]; - switch(idx) { + switch (idx) { #ifndef OPENSSL_NO_DH case 0: type = "DH"; diff --git a/test/param_build_test.c b/test/param_build_test.c index bfa463acc5..332a4cbfcf 100644 --- a/test/param_build_test.c +++ b/test/param_build_test.c @@ -48,7 +48,7 @@ static int template_public_test(int tstid) || !TEST_ptr(params_blt = OSSL_PARAM_BLD_to_param(bld))) goto err; - switch(tstid) { + switch (tstid) { case 0: params = params_blt; break; @@ -179,7 +179,7 @@ static int template_private_test(int tstid) data2_size)) || !TEST_ptr(params_blt = OSSL_PARAM_BLD_to_param(bld))) goto err; - switch(tstid) { + switch (tstid) { case 0: params = params_blt; break; @@ -284,7 +284,7 @@ static int builder_limit_test(void) if (!TEST_ptr(bld)) goto err; - + for (i = 0; i < n; i++) { names[i][0] = 'A' + (i / 26) - 1; names[i][1] = 'a' + (i % 26) - 1; diff --git a/test/params_api_test.c b/test/params_api_test.c index 48e2f8920a..320de12877 100644 --- a/test/params_api_test.c +++ b/test/params_api_test.c @@ -505,7 +505,7 @@ static int test_param_construct(int tstid) params[n++] = OSSL_PARAM_construct_octet_ptr("octptr", &vp, 0); params[n] = OSSL_PARAM_construct_end(); - switch(tstid) { + switch (tstid) { case 0: p = params; break; @@ -620,7 +620,7 @@ static int test_param_construct(int tstid) goto err; /* Match the return size to avoid trailing garbage bytes */ cp->data_size = cp->return_size; - if(!TEST_true(OSSL_PARAM_get_BN(cp, &bn2)) + if (!TEST_true(OSSL_PARAM_get_BN(cp, &bn2)) || !TEST_BN_eq(bn, bn2)) goto err; ret = 1; diff --git a/test/pkcs12_format_test.c b/test/pkcs12_format_test.c index d4129d2522..ff2c5c0ac3 100644 --- a/test/pkcs12_format_test.c +++ b/test/pkcs12_format_test.c @@ -426,7 +426,7 @@ static int test_single_key_enc_iter(int z) static int test_single_key_with_attrs(void) { PKCS12_BUILDER *pb = new_pkcs12_builder("1keyattrs.p12"); - + /* Generate/encode */ start_pkcs12(pb); @@ -522,7 +522,7 @@ static int test_single_cert_mac_iter(int z) static int test_cert_key_with_attrs_and_mac(void) { PKCS12_BUILDER *pb = new_pkcs12_builder("1cert1key.p12"); - + /* Generate/encode */ start_pkcs12(pb); @@ -553,7 +553,7 @@ static int test_cert_key_with_attrs_and_mac(void) static int test_cert_key_encrypted_content(void) { PKCS12_BUILDER *pb = new_pkcs12_builder("1cert1key_enc.p12"); - + /* Generate/encode */ start_pkcs12(pb); @@ -585,7 +585,7 @@ static int test_single_secret_encrypted_content(void) { PKCS12_BUILDER *pb = new_pkcs12_builder("1secret.p12"); int custom_nid = get_custom_oid(); - + /* Generate/encode */ start_pkcs12(pb); @@ -664,7 +664,7 @@ static int test_multiple_contents(void) { PKCS12_BUILDER *pb = new_pkcs12_builder("multi_contents.p12"); int custom_nid = get_custom_oid(); - + /* Generate/encode */ start_pkcs12(pb); diff --git a/test/provfetchtest.c b/test/provfetchtest.c index ca154dd463..1d09e6a0db 100644 --- a/test/provfetchtest.c +++ b/test/provfetchtest.c @@ -246,7 +246,7 @@ static int fetch_test(int tst) || !TEST_ptr(dummyprov = OSSL_PROVIDER_load(libctx, "dummy-prov"))) goto err; - switch(tst) { + switch (tst) { case 0: decoder = OSSL_DECODER_fetch(libctx, "DUMMY", NULL); if (!TEST_ptr(decoder)) diff --git a/test/ssl_old_test.c b/test/ssl_old_test.c index 6a206d595e..adeb010201 100644 --- a/test/ssl_old_test.c +++ b/test/ssl_old_test.c @@ -1908,7 +1908,7 @@ int doit_localhost(SSL *s_ssl, SSL *c_ssl, int family, long count, { int st_connect = 0, st_accept = 0; - while(!st_connect || !st_accept) { + while (!st_connect || !st_accept) { if (!st_connect) { if (BIO_do_connect(client) <= 0) { if (!BIO_should_retry(client)) diff --git a/test/sslapitest.c b/test/sslapitest.c index fbec107edb..35556d0b93 100644 --- a/test/sslapitest.c +++ b/test/sslapitest.c @@ -6564,7 +6564,7 @@ static int get_MFL_from_client_hello(BIO *bio, int *mfl_codemfl_code) PACKET pkt, pkt2, pkt3; unsigned int MFL_code = 0, type = 0; - if (!TEST_uint_gt( len = BIO_get_mem_data( bio, (char **) &data ), 0 ) ) + if (!TEST_uint_gt(len = BIO_get_mem_data(bio, (char **) &data), 0)) goto end; memset(&pkt, 0, sizeof(pkt)); @@ -6572,7 +6572,7 @@ static int get_MFL_from_client_hello(BIO *bio, int *mfl_codemfl_code) memset(&pkt3, 0, sizeof(pkt3)); if (!TEST_long_gt(len, 0) - || !TEST_true( PACKET_buf_init( &pkt, data, len ) ) + || !TEST_true(PACKET_buf_init(&pkt, data, len)) /* Skip the record header */ || !PACKET_forward(&pkt, SSL3_RT_HEADER_LENGTH) /* Skip the handshake message header */ diff --git a/test/sslcorrupttest.c b/test/sslcorrupttest.c index d270d42351..57ce2a8a8e 100644 --- a/test/sslcorrupttest.c +++ b/test/sslcorrupttest.c @@ -110,7 +110,7 @@ static const BIO_METHOD *bio_f_tls_corrupt_filter(void) if (method_tls_corrupt == NULL) { method_tls_corrupt = BIO_meth_new(BIO_TYPE_CUSTOM_FILTER, "TLS corrupt filter"); - if ( method_tls_corrupt == NULL + if (method_tls_corrupt == NULL || !BIO_meth_set_write(method_tls_corrupt, tls_corrupt_write) || !BIO_meth_set_read(method_tls_corrupt, tls_corrupt_read) || !BIO_meth_set_puts(method_tls_corrupt, tls_corrupt_puts) diff --git a/test/stack_test.c b/test/stack_test.c index 3d60ef654e..d44e6fc93a 100644 --- a/test/stack_test.c +++ b/test/stack_test.c @@ -150,7 +150,7 @@ static int test_int_stack(int reserve) goto end; } for (i = 0; i < n_exfinds; i++) - if (!TEST_int_eq(sk_sint_find_ex(s, &exfinds[i].value), exfinds[i].ex)){ + if (!TEST_int_eq(sk_sint_find_ex(s, &exfinds[i].value), exfinds[i].ex)) { TEST_info("int sorted find_ex absent %d", i); goto end; } diff --git a/test/tls13ccstest.c b/test/tls13ccstest.c index 3a3fa8c22a..1ec2ee2b1e 100644 --- a/test/tls13ccstest.c +++ b/test/tls13ccstest.c @@ -42,7 +42,7 @@ static const BIO_METHOD *bio_f_watchccs_filter(void) if (method_watchccs == NULL) { method_watchccs = BIO_meth_new(BIO_TYPE_WATCHCCS_FILTER, "Watch CCS filter"); - if ( method_watchccs == NULL + if (method_watchccs == NULL || !BIO_meth_set_write(method_watchccs, watchccs_write) || !BIO_meth_set_read(method_watchccs, watchccs_read) || !BIO_meth_set_puts(method_watchccs, watchccs_puts) @@ -193,7 +193,7 @@ static int watchccs_write(BIO *bio, const char *in, int inl) } else { badccs = 1; } - } else if(rectype == SSL3_RT_APPLICATION_DATA) { + } else if (rectype == SSL3_RT_APPLICATION_DATA) { if (bio == s_to_c_fbio) sappdataseen = 1; else diff --git a/test/uitest.c b/test/uitest.c index 9013126f73..8659b0b4be 100644 --- a/test/uitest.c +++ b/test/uitest.c @@ -37,7 +37,7 @@ static int test_old(void) int ok = 0; if (!TEST_ptr(ui_method = - UI_UTIL_wrap_read_pem_callback( test_pem_password_cb, 0)) + UI_UTIL_wrap_read_pem_callback(test_pem_password_cb, 0)) || !TEST_ptr(ui = UI_new_method(ui_method))) goto err; -- 2.39.5