Skip to content

Commit

Permalink
indent has problems with comments that are on the right hand side of …
Browse files Browse the repository at this point in the history
…a line.

Sometimes it fails to format them very well, and sometimes it corrupts them!
This commit moves some particularly problematic ones.

Reviewed-by: Tim Hudson <[email protected]>
  • Loading branch information
mattcaswell committed Jan 22, 2015
1 parent 0107079 commit dbd87ff
Show file tree
Hide file tree
Showing 35 changed files with 548 additions and 307 deletions.
4 changes: 3 additions & 1 deletion apps/s_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -2209,7 +2209,9 @@ static void print_stuff(BIO *bio, SSL *s, int full)
if (peer != NULL)
{
BIO_printf(bio,"Server certificate\n");
if (!(c_showcerts && got_a_chain)) /* Redundant if we showed the whole chain */

/* Redundant if we showed the whole chain */
if (!(c_showcerts && got_a_chain))
PEM_write_bio_X509(bio,peer);
X509_NAME_oneline(X509_get_subject_name(peer),
buf,sizeof buf);
Expand Down
19 changes: 11 additions & 8 deletions crypto/asn1/a_utctm.c
Original file line number Diff line number Diff line change
Expand Up @@ -346,13 +346,16 @@ time_t ASN1_UTCTIME_get(const ASN1_UTCTIME *s)
}
#undef g2

return mktime(&tm)-offset*60; /* FIXME: mktime assumes the current timezone
* instead of UTC, and unless we rewrite OpenSSL
* in Lisp we cannot locally change the timezone
* without possibly interfering with other parts
* of the program. timegm, which uses UTC, is
* non-standard.
* Also time_t is inappropriate for general
* UTC times because it may a 32 bit type. */
/*
* FIXME: mktime assumes the current timezone
* instead of UTC, and unless we rewrite OpenSSL
* in Lisp we cannot locally change the timezone
* without possibly interfering with other parts
* of the program. timegm, which uses UTC, is
* non-standard.
* Also time_t is inappropriate for general
* UTC times because it may a 32 bit type.
*/
return mktime(&tm)-offset*60;
}
#endif
9 changes: 7 additions & 2 deletions crypto/bio/bss_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,14 @@ BIO *BIO_new_file(const char *filename, const char *mode)
wmode,sizeof(wmode)/sizeof(wmode[0])) &&
(file=_wfopen(wfilename,wmode))==NULL &&
(errno==ENOENT || errno==EBADF)
) /* UTF-8 decode succeeded, but no file, filename
* could still have been locale-ized... */
)
{
/*
* UTF-8 decode succeeded, but no file, filename
* could still have been locale-ized...
*/
file = fopen(filename,mode);
}
}
else if (GetLastError()==ERROR_NO_UNICODE_TRANSLATION)
{
Expand Down
7 changes: 5 additions & 2 deletions crypto/bio/bss_log.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,11 @@ static void xsyslog(BIO *bp, int priority, const char *string)
case LOG_DEBUG:
evtype = EVENTLOG_INFORMATION_TYPE;
break;
default: /* Should never happen, but set it
as error anyway. */
default:
/*
* Should never happen, but set it
* as error anyway.
*/
evtype = EVENTLOG_ERROR_TYPE;
break;
}
Expand Down
22 changes: 14 additions & 8 deletions crypto/bn/bn.h
Original file line number Diff line number Diff line change
Expand Up @@ -257,16 +257,22 @@ extern "C" {

#define BN_FLG_MALLOCED 0x01
#define BN_FLG_STATIC_DATA 0x02
#define BN_FLG_CONSTTIME 0x04 /* avoid leaking exponent information through timing,
* BN_mod_exp_mont() will call BN_mod_exp_mont_consttime,
* BN_div() will call BN_div_no_branch,
* BN_mod_inverse() will call BN_mod_inverse_no_branch.
*/

/*
* avoid leaking exponent information through timing,
* BN_mod_exp_mont() will call BN_mod_exp_mont_consttime,
* BN_div() will call BN_div_no_branch,
* BN_mod_inverse() will call BN_mod_inverse_no_branch.
*/
#define BN_FLG_CONSTTIME 0x04

#ifdef OPENSSL_USE_DEPRECATED
#define BN_FLG_EXP_CONSTTIME BN_FLG_CONSTTIME /* deprecated name for the flag */
/* avoid leaking exponent information through timings
* (BN_mod_exp_mont() will call BN_mod_exp_mont_consttime) */
/* deprecated name for the flag */
#define BN_FLG_EXP_CONSTTIME BN_FLG_CONSTTIME
/*
* avoid leaking exponent information through timings
* (BN_mod_exp_mont() will call BN_mod_exp_mont_consttime)
*/
#endif

#ifdef OPENSSL_USE_DEPRECATED
Expand Down
9 changes: 6 additions & 3 deletions crypto/bn/bn_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -356,9 +356,12 @@ static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
case 3: A[2]=B[2];
case 2: A[1]=B[1];
case 1: A[0]=B[0];
case 0: /* workaround for ultrix cc: without 'case 0', the optimizer does
* the switch table by doing a=top&3; a--; goto jump_table[a];
* which fails for top== 0 */
case 0:
/*
* workaround for ultrix cc: without 'case 0', the optimizer does
* the switch table by doing a=top&3; a--; goto jump_table[a];
* which fails for top== 0
*/
;
}
}
Expand Down
3 changes: 2 additions & 1 deletion crypto/des/read_pwd.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@
#endif
#endif

/* #define SIGACTION */ /* Define this if you have sigaction() */
/* Define this if you have sigaction() */
/* #define SIGACTION */

/* 06-Apr-92 Luke Brennan Support for VMS */
#include "des_locl.h"
Expand Down
17 changes: 10 additions & 7 deletions crypto/dh/dh.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,16 @@
#define OPENSSL_DH_FIPS_MIN_MODULUS_BITS 1024

#define DH_FLAG_CACHE_MONT_P 0x01
#define DH_FLAG_NO_EXP_CONSTTIME 0x02 /* new with 0.9.7h; the built-in DH
* implementation now uses constant time
* modular exponentiation for secret exponents
* by default. This flag causes the
* faster variable sliding window method to
* be used for all exponents.
*/

/*
* new with 0.9.7h; the built-in DH
* implementation now uses constant time
* modular exponentiation for secret exponents
* by default. This flag causes the
* faster variable sliding window method to
* be used for all exponents.
*/
#define DH_FLAG_NO_EXP_CONSTTIME 0x02

/* If this flag is set the DH method is FIPS compliant and can be used
* in FIPS mode. This is set in the validated module method. If an
Expand Down
76 changes: 43 additions & 33 deletions crypto/ec/ec_lcl.h
Original file line number Diff line number Diff line change
Expand Up @@ -205,39 +205,49 @@ struct ec_group_st {
/* The following members are handled by the method functions,
* even if they appear generic */

BIGNUM *field; /* Field specification.
* For curves over GF(p), this is the modulus;
* for curves over GF(2^m), this is the
* irreducible polynomial defining the field.
*/

int poly[6]; /* Field specification for curves over GF(2^m).
* The irreducible f(t) is then of the form:
* t^poly[0] + t^poly[1] + ... + t^poly[k]
* where m = poly[0] > poly[1] > ... > poly[k] = 0.
* The array is terminated with poly[k+1]=-1.
* All elliptic curve irreducibles have at most 5
* non-zero terms.
*/

BIGNUM *a, *b; /* Curve coefficients.
* (Here the assumption is that BIGNUMs can be used
* or abused for all kinds of fields, not just GF(p).)
* For characteristic > 3, the curve is defined
* by a Weierstrass equation of the form
* y^2 = x^3 + a*x + b.
* For characteristic 2, the curve is defined by
* an equation of the form
* y^2 + x*y = x^3 + a*x^2 + b.
*/

int a_is_minus3; /* enable optimized point arithmetics for special case */

void *field_data1; /* method-specific (e.g., Montgomery structure) */
void *field_data2; /* method-specific */
int (*field_mod_func)(BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *); /* method-specific */

BN_MONT_CTX *mont_data; /* data for ECDSA inverse */
/* Field specification.
* For curves over GF(p), this is the modulus;
* for curves over GF(2^m), this is the
* irreducible polynomial defining the field.
*/
BIGNUM *field;

/* Field specification for curves over GF(2^m).
* The irreducible f(t) is then of the form:
* t^poly[0] + t^poly[1] + ... + t^poly[k]
* where m = poly[0] > poly[1] > ... > poly[k] = 0.
* The array is terminated with poly[k+1]=-1.
* All elliptic curve irreducibles have at most 5
* non-zero terms.
*/
int poly[6];

/* Curve coefficients.
* (Here the assumption is that BIGNUMs can be used
* or abused for all kinds of fields, not just GF(p).)
* For characteristic > 3, the curve is defined
* by a Weierstrass equation of the form
* y^2 = x^3 + a*x + b.
* For characteristic 2, the curve is defined by
* an equation of the form
* y^2 + x*y = x^3 + a*x^2 + b.
*/
BIGNUM *a, *b;

/* enable optimized point arithmetics for special case */
int a_is_minus3;

/* method-specific (e.g., Montgomery structure) */
void *field_data1;

/* method-specific */
void *field_data2;

/* method-specific */
int (*field_mod_func)(BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *);

/* data for ECDSA inverse */
BN_MONT_CTX *mont_data;
} /* EC_GROUP */;

struct ec_key_st {
Expand Down
9 changes: 6 additions & 3 deletions crypto/ec/ecp_nistp224.c
Original file line number Diff line number Diff line change
Expand Up @@ -1017,9 +1017,12 @@ static void point_add(felem x3, felem y3, felem z3,
felem_assign(z3, z_out);
}

/* select_point selects the |idx|th point from a precomputation table and
* copies it to out. */
static void select_point(const u64 idx, unsigned int size, const felem pre_comp[/*size*/][3], felem out[3])
/*
* select_point selects the |idx|th point from a precomputation table and
* copies it to out.
* The pre_comp array argument should be size of |size| argument
*/
static void select_point(const u64 idx, unsigned int size, const felem pre_comp[][3], felem out[3])
{
unsigned i, j;
limb *outlimbs = &out[0][0];
Expand Down
84 changes: 58 additions & 26 deletions crypto/evp/evp.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,16 @@ typedef int evp_verify_method(int type,const unsigned char *m,
unsigned int m_length,const unsigned char *sigbuf,
unsigned int siglen, void *key);

#define EVP_MD_FLAG_ONESHOT 0x0001 /* digest can only handle a single
* block */

#define EVP_MD_FLAG_PKEY_DIGEST 0x0002 /* digest is a "clone" digest used
* which is a copy of an existing
* one for a specific public key type.
* EVP_dss1() etc */
/* digest can only handle a single block */
#define EVP_MD_FLAG_ONESHOT 0x0001

/*
* digest is a "clone" digest used
* which is a copy of an existing
* one for a specific public key type.
* EVP_dss1() etc
*/
#define EVP_MD_FLAG_PKEY_DIGEST 0x0002

/* Digest uses EVP_PKEY_METHOD for signing instead of MD specific signing */

Expand All @@ -218,7 +221,8 @@ typedef int evp_verify_method(int type,const unsigned char *m,

#define EVP_MD_FLAG_DIGALGID_CUSTOM 0x0018

#define EVP_MD_FLAG_FIPS 0x0400 /* Note if suitable for use in FIPS mode */
/* Note if suitable for use in FIPS mode */
#define EVP_MD_FLAG_FIPS 0x0400

/* Digest ctrls */

Expand Down Expand Up @@ -311,19 +315,39 @@ struct evp_cipher_st
{
int nid;
int block_size;
int key_len; /* Default value for variable length ciphers */

/* Default value for variable length ciphers */
int key_len;
int iv_len;
unsigned long flags; /* Various flags */

/* Various flags */
unsigned long flags;

/* init key */
int (*init)(EVP_CIPHER_CTX *ctx, const unsigned char *key,
const unsigned char *iv, int enc); /* init key */
const unsigned char *iv, int enc);

/* encrypt/decrypt data */
int (*do_cipher)(EVP_CIPHER_CTX *ctx, unsigned char *out,
const unsigned char *in, size_t inl);/* encrypt/decrypt data */
int (*cleanup)(EVP_CIPHER_CTX *); /* cleanup ctx */
int ctx_size; /* how big ctx->cipher_data needs to be */
int (*set_asn1_parameters)(EVP_CIPHER_CTX *, ASN1_TYPE *); /* Populate a ASN1_TYPE with parameters */
int (*get_asn1_parameters)(EVP_CIPHER_CTX *, ASN1_TYPE *); /* Get parameters from a ASN1_TYPE */
int (*ctrl)(EVP_CIPHER_CTX *, int type, int arg, void *ptr); /* Miscellaneous operations */
void *app_data; /* Application data */
const unsigned char *in, size_t inl);

/* cleanup ctx */
int (*cleanup)(EVP_CIPHER_CTX *);

/* how big ctx->cipher_data needs to be */
int ctx_size;

/* Populate a ASN1_TYPE with parameters */
int (*set_asn1_parameters)(EVP_CIPHER_CTX *, ASN1_TYPE *);

/* Get parameters from a ASN1_TYPE */
int (*get_asn1_parameters)(EVP_CIPHER_CTX *, ASN1_TYPE *);

/* Miscellaneous operations */
int (*ctrl)(EVP_CIPHER_CTX *, int type, int arg, void *ptr);

/* Application data */
void *app_data;
} /* EVP_CIPHER */;

/* Values for cipher flags */
Expand Down Expand Up @@ -466,14 +490,22 @@ struct evp_cipher_ctx_st

typedef struct evp_Encode_Ctx_st
{
int num; /* number saved in a partial encode/decode */
int length; /* The length is either the output line length
* (in input bytes) or the shortest input line
* length that is ok. Once decoding begins,
* the length is adjusted up each time a longer
* line is decoded */
unsigned char enc_data[80]; /* data to encode */
int line_num; /* number read on current line */
/* number saved in a partial encode/decode */
int num;

/* The length is either the output line length
* (in input bytes) or the shortest input line
* length that is ok. Once decoding begins,
* the length is adjusted up each time a longer
* line is decoded
*/
int length;

/* data to encode */
unsigned char enc_data[80];

/* number read on current line */
int line_num;
int expect_nl;
} EVP_ENCODE_CTX;

Expand Down
13 changes: 7 additions & 6 deletions crypto/rand/rand_win.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,13 @@ typedef BOOL (WINAPI *MODULE32)(HANDLE, LPMODULEENTRY32);

#include <lmcons.h>
#include <lmstats.h>
#if 1 /* The NET API is Unicode only. It requires the use of the UNICODE
* macro. When UNICODE is defined LPTSTR becomes LPWSTR. LMSTR was
* was added to the Platform SDK to allow the NET API to be used in
* non-Unicode applications provided that Unicode strings were still
* used for input. LMSTR is defined as LPWSTR.
*/
#if 1
/* The NET API is Unicode only. It requires the use of the UNICODE
* macro. When UNICODE is defined LPTSTR becomes LPWSTR. LMSTR was
* was added to the Platform SDK to allow the NET API to be used in
* non-Unicode applications provided that Unicode strings were still
* used for input. LMSTR is defined as LPWSTR.
*/
typedef NET_API_STATUS (NET_API_FUNCTION * NETSTATGET)
(LPWSTR, LPWSTR, DWORD, DWORD, LPBYTE*);
typedef NET_API_STATUS (NET_API_FUNCTION * NETFREE)(LPBYTE);
Expand Down
Loading

0 comments on commit dbd87ff

Please sign in to comment.