Correct various documentation typos

Some of the documentation had the right explanation but the incorrect
function names attached.

Change-Id: I7b479dae6d71a5ac7bc86df5a3890508c3b3d09f
Reviewed-on: https://boringssl-review.googlesource.com/5090
Reviewed-by: Adam Langley <agl@google.com>
diff --git a/include/openssl/bio.h b/include/openssl/bio.h
index 8724657..bb15591 100644
--- a/include/openssl/bio.h
+++ b/include/openssl/bio.h
@@ -207,7 +207,7 @@
  * flags on |bio|. */
 OPENSSL_EXPORT void BIO_set_retry_read(BIO *bio);
 
-/* BIO_set_retry_read sets the |BIO_FLAGS_WRITE| and |BIO_FLAGS_SHOULD_RETRY|
+/* BIO_set_retry_write sets the |BIO_FLAGS_WRITE| and |BIO_FLAGS_SHOULD_RETRY|
  * flags on |bio|. */
 OPENSSL_EXPORT void BIO_set_retry_write(BIO *bio);
 
@@ -656,7 +656,7 @@
  * error stack. */
 OPENSSL_EXPORT int BIO_zero_copy_get_read_buf_done(BIO* bio, size_t bytes_read);
 
-/* BIO_zero_copy_get_write_buf_done initiates a zero copy write operation.
+/* BIO_zero_copy_get_write_buf initiates a zero copy write operation.
  * |out_write_buf| is set to to the internal write buffer, and |out_buf_offset|
  * is set to the current write position of |out_write_buf|.
  * The number of bytes available for write from |out_write_buf| +
@@ -667,7 +667,7 @@
  * stack.
  *
  * The zero copy write operation is completed by calling
- * |BIO_zero_copy_write_buf_done|. Neither |BIO_zero_copy_get_write_buf|
+ * |BIO_zero_copy_get_write_buf_done|. Neither |BIO_zero_copy_get_write_buf|
  * nor any other I/O write operation may be called while a zero copy write
  * operation is active. */
 OPENSSL_EXPORT int BIO_zero_copy_get_write_buf(BIO* bio,
@@ -675,8 +675,8 @@
                                                size_t* out_buf_offset,
                                                size_t* out_available_bytes);
 
-/* BIO_zero_copy_write_buf_done must be called after writing to a BIO using
- * |BIO_zero_copy_get_write_buf_done| to finish the write operation. The
+/* BIO_zero_copy_get_write_buf_done must be called after writing to a BIO using
+ * |BIO_zero_copy_get_write_buf| to finish the write operation. The
  * |bytes_written| argument gives the number of bytes written.
  *
  * It returns one on success. In case of error it returns zero and pushes to the
diff --git a/include/openssl/bytestring.h b/include/openssl/bytestring.h
index 6d1a125..b30ae5c 100644
--- a/include/openssl/bytestring.h
+++ b/include/openssl/bytestring.h
@@ -293,7 +293,7 @@
  * big-endian length. It returns one on success or zero on error. */
 OPENSSL_EXPORT int CBB_add_u24_length_prefixed(CBB *cbb, CBB *out_contents);
 
-/* CBB_add_asn sets |*out_contents| to a |CBB| into which the contents of an
+/* CBB_add_asn1 sets |*out_contents| to a |CBB| into which the contents of an
  * ASN.1 object can be written. The |tag| argument will be used as the tag for
  * the object. Passing in |tag| number 31 will return in an error since only
  * single octet identifiers are supported. It returns one on success or zero
@@ -314,7 +314,7 @@
  * success and zero otherwise. */
 OPENSSL_EXPORT int CBB_add_u8(CBB *cbb, uint8_t value);
 
-/* CBB_add_u8 appends a 16-bit, big-endian number from |value| to |cbb|. It
+/* CBB_add_u16 appends a 16-bit, big-endian number from |value| to |cbb|. It
  * returns one on success and zero otherwise. */
 OPENSSL_EXPORT int CBB_add_u16(CBB *cbb, uint16_t value);
 
diff --git a/include/openssl/ec.h b/include/openssl/ec.h
index 25b4551..6d7a00c 100644
--- a/include/openssl/ec.h
+++ b/include/openssl/ec.h
@@ -220,7 +220,7 @@
                                                        BIGNUM *x, BIGNUM *y,
                                                        BN_CTX *ctx);
 
-/* EC_POINT_set_affine_coordinates sets the value of |p| to be (|x|, |y|). The
+/* EC_POINT_set_affine_coordinates_GFp sets the value of |p| to be (|x|, |y|). The
  * |ctx| argument may be used if not NULL. */
 OPENSSL_EXPORT int EC_POINT_set_affine_coordinates_GFp(const EC_GROUP *group,
                                                        EC_POINT *point,
@@ -265,7 +265,7 @@
 OPENSSL_EXPORT int EC_POINT_dbl(const EC_GROUP *group, EC_POINT *r,
                                 const EC_POINT *a, BN_CTX *ctx);
 
-/* EC_POINT_dbl sets |a| equal to minus |a|. It returns one on success and zero
+/* EC_POINT_invert sets |a| equal to minus |a|. It returns one on success and zero
  * otherwise. If |ctx| is not NULL, it may be used. */
 OPENSSL_EXPORT int EC_POINT_invert(const EC_GROUP *group, EC_POINT *a,
                                    BN_CTX *ctx);
diff --git a/include/openssl/ec_key.h b/include/openssl/ec_key.h
index ee64030..d67c45d 100644
--- a/include/openssl/ec_key.h
+++ b/include/openssl/ec_key.h
@@ -192,7 +192,7 @@
 OPENSSL_EXPORT EC_KEY *d2i_ECPrivateKey(EC_KEY **out_key, const uint8_t **inp,
                                         long len);
 
-/* i2d_ECParameters marshals an EC private key from |key| to an ASN.1, DER
+/* i2d_ECPrivateKey marshals an EC private key from |key| to an ASN.1, DER
  * structure. If |outp| is not NULL then the result is written to |*outp| and
  * |*outp| is advanced just past the output. It returns the number of bytes in
  * the result, whether written or not, or a negative value on error. */
diff --git a/include/openssl/err.h b/include/openssl/err.h
index 30dc4af..44ec7d2 100644
--- a/include/openssl/err.h
+++ b/include/openssl/err.h
@@ -287,7 +287,7 @@
 
 /* Deprecated functions. */
 
-/* |ERR_remove_state| calls |ERR_clear_error|. */
+/* ERR_remove_state calls |ERR_clear_error|. */
 OPENSSL_EXPORT void ERR_remove_state(unsigned long pid);
 
 
diff --git a/include/openssl/evp.h b/include/openssl/evp.h
index 490a951..c32b8a2 100644
--- a/include/openssl/evp.h
+++ b/include/openssl/evp.h
@@ -377,12 +377,12 @@
 OPENSSL_EXPORT int EVP_PKEY_print_public(BIO *out, const EVP_PKEY *pkey,
                                          int indent, ASN1_PCTX *pctx);
 
-/* EVP_PKEY_print_public prints a textual representation of the private key in
+/* EVP_PKEY_print_private prints a textual representation of the private key in
  * |pkey| to |out|. Returns one on success or zero otherwise. */
 OPENSSL_EXPORT int EVP_PKEY_print_private(BIO *out, const EVP_PKEY *pkey,
                                           int indent, ASN1_PCTX *pctx);
 
-/* EVP_PKEY_print_public prints a textual representation of the parameters in
+/* EVP_PKEY_print_params prints a textual representation of the parameters in
  * |pkey| to |out|. Returns one on success or zero otherwise. */
 OPENSSL_EXPORT int EVP_PKEY_print_params(BIO *out, const EVP_PKEY *pkey,
                                          int indent, ASN1_PCTX *pctx);
@@ -419,13 +419,13 @@
  * returns the context or NULL on error. */
 OPENSSL_EXPORT EVP_PKEY_CTX *EVP_PKEY_CTX_new(EVP_PKEY *pkey, ENGINE *e);
 
-/* EVP_PKEY_CTX_new allocates a fresh |EVP_PKEY_CTX| for a key of type |id|
+/* EVP_PKEY_CTX_new_id allocates a fresh |EVP_PKEY_CTX| for a key of type |id|
  * (e.g. |EVP_PKEY_HMAC|). This can be used for key generation where
  * |EVP_PKEY_CTX_new| can't be used because there isn't an |EVP_PKEY| to pass
  * it. It returns the context or NULL on error. */
 OPENSSL_EXPORT EVP_PKEY_CTX *EVP_PKEY_CTX_new_id(int id, ENGINE *e);
 
-/* EVP_KEY_CTX_free frees |ctx| and the data it owns. */
+/* EVP_PKEY_CTX_free frees |ctx| and the data it owns. */
 OPENSSL_EXPORT void EVP_PKEY_CTX_free(EVP_PKEY_CTX *ctx);
 
 /* EVP_PKEY_CTX_dup allocates a fresh |EVP_PKEY_CTX| and sets it equal to the
diff --git a/include/openssl/ex_data.h b/include/openssl/ex_data.h
index 2303eb4..c0d3773 100644
--- a/include/openssl/ex_data.h
+++ b/include/openssl/ex_data.h
@@ -134,7 +134,7 @@
 
 #if 0 /* Sample */
 
-/* |TYPE_get_ex_new_index| allocates a new index for |TYPE|. See the
+/* TYPE_get_ex_new_index allocates a new index for |TYPE|. See the
  * descriptions of the callback typedefs for details of when they are
  * called. Any of the callback arguments may be NULL. The |argl| and |argp|
  * arguments are opaque values that are passed to the callbacks. It returns the
@@ -146,11 +146,11 @@
                                          CRYPTO_EX_dup *dup_func,
                                          CRYPTO_EX_free *free_func);
 
-/* |TYPE_set_ex_data| sets an extra data pointer on |t|. The |index| argument
+/* TYPE_set_ex_data sets an extra data pointer on |t|. The |index| argument
  * should have been returned from a previous call to |TYPE_get_ex_new_index|. */
 OPENSSL_EXPORT int TYPE_set_ex_data(TYPE *t, int index, void *arg);
 
-/* |TYPE_get_ex_data| returns an extra data pointer for |t|, or NULL if no such
+/* TYPE_get_ex_data returns an extra data pointer for |t|, or NULL if no such
  * pointer exists. The |index| argument should have been returned from a
  * previous call to |TYPE_get_ex_new_index|. */
 OPENSSL_EXPORT void *TYPE_get_ex_data(const TYPE *t, int index);
diff --git a/include/openssl/md4.h b/include/openssl/md4.h
index ce4fa99..dbf7430 100644
--- a/include/openssl/md4.h
+++ b/include/openssl/md4.h
@@ -71,7 +71,7 @@
 /* MD4_DIGEST_LENGTH is the length of an MD4 digest. */
 #define MD4_DIGEST_LENGTH 16
 
-/* MD41_Init initialises |md4| and returns one. */
+/* MD4_Init initialises |md4| and returns one. */
 OPENSSL_EXPORT int MD4_Init(MD4_CTX *md4);
 
 /* MD4_Update adds |len| bytes from |data| to |md4| and returns one. */
diff --git a/include/openssl/md5.h b/include/openssl/md5.h
index efedc98..0246649 100644
--- a/include/openssl/md5.h
+++ b/include/openssl/md5.h
@@ -72,7 +72,7 @@
 /* MD5_DIGEST_LENGTH is the length of an MD5 digest. */
 #define MD5_DIGEST_LENGTH 16
 
-/* MD51_Init initialises |md5| and returns one. */
+/* MD5_Init initialises |md5| and returns one. */
 OPENSSL_EXPORT int MD5_Init(MD5_CTX *md5);
 
 /* MD5_Update adds |len| bytes from |data| to |md5| and returns one. */
diff --git a/include/openssl/obj.h b/include/openssl/obj.h
index f476617..ac7d0e1 100644
--- a/include/openssl/obj.h
+++ b/include/openssl/obj.h
@@ -128,7 +128,7 @@
 /* OBJ_nid2sn returns the long name for |nid|, or NULL if |nid| is unknown. */
 OPENSSL_EXPORT const char *OBJ_nid2ln(int nid);
 
-/* OBJ_nid2cbs writes |nid| as an ASN.1 OBJECT IDENTIFIER to |out|. It returns
+/* OBJ_nid2cbb writes |nid| as an ASN.1 OBJECT IDENTIFIER to |out|. It returns
  * one on success or zero otherwise. */
 OPENSSL_EXPORT int OBJ_nid2cbb(CBB *out, int nid);
 
diff --git a/include/openssl/pem.h b/include/openssl/pem.h
index 7756e45e..2f68acd 100644
--- a/include/openssl/pem.h
+++ b/include/openssl/pem.h
@@ -410,7 +410,7 @@
 OPENSSL_EXPORT void    PEM_SignUpdate(EVP_MD_CTX *ctx,unsigned char *d,unsigned int cnt);
 OPENSSL_EXPORT int	PEM_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, unsigned int *siglen, EVP_PKEY *pkey);
 
-/* |PEM_def_callback| treats |userdata| as a string and copies it into |buf|,
+/* PEM_def_callback treats |userdata| as a string and copies it into |buf|,
  * assuming its |size| is sufficient. Returns the length of the string, or 0
  * if there is not enough room. If either |buf| or |userdata| is NULL, 0 is
  * returned. Note that this is different from OpenSSL, which prompts for a
diff --git a/include/openssl/rsa.h b/include/openssl/rsa.h
index ff0a9a9..e27f04e 100644
--- a/include/openssl/rsa.h
+++ b/include/openssl/rsa.h
@@ -246,7 +246,7 @@
 OPENSSL_EXPORT int RSA_private_encrypt(int flen, const uint8_t *from,
                                        uint8_t *to, RSA *rsa, int padding);
 
-/* RSA_private_encrypt verifies |flen| bytes of signature from |from| using the
+/* RSA_public_decrypt verifies |flen| bytes of signature from |from| using the
  * public key in |rsa| and writes the plaintext to |to|. The |to| buffer must
  * have at least |RSA_size| bytes of space. It returns the number of bytes
  * written, or -1 on error. The |padding| argument must be one of the
diff --git a/include/openssl/ssl.h b/include/openssl/ssl.h
index 97485c7..fa1a55d 100644
--- a/include/openssl/ssl.h
+++ b/include/openssl/ssl.h
@@ -2407,13 +2407,13 @@
 /* SSL_set_tmp_rsa returns one. */
 OPENSSL_EXPORT int SSL_set_tmp_rsa(SSL *ssl, const RSA *rsa);
 
-/* SSL_CTX_get_read_head returns zero. */
+/* SSL_CTX_get_read_ahead returns zero. */
 OPENSSL_EXPORT int SSL_CTX_get_read_ahead(const SSL_CTX *ctx);
 
 /* SSL_CTX_set_read_ahead does nothing. */
 OPENSSL_EXPORT void SSL_CTX_set_read_ahead(SSL_CTX *ctx, int yes);
 
-/* SSL_get_read_head returns zero. */
+/* SSL_get_read_ahead returns zero. */
 OPENSSL_EXPORT int SSL_get_read_ahead(const SSL *s);
 
 /* SSL_set_read_ahead does nothing. */