Commit e9b77246 authored by Beat Bolli's avatar Beat Bolli Committed by Matt Caswell
Browse files

doc/man3: reformat the function prototypes in the synopses



I tried hard to keep the lines at 80 characters or less, but in a few
cases I had to punt and just indented the subsequent lines by 4 spaces.

A few well-placed typedefs for callback functions would really help, but
these would be part of the API, so that's probably for later.

I also took the liberty of inserting empty lines in overlong blocks to
provide some visual space.

Reviewed-by: default avatarRich Salz <rsalz@openssl.org>
Reviewed-by: default avatarMatt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1956)
parent 61ced34f
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -85,9 +85,11 @@ Set a time structure to one hour after the current time and print it out:

 #include <time.h>
 #include <openssl/asn1.h>

 ASN1_TIME *tm;
 time_t t;
 BIO *b;

 t = time(NULL);
 tm = ASN1_TIME_adj(NULL, t, 0, 60 * 60);
 b = BIO_new_fp(stdout, BIO_NOCLOSE);
@@ -101,7 +103,6 @@ Determine if one time is later or sooner than the current time:

 if (!ASN1_TIME_diff(&day, &sec, NULL, to))
     /* Invalid time format */

 if (day > 0 || sec > 0)
     printf("Later\n");
 else if (day < 0 || sec < 0)
+1 −0
Original line number Diff line number Diff line
@@ -187,6 +187,7 @@ The following example demonstrates how to use most of the core async APIs:
 void cleanup(ASYNC_WAIT_CTX *ctx, const void *key, OSSL_ASYNC_FD r, void *vw)
 {
     OSSL_ASYNC_FD *w = (OSSL_ASYNC_FD *)vw;

     close(r);
     close(*w);
     OPENSSL_free(w);
+7 −5
Original line number Diff line number Diff line
@@ -14,12 +14,14 @@ BF_cfb64_encrypt, BF_ofb64_encrypt, BF_options - Blowfish encryption
 void BF_ecb_encrypt(const unsigned char *in, unsigned char *out,
                     BF_KEY *key, int enc);
 void BF_cbc_encrypt(const unsigned char *in, unsigned char *out,
         long length, BF_KEY *schedule, unsigned char *ivec, int enc);
                     long length, BF_KEY *schedule,
                     unsigned char *ivec, int enc);
 void BF_cfb64_encrypt(const unsigned char *in, unsigned char *out,
         long length, BF_KEY *schedule, unsigned char *ivec, int *num,
         int enc);
                       long length, BF_KEY *schedule,
                       unsigned char *ivec, int *num, int enc);
 void BF_ofb64_encrypt(const unsigned char *in, unsigned char *out,
         long length, BF_KEY *schedule, unsigned char *ivec, int *num);
                       long length, BF_KEY *schedule,
                       unsigned char *ivec, int *num);
 const char *BF_options(void);

 void BF_encrypt(BF_LONG *data, const BF_KEY *key);
+2 −1
Original line number Diff line number Diff line
@@ -12,7 +12,8 @@ BIO_get_info_callback, BIO_set_info_callback, bio_info_cb

 #include <openssl/bio.h>

 typedef void (*bio_info_cb)(BIO *b, int oper, const char *ptr, int arg1, long arg2, long arg3);
 typedef void (*bio_info_cb)(BIO *b, int oper, const char *ptr,
                             int arg1, long arg2, long arg3);

 long BIO_ctrl(BIO *bp, int cmd, long larg, void *parg);
 long BIO_callback_ctrl(BIO *b, int cmd, bio_info_cb cb);
+4 −0
Original line number Diff line number Diff line
@@ -79,6 +79,7 @@ checking has been omitted for clarity.

 BIO *bio, *mdtmp;
 char message[] = "Hello World";

 bio = BIO_new(BIO_s_null());
 mdtmp = BIO_new(BIO_f_md());
 BIO_set_md(mdtmp, EVP_sha1());
@@ -98,6 +99,7 @@ The next example digests data by reading through a chain instead:
 BIO *bio, *mdtmp;
 char buf[1024];
 int rdlen;

 bio = BIO_new_file(file, "rb");
 mdtmp = BIO_new(BIO_f_md());
 BIO_set_md(mdtmp, EVP_sha1());
@@ -117,9 +119,11 @@ outputs them. This could be used with the examples above.
 unsigned char mdbuf[EVP_MAX_MD_SIZE];
 int mdlen;
 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;
Loading