aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorFdaSilvaYY <fdasilvayy@gmail.com>2016-06-29 00:19:46 +0200
committerRich Salz <rsalz@openssl.org>2016-07-20 07:21:53 -0400
commit2f8e53d7944b3d659c8ae678163eb0f096a6d992 (patch)
treec924c32dfcf70ab0ecf83b823c3f9001e2c992ce /doc
parente8aa8b6c8f6d4e2b2bbd5e5721d977b0a6aa3cee (diff)
downloadopenssl-2f8e53d7944b3d659c8ae678163eb0f096a6d992.tar.gz
Fix if/for/while( in docs
Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/1292)
Diffstat (limited to 'doc')
-rw-r--r--doc/crypto/BIO_f_md.pod8
-rw-r--r--doc/crypto/BIO_f_ssl.pod2
-rw-r--r--doc/crypto/BIO_find_type.pod4
-rw-r--r--doc/crypto/BIO_s_connect.pod2
-rw-r--r--doc/crypto/BIO_s_file.pod10
-rw-r--r--doc/crypto/ENGINE_add.pod6
-rw-r--r--doc/crypto/EVP_DigestInit.pod2
-rw-r--r--doc/crypto/EVP_EncryptInit.pod2
-rw-r--r--doc/ssl/SSL_CTX_set_generate_session_id.pod32
9 files changed, 35 insertions, 33 deletions
diff --git a/doc/crypto/BIO_f_md.pod b/doc/crypto/BIO_f_md.pod
index b2c1433d25..32f0046751 100644
--- a/doc/crypto/BIO_f_md.pod
+++ b/doc/crypto/BIO_f_md.pod
@@ -107,7 +107,7 @@ The next example digests data by reading through a chain instead:
do {
rdlen = BIO_read(bio, buf, sizeof(buf));
/* Might want to do something with the data here */
- } while(rdlen > 0);
+ } while (rdlen > 0);
This next example retrieves the message digests from a BIO chain and
outputs them. This could be used with the examples above.
@@ -120,14 +120,14 @@ outputs them. This could be used with the examples above.
do {
EVP_MD *md;
mdtmp = BIO_find_type(mdtmp, BIO_TYPE_MD);
- if(!mdtmp) break;
+ if (!mdtmp) break;
BIO_get_md(mdtmp, &md);
printf("%s digest", OBJ_nid2sn(EVP_MD_type(md)));
mdlen = BIO_gets(mdtmp, mdbuf, EVP_MAX_MD_SIZE);
- for(i = 0; i < mdlen; i++) printf(":%02X", mdbuf[i]);
+ for (i = 0; i < mdlen; i++) printf(":%02X", mdbuf[i]);
printf("\n");
mdtmp = BIO_next(mdtmp);
- } while(mdtmp);
+ } while (mdtmp);
BIO_free_all(bio);
diff --git a/doc/crypto/BIO_f_ssl.pod b/doc/crypto/BIO_f_ssl.pod
index 318b3c8dbf..3f9635ee68 100644
--- a/doc/crypto/BIO_f_ssl.pod
+++ b/doc/crypto/BIO_f_ssl.pod
@@ -180,7 +180,7 @@ unencrypted example in L<BIO_s_connect(3)>.
BIO_puts(sbio, "GET / HTTP/1.0\n\n");
for ( ; ; ) {
len = BIO_read(sbio, tmpbuf, 1024);
- if(len <= 0)
+ if (len <= 0)
break;
BIO_write(out, tmpbuf, len);
}
diff --git a/doc/crypto/BIO_find_type.pod b/doc/crypto/BIO_find_type.pod
index b87e87b9fd..ff7b488609 100644
--- a/doc/crypto/BIO_find_type.pod
+++ b/doc/crypto/BIO_find_type.pod
@@ -49,12 +49,12 @@ Traverse a chain looking for digest BIOs:
do {
btmp = BIO_find_type(btmp, BIO_TYPE_MD);
- if(btmp == NULL) break; /* Not found */
+ if (btmp == NULL) break; /* Not found */
/* btmp is a digest BIO, do something with it ...*/
...
btmp = BIO_next(btmp);
- } while(btmp);
+ } while (btmp);
=head1 COPYRIGHT
diff --git a/doc/crypto/BIO_s_connect.pod b/doc/crypto/BIO_s_connect.pod
index 29192a6cf0..2143acd099 100644
--- a/doc/crypto/BIO_s_connect.pod
+++ b/doc/crypto/BIO_s_connect.pod
@@ -176,7 +176,7 @@ to retrieve a page and copy the result to standard output.
BIO_puts(cbio, "GET / HTTP/1.0\n\n");
for ( ; ; ) {
len = BIO_read(cbio, tmpbuf, 1024);
- if(len <= 0)
+ if (len <= 0)
break;
BIO_write(out, tmpbuf, len);
}
diff --git a/doc/crypto/BIO_s_file.pod b/doc/crypto/BIO_s_file.pod
index b77b00f544..e19d824290 100644
--- a/doc/crypto/BIO_s_file.pod
+++ b/doc/crypto/BIO_s_file.pod
@@ -92,15 +92,15 @@ Alternative technique:
BIO *bio_out;
bio_out = BIO_new(BIO_s_file());
- if(bio_out == NULL) /* Error ... */
- if(!BIO_set_fp(bio_out, stdout, BIO_NOCLOSE)) /* Error ... */
+ if (bio_out == NULL) /* Error ... */
+ if (!BIO_set_fp(bio_out, stdout, BIO_NOCLOSE)) /* Error ... */
BIO_printf(bio_out, "Hello World\n");
Write to a file:
BIO *out;
out = BIO_new_file("filename.txt", "w");
- if(!out) /* Error occurred */
+ if (!out) /* Error occurred */
BIO_printf(out, "Hello World\n");
BIO_free(out);
@@ -108,8 +108,8 @@ Alternative technique:
BIO *out;
out = BIO_new(BIO_s_file());
- if(out == NULL) /* Error ... */
- if(!BIO_write_filename(out, "filename.txt")) /* Error ... */
+ if (out == NULL) /* Error ... */
+ if (!BIO_write_filename(out, "filename.txt")) /* Error ... */
BIO_printf(out, "Hello World\n");
BIO_free(out);
diff --git a/doc/crypto/ENGINE_add.pod b/doc/crypto/ENGINE_add.pod
index da86532ad9..37384f69b5 100644
--- a/doc/crypto/ENGINE_add.pod
+++ b/doc/crypto/ENGINE_add.pod
@@ -472,8 +472,8 @@ boolean success or failure.
const char **post_cmds, int post_num)
{
ENGINE *e = ENGINE_by_id(engine_id);
- if(!e) return 0;
- while(pre_num--) {
+ if (!e) return 0;
+ while (pre_num--) {
if(!ENGINE_ctrl_cmd_string(e, pre_cmds[0], pre_cmds[1], 0)) {
fprintf(stderr, "Failed command (%s - %s:%s)\n", engine_id,
pre_cmds[0], pre_cmds[1] ? pre_cmds[1] : "(NULL)");
@@ -482,7 +482,7 @@ boolean success or failure.
}
pre_cmds += 2;
}
- if(!ENGINE_init(e)) {
+ if (!ENGINE_init(e)) {
fprintf(stderr, "Failed initialisation\n");
ENGINE_free(e);
return 0;
diff --git a/doc/crypto/EVP_DigestInit.pod b/doc/crypto/EVP_DigestInit.pod
index 1f2da05a76..d615b31b87 100644
--- a/doc/crypto/EVP_DigestInit.pod
+++ b/doc/crypto/EVP_DigestInit.pod
@@ -223,7 +223,7 @@ digest name passed on the command line.
EVP_MD_CTX_free(mdctx);
printf("Digest is: ");
- for(i = 0; i < md_len; i++)
+ for (i = 0; i < md_len; i++)
printf("%02x", md_value[i]);
printf("\n");
diff --git a/doc/crypto/EVP_EncryptInit.pod b/doc/crypto/EVP_EncryptInit.pod
index bffe72b73a..8286a717e9 100644
--- a/doc/crypto/EVP_EncryptInit.pod
+++ b/doc/crypto/EVP_EncryptInit.pod
@@ -603,7 +603,7 @@ with a 128-bit key:
for(;;)
{
inlen = fread(inbuf, 1, 1024, in);
- if(inlen <= 0) break;
+ if (inlen <= 0) break;
if(!EVP_CipherUpdate(ctx, outbuf, &outlen, inbuf, inlen))
{
/* Error */
diff --git a/doc/ssl/SSL_CTX_set_generate_session_id.pod b/doc/ssl/SSL_CTX_set_generate_session_id.pod
index 95b7e9e1ca..515fd251d2 100644
--- a/doc/ssl/SSL_CTX_set_generate_session_id.pod
+++ b/doc/ssl/SSL_CTX_set_generate_session_id.pod
@@ -90,25 +90,27 @@ server id given, and will fill the rest with pseudo random bytes:
#define MAX_SESSION_ID_ATTEMPTS 10
static int generate_session_id(const SSL *ssl, unsigned char *id,
unsigned int *id_len)
- {
+ {
unsigned int count = 0;
- do {
- RAND_pseudo_bytes(id, *id_len);
- /* Prefix the session_id with the required prefix. NB: If our
- * prefix is too long, clip it - but there will be worse effects
- * anyway, eg. the server could only possibly create 1 session
- * ID (ie. the prefix!) so all future session negotiations will
- * fail due to conflicts. */
- memcpy(id, session_id_prefix,
- (strlen(session_id_prefix) < *id_len) ?
- strlen(session_id_prefix) : *id_len);
- }
- while(SSL_has_matching_session_id(ssl, id, *id_len) &&
+ do {
+ RAND_pseudo_bytes(id, *id_len);
+ /*
+ * Prefix the session_id with the required prefix. NB: If our
+ * prefix is too long, clip it - but there will be worse effects
+ * anyway, eg. the server could only possibly create 1 session
+ * ID (ie. the prefix!) so all future session negotiations will
+ * fail due to conflicts.
+ */
+ memcpy(id, session_id_prefix,
+ (strlen(session_id_prefix) < *id_len) ?
+ strlen(session_id_prefix) : *id_len);
+ }
+ while (SSL_has_matching_session_id(ssl, id, *id_len) &&
(++count < MAX_SESSION_ID_ATTEMPTS));
- if(count >= MAX_SESSION_ID_ATTEMPTS)
+ if (count >= MAX_SESSION_ID_ATTEMPTS)
return 0;
return 1;
- }
+ }
=head1 RETURN VALUES