Run the comment converter on libcrypto.

crypto/{asn1,x509,x509v3,pem} were skipped as they are still OpenSSL
style.

Change-Id: I3cd9a60e1cb483a981aca325041f3fbce294247c
Reviewed-on: https://boringssl-review.googlesource.com/19504
Reviewed-by: Adam Langley <agl@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>
diff --git a/crypto/err/err.c b/crypto/err/err.c
index cbb1260..2c567ce 100644
--- a/crypto/err/err.c
+++ b/crypto/err/err.c
@@ -129,7 +129,7 @@
 extern const size_t kOpenSSLReasonValuesLen;
 extern const char kOpenSSLReasonStringData[];
 
-/* err_clear_data frees the optional |data| member of the given error. */
+// err_clear_data frees the optional |data| member of the given error.
 static void err_clear_data(struct err_error_st *error) {
   if ((error->flags & ERR_FLAG_MALLOCED) != 0) {
     OPENSSL_free(error->data);
@@ -138,17 +138,17 @@
   error->flags &= ~ERR_FLAG_MALLOCED;
 }
 
-/* err_clear clears the given queued error. */
+// err_clear clears the given queued error.
 static void err_clear(struct err_error_st *error) {
   err_clear_data(error);
   OPENSSL_memset(error, 0, sizeof(struct err_error_st));
 }
 
-/* global_next_library contains the next custom library value to return. */
+// global_next_library contains the next custom library value to return.
 static int global_next_library = ERR_NUM_LIBS;
 
-/* global_next_library_mutex protects |global_next_library| from concurrent
- * updates. */
+// global_next_library_mutex protects |global_next_library| from concurrent
+// updates.
 static struct CRYPTO_STATIC_MUTEX global_next_library_mutex =
     CRYPTO_STATIC_MUTEX_INIT;
 
@@ -167,7 +167,7 @@
   OPENSSL_free(state);
 }
 
-/* err_get_state gets the ERR_STATE object for the current thread. */
+// err_get_state gets the ERR_STATE object for the current thread.
 static ERR_STATE *err_get_state(void) {
   ERR_STATE *state = CRYPTO_get_thread_local(OPENSSL_THREAD_LOCAL_ERR);
   if (state == NULL) {
@@ -199,7 +199,7 @@
 
   if (top) {
     assert(!inc);
-    /* last error */
+    // last error
     i = state->top;
   } else {
     i = (state->bottom + 1) % ERR_NUM_ERRORS;
@@ -229,11 +229,11 @@
       if (flags != NULL) {
         *flags = error->flags & ERR_FLAG_PUBLIC_MASK;
       }
-      /* If this error is being removed, take ownership of data from
-       * the error. The semantics are such that the caller doesn't
-       * take ownership either. Instead the error system takes
-       * ownership and retains it until the next call that affects the
-       * error queue. */
+      // If this error is being removed, take ownership of data from
+      // the error. The semantics are such that the caller doesn't
+      // take ownership either. Instead the error system takes
+      // ownership and retains it until the next call that affects the
+      // error queue.
       if (inc) {
         if (error->flags & ERR_FLAG_MALLOCED) {
           OPENSSL_free(state->to_free);
@@ -342,13 +342,13 @@
   static char buf[ERR_ERROR_STRING_BUF_LEN];
 
   if (ret == NULL) {
-    /* TODO(fork): remove this. */
+    // TODO(fork): remove this.
     ret = buf;
   }
 
 #if !defined(NDEBUG)
-  /* This is aimed to help catch callers who don't provide
-   * |ERR_ERROR_STRING_BUF_LEN| bytes of space. */
+  // This is aimed to help catch callers who don't provide
+  // |ERR_ERROR_STRING_BUF_LEN| bytes of space.
   OPENSSL_memset(ret, 0, ERR_ERROR_STRING_BUF_LEN);
 #endif
 
@@ -386,15 +386,15 @@
                packed_error, lib_str, reason_str);
 
   if (strlen(buf) == len - 1) {
-    /* output may be truncated; make sure we always have 5 colon-separated
-     * fields, i.e. 4 colons. */
+    // output may be truncated; make sure we always have 5 colon-separated
+    // fields, i.e. 4 colons.
     static const unsigned num_colons = 4;
     unsigned i;
     char *s = buf;
 
     if (len <= num_colons) {
-      /* In this situation it's not possible to ensure that the correct number
-       * of colons are included in the output. */
+      // In this situation it's not possible to ensure that the correct number
+      // of colons are included in the output.
       return;
     }
 
@@ -403,10 +403,10 @@
       char *last_pos = &buf[len - 1] - num_colons + i;
 
       if (colon == NULL || colon > last_pos) {
-        /* set colon |i| at last possible position (buf[len-1] is the
-         * terminating 0). If we're setting this colon, then all whole of the
-         * rest of the string must be colons in order to have the correct
-         * number. */
+        // set colon |i| at last possible position (buf[len-1] is the
+        // terminating 0). If we're setting this colon, then all whole of the
+        // rest of the string must be colons in order to have the correct
+        // number.
         OPENSSL_memset(last_pos, ':', num_colons - i);
         break;
       }
@@ -431,25 +431,25 @@
   }
 }
 
-/* err_string_lookup looks up the string associated with |lib| and |key| in
- * |values| and |string_data|. It returns the string or NULL if not found. */
+// err_string_lookup looks up the string associated with |lib| and |key| in
+// |values| and |string_data|. It returns the string or NULL if not found.
 static const char *err_string_lookup(uint32_t lib, uint32_t key,
                                      const uint32_t *values,
                                      size_t num_values,
                                      const char *string_data) {
-  /* |values| points to data in err_data.h, which is generated by
-   * err_data_generate.go. It's an array of uint32_t values. Each value has the
-   * following structure:
-   *   | lib  |    key    |    offset     |
-   *   |6 bits|  11 bits  |    15 bits    |
-   *
-   * The |lib| value is a library identifier: one of the |ERR_LIB_*| values.
-   * The |key| is a reason code, depending on the context.
-   * The |offset| is the number of bytes from the start of |string_data| where
-   * the (NUL terminated) string for this value can be found.
-   *
-   * Values are sorted based on treating the |lib| and |key| part as an
-   * unsigned integer. */
+  // |values| points to data in err_data.h, which is generated by
+  // err_data_generate.go. It's an array of uint32_t values. Each value has the
+  // following structure:
+  //   | lib  |    key    |    offset     |
+  //   |6 bits|  11 bits  |    15 bits    |
+  //
+  // The |lib| value is a library identifier: one of the |ERR_LIB_*| values.
+  // The |key| is a reason code, depending on the context.
+  // The |offset| is the number of bytes from the start of |string_data| where
+  // the (NUL terminated) string for this value can be found.
+  //
+  // Values are sorted based on treating the |lib| and |key| part as an
+  // unsigned integer.
   if (lib >= (1 << 6) || key >= (1 << 11)) {
     return NULL;
   }
@@ -465,38 +465,38 @@
 
 static const char *const kLibraryNames[ERR_NUM_LIBS] = {
     "invalid library (0)",
-    "unknown library",                            /* ERR_LIB_NONE */
-    "system library",                             /* ERR_LIB_SYS */
-    "bignum routines",                            /* ERR_LIB_BN */
-    "RSA routines",                               /* ERR_LIB_RSA */
-    "Diffie-Hellman routines",                    /* ERR_LIB_DH */
-    "public key routines",                        /* ERR_LIB_EVP */
-    "memory buffer routines",                     /* ERR_LIB_BUF */
-    "object identifier routines",                 /* ERR_LIB_OBJ */
-    "PEM routines",                               /* ERR_LIB_PEM */
-    "DSA routines",                               /* ERR_LIB_DSA */
-    "X.509 certificate routines",                 /* ERR_LIB_X509 */
-    "ASN.1 encoding routines",                    /* ERR_LIB_ASN1 */
-    "configuration file routines",                /* ERR_LIB_CONF */
-    "common libcrypto routines",                  /* ERR_LIB_CRYPTO */
-    "elliptic curve routines",                    /* ERR_LIB_EC */
-    "SSL routines",                               /* ERR_LIB_SSL */
-    "BIO routines",                               /* ERR_LIB_BIO */
-    "PKCS7 routines",                             /* ERR_LIB_PKCS7 */
-    "PKCS8 routines",                             /* ERR_LIB_PKCS8 */
-    "X509 V3 routines",                           /* ERR_LIB_X509V3 */
-    "random number generator",                    /* ERR_LIB_RAND */
-    "ENGINE routines",                            /* ERR_LIB_ENGINE */
-    "OCSP routines",                              /* ERR_LIB_OCSP */
-    "UI routines",                                /* ERR_LIB_UI */
-    "COMP routines",                              /* ERR_LIB_COMP */
-    "ECDSA routines",                             /* ERR_LIB_ECDSA */
-    "ECDH routines",                              /* ERR_LIB_ECDH */
-    "HMAC routines",                              /* ERR_LIB_HMAC */
-    "Digest functions",                           /* ERR_LIB_DIGEST */
-    "Cipher functions",                           /* ERR_LIB_CIPHER */
-    "HKDF functions",                             /* ERR_LIB_HKDF */
-    "User defined functions",                     /* ERR_LIB_USER */
+    "unknown library",                            // ERR_LIB_NONE
+    "system library",                             // ERR_LIB_SYS
+    "bignum routines",                            // ERR_LIB_BN
+    "RSA routines",                               // ERR_LIB_RSA
+    "Diffie-Hellman routines",                    // ERR_LIB_DH
+    "public key routines",                        // ERR_LIB_EVP
+    "memory buffer routines",                     // ERR_LIB_BUF
+    "object identifier routines",                 // ERR_LIB_OBJ
+    "PEM routines",                               // ERR_LIB_PEM
+    "DSA routines",                               // ERR_LIB_DSA
+    "X.509 certificate routines",                 // ERR_LIB_X509
+    "ASN.1 encoding routines",                    // ERR_LIB_ASN1
+    "configuration file routines",                // ERR_LIB_CONF
+    "common libcrypto routines",                  // ERR_LIB_CRYPTO
+    "elliptic curve routines",                    // ERR_LIB_EC
+    "SSL routines",                               // ERR_LIB_SSL
+    "BIO routines",                               // ERR_LIB_BIO
+    "PKCS7 routines",                             // ERR_LIB_PKCS7
+    "PKCS8 routines",                             // ERR_LIB_PKCS8
+    "X509 V3 routines",                           // ERR_LIB_X509V3
+    "random number generator",                    // ERR_LIB_RAND
+    "ENGINE routines",                            // ERR_LIB_ENGINE
+    "OCSP routines",                              // ERR_LIB_OCSP
+    "UI routines",                                // ERR_LIB_UI
+    "COMP routines",                              // ERR_LIB_COMP
+    "ECDSA routines",                             // ERR_LIB_ECDSA
+    "ECDH routines",                              // ERR_LIB_ECDH
+    "HMAC routines",                              // ERR_LIB_HMAC
+    "Digest functions",                           // ERR_LIB_DIGEST
+    "Cipher functions",                           // ERR_LIB_CIPHER
+    "HKDF functions",                             // ERR_LIB_HKDF
+    "User defined functions",                     // ERR_LIB_USER
 };
 
 const char *ERR_lib_error_string(uint32_t packed_error) {
@@ -555,8 +555,8 @@
   int line, flags;
   uint32_t packed_error;
 
-  /* thread_hash is the least-significant bits of the |ERR_STATE| pointer value
-   * for this thread. */
+  // thread_hash is the least-significant bits of the |ERR_STATE| pointer value
+  // for this thread.
   const unsigned long thread_hash = (uintptr_t) err_get_state();
 
   for (;;) {
@@ -585,8 +585,8 @@
   ERR_print_errors_cb(print_errors_to_file, file);
 }
 
-/* err_set_error_data sets the data on the most recent error. The |flags|
- * argument is a combination of the |ERR_FLAG_*| values. */
+// err_set_error_data sets the data on the most recent error. The |flags|
+// argument is a combination of the |ERR_FLAG_*| values.
 static void err_set_error_data(char *data, int flags) {
   ERR_STATE *const state = err_get_state();
   struct err_error_st *error;
@@ -634,9 +634,9 @@
   error->packed = ERR_PACK(library, reason);
 }
 
-/* ERR_add_error_data_vdata takes a variable number of const char* pointers,
- * concatenates them and sets the result as the data on the most recent
- * error. */
+// ERR_add_error_data_vdata takes a variable number of const char* pointers,
+// concatenates them and sets the result as the data on the most recent
+// error.
 static void err_add_error_vdata(unsigned num, va_list args) {
   size_t alloced, new_len, len = 0, substr_len;
   char *buf;
@@ -661,7 +661,7 @@
       char *new_buf;
 
       if (alloced + 20 + 1 < alloced) {
-        /* overflow. */
+        // overflow.
         OPENSSL_free(buf);
         return;
       }
@@ -695,9 +695,9 @@
   char *buf;
   static const unsigned buf_len = 256;
 
-  /* A fixed-size buffer is used because va_copy (which would be needed in
-   * order to call vsnprintf twice and measure the buffer) wasn't defined until
-   * C99. */
+  // A fixed-size buffer is used because va_copy (which would be needed in
+  // order to call vsnprintf twice and measure the buffer) wasn't defined until
+  // C99.
   buf = OPENSSL_malloc(buf_len + 1);
   if (buf == NULL) {
     return;