Skip to content

Commit

Permalink
More comment realignment
Browse files Browse the repository at this point in the history
Reviewed-by: Tim Hudson <tjh@openssl.org>
  • Loading branch information
mattcaswell committed Jan 22, 2015
1 parent 50e735f commit 35a1cc9
Show file tree
Hide file tree
Showing 41 changed files with 403 additions and 398 deletions.
4 changes: 2 additions & 2 deletions apps/gendh.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ int MAIN(int argc, char **argv)
outfile = *(++argv);
} else if (strcmp(*argv, "-2") == 0)
g = 2;
/*- else if (strcmp(*argv,"-3") == 0)
g=3; */
/*- else if (strcmp(*argv,"-3") == 0)
g=3; */
else if (strcmp(*argv, "-5") == 0)
g = 5;
# ifndef OPENSSL_NO_ENGINE
Expand Down
8 changes: 4 additions & 4 deletions apps/s_cb.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,10 @@ int verify_callback(int ok, X509_STORE_CTX *ctx)
int set_cert_stuff(SSL_CTX *ctx, char *cert_file, char *key_file)
{
if (cert_file != NULL) {
/*-
SSL *ssl;
X509 *x509;
*/
/*-
SSL *ssl;
X509 *x509;
*/

if (SSL_CTX_use_certificate_file(ctx, cert_file,
SSL_FILETYPE_PEM) <= 0) {
Expand Down
4 changes: 2 additions & 2 deletions apps/s_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -1749,8 +1749,8 @@ int MAIN(int argc, char **argv)
openssl_fdset(SSL_get_fd(con), &writefds);
}
#endif
/*- printf("mode tty(%d %d%d) ssl(%d%d)\n",
tty_on,read_tty,write_tty,read_ssl,write_ssl);*/
/*- printf("mode tty(%d %d%d) ssl(%d%d)\n",
tty_on,read_tty,write_tty,read_ssl,write_ssl);*/

/*
* Note: under VMS with SOCKETSHR the second parameter is
Expand Down
14 changes: 7 additions & 7 deletions crypto/bio/b_sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -529,13 +529,13 @@ int BIO_socket_ioctl(int fd, long type, void *arg)
i = ioctlsocket(fd, type, (char *)arg);
# else
# if defined(OPENSSL_SYS_VMS)
/*-
* 2011-02-18 SMS.
* VMS ioctl() can't tolerate a 64-bit "void *arg", but we
* observe that all the consumers pass in an "unsigned long *",
* so we arrange a local copy with a short pointer, and use
* that, instead.
*/
/*-
* 2011-02-18 SMS.
* VMS ioctl() can't tolerate a 64-bit "void *arg", but we
* observe that all the consumers pass in an "unsigned long *",
* so we arrange a local copy with a short pointer, and use
* that, instead.
*/
# if __INITIAL_POINTER_SIZE == 64
# define ARG arg_32p
# pragma pointer_size save
Expand Down
10 changes: 5 additions & 5 deletions crypto/bio/bf_null.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,11 @@ static int nullf_free(BIO *a)
{
if (a == NULL)
return (0);
/*-
a->ptr=NULL;
a->init=0;
a->flags=0;
*/
/*-
a->ptr=NULL;
a->init=0;
a->flags=0;
*/
return (1);
}

Expand Down
12 changes: 6 additions & 6 deletions crypto/bio/bss_acpt.c
Original file line number Diff line number Diff line change
Expand Up @@ -415,12 +415,12 @@ static long acpt_ctrl(BIO *b, int cmd, long num, void *ptr)
ret = (long)data->bind_mode;
break;
case BIO_CTRL_DUP:
/*- dbio=(BIO *)ptr;
if (data->param_port) EAY EAY
BIO_set_port(dbio,data->param_port);
if (data->param_hostname)
BIO_set_hostname(dbio,data->param_hostname);
BIO_set_nbio(dbio,data->nbio); */
/*- dbio=(BIO *)ptr;
if (data->param_port) EAY EAY
BIO_set_port(dbio,data->param_port);
if (data->param_hostname)
BIO_set_hostname(dbio,data->param_hostname);
BIO_set_nbio(dbio,data->nbio); */
break;

default:
Expand Down
14 changes: 7 additions & 7 deletions crypto/bn/bn_kron.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@ int BN_kronecker(const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
int ret = -2; /* avoid 'uninitialized' warning */
int err = 0;
BIGNUM *A, *B, *tmp;
/*-
* In 'tab', only odd-indexed entries are relevant:
* For any odd BIGNUM n,
* tab[BN_lsw(n) & 7]
* is $(-1)^{(n^2-1)/8}$ (using TeX notation).
* Note that the sign of n does not matter.
*/
/*-
* In 'tab', only odd-indexed entries are relevant:
* For any odd BIGNUM n,
* tab[BN_lsw(n) & 7]
* is $(-1)^{(n^2-1)/8}$ (using TeX notation).
* Note that the sign of n does not matter.
*/
static const int tab[8] = { 0, 1, 0, -1, 0, -1, 0, 1 };

bn_check_top(a);
Expand Down
12 changes: 6 additions & 6 deletions crypto/bn/bn_print.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,12 @@ char *BN_bn2dec(const BIGNUM *a)
BIGNUM *t = NULL;
BN_ULONG *bn_data = NULL, *lp;

/*-
* get an upper bound for the length of the decimal integer
* num <= (BN_num_bits(a) + 1) * log(2)
* <= 3 * BN_num_bits(a) * 0.1001 + log(2) + 1 (rounding error)
* <= BN_num_bits(a)/10 + BN_num_bits/1000 + 1 + 1
*/
/*-
* get an upper bound for the length of the decimal integer
* num <= (BN_num_bits(a) + 1) * log(2)
* <= 3 * BN_num_bits(a) * 0.1001 + log(2) + 1 (rounding error)
* <= BN_num_bits(a)/10 + BN_num_bits/1000 + 1 + 1
*/
i = BN_num_bits(a) * 3;
num = (i / 10 + i / 1000 + 1) + 1;
bn_data =
Expand Down
52 changes: 26 additions & 26 deletions crypto/bn/bn_sqrt.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,32 +152,32 @@ BIGNUM *BN_mod_sqrt(BIGNUM *in, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx)
}

if (e == 2) {
/*-
* |p| == 5 (mod 8)
*
* In this case 2 is always a non-square since
* Legendre(2,p) = (-1)^((p^2-1)/8) for any odd prime.
* So if a really is a square, then 2*a is a non-square.
* Thus for
* b := (2*a)^((|p|-5)/8),
* i := (2*a)*b^2
* we have
* i^2 = (2*a)^((1 + (|p|-5)/4)*2)
* = (2*a)^((p-1)/2)
* = -1;
* so if we set
* x := a*b*(i-1),
* then
* x^2 = a^2 * b^2 * (i^2 - 2*i + 1)
* = a^2 * b^2 * (-2*i)
* = a*(-i)*(2*a*b^2)
* = a*(-i)*i
* = a.
*
* (This is due to A.O.L. Atkin,
* <URL: http://listserv.nodak.edu/scripts/wa.exe?A2=ind9211&L=nmbrthry&O=T&P=562>,
* November 1992.)
*/
/*-
* |p| == 5 (mod 8)
*
* In this case 2 is always a non-square since
* Legendre(2,p) = (-1)^((p^2-1)/8) for any odd prime.
* So if a really is a square, then 2*a is a non-square.
* Thus for
* b := (2*a)^((|p|-5)/8),
* i := (2*a)*b^2
* we have
* i^2 = (2*a)^((1 + (|p|-5)/4)*2)
* = (2*a)^((p-1)/2)
* = -1;
* so if we set
* x := a*b*(i-1),
* then
* x^2 = a^2 * b^2 * (i^2 - 2*i + 1)
* = a^2 * b^2 * (-2*i)
* = a*(-i)*(2*a*b^2)
* = a*(-i)*i
* = a.
*
* (This is due to A.O.L. Atkin,
* <URL: http://listserv.nodak.edu/scripts/wa.exe?A2=ind9211&L=nmbrthry&O=T&P=562>,
* November 1992.)
*/

/* t := 2*a */
if (!BN_mod_lshift1_quick(t, A, p))
Expand Down
6 changes: 3 additions & 3 deletions crypto/cast/casttest.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,9 @@ static unsigned char cfb_cipher64[CFB_TEST_SIZE] = {
0x59, 0xD8, 0xE2, 0x65, 0x00, 0x58, 0x6C, 0x3F,
0x2C, 0x17, 0x25, 0xD0, 0x1A, 0x38, 0xB7, 0x2A,
0x39, 0x61, 0x37, 0xDC, 0x79, 0xFB, 0x9F, 0x45
/*- 0xF9,0x78,0x32,0xB5,0x42,0x1A,0x6B,0x38,
0x9A,0x44,0xD6,0x04,0x19,0x43,0xC4,0xD9,
0x3D,0x1E,0xAE,0x47,0xFC,0xCF,0x29,0x0B,*/
/*- 0xF9,0x78,0x32,0xB5,0x42,0x1A,0x6B,0x38,
0x9A,0x44,0xD6,0x04,0x19,0x43,0xC4,0xD9,
0x3D,0x1E,0xAE,0x47,0xFC,0xCF,0x29,0x0B,*/
};
# endif

Expand Down
2 changes: 1 addition & 1 deletion crypto/des/destest.c
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ int main(int argc, char *argv[])
DES_ENCRYPT);
DES_ede3_cbcm_encrypt(&cbc_data[16], &cbc_out[16], i - 16, &ks, &ks2,
&ks3, &iv3, &iv2, DES_ENCRYPT);
/*- if (memcmp(cbc_out,cbc3_ok,
/*- if (memcmp(cbc_out,cbc3_ok,
(unsigned int)(strlen((char *)cbc_data)+1+7)/8*8) != 0)
{
printf("des_ede3_cbc_encrypt encrypt error\n");
Expand Down
12 changes: 6 additions & 6 deletions crypto/des/enc_read.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,12 +205,12 @@ int DES_enc_read(int fd, void *buf, int len, DES_key_schedule *sched,
*/
num = len;
} else {
/*-
* >output is a multiple of 8 byes, if len < rnum
* >we must be careful. The user must be aware that this
* >routine will write more bytes than he asked for.
* >The length of the buffer must be correct.
* FIXED - Should be ok now 18-9-90 - eay */
/*-
* >output is a multiple of 8 byes, if len < rnum
* >we must be careful. The user must be aware that this
* >routine will write more bytes than he asked for.
* >The length of the buffer must be correct.
* FIXED - Should be ok now 18-9-90 - eay */
if (len < rnum) {

if (DES_rw_mode & DES_PCBC_MODE)
Expand Down
4 changes: 2 additions & 2 deletions crypto/des/ofb64ede.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ void DES_ede3_ofb64_encrypt(register const unsigned char *in,
n = (n + 1) & 0x07;
}
if (save) {
/*- v0=ti[0];
v1=ti[1];*/
/*- v0=ti[0];
v1=ti[1];*/
iv = &(*ivec)[0];
l2c(v0, iv);
l2c(v1, iv);
Expand Down
77 changes: 40 additions & 37 deletions crypto/ec/ecp_nistp256.c
Original file line number Diff line number Diff line change
Expand Up @@ -432,25 +432,25 @@ static void felem_shrink(smallfelem out, const felem in)
/* As tmp[3] < 2^65, high is either 1 or 0 */
high <<= 63;
high >>= 63;
/*-
* high is:
* all ones if the high word of tmp[3] is 1
* all zeros if the high word of tmp[3] if 0 */
/*-
* high is:
* all ones if the high word of tmp[3] is 1
* all zeros if the high word of tmp[3] if 0 */
low = tmp[3];
mask = low >> 63;
/*-
* mask is:
* all ones if the MSB of low is 1
* all zeros if the MSB of low if 0 */
/*-
* mask is:
* all ones if the MSB of low is 1
* all zeros if the MSB of low if 0 */
low &= bottom63bits;
low -= kPrime3Test;
/* if low was greater than kPrime3Test then the MSB is zero */
low = ~low;
low >>= 63;
/*-
* low is:
* all ones if low was > kPrime3Test
* all zeros if low was <= kPrime3Test */
/*-
* low is:
* all ones if low was > kPrime3Test
* all zeros if low was <= kPrime3Test */
mask = (mask & low) | high;
tmp[0] -= mask & kPrime[0];
tmp[1] -= mask & kPrime[1];
Expand Down Expand Up @@ -790,17 +790,17 @@ static void felem_reduce(felem out, const longfelem in)

felem_reduce_(out, in);

/*-
* out[0] > 2^100 - 2^36 - 2^4 - 3*2^64 - 3*2^96 - 2^64 - 2^96 > 0
* out[1] > 2^100 - 2^64 - 7*2^96 > 0
* out[2] > 2^100 - 2^36 + 2^4 - 5*2^64 - 5*2^96 > 0
* out[3] > 2^100 - 2^36 + 2^4 - 7*2^64 - 5*2^96 - 3*2^96 > 0
*
* out[0] < 2^100 + 2^64 + 7*2^64 + 5*2^96 < 2^101
* out[1] < 2^100 + 3*2^64 + 5*2^64 + 3*2^97 < 2^101
* out[2] < 2^100 + 5*2^64 + 2^64 + 3*2^65 + 2^97 < 2^101
* out[3] < 2^100 + 7*2^64 + 7*2^96 + 3*2^64 < 2^101
*/
/*-
* out[0] > 2^100 - 2^36 - 2^4 - 3*2^64 - 3*2^96 - 2^64 - 2^96 > 0
* out[1] > 2^100 - 2^64 - 7*2^96 > 0
* out[2] > 2^100 - 2^36 + 2^4 - 5*2^64 - 5*2^96 > 0
* out[3] > 2^100 - 2^36 + 2^4 - 7*2^64 - 5*2^96 - 3*2^96 > 0
*
* out[0] < 2^100 + 2^64 + 7*2^64 + 5*2^96 < 2^101
* out[1] < 2^100 + 3*2^64 + 5*2^64 + 3*2^97 < 2^101
* out[2] < 2^100 + 5*2^64 + 2^64 + 3*2^65 + 2^97 < 2^101
* out[3] < 2^100 + 7*2^64 + 7*2^96 + 3*2^64 < 2^101
*/
}

/*-
Expand All @@ -819,17 +819,17 @@ static void felem_reduce_zero105(felem out, const longfelem in)

felem_reduce_(out, in);

/*-
* out[0] > 2^105 - 2^41 - 2^9 - 2^71 - 2^103 - 2^71 - 2^103 > 0
* out[1] > 2^105 - 2^71 - 2^103 > 0
* out[2] > 2^105 - 2^41 + 2^9 - 2^71 - 2^103 > 0
* out[3] > 2^105 - 2^41 + 2^9 - 2^71 - 2^103 - 2^103 > 0
*
* out[0] < 2^105 + 2^71 + 2^71 + 2^103 < 2^106
* out[1] < 2^105 + 2^71 + 2^71 + 2^103 < 2^106
* out[2] < 2^105 + 2^71 + 2^71 + 2^71 + 2^103 < 2^106
* out[3] < 2^105 + 2^71 + 2^103 + 2^71 < 2^106
*/
/*-
* out[0] > 2^105 - 2^41 - 2^9 - 2^71 - 2^103 - 2^71 - 2^103 > 0
* out[1] > 2^105 - 2^71 - 2^103 > 0
* out[2] > 2^105 - 2^41 + 2^9 - 2^71 - 2^103 > 0
* out[3] > 2^105 - 2^41 + 2^9 - 2^71 - 2^103 - 2^103 > 0
*
* out[0] < 2^105 + 2^71 + 2^71 + 2^103 < 2^106
* out[1] < 2^105 + 2^71 + 2^71 + 2^103 < 2^106
* out[2] < 2^105 + 2^71 + 2^71 + 2^71 + 2^103 < 2^106
* out[3] < 2^105 + 2^71 + 2^103 + 2^71 < 2^106
*/
}

/*
Expand Down Expand Up @@ -1094,7 +1094,8 @@ static void smallfelem_inv_contract(smallfelem out, const smallfelem in)
*
* Building on top of the field operations we have the operations on the
* elliptic curve group itself. Points on the curve are represented in Jacobian
* coordinates */
* coordinates
*/

/*-
* point_double calculates 2*(x_in, y_in, z_in)
Expand All @@ -1103,7 +1104,8 @@ static void smallfelem_inv_contract(smallfelem out, const smallfelem in)
* http://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#doubling-dbl-2001-b
*
* Outputs can equal corresponding inputs, i.e., x_out == x_in is allowed.
* while x_out == y_in is not (maybe this works, but it's not tested). */
* while x_out == y_in is not (maybe this works, but it's not tested).
*/
static void
point_double(felem x_out, felem y_out, felem z_out,
const felem x_in, const felem y_in, const felem z_in)
Expand Down Expand Up @@ -1234,7 +1236,8 @@ static void copy_small_conditional(felem out, const smallfelem in, limb mask)
* This function includes a branch for checking whether the two input points
* are equal, (while not equal to the point at infinity). This case never
* happens during single point multiplication, so there is no timing leak for
* ECDH or ECDSA signing. */
* ECDH or ECDSA signing.
*/
static void point_add(felem x3, felem y3, felem z3,
const felem x1, const felem y1, const felem z1,
const int mixed, const smallfelem x2,
Expand Down

0 comments on commit 35a1cc9

Please sign in to comment.