summaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorBeat Bolli <dev@drbeat.li>2016-11-19 00:10:05 +0100
committerMatt Caswell <matt@openssl.org>2017-06-08 11:54:15 +0100
commit2947af32a0ec6666efd5b287ac4609ba3a984f0d (patch)
tree7f024902fa2741965c415283a734267fcd083976 /doc
parent52df25cf2e656146cb3b206d8220124f0417d03f (diff)
doc/man3: use the documented coding style in the example code
Adjust brace placement, whitespace after keywords, indentation and empty lines after variable declarations according to https://www.openssl.org/policies/codingstyle.html. Indent literal sections by exactly one space. Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/1956)
Diffstat (limited to 'doc')
-rw-r--r--doc/man3/ASN1_TIME_set.pod8
-rw-r--r--doc/man3/ASYNC_start_job.pod14
-rw-r--r--doc/man3/BIO_connect.pod2
-rw-r--r--doc/man3/BIO_f_base64.pod4
-rw-r--r--doc/man3/BIO_f_md.pod26
-rw-r--r--doc/man3/BIO_f_ssl.pod10
-rw-r--r--doc/man3/BIO_find_type.pod11
-rw-r--r--doc/man3/BIO_s_connect.pod2
-rw-r--r--doc/man3/BIO_s_file.pod15
-rw-r--r--doc/man3/BIO_set_callback.pod9
-rw-r--r--doc/man3/BN_CTX_new.pod3
-rw-r--r--doc/man3/BN_generate_prime.pod3
-rw-r--r--doc/man3/CONF_modules_load_file.pod46
-rw-r--r--doc/man3/CRYPTO_THREAD_run_once.pod76
-rw-r--r--doc/man3/ECDSA_SIG_new.pod41
-rw-r--r--doc/man3/ENGINE_add.pod28
-rw-r--r--doc/man3/ERR_load_strings.pod4
-rw-r--r--doc/man3/EVP_DigestInit.pod62
-rw-r--r--doc/man3/EVP_EncryptInit.pod172
-rw-r--r--doc/man3/EVP_PKEY_CTX_set_hkdf_md.pod12
-rw-r--r--doc/man3/EVP_PKEY_CTX_set_tls1_prf_md.pod10
-rw-r--r--doc/man3/EVP_PKEY_decrypt.pod15
-rw-r--r--doc/man3/EVP_PKEY_derive.pod12
-rw-r--r--doc/man3/EVP_PKEY_encrypt.pod15
-rw-r--r--doc/man3/EVP_PKEY_keygen.pod43
-rw-r--r--doc/man3/EVP_PKEY_sign.pod14
-rw-r--r--doc/man3/EVP_PKEY_verify.pod14
-rw-r--r--doc/man3/EVP_PKEY_verify_recover.pod17
-rw-r--r--doc/man3/OBJ_nid2obj.pod2
-rw-r--r--doc/man3/OCSP_REQUEST_new.pod2
-rw-r--r--doc/man3/PEM_read_bio_PrivateKey.pod22
-rw-r--r--doc/man3/PKCS12_newpass.pod64
-rw-r--r--doc/man3/RAND_set_rand_method.pod12
-rw-r--r--doc/man3/RSA_set_method.pod54
-rw-r--r--doc/man3/SCT_new.pod18
-rw-r--r--doc/man3/SCT_validate.pod12
-rw-r--r--doc/man3/SSL_CTX_config.pod7
-rw-r--r--doc/man3/SSL_CTX_dane_enable.pod264
-rw-r--r--doc/man3/SSL_CTX_load_verify_locations.pod2
-rw-r--r--doc/man3/SSL_CTX_set1_sigalgs.pod6
-rw-r--r--doc/man3/SSL_CTX_set_client_CA_list.pod2
-rw-r--r--doc/man3/SSL_CTX_set_default_passwd_cb.pod6
-rw-r--r--doc/man3/SSL_CTX_set_generate_session_id.pod40
-rw-r--r--doc/man3/SSL_CTX_set_info_callback.pod62
-rw-r--r--doc/man3/SSL_CTX_set_tlsext_ticket_key_cb.pod93
-rw-r--r--doc/man3/SSL_CTX_set_tmp_dh_callback.pod24
-rw-r--r--doc/man3/SSL_CTX_set_verify.pod122
-rw-r--r--doc/man3/SSL_load_client_CA_file.pod4
-rw-r--r--doc/man3/SSL_set1_host.pod31
-rw-r--r--doc/man3/X509_NAME_add_entry_by_txt.pod14
-rw-r--r--doc/man3/X509_NAME_get_index_by_NID.pod24
-rw-r--r--doc/man3/X509_STORE_CTX_get_error.pod2
-rw-r--r--doc/man3/X509_STORE_CTX_set_verify_cb.pod139
-rw-r--r--doc/man3/X509_VERIFY_PARAM_set_flags.pod10
54 files changed, 857 insertions, 869 deletions
diff --git a/doc/man3/ASN1_TIME_set.pod b/doc/man3/ASN1_TIME_set.pod
index 457b7218d4..b6acd730b7 100644
--- a/doc/man3/ASN1_TIME_set.pod
+++ b/doc/man3/ASN1_TIME_set.pod
@@ -100,14 +100,14 @@ Determine if one time is later or sooner than the current time:
int day, sec;
if (!ASN1_TIME_diff(&day, &sec, NULL, to))
- /* Invalid time format */
+ /* Invalid time format */
if (day > 0 || sec > 0)
- printf("Later\n");
+ printf("Later\n");
else if (day < 0 || sec < 0)
- printf("Sooner\n");
+ printf("Sooner\n");
else
- printf("Same\n");
+ printf("Same\n");
=head1 RETURN VALUES
diff --git a/doc/man3/ASYNC_start_job.pod b/doc/man3/ASYNC_start_job.pod
index cb0229543f..e6ccf55c4d 100644
--- a/doc/man3/ASYNC_start_job.pod
+++ b/doc/man3/ASYNC_start_job.pod
@@ -262,17 +262,17 @@ The following example demonstrates how to use most of the core async APIs:
}
for (;;) {
- switch(ASYNC_start_job(&job, ctx, &ret, jobfunc, msg, sizeof(msg))) {
+ switch (ASYNC_start_job(&job, ctx, &ret, jobfunc, msg, sizeof(msg))) {
case ASYNC_ERR:
case ASYNC_NO_JOBS:
- printf("An error occurred\n");
- goto end;
+ printf("An error occurred\n");
+ goto end;
case ASYNC_PAUSE:
- printf("Job was paused\n");
- break;
+ printf("Job was paused\n");
+ break;
case ASYNC_FINISH:
- printf("Job finished with return value %d\n", ret);
- goto end;
+ printf("Job finished with return value %d\n", ret);
+ goto end;
}
/* Wait for the job to be woken */
diff --git a/doc/man3/BIO_connect.pod b/doc/man3/BIO_connect.pod
index 5194033feb..bb1047a347 100644
--- a/doc/man3/BIO_connect.pod
+++ b/doc/man3/BIO_connect.pod
@@ -73,7 +73,7 @@ and not IPv4 addresses mapped to IPv6.
These flags are bit flags, so they are to be combined with the
C<|> operator, for example:
- BIO_connect(sock, addr, BIO_SOCK_KEEPALIVE | BIO_SOCK_NONBLOCK);
+ BIO_connect(sock, addr, BIO_SOCK_KEEPALIVE | BIO_SOCK_NONBLOCK);
=head1 RETURN VALUES
diff --git a/doc/man3/BIO_f_base64.pod b/doc/man3/BIO_f_base64.pod
index 1740dad57f..5097c2849b 100644
--- a/doc/man3/BIO_f_base64.pod
+++ b/doc/man3/BIO_f_base64.pod
@@ -65,8 +65,8 @@ data to standard output:
bio = BIO_new_fp(stdin, BIO_NOCLOSE);
bio_out = BIO_new_fp(stdout, BIO_NOCLOSE);
BIO_push(b64, bio);
- while((inlen = BIO_read(b64, inbuf, 512)) > 0)
- BIO_write(bio_out, inbuf, inlen);
+ while ((inlen = BIO_read(b64, inbuf, 512)) > 0)
+ BIO_write(bio_out, inbuf, inlen);
BIO_flush(bio_out);
BIO_free_all(b64);
diff --git a/doc/man3/BIO_f_md.pod b/doc/man3/BIO_f_md.pod
index dede0cc84c..3c8d4311ae 100644
--- a/doc/man3/BIO_f_md.pod
+++ b/doc/man3/BIO_f_md.pod
@@ -82,7 +82,8 @@ checking has been omitted for clarity.
bio = BIO_new(BIO_s_null());
mdtmp = BIO_new(BIO_f_md());
BIO_set_md(mdtmp, EVP_sha1());
- /* For BIO_push() we want to append the sink BIO and keep a note of
+ /*
+ * For BIO_push() we want to append the sink BIO and keep a note of
* the start of the chain.
*/
bio = BIO_push(mdtmp, bio);
@@ -105,8 +106,8 @@ The next example digests data by reading through a chain instead:
BIO_set_md(mdtmp, EVP_md5());
bio = BIO_push(mdtmp, bio);
do {
- rdlen = BIO_read(bio, buf, sizeof(buf));
- /* Might want to do something with the data here */
+ rdlen = BIO_read(bio, buf, sizeof(buf));
+ /* Might want to do something with the data here */
} while (rdlen > 0);
This next example retrieves the message digests from a BIO chain and
@@ -118,15 +119,16 @@ outputs them. This could be used with the examples above.
int i;
mdtmp = bio; /* Assume bio has previously been set up */
do {
- EVP_MD *md;
- mdtmp = BIO_find_type(mdtmp, BIO_TYPE_MD);
- 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]);
- printf("\n");
- mdtmp = BIO_next(mdtmp);
+ EVP_MD *md;
+ mdtmp = BIO_find_type(mdtmp, BIO_TYPE_MD);
+ 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]);
+ printf("\n");
+ mdtmp = BIO_next(mdtmp);
} while (mdtmp);
BIO_free_all(bio);
diff --git a/doc/man3/BIO_f_ssl.pod b/doc/man3/BIO_f_ssl.pod
index d2046f2e6d..2bc9afea6f 100644
--- a/doc/man3/BIO_f_ssl.pod
+++ b/doc/man3/BIO_f_ssl.pod
@@ -170,15 +170,15 @@ unencrypted example in L<BIO_s_connect(3)>.
exit(1);
}
if (BIO_do_handshake(sbio) <= 0) {
- fprintf(stderr, "Error establishing SSL connection\n");
- ERR_print_errors_fp(stderr);
- exit(1);
+ fprintf(stderr, "Error establishing SSL connection\n");
+ ERR_print_errors_fp(stderr);
+ exit(1);
}
/* XXX Could examine ssl here to get connection info */
BIO_puts(sbio, "GET / HTTP/1.0\n\n");
- for ( ; ; ) {
+ for (;;) {
len = BIO_read(sbio, tmpbuf, 1024);
if (len <= 0)
break;
@@ -261,7 +261,7 @@ a client and also echoes the request to standard output.
BIO_puts(sbio, "\r\nConnection Established\r\nRequest headers:\r\n");
BIO_puts(sbio, "--------------------------------------------------\r\n");
- for ( ; ; ) {
+ for (;;) {
len = BIO_gets(sbio, tmpbuf, 1024);
if (len <= 0)
break;
diff --git a/doc/man3/BIO_find_type.pod b/doc/man3/BIO_find_type.pod
index ff7b488609..08ec161349 100644
--- a/doc/man3/BIO_find_type.pod
+++ b/doc/man3/BIO_find_type.pod
@@ -48,12 +48,13 @@ Traverse a chain looking for digest BIOs:
btmp = in_bio; /* in_bio is chain to search through */
do {
- btmp = BIO_find_type(btmp, BIO_TYPE_MD);
- if (btmp == NULL) break; /* Not found */
- /* btmp is a digest BIO, do something with it ...*/
- ...
+ btmp = BIO_find_type(btmp, BIO_TYPE_MD);
+ if (btmp == NULL)
+ break; /* Not found */
+ /* btmp is a digest BIO, do something with it ...*/
+ ...
- btmp = BIO_next(btmp);
+ btmp = BIO_next(btmp);
} while (btmp);
diff --git a/doc/man3/BIO_s_connect.pod b/doc/man3/BIO_s_connect.pod
index 2143acd099..be2f4e5002 100644
--- a/doc/man3/BIO_s_connect.pod
+++ b/doc/man3/BIO_s_connect.pod
@@ -174,7 +174,7 @@ to retrieve a page and copy the result to standard output.
exit(1);
}
BIO_puts(cbio, "GET / HTTP/1.0\n\n");
- for ( ; ; ) {
+ for (;;) {
len = BIO_read(cbio, tmpbuf, 1024);
if (len <= 0)
break;
diff --git a/doc/man3/BIO_s_file.pod b/doc/man3/BIO_s_file.pod
index abbcdb0e53..fa3016f950 100644
--- a/doc/man3/BIO_s_file.pod
+++ b/doc/man3/BIO_s_file.pod
@@ -92,15 +92,18 @@ 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 */
BIO_printf(out, "Hello World\n");
BIO_free(out);
@@ -108,8 +111,10 @@ 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/man3/BIO_set_callback.pod b/doc/man3/BIO_set_callback.pod
index 3d15859406..ac017e7243 100644
--- a/doc/man3/BIO_set_callback.pod
+++ b/doc/man3/BIO_set_callback.pod
@@ -122,7 +122,8 @@ or
is called before the read and
- callback_ex(b, BIO_CB_READ | BIO_CB_RETURN, data, dlen, 0, 0L, retvalue, readbytes)
+ callback_ex(b, BIO_CB_READ | BIO_CB_RETURN, data, dlen, 0, 0L, retvalue,
+ readbytes)
or
@@ -140,7 +141,8 @@ or
is called before the write and
- callback_ex(b, BIO_CB_WRITE | BIO_CB_RETURN, data, dlen, 0, 0L, retvalue, written)
+ callback_ex(b, BIO_CB_WRITE | BIO_CB_RETURN, data, dlen, 0, 0L, retvalue,
+ written)
or
@@ -158,7 +160,8 @@ or
is called before the operation and
- callback_ex(b, BIO_CB_GETS | BIO_CB_RETURN, buf, size, 0, 0L, retvalue, readbytes)
+ callback_ex(b, BIO_CB_GETS | BIO_CB_RETURN, buf, size, 0, 0L, retvalue,
+ readbytes)
or
diff --git a/doc/man3/BN_CTX_new.pod b/doc/man3/BN_CTX_new.pod
index 623fcd5692..4cf3634e9b 100644
--- a/doc/man3/BN_CTX_new.pod
+++ b/doc/man3/BN_CTX_new.pod
@@ -51,7 +51,8 @@ replace use of BN_CTX_init with BN_CTX_new instead:
BN_CTX *ctx;
ctx = BN_CTX_new();
- if(!ctx) /* Handle error */
+ if (!ctx)
+ /* error */
...
BN_CTX_free(ctx);
diff --git a/doc/man3/BN_generate_prime.pod b/doc/man3/BN_generate_prime.pod
index c97536b5c4..fb492feb77 100644
--- a/doc/man3/BN_generate_prime.pod
+++ b/doc/man3/BN_generate_prime.pod
@@ -169,7 +169,8 @@ Instead applications should create a BN_GENCB structure using BN_GENCB_new:
BN_GENCB *callback;
callback = BN_GENCB_new();
- if(!callback) /* handle error */
+ if (!callback)
+ /* error */
...
BN_GENCB_free(callback);
diff --git a/doc/man3/CONF_modules_load_file.pod b/doc/man3/CONF_modules_load_file.pod
index 4f02f52f6a..a752c2ff82 100644
--- a/doc/man3/CONF_modules_load_file.pod
+++ b/doc/man3/CONF_modules_load_file.pod
@@ -65,9 +65,9 @@ Load a configuration file and print out any errors and exit (missing file
considered fatal):
if (CONF_modules_load_file(NULL, NULL, 0) <= 0) {
- fprintf(stderr, "FATAL: error loading configuration file\n");
- ERR_print_errors_fp(stderr);
- exit(1);
+ fprintf(stderr, "FATAL: error loading configuration file\n");
+ ERR_print_errors_fp(stderr);
+ exit(1);
}
Load default configuration file using the section indicated by "myapp",
@@ -75,9 +75,9 @@ tolerate missing files, but exit on other errors:
if (CONF_modules_load_file(NULL, "myapp",
CONF_MFLAGS_IGNORE_MISSING_FILE) <= 0) {
- fprintf(stderr, "FATAL: error loading configuration file\n");
- ERR_print_errors_fp(stderr);
- exit(1);
+ fprintf(stderr, "FATAL: error loading configuration file\n");
+ ERR_print_errors_fp(stderr);
+ exit(1);
}
Load custom configuration file and section, only print warnings on error,
@@ -85,8 +85,8 @@ missing configuration file ignored:
if (CONF_modules_load_file("/something/app.cnf", "myapp",
CONF_MFLAGS_IGNORE_MISSING_FILE) <= 0) {
- fprintf(stderr, "WARNING: error loading configuration file\n");
- ERR_print_errors_fp(stderr);
+ fprintf(stderr, "WARNING: error loading configuration file\n");
+ ERR_print_errors_fp(stderr);
}
Load and parse configuration file manually, custom error handling:
@@ -96,22 +96,22 @@ Load and parse configuration file manually, custom error handling:
long eline;
fp = fopen("/somepath/app.cnf", "r");
if (fp == NULL) {
- fprintf(stderr, "Error opening configuration file\n");
- /* Other missing configuration file behaviour */
+ fprintf(stderr, "Error opening configuration file\n");
+ /* Other missing configuration file behaviour */
} else {
- cnf = NCONF_new(NULL);
- if (NCONF_load_fp(cnf, fp, &eline) == 0) {
- fprintf(stderr, "Error on line %ld of configuration file\n", eline);
- ERR_print_errors_fp(stderr);
- /* Other malformed configuration file behaviour */
- } else if (CONF_modules_load(cnf, "appname", 0) <= 0) {
- fprintf(stderr, "Error configuring application\n");
- ERR_print_errors_fp(stderr);
- /* Other configuration error behaviour */
- }
- fclose(fp);
- NCONF_free(cnf);
- }
+ cnf = NCONF_new(NULL);
+ if (NCONF_load_fp(cnf, fp, &eline) == 0) {
+ fprintf(stderr, "Error on line %ld of configuration file\n", eline);
+ ERR_print_errors_fp(stderr);
+ /* Other malformed configuration file behaviour */
+ } else if (CONF_modules_load(cnf, "appname", 0) <= 0) {
+ fprintf(stderr, "Error configuring application\n");
+ ERR_print_errors_fp(stderr);
+ /* Other configuration error behaviour */
+ }
+ fclose(fp);
+ NCONF_free(cnf);
+ }
=head1 RETURN VALUES
diff --git a/doc/man3/CRYPTO_THREAD_run_once.pod b/doc/man3/CRYPTO_THREAD_run_once.pod
index b256a18637..072790dc31 100644
--- a/doc/man3/CRYPTO_THREAD_run_once.pod
+++ b/doc/man3/CRYPTO_THREAD_run_once.pod
@@ -100,42 +100,42 @@ crypto.h where use of CRYPTO_THREAD_* types and functions is required.
This example safely initializes and uses a lock.
- #ifdef _WIN32
- # include <windows.h>
- #endif
- #include <openssl/crypto.h>
-
- static CRYPTO_ONCE once = CRYPTO_ONCE_STATIC_INIT;
- static CRYPTO_RWLOCK *lock;
-
- static void myinit(void)
- {
- lock = CRYPTO_THREAD_lock_new();
- }
-
- static int mylock(void)
- {
- if (!CRYPTO_THREAD_run_once(&once, void init) || lock == NULL)
- return 0;
- return CRYPTO_THREAD_write_lock(lock);
- }
-
- static int myunlock(void)
- {
- return CRYPTO_THREAD_unlock(lock);
- }
-
- int serialized(void)
- {
- int ret = 0;
-
- if (mylock()) {
- /* Your code here, do not return without releasing the lock! */
- ret = ... ;
- }
- myunlock();
- return ret;
- }
+ #ifdef _WIN32
+ # include <windows.h>
+ #endif
+ #include <openssl/crypto.h>
+
+ static CRYPTO_ONCE once = CRYPTO_ONCE_STATIC_INIT;
+ static CRYPTO_RWLOCK *lock;
+
+ static void myinit(void)
+ {
+ lock = CRYPTO_THREAD_lock_new();
+ }
+
+ static int mylock(void)
+ {
+ if (!CRYPTO_THREAD_run_once(&once, void init) || lock == NULL)
+ return 0;
+ return CRYPTO_THREAD_write_lock(lock);
+ }
+
+ static int myunlock(void)
+ {
+ return CRYPTO_THREAD_unlock(lock);
+ }
+
+ int serialized(void)
+ {
+ int ret = 0;
+
+ if (mylock()) {
+ /* Your code here, do not return without releasing the lock! */
+ ret = ... ;
+ }
+ myunlock();
+ return ret;
+ }
Finalization of locks is an advanced topic, not covered in this example.
This can only be done at process exit or when a dynamically loaded library is
@@ -149,9 +149,9 @@ You can find out if OpenSSL was configured with thread support:
#include <openssl/opensslconf.h>
#if defined(OPENSSL_THREADS)
- // thread support enabled
+ // thread support enabled
#else
- // no thread support
+ // no thread support
#endif
=head1 SEE ALSO
diff --git a/doc/man3/ECDSA_SIG_new.pod b/doc/man3/ECDSA_SIG_new.pod
index 9e1f662c62..8d35c9e5f9 100644
--- a/doc/man3/ECDSA_SIG_new.pod
+++ b/doc/man3/ECDSA_SIG_new.pod
@@ -136,35 +136,31 @@ named curve prime256v1 (aka P-256).
First step: create an EC_KEY object (note: this part is B<not> ECDSA
specific)
- int ret;
+ int ret;
ECDSA_SIG *sig;
- EC_KEY *eckey;
+ EC_KEY *eckey;
eckey = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1);
- if (eckey == NULL) {
- /* error */
- }
- if (EC_KEY_generate_key(eckey) == 0) {
- /* error */
- }
+ if (eckey == NULL)
+ /* error */
+ if (EC_KEY_generate_key(eckey) == 0)
+ /* error */
Second step: compute the ECDSA signature of a SHA-256 hash value
using ECDSA_do_sign():
sig = ECDSA_do_sign(digest, 32, eckey);
- if (sig == NULL) {
- /* error */
- }
+ if (sig == NULL)
+ /* error */
or using ECDSA_sign():
unsigned char *buffer, *pp;
- int buf_len;
+ int buf_len;
buf_len = ECDSA_size(eckey);
- buffer = OPENSSL_malloc(buf_len);
+ buffer = OPENSSL_malloc(buf_len);
pp = buffer;
- if (ECDSA_sign(0, dgst, dgstlen, pp, &buf_len, eckey) == 0) {
- /* error */
- }
+ if (ECDSA_sign(0, dgst, dgstlen, pp, &buf_len, eckey) == 0)
+ /* error */
Third step: verify the created ECDSA signature using ECDSA_do_verify():
@@ -176,13 +172,12 @@ or using ECDSA_verify():
and finally evaluate the return value:
- if (ret == 1) {
- /* signature ok */
- } else if (ret == 0) {
- /* incorrect signature */
- } else {
- /* error */
- }
+ if (ret == 1)
+ /* signature ok */
+ else if (ret == 0)
+ /* incorrect signature */
+ else
+ /* error */
=head1 CONFORMING TO
diff --git a/doc/man3/ENGINE_add.pod b/doc/man3/ENGINE_add.pod
index c9181df3b5..5346fd4d98 100644
--- a/doc/man3/ENGINE_add.pod
+++ b/doc/man3/ENGINE_add.pod
@@ -385,17 +385,19 @@ illustrates how to approach this;
const char *engine_id = "ACME";
ENGINE_load_builtin_engines();
e = ENGINE_by_id(engine_id);
- if(!e)
+ if (!e)
/* the engine isn't available */
return;
- if(!ENGINE_init(e)) {
+ if (!ENGINE_init(e)) {
/* the engine couldn't initialise, release 'e' */
ENGINE_free(e);
return;
}
- if(!ENGINE_set_default_RSA(e))
- /* This should only happen when 'e' can't initialise, but the previous
- * statement suggests it did. */
+ if (!ENGINE_set_default_RSA(e))
+ /*
+ * This should only happen when 'e' can't initialise, but the previous
+ * statement suggests it did.
+ */
abort();
ENGINE_set_default_DSA(e);
ENGINE_set_default_ciphers(e);
@@ -474,9 +476,9 @@ boolean success or failure.
ENGINE *e = ENGINE_by_id(engine_id);
if (!e) return 0;
while (pre_num--) {
- if(!ENGINE_ctrl_cmd_string(e, pre_cmds[0], pre_cmds[1], 0)) {
+ 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)");
+ pre_cmds[0], pre_cmds[1] ? pre_cmds[1] : "(NULL)");
ENGINE_free(e);
return 0;
}
@@ -487,13 +489,15 @@ boolean success or failure.
ENGINE_free(e);
return 0;
}
- /* ENGINE_init() returned a functional reference, so free the structural
- * reference from ENGINE_by_id(). */
+ /*
+ * ENGINE_init() returned a functional reference, so free the structural
+ * reference from ENGINE_by_id().
+ */
ENGINE_free(e);
- while(post_num--) {
- if(!ENGINE_ctrl_cmd_string(e, post_cmds[0], post_cmds[1], 0)) {
+ while (post_num--) {
+ if (!ENGINE_ctrl_cmd_string(e, post_cmds[0], post_cmds[1], 0)) {
fprintf(stderr, "Failed command (%s - %s:%s)\n", engine_id,
- post_cmds[0], post_cmds[1] ? post_cmds[1] : "(NULL)");
+ post_cmds[0], post_cmds[1] ? post_cmds[1] : "(NULL)");
ENGINE_finish(e);