From 02e112a88579ff2592f34015f73dc85f4ed76ad5 Mon Sep 17 00:00:00 2001 From: FdaSilvaYY Date: Tue, 28 Jun 2016 22:51:01 +0200 Subject: [PATCH] Whitespace cleanup in crypto Reviewed-by: Andy Polyakov Reviewed-by: Kurt Roeckx Reviewed-by: Rich Salz (Merged from https://github.com/openssl/openssl/pull/1264) --- crypto/aes/aes_core.c | 2 +- crypto/aes/aes_x86core.c | 10 +++++----- crypto/asn1/asn1_par.c | 2 +- crypto/bn/bn_div.c | 2 +- crypto/bn/bn_exp.c | 2 +- crypto/bn/bn_gcd.c | 4 ++-- crypto/bn/bn_prime.c | 2 +- crypto/conf/conf_mod.c | 4 ++-- crypto/ec/ec_lib.c | 1 - crypto/evp/bio_ok.c | 2 +- crypto/evp/e_aes_cbc_hmac_sha1.c | 2 +- crypto/modes/ocb128.c | 2 +- crypto/objects/obj_dat.h | 4 ++-- crypto/pkcs7/pk7_doit.c | 2 +- crypto/rsa/rsa_pk1.c | 2 +- crypto/ts/ts_rsp_verify.c | 2 +- crypto/x509/x509_vfy.c | 2 +- include/openssl/bn.h | 2 +- include/openssl/buffer.h | 2 +- include/openssl/err.h | 2 +- include/openssl/pkcs12.h | 4 ++-- include/openssl/srp.h | 2 +- include/openssl/x509v3.h | 2 +- 23 files changed, 30 insertions(+), 31 deletions(-) diff --git a/crypto/aes/aes_core.c b/crypto/aes/aes_core.c index ef0fc51d95..69be3d85c7 100644 --- a/crypto/aes/aes_core.c +++ b/crypto/aes/aes_core.c @@ -1355,7 +1355,7 @@ int AES_set_decrypt_key(const unsigned char *userKey, const int bits, rk[j] = tpe ^ ROTATE(tpd,16) ^ ROTATE(tp9,24) ^ ROTATE(tpb,8); #else - rk[j] = tpe ^ (tpd >> 16) ^ (tpd << 16) ^ + rk[j] = tpe ^ (tpd >> 16) ^ (tpd << 16) ^ (tp9 >> 8) ^ (tp9 << 24) ^ (tpb >> 24) ^ (tpb << 8); #endif diff --git a/crypto/aes/aes_x86core.c b/crypto/aes/aes_x86core.c index dd7e905470..95b49bbabc 100644 --- a/crypto/aes/aes_x86core.c +++ b/crypto/aes/aes_x86core.c @@ -621,7 +621,7 @@ int AES_set_decrypt_key(const unsigned char *userKey, const int bits, rk[j] = tpe ^ ROTATE(tpd,16) ^ ROTATE(tp9,8) ^ ROTATE(tpb,24); #else - rk[j] = tpe ^ (tpd >> 16) ^ (tpd << 16) ^ + rk[j] = tpe ^ (tpd >> 16) ^ (tpd << 16) ^ (tp9 >> 24) ^ (tp9 << 8) ^ (tpb >> 8) ^ (tpb << 24); #endif @@ -910,7 +910,7 @@ void AES_decrypt(const unsigned char *in, unsigned char *out, (u32)Td4[(s1 >> 16) & 0xff] << 16 ^ (u32)Td4[(s0 >> 24) ] << 24; - /* now do the linear transform using words */ + /* now do the linear transform using words */ { int i; u32 tp1, tp2, tp4, tp8, tp9, tpb, tpd, tpe, m; @@ -934,7 +934,7 @@ void AES_decrypt(const unsigned char *in, unsigned char *out, t[i] = tpe ^ ROTATE(tpd,16) ^ ROTATE(tp9,8) ^ ROTATE(tpb,24); #else - t[i] = tpe ^ (tpd >> 16) ^ (tpd << 16) ^ + t[i] = tpe ^ (tpd >> 16) ^ (tpd << 16) ^ (tp9 >> 24) ^ (tp9 << 8) ^ (tpb >> 8) ^ (tpb << 24); #endif @@ -987,7 +987,7 @@ void AES_decrypt(const unsigned char *in, unsigned char *out, (u32)Td4[(s1 >> 16) & 0xff] << 16 ^ (u32)Td4[(s0 >> 24) ] << 24; - /* now do the linear transform using words */ + /* now do the linear transform using words */ { int i; u32 tp1, tp2, tp4, tp8, tp9, tpb, tpd, tpe, m; @@ -1011,7 +1011,7 @@ void AES_decrypt(const unsigned char *in, unsigned char *out, t[i] = tpe ^ ROTATE(tpd,16) ^ ROTATE(tp9,8) ^ ROTATE(tpb,24); #else - t[i] = tpe ^ (tpd >> 16) ^ (tpd << 16) ^ + t[i] = tpe ^ (tpd >> 16) ^ (tpd << 16) ^ (tp9 >> 24) ^ (tp9 << 8) ^ (tpb >> 8) ^ (tpb << 24); #endif diff --git a/crypto/asn1/asn1_par.c b/crypto/asn1/asn1_par.c index 1e17895f26..4db3df9b8d 100644 --- a/crypto/asn1/asn1_par.c +++ b/crypto/asn1/asn1_par.c @@ -116,7 +116,7 @@ static int asn1_parse2(BIO *bp, const unsigned char **pp, long length, goto end; if (j & V_ASN1_CONSTRUCTED) { const unsigned char *sp = p; - + ep = p + len; if (BIO_write(bp, "\n", 1) <= 0) goto end; diff --git a/crypto/bn/bn_div.c b/crypto/bn/bn_div.c index eef1b878c8..0bec12b1c8 100644 --- a/crypto/bn/bn_div.c +++ b/crypto/bn/bn_div.c @@ -130,7 +130,7 @@ int BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, const BIGNUM *d, # endif /* OPENSSL_NO_ASM */ /*- - * BN_div computes dv := num / divisor, rounding towards + * BN_div computes dv := num / divisor, rounding towards * zero, and sets up rm such that dv*divisor + rm = num holds. * Thus: * dv->neg == num->neg ^ divisor->neg (unless the result is zero) diff --git a/crypto/bn/bn_exp.c b/crypto/bn/bn_exp.c index d334cf705b..e2f0d5e316 100644 --- a/crypto/bn/bn_exp.c +++ b/crypto/bn/bn_exp.c @@ -97,7 +97,7 @@ int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, bn_check_top(m); /*- - * For even modulus m = 2^k*m_odd, it might make sense to compute + * For even modulus m = 2^k*m_odd, it might make sense to compute * a^p mod m_odd and a^p mod 2^k separately (with Montgomery * exponentiation for the odd part), using appropriate exponent * reductions, and combine the results using the CRT. diff --git a/crypto/bn/bn_gcd.c b/crypto/bn/bn_gcd.c index 1039e7630f..e1aac131c5 100644 --- a/crypto/bn/bn_gcd.c +++ b/crypto/bn/bn_gcd.c @@ -370,7 +370,7 @@ BIGNUM *int_bn_mod_inverse(BIGNUM *in, * i.e. * sign*(Y + D*X)*a == B (mod |n|). * - * So if we set (X, Y, sign) := (Y + D*X, X, -sign), we arrive back at + * So if we set (X, Y, sign) := (Y + D*X, X, -sign), we arrive back at * -sign*X*a == B (mod |n|), * sign*Y*a == A (mod |n|). * Note that X and Y stay non-negative all the time. @@ -565,7 +565,7 @@ static BIGNUM *BN_mod_inverse_no_branch(BIGNUM *in, * i.e. * sign*(Y + D*X)*a == B (mod |n|). * - * So if we set (X, Y, sign) := (Y + D*X, X, -sign), we arrive back at + * So if we set (X, Y, sign) := (Y + D*X, X, -sign), we arrive back at * -sign*X*a == B (mod |n|), * sign*Y*a == A (mod |n|). * Note that X and Y stay non-negative all the time. diff --git a/crypto/bn/bn_prime.c b/crypto/bn/bn_prime.c index 1c41938fed..8e7f4f5676 100644 --- a/crypto/bn/bn_prime.c +++ b/crypto/bn/bn_prime.c @@ -430,7 +430,7 @@ static int probable_prime(BIGNUM *rnd, int bits, prime_t *mods) */ if (is_single_word) { BN_ULONG size_limit; - + if (bits == BN_BITS2) { /* * Shifting by this much has undefined behaviour so we do it a diff --git a/crypto/conf/conf_mod.c b/crypto/conf/conf_mod.c index d01d20e3d4..31f838e0fa 100644 --- a/crypto/conf/conf_mod.c +++ b/crypto/conf/conf_mod.c @@ -64,7 +64,7 @@ static CONF_MODULE *module_add(DSO *dso, const char *name, static CONF_MODULE *module_find(const char *name); static int module_init(CONF_MODULE *pmod, const char *name, const char *value, const CONF *cnf); -static CONF_MODULE *module_load_dso(const CONF *cnf, const char *name, +static CONF_MODULE *module_load_dso(const CONF *cnf, const char *name, const char *value); /* Main function: load modules from a CONF structure */ @@ -181,7 +181,7 @@ static int module_run(const CONF *cnf, const char *name, const char *value, } /* Load a module from a DSO */ -static CONF_MODULE *module_load_dso(const CONF *cnf, +static CONF_MODULE *module_load_dso(const CONF *cnf, const char *name, const char *value) { DSO *dso = NULL; diff --git a/crypto/ec/ec_lib.c b/crypto/ec/ec_lib.c index fa74ee7644..c592c067a1 100644 --- a/crypto/ec/ec_lib.c +++ b/crypto/ec/ec_lib.c @@ -284,7 +284,6 @@ int EC_GROUP_set_generator(EC_GROUP *group, const EC_POINT *generator, } else BN_zero(group->cofactor); - /* * Some groups have an order with * factors of two, which makes the Montgomery setup fail. diff --git a/crypto/evp/bio_ok.c b/crypto/evp/bio_ok.c index 33066e8d83..7974b96311 100644 --- a/crypto/evp/bio_ok.c +++ b/crypto/evp/bio_ok.c @@ -402,7 +402,7 @@ static long ok_callback_ctrl(BIO *b, int cmd, bio_info_cb *fp) { long ret = 1; BIO *next; - + next = BIO_next(b); if (next == NULL) diff --git a/crypto/evp/e_aes_cbc_hmac_sha1.c b/crypto/evp/e_aes_cbc_hmac_sha1.c index be1deaa474..0e1ad74615 100644 --- a/crypto/evp/e_aes_cbc_hmac_sha1.c +++ b/crypto/evp/e_aes_cbc_hmac_sha1.c @@ -818,7 +818,7 @@ static int aesni_cbc_hmac_sha1_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, if (arg != EVP_AEAD_TLS1_AAD_LEN) return -1; - + len = p[arg - 2] << 8 | p[arg - 1]; if (EVP_CIPHER_CTX_encrypting(ctx)) { diff --git a/crypto/modes/ocb128.c b/crypto/modes/ocb128.c index 54a96b8e98..c3bd13bbe2 100644 --- a/crypto/modes/ocb128.c +++ b/crypto/modes/ocb128.c @@ -230,7 +230,7 @@ int CRYPTO_ocb128_setiv(OCB128_CONTEXT *ctx, const unsigned char *iv, /* * Spec says IV is 120 bits or fewer - it allows non byte aligned lengths. - * We don't support this at this stage + * We don't support this at this stage */ if ((len > 15) || (len < 1) || (taglen > 16) || (taglen < 1)) { return -1; diff --git a/crypto/objects/obj_dat.h b/crypto/objects/obj_dat.h index df03694974..be7565753e 100644 --- a/crypto/objects/obj_dat.h +++ b/crypto/objects/obj_dat.h @@ -2314,11 +2314,11 @@ static const ASN1_OBJECT nid_objs[NUM_NID]={ {"id-GostR3410-2001-CryptoPro-XchA-ParamSet", "id-GostR3410-2001-CryptoPro-XchA-ParamSet", NID_id_GostR3410_2001_CryptoPro_XchA_ParamSet,7,&(lvalues[5609]),0}, - + {"id-GostR3410-2001-CryptoPro-XchB-ParamSet", "id-GostR3410-2001-CryptoPro-XchB-ParamSet", NID_id_GostR3410_2001_CryptoPro_XchB_ParamSet,7,&(lvalues[5616]),0}, - + {"id-GostR3410-94-a","id-GostR3410-94-a",NID_id_GostR3410_94_a,7, &(lvalues[5623]),0}, {"id-GostR3410-94-aBis","id-GostR3410-94-aBis", diff --git a/crypto/pkcs7/pk7_doit.c b/crypto/pkcs7/pk7_doit.c index 24022416d2..bc6bd30fc3 100644 --- a/crypto/pkcs7/pk7_doit.c +++ b/crypto/pkcs7/pk7_doit.c @@ -582,7 +582,7 @@ BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert) BIO_free_all(btmp); BIO_free_all(etmp); BIO_free_all(bio); - return NULL; + return NULL; } static BIO *PKCS7_find_digest(EVP_MD_CTX **pmd, BIO *bio, int nid) diff --git a/crypto/rsa/rsa_pk1.c b/crypto/rsa/rsa_pk1.c index bac7c26a17..efb16a02e6 100644 --- a/crypto/rsa/rsa_pk1.c +++ b/crypto/rsa/rsa_pk1.c @@ -183,7 +183,7 @@ int RSA_padding_check_PKCS1_type_2(unsigned char *to, int tlen, /* * Always do this zero-padding copy (even when num == flen) to avoid * leaking that information. The copy still leaks some side-channel - * information, but it's impossible to have a fixed memory access + * information, but it's impossible to have a fixed memory access * pattern since we can't read out of the bounds of |from|. * * TODO(emilia): Consider porting BN_bn2bin_padded from BoringSSL. diff --git a/crypto/ts/ts_rsp_verify.c b/crypto/ts/ts_rsp_verify.c index 21da8aaa9e..091663686f 100644 --- a/crypto/ts/ts_rsp_verify.c +++ b/crypto/ts/ts_rsp_verify.c @@ -463,7 +463,7 @@ static char *ts_get_status_text(STACK_OF(ASN1_UTF8STRING) *text) TSerr(TS_F_TS_GET_STATUS_TEXT, ERR_R_MALLOC_FAILURE); return NULL; } - + for (i = 0, p = result; i < sk_ASN1_UTF8STRING_num(text); ++i) { ASN1_UTF8STRING *current = sk_ASN1_UTF8STRING_value(text, i); length = ASN1_STRING_length(current); diff --git a/crypto/x509/x509_vfy.c b/crypto/x509/x509_vfy.c index 15920840f9..b400ce4ad6 100644 --- a/crypto/x509/x509_vfy.c +++ b/crypto/x509/x509_vfy.c @@ -2538,7 +2538,7 @@ static int dane_match(X509_STORE_CTX *ctx, X509 *cert, int depth) /* * If we've previously matched a PKIX-?? record, no need to test any - * further PKIX-?? records, it remains to just build the PKIX chain. + * further PKIX-?? records, it remains to just build the PKIX chain. * Had the match been a DANE-?? record, we'd be done already. */ if (dane->mdpth >= 0) diff --git a/include/openssl/bn.h b/include/openssl/bn.h index 82552b6e84..c4fca99ff6 100644 --- a/include/openssl/bn.h +++ b/include/openssl/bn.h @@ -90,7 +90,7 @@ int BN_get_flags(const BIGNUM *b, int n); */ void BN_with_flags(BIGNUM *dest, const BIGNUM *b, int flags); -/* Wrapper function to make using BN_GENCB easier, */ +/* Wrapper function to make using BN_GENCB easier */ int BN_GENCB_call(BN_GENCB *cb, int a, int b); BN_GENCB *BN_GENCB_new(void); diff --git a/include/openssl/buffer.h b/include/openssl/buffer.h index 88409fd9eb..e2e1e5da9d 100644 --- a/include/openssl/buffer.h +++ b/include/openssl/buffer.h @@ -36,7 +36,7 @@ extern "C" { # define BUF_strlcpy(dst, src, size) OPENSSL_strlcpy(dst, src, size) # define BUF_strlcat(dst, src, size) OPENSSL_strlcat(dst, src, size) # define BUF_strnlen(str, maxlen) OPENSSL_strnlen(str, maxlen) - + struct buf_mem_st { size_t length; /* current number of bytes */ char *data; diff --git a/include/openssl/err.h b/include/openssl/err.h index b019d0e3bb..9dcd27e9be 100644 --- a/include/openssl/err.h +++ b/include/openssl/err.h @@ -188,7 +188,7 @@ typedef struct err_state_st { # define ERR_R_INTERNAL_ERROR (4|ERR_R_FATAL) # define ERR_R_DISABLED (5|ERR_R_FATAL) # define ERR_R_INIT_FAIL (6|ERR_R_FATAL) -# define ERR_R_PASSED_INVALID_ARGUMENT (7) +# define ERR_R_PASSED_INVALID_ARGUMENT (7) /* * 99 is the maximum possible ERR_R_... code, higher values are reserved for diff --git a/include/openssl/pkcs12.h b/include/openssl/pkcs12.h index 37d02aef25..4c49fb2881 100644 --- a/include/openssl/pkcs12.h +++ b/include/openssl/pkcs12.h @@ -188,8 +188,8 @@ DECLARE_ASN1_ITEM(PKCS12_AUTHSAFES) void PKCS12_PBE_add(void); int PKCS12_parse(PKCS12 *p12, const char *pass, EVP_PKEY **pkey, X509 **cert, STACK_OF(X509) **ca); -PKCS12 *PKCS12_create(const char *pass, const char *name, EVP_PKEY *pkey, - X509 *cert, STACK_OF(X509) *ca, int nid_key, int nid_cert, +PKCS12 *PKCS12_create(const char *pass, const char *name, EVP_PKEY *pkey, + X509 *cert, STACK_OF(X509) *ca, int nid_key, int nid_cert, int iter, int mac_iter, int keytype); PKCS12_SAFEBAG *PKCS12_add_cert(STACK_OF(PKCS12_SAFEBAG) **pbags, X509 *cert); diff --git a/include/openssl/srp.h b/include/openssl/srp.h index 80bcb0dd38..f2b6ec750d 100644 --- a/include/openssl/srp.h +++ b/include/openssl/srp.h @@ -57,7 +57,7 @@ typedef struct SRP_VBASE_st { } SRP_VBASE; /* - * Internal structure storing N and g pair + * Internal structure storing N and g pair */ typedef struct SRP_gN_st { char *id; diff --git a/include/openssl/x509v3.h b/include/openssl/x509v3.h index 29b7194f26..7b0403b9dc 100644 --- a/include/openssl/x509v3.h +++ b/include/openssl/x509v3.h @@ -549,7 +549,7 @@ DECLARE_ASN1_ITEM(POLICY_CONSTRAINTS) GENERAL_NAME *a2i_GENERAL_NAME(GENERAL_NAME *out, const X509V3_EXT_METHOD *method, - X509V3_CTX *ctx, int gen_type, + X509V3_CTX *ctx, int gen_type, const char *value, int is_nc); # ifdef HEADER_CONF_H -- 2.34.1