Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enforce OpenSSL coding style #21468

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/cmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1571,7 +1571,7 @@ static int setup_request_ctx(OSSL_CMP_CTX *ctx, ENGINE *engine)
if (opt_csr != NULL) {
CMP_err1("no -newkey option given with private key for POPO, -csr option only provides public key%s",
opt_key == NULL ? "" :
", and -key option superseded by by -csr");
", and -key option superseded by -csr");
return 0;
}
if (opt_key == NULL) {
Expand Down
2 changes: 1 addition & 1 deletion apps/dgst.c
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ static void show_digests(const OBJ_NAME *name, void *arg)
* in the '*sum' checksum programs. This aims to preserve backward
* compatibility.
*/
static const char *newline_escape_filename(const char *file, int * backslash)
static const char *newline_escape_filename(const char *file, int *backslash)
{
size_t i, e = 0, length = strlen(file), newline_count = 0, mem_len = 0;
char *file_cpy = NULL;
Expand Down
6 changes: 3 additions & 3 deletions apps/include/opt.h
Original file line number Diff line number Diff line change
Expand Up @@ -387,11 +387,11 @@ typedef struct string_int_pair_st {
#define OPT_PARAMETERS() { OPT_PARAM_STR, 1, '-', "Parameters:\n" }

const char *opt_path_end(const char *filename);
char *opt_init(int ac, char **av, const OPTIONS * o);
char *opt_init(int ac, char **av, const OPTIONS *o);
char *opt_progname(const char *argv0);
char *opt_appname(const char *argv0);
char *opt_getprog(void);
void opt_help(const OPTIONS * list);
void opt_help(const OPTIONS *list);

void opt_begin(void);
int opt_next(void);
Expand Down Expand Up @@ -419,7 +419,7 @@ int opt_format(const char *s, unsigned long flags, int *result);
void print_format_error(int format, unsigned long flags);
int opt_printf_stderr(const char *fmt, ...);
int opt_string(const char *name, const char **options);
int opt_pair(const char *arg, const OPT_PAIR * pairs, int *result);
int opt_pair(const char *arg, const OPT_PAIR *pairs, int *result);

int opt_verify(int i, X509_VERIFY_PARAM *vpm);
int opt_rand(int i);
Expand Down
8 changes: 4 additions & 4 deletions apps/lib/apps.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ typedef struct {
} NAME_EX_TBL;

static int set_table_opts(unsigned long *flags, const char *arg,
const NAME_EX_TBL * in_tbl);
const NAME_EX_TBL *in_tbl);
static int set_multi_opts(unsigned long *flags, const char *arg,
const NAME_EX_TBL * in_tbl);
const NAME_EX_TBL *in_tbl);
int app_init(long mesgwin);

int chopup_args(ARGS *arg, char *buf)
Expand Down Expand Up @@ -1273,7 +1273,7 @@ int copy_extensions(X509 *x, X509_REQ *req, int copy_type)
}

static int set_multi_opts(unsigned long *flags, const char *arg,
const NAME_EX_TBL * in_tbl)
const NAME_EX_TBL *in_tbl)
{
STACK_OF(CONF_VALUE) *vals;
CONF_VALUE *val;
Expand All @@ -1292,7 +1292,7 @@ static int set_multi_opts(unsigned long *flags, const char *arg,
}

static int set_table_opts(unsigned long *flags, const char *arg,
const NAME_EX_TBL * in_tbl)
const NAME_EX_TBL *in_tbl)
{
char c;
const NAME_EX_TBL *ptbl;
Expand Down
4 changes: 2 additions & 2 deletions apps/openssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -446,12 +446,12 @@ static int do_cmd(LHASH_OF(FUNCTION) *prog, int argc, char *argv[])
return 1;
}

static int function_cmp(const FUNCTION * a, const FUNCTION * b)
static int function_cmp(const FUNCTION *a, const FUNCTION *b)
{
return strncmp(a->name, b->name, 8);
}

static unsigned long function_hash(const FUNCTION * a)
static unsigned long function_hash(const FUNCTION *a)
{
return OPENSSL_LH_strhash(a->name);
}
Expand Down
2 changes: 1 addition & 1 deletion apps/s_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ typedef struct {
char buff[1];
} EBCDIC_OUTBUFF;

static const BIO_METHOD *BIO_f_ebcdic_filter()
static const BIO_METHOD *BIO_f_ebcdic_filter(void)
{
if (methods_ebcdic == NULL) {
methods_ebcdic = BIO_meth_new(BIO_TYPE_EBCDIC_FILTER,
Expand Down
4 changes: 2 additions & 2 deletions apps/speed.c
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ typedef struct loopargs_st {
unsigned char *sig_sig[MAX_KEM_NUM];
} loopargs_t;
static int run_benchmark(int async_jobs, int (*loop_function) (void *),
loopargs_t * loopargs);
loopargs_t *loopargs);

static unsigned int testnum;

Expand Down Expand Up @@ -1363,7 +1363,7 @@ static int SIG_verify_loop(void *args)
}

static int run_benchmark(int async_jobs,
int (*loop_function) (void *), loopargs_t * loopargs)
int (*loop_function) (void *), loopargs_t *loopargs)
{
int job_op_count = 0;
int total_op_count = 0;
Expand Down
2 changes: 1 addition & 1 deletion crypto/conf/conf_def.c
Original file line number Diff line number Diff line change
Expand Up @@ -892,7 +892,7 @@ static BIO *get_next_file(const char *path, OPENSSL_DIR_CTX **dirctx)

static int is_keytype(const CONF *conf, char c, unsigned short type)
{
const unsigned short * keytypes = (const unsigned short *) conf->meth_data;
const unsigned short *keytypes = (const unsigned short *) conf->meth_data;
unsigned char key = (unsigned char)c;

#ifdef CHARSET_EBCDIC
Expand Down
6 changes: 3 additions & 3 deletions crypto/cpuid.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ static variant_char *ossl_getenv(const char *name)
{
/*
* Since we pull only one environment variable, it's simpler to
* to just ignore |name| and use equivalent wide-char L-literal.
* just ignore |name| and use equivalent wide-char L-literal.
* As well as to ignore excessively long values...
*/
static WCHAR value[48];
Expand Down Expand Up @@ -173,15 +173,15 @@ void OPENSSL_cpuid_setup(void)
*/

/*
* The volatile is used to to ensure that the compiler generates code that reads
* The volatile is used to ensure that the compiler generates code that reads
* all values from the array and doesn't try to optimize this away. The standard
* doesn't actually require this behavior if the original data pointed to is
* not volatile, but compilers do this in practice anyway.
*
* There are also assembler versions of this function.
*/
# undef CRYPTO_memcmp
int CRYPTO_memcmp(const void * in_a, const void * in_b, size_t len)
int CRYPTO_memcmp(const void *in_a, const void *in_b, size_t len)
{
size_t i;
const volatile unsigned char *a = in_a;
Expand Down
6 changes: 3 additions & 3 deletions crypto/ec/curve448/curve448.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,15 +221,15 @@ ossl_curve448_point_valid(const curve448_point_t p)
}

static ossl_inline void constant_time_lookup_niels(niels_s * RESTRICT ni,
const niels_t * table,
const niels_t *table,
int nelts, int idx)
{
constant_time_lookup(ni, table, sizeof(niels_s), nelts, idx);
}

void
ossl_curve448_precomputed_scalarmul(curve448_point_t out,
const curve448_precomputed_s * table,
const curve448_precomputed_s *table,
const curve448_scalar_t scalar)
{
unsigned int i, j, k;
Expand Down Expand Up @@ -612,7 +612,7 @@ static int recode_wnaf(struct smvt_control *control,
return n - 1;
}

static void prepare_wnaf_table(pniels_t * output,
static void prepare_wnaf_table(pniels_t *output,
const curve448_point_t working,
unsigned int tbits)
{
Expand Down
2 changes: 1 addition & 1 deletion crypto/ec/curve448/point_448.h
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ ossl_x448_derive_public_key(uint8_t out[X448_PUBLIC_BYTES],
*/
void
ossl_curve448_precomputed_scalarmul(curve448_point_t scaled,
const curve448_precomputed_s * base,
const curve448_precomputed_s *base,
const curve448_scalar_t scalar);

/*
Expand Down
2 changes: 1 addition & 1 deletion crypto/ec/ecp_s390x_nistp.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ static ECDSA_SIG *ecdsa_s390x_nistp_sign_sig(const unsigned char *dgst,
goto ret;
}
/*
* Generate random k and copy to param param block. RAND_priv_bytes_ex
* Generate random k and copy to param block. RAND_priv_bytes_ex
* is used instead of BN_priv_rand_range or BN_generate_dsa_nonce
* because kdsa instruction constructs an in-range, invertible nonce
* internally implementing counter-measures for RNG weakness.
Expand Down
2 changes: 1 addition & 1 deletion crypto/evp/e_chacha20_poly1305.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ static int chacha_init_key(EVP_CIPHER_CTX *ctx,
return 1;
}

static int chacha_cipher(EVP_CIPHER_CTX * ctx, unsigned char *out,
static int chacha_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
const unsigned char *inp, size_t len)
{
EVP_CHACHA_KEY *key = data(ctx);
Expand Down
2 changes: 1 addition & 1 deletion crypto/http/http_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -1466,7 +1466,7 @@ int OSSL_HTTP_proxy_connect(BIO *bio, const char *server, const char *port,
do {
/*
* This does not necessarily catch the case when the full
* HTTP response came in in more than a single TCP message.
* HTTP response came in more than a single TCP message.
*/
read_len = BIO_gets(fbio, mbuf, BUF_SIZE);
} while (read_len > 2);
Expand Down
2 changes: 1 addition & 1 deletion crypto/pem/pem_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -929,7 +929,7 @@ int PEM_read_bio_ex(BIO *bp, char **name_out, char **header,
BIO *headerB = NULL, *dataB = NULL;
char *name = NULL;
int len, taillen, headerlen, ret = 0;
BUF_MEM * buf_mem;
BUF_MEM *buf_mem;

*len_out = 0;
*name_out = *header = NULL;
Expand Down
2 changes: 1 addition & 1 deletion crypto/pem/pvkfmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ static EVP_PKEY *evp_pkey_new0_key(void *key, int evp_type)
* Read the MSBLOB header and get relevant data from it.
*
* |pisdss| and |pispub| have a double role, as they can be used for
* discovery as well as to check the the blob meets expectations.
* discovery as well as to check the blob meets expectations.
* |*pisdss| is the indicator for whether the key is a DSA key or not.
* |*pispub| is the indicator for whether the key is public or not.
* In both cases, the following input values apply:
Expand Down
2 changes: 1 addition & 1 deletion crypto/rsa/rsa_sp800_56b_gen.c
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ int ossl_rsa_sp800_56b_generate_key(RSA *rsa, int nbits, const BIGNUM *efixed,
* See SP800-56Br1 6.3.1.3 (Step 6) Perform a pair-wise consistency test by
* verifying that: k = (k^e)^d mod n for some integer k where 1 < k < n-1.
*
* Returns 1 if the RSA key passes the pairwise test or 0 it it fails.
* Returns 1 if the RSA key passes the pairwise test or 0 if it fails.
*/
int ossl_rsa_sp800_56b_pairwise_test(RSA *rsa, BN_CTX *ctx)
{
Expand Down
2 changes: 1 addition & 1 deletion crypto/sha/keccak1600.c
Original file line number Diff line number Diff line change
Expand Up @@ -1153,7 +1153,7 @@ void SHA3_sponge(const unsigned char *inp, size_t len,

# include <stdio.h>

int main()
int main(void)
{
/*
* This is 5-bit SHAKE128 test from http://csrc.nist.gov/groups/ST/toolkit/examples.html#aHashing
Expand Down
2 changes: 1 addition & 1 deletion crypto/store/store_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -1013,7 +1013,7 @@ OSSL_STORE_CTX *OSSL_STORE_attach(BIO *bp, const char *scheme,
ctx->post_process_data = post_process_data;

/*
* ossl_store_get0_loader_int will raise an error if the loader for the
* ossl_store_get0_loader_int will raise an error if the loader for
* the scheme cannot be retrieved. But if a loader was successfully
* fetched then we remove this error from the error stack.
*/
Expand Down
2 changes: 1 addition & 1 deletion crypto/trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ BIO *OSSL_trace_begin(int category)
return channel;
}

void OSSL_trace_end(int category, BIO * channel)
void OSSL_trace_end(int category, BIO *channel)
{
#ifndef OPENSSL_NO_TRACE
char *suffix = NULL;
Expand Down
4 changes: 2 additions & 2 deletions crypto/x509/v3_admis.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const X509V3_EXT_METHOD ossl_v3_ext_admission = {
static int i2r_NAMING_AUTHORITY(const struct v3_ext_method *method, void *in,
BIO *bp, int ind)
{
NAMING_AUTHORITY * namingAuthority = (NAMING_AUTHORITY*) in;
NAMING_AUTHORITY *namingAuthority = (NAMING_AUTHORITY*) in;

if (namingAuthority == NULL)
return 0;
Expand Down Expand Up @@ -118,7 +118,7 @@ static int i2r_NAMING_AUTHORITY(const struct v3_ext_method *method, void *in,
static int i2r_ADMISSION_SYNTAX(const struct v3_ext_method *method, void *in,
BIO *bp, int ind)
{
ADMISSION_SYNTAX * admission = (ADMISSION_SYNTAX *)in;
ADMISSION_SYNTAX *admission = (ADMISSION_SYNTAX *)in;
int i, j, k;

if (admission->admissionAuthority != NULL) {
Expand Down
2 changes: 1 addition & 1 deletion crypto/x509/x509_trust.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ static int obj_trust(int id, X509 *x, int flags)
/*
* Reject when explicit trust EKU are set and none match.
*
* Returning untrusted is enough for for full chains that end in
* Returning untrusted is enough for full chains that end in
* self-signed roots, because when explicit trust is specified it
* suppresses the default blanket trust of self-signed objects.
*
Expand Down
2 changes: 1 addition & 1 deletion demos/digest/BIO_f_md.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
* The default digest is SHA3-512
*/

int main(int argc, char * argv[])
int main(int argc, char *argv[])
{
int ret = EXIT_FAILURE;
OSSL_LIB_CTX *library_context = NULL;
Expand Down
4 changes: 2 additions & 2 deletions demos/digest/EVP_MD_demo.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* more than once.
*/

const char * hamlet_1 =
const char *hamlet_1 =
"To be, or not to be, that is the question,\n"
"Whether tis nobler in the minde to suffer\n"
"The ſlings and arrowes of outragious fortune,\n"
Expand All @@ -43,7 +43,7 @@ const char * hamlet_1 =
"The oppressor's wrong, the proud man's Contumely,\n"
"The pangs of dispised love, the Law's delay,\n"
;
const char * hamlet_2 =
const char *hamlet_2 =
"The insolence of Office, and the spurns\n"
"That patient merit of the'unworthy takes,\n"
"When he himself might his Quietas make\n"
Expand Down
2 changes: 1 addition & 1 deletion demos/digest/EVP_MD_stdin.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ int demonstrate_digest(BIO *input)
{
OSSL_LIB_CTX *library_context = NULL;
int ret = 0;
const char * option_properties = NULL;
const char *option_properties = NULL;
EVP_MD *message_digest = NULL;
EVP_MD_CTX *digest_context = NULL;
unsigned int digest_length;
Expand Down
2 changes: 1 addition & 1 deletion demos/sslecho/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ void configure_client_context(SSL_CTX *ctx)
}
}

void usage()
void usage(void)
{
printf("Usage: sslecho s\n");
printf(" --or--\n");
Expand Down
2 changes: 1 addition & 1 deletion engines/e_dasync.c
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ static void dummy_pause_job(void) {
ASYNC_JOB *job;
ASYNC_WAIT_CTX *waitctx;
ASYNC_callback_fn callback;
void * callback_arg;
void *callback_arg;
OSSL_ASYNC_FD pipefds[2] = {0, 0};
OSSL_ASYNC_FD *writefd;
#if defined(ASYNC_WIN)
Expand Down
24 changes: 12 additions & 12 deletions include/crypto/aes_platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,29 +121,29 @@ void gcm_ghash_p8(u64 Xi[2],const u128 Htable[16],const u8 *inp, size_t len);
(gctx)->gcm.funcs.ghash==gcm_ghash_v8)
/* The [unroll8_eor3_]aes_gcm_(enc|dec)_(128|192|256)_kernel() functions
* take input length in BITS and return number of BYTES processed */
size_t aes_gcm_enc_128_kernel(const uint8_t * plaintext, uint64_t plaintext_length, uint8_t * ciphertext,
size_t aes_gcm_enc_128_kernel(const uint8_t *plaintext, uint64_t plaintext_length, uint8_t *ciphertext,
uint64_t *Xi, unsigned char ivec[16], const void *key);
size_t aes_gcm_enc_192_kernel(const uint8_t * plaintext, uint64_t plaintext_length, uint8_t * ciphertext,
size_t aes_gcm_enc_192_kernel(const uint8_t *plaintext, uint64_t plaintext_length, uint8_t *ciphertext,
uint64_t *Xi, unsigned char ivec[16], const void *key);
size_t aes_gcm_enc_256_kernel(const uint8_t * plaintext, uint64_t plaintext_length, uint8_t * ciphertext,
size_t aes_gcm_enc_256_kernel(const uint8_t *plaintext, uint64_t plaintext_length, uint8_t *ciphertext,
uint64_t *Xi, unsigned char ivec[16], const void *key);
size_t aes_gcm_dec_128_kernel(const uint8_t * ciphertext, uint64_t plaintext_length, uint8_t * plaintext,
size_t aes_gcm_dec_128_kernel(const uint8_t *ciphertext, uint64_t plaintext_length, uint8_t *plaintext,
uint64_t *Xi, unsigned char ivec[16], const void *key);
size_t aes_gcm_dec_192_kernel(const uint8_t * ciphertext, uint64_t plaintext_length, uint8_t * plaintext,
size_t aes_gcm_dec_192_kernel(const uint8_t *ciphertext, uint64_t plaintext_length, uint8_t *plaintext,
uint64_t *Xi, unsigned char ivec[16], const void *key);
size_t aes_gcm_dec_256_kernel(const uint8_t * ciphertext, uint64_t plaintext_length, uint8_t * plaintext,
size_t aes_gcm_dec_256_kernel(const uint8_t *ciphertext, uint64_t plaintext_length, uint8_t *plaintext,
uint64_t *Xi, unsigned char ivec[16], const void *key);
size_t unroll8_eor3_aes_gcm_enc_128_kernel(const uint8_t * plaintext, uint64_t plaintext_length, uint8_t * ciphertext,
size_t unroll8_eor3_aes_gcm_enc_128_kernel(const uint8_t *plaintext, uint64_t plaintext_length, uint8_t *ciphertext,
uint64_t *Xi, unsigned char ivec[16], const void *key);
size_t unroll8_eor3_aes_gcm_enc_192_kernel(const uint8_t * plaintext, uint64_t plaintext_length, uint8_t * ciphertext,
size_t unroll8_eor3_aes_gcm_enc_192_kernel(const uint8_t *plaintext, uint64_t plaintext_length, uint8_t *ciphertext,
uint64_t *Xi, unsigned char ivec[16], const void *key);
size_t unroll8_eor3_aes_gcm_enc_256_kernel(const uint8_t * plaintext, uint64_t plaintext_length, uint8_t * ciphertext,
size_t unroll8_eor3_aes_gcm_enc_256_kernel(const uint8_t *plaintext, uint64_t plaintext_length, uint8_t *ciphertext,
uint64_t *Xi, unsigned char ivec[16], const void *key);
size_t unroll8_eor3_aes_gcm_dec_128_kernel(const uint8_t * ciphertext, uint64_t plaintext_length, uint8_t * plaintext,
size_t unroll8_eor3_aes_gcm_dec_128_kernel(const uint8_t *ciphertext, uint64_t plaintext_length, uint8_t *plaintext,
uint64_t *Xi, unsigned char ivec[16], const void *key);
size_t unroll8_eor3_aes_gcm_dec_192_kernel(const uint8_t * ciphertext, uint64_t plaintext_length, uint8_t * plaintext,
size_t unroll8_eor3_aes_gcm_dec_192_kernel(const uint8_t *ciphertext, uint64_t plaintext_length, uint8_t *plaintext,
uint64_t *Xi, unsigned char ivec[16], const void *key);
size_t unroll8_eor3_aes_gcm_dec_256_kernel(const uint8_t * ciphertext, uint64_t plaintext_length, uint8_t * plaintext,
size_t unroll8_eor3_aes_gcm_dec_256_kernel(const uint8_t *ciphertext, uint64_t plaintext_length, uint8_t *plaintext,
uint64_t *Xi, unsigned char ivec[16], const void *key);
size_t armv8_aes_gcm_encrypt(const unsigned char *in, unsigned char *out, size_t len, const void *key,
unsigned char ivec[16], u64 *Xi);
Expand Down