Convert all zero-argument functions to '(void)'

Otherwise, in C, it becomes a K&R function declaration which doesn't actually
type-check the number of arguments.

Change-Id: I0731a9fefca46fb1c266bfb1c33d464cf451a22e
Reviewed-on: https://boringssl-review.googlesource.com/1582
Reviewed-by: Adam Langley <agl@google.com>
diff --git a/crypto/asn1/a_strnid.c b/crypto/asn1/a_strnid.c
index ded339a..e61de70 100644
--- a/crypto/asn1/a_strnid.c
+++ b/crypto/asn1/a_strnid.c
@@ -251,7 +251,8 @@
 
 #ifdef STRING_TABLE_TEST
 
-main()
+int
+main(void)
 {
 	ASN1_STRING_TABLE *tmp;
 	int i, last_nid = -1;
@@ -278,6 +279,7 @@
 			printf("Index %d, NID %d, Name=%s\n", i, tmp->nid,
 							OBJ_nid2ln(tmp->nid));
 
+	return 0;
 }
 
 #endif
diff --git a/crypto/base64/base64_test.c b/crypto/base64/base64_test.c
index 0cd2b6e..e8a8bd0 100644
--- a/crypto/base64/base64_test.c
+++ b/crypto/base64/base64_test.c
@@ -37,7 +37,7 @@
 
 static const size_t kNumTests = sizeof(test_vectors) / sizeof(test_vectors[0]);
 
-static int test_encode() {
+static int test_encode(void) {
   uint8_t out[9];
   size_t i;
   ssize_t len;
@@ -55,7 +55,7 @@
   return 1;
 }
 
-static int test_decode() {
+static int test_decode(void) {
   uint8_t out[6];
   size_t i;
   ssize_t len;
@@ -90,7 +90,7 @@
   return 1;
 }
 
-int main() {
+int main(void) {
   ERR_load_crypto_strings();
 
   if (!test_encode()) {
diff --git a/crypto/bio/bio_test.c b/crypto/bio/bio_test.c
index f3075b8..75399df 100644
--- a/crypto/bio/bio_test.c
+++ b/crypto/bio/bio_test.c
@@ -25,7 +25,7 @@
 #include <openssl/err.h>
 
 
-static int test_socket_connect() {
+static int test_socket_connect(void) {
   int listening_sock = socket(AF_INET, SOCK_STREAM, 0);
   int sock;
   struct sockaddr_in sin;
@@ -94,7 +94,7 @@
   return 1;
 }
 
-static int test_printf() {
+static int test_printf(void) {
   /* Test a short output, a very long one, and various sizes around
    * 256 (the size of the buffer) to ensure edge cases are correct. */
   static const size_t kLengths[] = { 5, 250, 251, 252, 253, 254, 1023 };
@@ -144,7 +144,7 @@
   return 1;
 }
 
-int main() {
+int main(void) {
   ERR_load_crypto_strings();
 
   if (!test_socket_connect()) {
diff --git a/crypto/bio/internal.h b/crypto/bio/internal.h
index dd3d800..ba28839 100644
--- a/crypto/bio/internal.h
+++ b/crypto/bio/internal.h
@@ -92,7 +92,7 @@
 /* BIO_clear_socket_error clears the last system socket error.
  *
  * TODO(fork): remove all callers of this. */
-void bio_clear_socket_error();
+void bio_clear_socket_error(void);
 
 /* BIO_sock_error returns the last socket error on |sock|. */
 int bio_sock_error(int sock);
diff --git a/crypto/bio/socket_helper.c b/crypto/bio/socket_helper.c
index 0d7d21a..ba65a1a 100644
--- a/crypto/bio/socket_helper.c
+++ b/crypto/bio/socket_helper.c
@@ -97,7 +97,7 @@
 #endif
 }
 
-void bio_clear_socket_error() {}
+void bio_clear_socket_error(void) {}
 
 int bio_sock_error(int sock) {
   int error;
diff --git a/crypto/bn/bn_test.c b/crypto/bn/bn_test.c
index 440e1b6..d50b6b5 100644
--- a/crypto/bn/bn_test.c
+++ b/crypto/bn/bn_test.c
@@ -99,7 +99,7 @@
 int test_mod_exp_mont_consttime(BIO *bp, BN_CTX *ctx);
 int test_exp(BIO *bp, BN_CTX *ctx);
 int test_mod_sqrt(BIO *bp, BN_CTX *ctx);
-static int test_exp_mod_zero();
+static int test_exp_mod_zero(void);
 int test_small_prime(BIO *bp,BN_CTX *ctx);
 int test_mod_exp_mont5(BIO *bp, BN_CTX *ctx);
 int test_sqrt(BIO *bp, BN_CTX *ctx);
@@ -1129,7 +1129,7 @@
 }
 
 /* test_exp_mod_zero tests that x**0 mod 1 == 0. */
-static int test_exp_mod_zero() {
+static int test_exp_mod_zero(void) {
   BIGNUM a, p, m;
   BIGNUM r;
   BN_CTX *ctx = BN_CTX_new();
diff --git a/crypto/bn/rsaz_exp.h b/crypto/bn/rsaz_exp.h
index 4241a1f..0bb6b0c 100644
--- a/crypto/bn/rsaz_exp.h
+++ b/crypto/bn/rsaz_exp.h
@@ -36,7 +36,7 @@
 void RSAZ_1024_mod_exp_avx2(BN_ULONG result[16],
 	const BN_ULONG base_norm[16], const BN_ULONG exponent[16],
 	const BN_ULONG m_norm[16], const BN_ULONG RR[16], BN_ULONG k0);
-int rsaz_avx2_eligible();
+int rsaz_avx2_eligible(void);
 
 void RSAZ_512_mod_exp(BN_ULONG result[8],
 	const BN_ULONG base_norm[8], const BN_ULONG exponent[8],
diff --git a/crypto/bytestring/bytestring_test.c b/crypto/bytestring/bytestring_test.c
index 20ce571..29d26e8 100644
--- a/crypto/bytestring/bytestring_test.c
+++ b/crypto/bytestring/bytestring_test.c
@@ -18,7 +18,7 @@
 #include <openssl/bytestring.h>
 
 
-static int test_skip() {
+static int test_skip(void) {
   static const uint8_t kData[] = {1, 2, 3};
   CBS data;
 
@@ -31,7 +31,7 @@
       !CBS_skip(&data, 1);
 }
 
-static int test_get_u() {
+static int test_get_u(void) {
   static const uint8_t kData[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
   uint8_t u8;
   uint16_t u16;
@@ -50,7 +50,7 @@
     !CBS_get_u8(&data, &u8);
 }
 
-static int test_get_prefixed() {
+static int test_get_prefixed(void) {
   static const uint8_t kData[] = {1, 2, 0, 2, 3, 4, 0, 0, 3, 3, 2, 1};
   uint8_t u8;
   uint16_t u16;
@@ -72,7 +72,7 @@
     u32 == 0x30201;
 }
 
-static int test_get_prefixed_bad() {
+static int test_get_prefixed_bad(void) {
   static const uint8_t kData1[] = {2, 1};
   static const uint8_t kData2[] = {0, 2, 1};
   static const uint8_t kData3[] = {0, 0, 2, 1};
@@ -96,7 +96,7 @@
   return 1;
 }
 
-static int test_get_asn1() {
+static int test_get_asn1(void) {
   static const uint8_t kData1[] = {0x30, 2, 1, 2};
   static const uint8_t kData2[] = {0x30, 3, 1, 2};
   static const uint8_t kData3[] = {0x30, 0x80};
@@ -145,7 +145,7 @@
   return 1;
 }
 
-static int test_get_indef() {
+static int test_get_indef(void) {
   static const uint8_t kData1[] = {0x30, 0x80, 0x00, 0x00};
   static const uint8_t kDataWithoutEOC[] = {0x30, 0x80, 0x01, 0x00};
   static const uint8_t kDataWithBadInternalLength[] = {0x30, 0x80, 0x01, 0x01};
@@ -200,7 +200,7 @@
   return 1;
 }
 
-static int test_cbb_basic() {
+static int test_cbb_basic(void) {
   static const uint8_t kExpected[] = {1, 2, 3, 4, 5, 6, 7, 8};
   uint8_t *buf;
   size_t buf_len;
@@ -226,7 +226,7 @@
   return ok;
 }
 
-static int test_cbb_fixed() {
+static int test_cbb_fixed(void) {
   CBB cbb;
   uint8_t buf[1];
   uint8_t *out_buf;
@@ -253,7 +253,7 @@
   return 1;
 }
 
-static int test_cbb_finish_child() {
+static int test_cbb_finish_child(void) {
   CBB cbb, child;
   uint8_t *out_buf;
   size_t out_size;
@@ -271,7 +271,7 @@
   return 1;
 }
 
-static int test_cbb_prefixed() {
+static int test_cbb_prefixed(void) {
   static const uint8_t kExpected[] = {0, 1, 1, 0, 2, 2, 3, 0, 0, 3,
                                       4, 5, 6, 5, 4, 1, 0, 1, 2};
   uint8_t *buf;
@@ -301,7 +301,7 @@
   return ok;
 }
 
-static int test_cbb_misuse() {
+static int test_cbb_misuse(void) {
   CBB cbb, child, contents;
   uint8_t *buf;
   size_t buf_len;
@@ -337,7 +337,7 @@
   return 1;
 }
 
-static int test_cbb_asn1() {
+static int test_cbb_asn1(void) {
   static const uint8_t kExpected[] = {0x30, 3, 1, 2, 3};
   uint8_t *buf, *test_data;
   size_t buf_len;
@@ -405,7 +405,7 @@
   return 1;
 }
 
-int main() {
+int main(void) {
   if (!test_skip() ||
       !test_get_u() ||
       !test_get_prefixed() ||
diff --git a/crypto/cipher/e_aes.c b/crypto/cipher/e_aes.c
index 15a886c..d22274e 100644
--- a/crypto/cipher/e_aes.c
+++ b/crypto/cipher/e_aes.c
@@ -92,13 +92,13 @@
 #define VPAES
 extern unsigned int OPENSSL_ia32cap_P[];
 
-static char vpaes_capable() {
+static char vpaes_capable(void) {
   return (OPENSSL_ia32cap_P[1] & (1 << (41 - 32))) != 0;
 }
 
 #if defined(OPENSSL_X86_64)
 #define BSAES
-static char bsaes_capable() {
+static char bsaes_capable(void) {
   return vpaes_capable();
 }
 #endif
@@ -107,7 +107,7 @@
 #include "../arm_arch.h"
 #if __ARM_ARCH__ >= 7
 #define BSAES
-static char bsaes_capable() {
+static char bsaes_capable(void) {
   return CRYPTO_is_NEON_capable();
 }
 #endif  /* __ARM_ARCH__ >= 7 */
@@ -121,7 +121,7 @@
 void bsaes_ctr32_encrypt_blocks(const uint8_t *in, uint8_t *out, size_t len,
                                 const AES_KEY *key, const uint8_t ivec[16]);
 #else
-static char bsaes_capable() {
+static char bsaes_capable(void) {
   return 0;
 }
 
@@ -150,7 +150,7 @@
 void vpaes_cbc_encrypt(const uint8_t *in, uint8_t *out, size_t length,
                        const AES_KEY *key, uint8_t *ivec, int enc);
 #else
-static char vpaes_capable() {
+static char vpaes_capable(void) {
   return 0;
 }
 
@@ -658,7 +658,7 @@
 
 /* AES-NI section. */
 
-static char aesni_capable() {
+static char aesni_capable(void) {
   return (OPENSSL_ia32cap_P[1] & (1 << (57 - 32))) != 0;
 }
 
@@ -812,7 +812,7 @@
 
 #else  /* ^^^  OPENSSL_X86_64 || OPENSSL_X86 */
 
-static char aesni_capable() {
+static char aesni_capable(void) {
   return 0;
 }
 
@@ -1004,9 +1004,9 @@
     aead_aes_gcm_seal,        aead_aes_gcm_open,
 };
 
-const EVP_AEAD *EVP_aead_aes_128_gcm() { return &aead_aes_128_gcm; }
+const EVP_AEAD *EVP_aead_aes_128_gcm(void) { return &aead_aes_128_gcm; }
 
-const EVP_AEAD *EVP_aead_aes_256_gcm() { return &aead_aes_256_gcm; }
+const EVP_AEAD *EVP_aead_aes_256_gcm(void) { return &aead_aes_256_gcm; }
 
 
 /* AES Key Wrap is specified in
@@ -1268,9 +1268,9 @@
     aead_aes_key_wrap_seal, aead_aes_key_wrap_open,
 };
 
-const EVP_AEAD *EVP_aead_aes_128_key_wrap() { return &aead_aes_128_key_wrap; }
+const EVP_AEAD *EVP_aead_aes_128_key_wrap(void) { return &aead_aes_128_key_wrap; }
 
-const EVP_AEAD *EVP_aead_aes_256_key_wrap() { return &aead_aes_256_key_wrap; }
+const EVP_AEAD *EVP_aead_aes_256_key_wrap(void) { return &aead_aes_256_key_wrap; }
 
 int EVP_has_aes_hardware(void) {
 #if defined(OPENSSL_X86) || defined(OPENSSL_X86_64)
diff --git a/crypto/cipher/e_chacha20poly1305.c b/crypto/cipher/e_chacha20poly1305.c
index 8b6d378..e656cd7 100644
--- a/crypto/cipher/e_chacha20poly1305.c
+++ b/crypto/cipher/e_chacha20poly1305.c
@@ -217,4 +217,6 @@
     aead_chacha20_poly1305_seal, aead_chacha20_poly1305_open,
 };
 
-const EVP_AEAD *EVP_aead_chacha20_poly1305() { return &aead_chacha20_poly1305; }
+const EVP_AEAD *EVP_aead_chacha20_poly1305(void) {
+  return &aead_chacha20_poly1305;
+}
diff --git a/crypto/cipher/e_rc4.c b/crypto/cipher/e_rc4.c
index df1bc11..f1d4c50 100644
--- a/crypto/cipher/e_rc4.c
+++ b/crypto/cipher/e_rc4.c
@@ -366,4 +366,4 @@
     aead_rc4_md5_tls_seal,  aead_rc4_md5_tls_open,
 };
 
-const EVP_AEAD *EVP_aead_rc4_md5_tls() { return &aead_rc4_md5_tls; }
+const EVP_AEAD *EVP_aead_rc4_md5_tls(void) { return &aead_rc4_md5_tls; }
diff --git a/crypto/conf/conf.c b/crypto/conf/conf.c
index 1630c93..520416a 100644
--- a/crypto/conf/conf.c
+++ b/crypto/conf/conf.c
@@ -90,7 +90,7 @@
   }
 }
 
-CONF *NCONF_new() {
+CONF *NCONF_new(void) {
   CONF *conf;
 
   conf = OPENSSL_malloc(sizeof(CONF));
diff --git a/crypto/cpu-arm.c b/crypto/cpu-arm.c
index 814df26..dac7e1e 100644
--- a/crypto/cpu-arm.c
+++ b/crypto/cpu-arm.c
@@ -69,7 +69,7 @@
 uint32_t OPENSSL_armcap_P = ARMV7_NEON_FUNCTIONAL;
 #endif
 
-char CRYPTO_is_NEON_capable() {
+char CRYPTO_is_NEON_capable(void) {
   return (OPENSSL_armcap_P & ARMV7_NEON) != 0;
 }
 
@@ -81,7 +81,7 @@
   }
 }
 
-char CRYPTO_is_NEON_functional() {
+char CRYPTO_is_NEON_functional(void) {
   static const uint32_t kWantFlags = ARMV7_NEON | ARMV7_NEON_FUNCTIONAL;
   return (OPENSSL_armcap_P & kWantFlags) == kWantFlags;
 }
diff --git a/crypto/ec/example_mul.c b/crypto/ec/example_mul.c
index 1e83d61..d65c3a1 100644
--- a/crypto/ec/example_mul.c
+++ b/crypto/ec/example_mul.c
@@ -72,7 +72,7 @@
 #include <openssl/obj.h>
 
 
-int example_EC_POINT_mul() {
+int example_EC_POINT_mul(void) {
   /* This example ensures that 10×∞ + G = G, in P-256. */
   EC_GROUP *group = NULL;
   EC_POINT *p = NULL, *result = NULL;
@@ -119,7 +119,7 @@
   return ret;
 }
 
-int main() {
+int main(void) {
   if (!example_EC_POINT_mul()) {
     fprintf(stderr, "failed\n");
     return 1;
diff --git a/crypto/ec/internal.h b/crypto/ec/internal.h
index 76c3a80..5c3be55 100644
--- a/crypto/ec/internal.h
+++ b/crypto/ec/internal.h
@@ -186,7 +186,7 @@
   int (*field_set_to_one)(const EC_GROUP *, BIGNUM *r, BN_CTX *);
 } /* EC_METHOD */;
 
-const EC_METHOD* EC_GFp_mont_method();
+const EC_METHOD* EC_GFp_mont_method(void);
 
 struct ec_pre_comp_st;
 void ec_pre_comp_free(struct ec_pre_comp_st *pre_comp);
diff --git a/crypto/engine/engine.c b/crypto/engine/engine.c
index bb0886e..c9b8823 100644
--- a/crypto/engine/engine.c
+++ b/crypto/engine/engine.c
@@ -29,7 +29,7 @@
   ECDSA_METHOD *ecdsa_method;
 };
 
-ENGINE *ENGINE_new() {
+ENGINE *ENGINE_new(void) {
   ENGINE *engine = OPENSSL_malloc(sizeof(ENGINE));
   if (engine == NULL) {
     return NULL;
diff --git a/crypto/err/err.c b/crypto/err/err.c
index fd3a76b..53ee5cb 100644
--- a/crypto/err/err.c
+++ b/crypto/err/err.c
@@ -298,7 +298,7 @@
   OPENSSL_free(state);
 }
 
-int ERR_get_next_error_library() {
+int ERR_get_next_error_library(void) {
   err_fns_check();
   return ERRFN(get_next_library)();
 }
@@ -760,11 +760,11 @@
   }
 }
 
-void ERR_load_crypto_strings() { err_load_strings(); }
+void ERR_load_crypto_strings(void) { err_load_strings(); }
 
-void ERR_free_strings() {
+void ERR_free_strings(void) {
   err_fns_check();
   ERRFN(shutdown)();
 }
 
-void ERR_load_BIO_strings() {}
+void ERR_load_BIO_strings(void) {}
diff --git a/crypto/err/err_test.c b/crypto/err/err_test.c
index 540ea07..14217f7 100644
--- a/crypto/err/err_test.c
+++ b/crypto/err/err_test.c
@@ -18,7 +18,7 @@
 #include <openssl/mem.h>
 
 
-static int test_overflow() {
+static int test_overflow(void) {
   unsigned i;
 
   for (i = 0; i < ERR_NUM_ERRORS*2; i++) {
@@ -40,7 +40,7 @@
   return 1;
 }
 
-static int test_put_error() {
+static int test_put_error(void) {
   uint32_t packed_error;
   int line, flags;
   const char *file;
@@ -72,7 +72,7 @@
   return 1;
 }
 
-static int test_clear_error() {
+static int test_clear_error(void) {
   if (ERR_get_error() != 0) {
     fprintf(stderr, "ERR_get_error returned value before an error was added.\n");
     return 0;
@@ -89,7 +89,7 @@
   return 1;
 }
 
-static int test_print() {
+static int test_print(void) {
   size_t i;
   char buf[256];
   uint32_t packed_error;
@@ -105,13 +105,13 @@
   return 1;
 }
 
-static int test_release() {
+static int test_release(void) {
   ERR_put_error(1, 2, 3, "test", 4);
   ERR_remove_thread_state(NULL);
   return 1;
 }
 
-int main() {
+int main(void) {
   if (!test_overflow() ||
       !test_put_error() ||
       !test_clear_error() ||
diff --git a/crypto/evp/evp.c b/crypto/evp/evp.c
index 06fdabf..c7c4ffb 100644
--- a/crypto/evp/evp.c
+++ b/crypto/evp/evp.c
@@ -74,7 +74,7 @@
 extern const EVP_PKEY_ASN1_METHOD hmac_asn1_meth;
 extern const EVP_PKEY_ASN1_METHOD rsa_asn1_meth;
 
-EVP_PKEY *EVP_PKEY_new() {
+EVP_PKEY *EVP_PKEY_new(void) {
   EVP_PKEY *ret;
 
   ret = OPENSSL_malloc(sizeof(EVP_PKEY));
@@ -427,6 +427,6 @@
                            0, (void *)out_md);
 }
 
-void OpenSSL_add_all_algorithms() {}
+void OpenSSL_add_all_algorithms(void) {}
 
-void EVP_cleanup() {}
+void EVP_cleanup(void) {}
diff --git a/crypto/evp/example_sign.c b/crypto/evp/example_sign.c
index df7156b..847330d 100644
--- a/crypto/evp/example_sign.c
+++ b/crypto/evp/example_sign.c
@@ -95,7 +95,7 @@
 };
 
 
-int example_EVP_DigestSignInit() {
+int example_EVP_DigestSignInit(void) {
   int ret = 0;
   EVP_PKEY *pkey = NULL;
   RSA *rsa = NULL;
@@ -154,7 +154,7 @@
   return ret;
 }
 
-int example_EVP_DigestVerifyInit() {
+int example_EVP_DigestVerifyInit(void) {
   int ret = 0;
   EVP_PKEY *pkey = NULL;
   RSA *rsa = NULL;
@@ -193,7 +193,7 @@
   return ret;
 }
 
-int main() {
+int main(void) {
   if (!example_EVP_DigestSignInit()) {
     fprintf(stderr, "EVP_DigestSignInit failed\n");
     return 1;
diff --git a/crypto/ex_data.c b/crypto/ex_data.c
index 00b8ff3..820f48d 100644
--- a/crypto/ex_data.c
+++ b/crypto/ex_data.c
@@ -123,7 +123,7 @@
 extern const CRYPTO_EX_DATA_IMPL ex_data_default_impl;
 
 /* get_impl returns the current ex_data implementatation. */
-static const CRYPTO_EX_DATA_IMPL *get_impl() {
+static const CRYPTO_EX_DATA_IMPL *get_impl(void) {
   const CRYPTO_EX_DATA_IMPL *impl;
 
   CRYPTO_r_lock(CRYPTO_LOCK_EX_DATA);
diff --git a/crypto/ex_data_impl.c b/crypto/ex_data_impl.c
index 23d1fac..ddc6b8a 100644
--- a/crypto/ex_data_impl.c
+++ b/crypto/ex_data_impl.c
@@ -171,7 +171,7 @@
   sk_CRYPTO_EX_DATA_FUNCS_pop_free(item->meth, data_funcs_free);
 }
 
-static LHASH_OF(EX_CLASS_ITEM) *get_classes() {
+static LHASH_OF(EX_CLASS_ITEM) *get_classes(void) {
   LHASH_OF(EX_CLASS_ITEM) *ret;
 
   CRYPTO_r_lock(CRYPTO_LOCK_EX_DATA);
diff --git a/crypto/lhash/lhash_test.c b/crypto/lhash/lhash_test.c
index 2aa90c3..9a94a88 100644
--- a/crypto/lhash/lhash_test.c
+++ b/crypto/lhash/lhash_test.c
@@ -99,7 +99,7 @@
   return NULL;
 }
 
-static char *rand_string() {
+static char *rand_string(void) {
   unsigned len = 1 + (rand() % 3);
   char *ret = malloc(len + 1);
   unsigned i;
diff --git a/crypto/modes/gcm_test.c b/crypto/modes/gcm_test.c
index 8c52b85..a112431 100644
--- a/crypto/modes/gcm_test.c
+++ b/crypto/modes/gcm_test.c
@@ -413,7 +413,7 @@
   return ret;
 }
 
-int main() {
+int main(void) {
   int ret = 0;
   unsigned i;
 
diff --git a/crypto/obj/obj.c b/crypto/obj/obj.c
index 6bbac92..8a7a584 100644
--- a/crypto/obj/obj.c
+++ b/crypto/obj/obj.c
@@ -76,7 +76,7 @@
 
 static unsigned global_next_nid = NUM_NID;
 
-static int obj_next_nid() {
+static int obj_next_nid(void) {
   int ret;
 
   CRYPTO_w_lock(CRYPTO_LOCK_OBJ);
diff --git a/crypto/rand/urandom.c b/crypto/rand/urandom.c
index 6cd9271..2ad4af0 100644
--- a/crypto/rand/urandom.c
+++ b/crypto/rand/urandom.c
@@ -87,7 +87,7 @@
 
 /* urandom_get_fd_locked returns a file descriptor to /dev/urandom. The caller
  * of this function must hold CRYPTO_LOCK_RAND. */
-static int urandom_get_fd_locked() {
+static int urandom_get_fd_locked(void) {
   if (urandom_fd != -2)
     return urandom_fd;
 
diff --git a/crypto/rsa/rsa_test.c b/crypto/rsa/rsa_test.c
index 4a0069c..897bb61 100644
--- a/crypto/rsa/rsa_test.c
+++ b/crypto/rsa/rsa_test.c
@@ -237,7 +237,7 @@
   SetKey;
 }
 
-static int test_bad_key() {
+static int test_bad_key(void) {
   RSA *key = RSA_new();
   BIGNUM e;
 
@@ -267,7 +267,7 @@
   return 1;
 }
 
-static int test_only_d_given() {
+static int test_only_d_given(void) {
   RSA *key = RSA_new();
   uint8_t buf[64];
   unsigned buf_len = sizeof(buf);
@@ -312,7 +312,7 @@
   return ret;
 }
 
-static int test_recover_crt_params() {
+static int test_recover_crt_params(void) {
   RSA *key1, *key2;
   BIGNUM *e = BN_new();
   uint8_t buf[128];
diff --git a/crypto/sha/sha1_test.c b/crypto/sha/sha1_test.c
index 72ef9e1..a0df062 100644
--- a/crypto/sha/sha1_test.c
+++ b/crypto/sha/sha1_test.c
@@ -67,7 +67,7 @@
     "a9993e364706816aba3e25717850c26c9cd0d89d",
     "84983e441c3bd26ebaae4aa1f95129e5e54670f1", };
 
-static int test_incremental() {
+static int test_incremental(void) {
   EVP_MD_CTX ctx;
   char buf[1000];
   uint8_t md[SHA_DIGEST_LENGTH];
diff --git a/crypto/x509/pkcs7_test.c b/crypto/x509/pkcs7_test.c
index eb2668f..014ec87 100644
--- a/crypto/x509/pkcs7_test.c
+++ b/crypto/x509/pkcs7_test.c
@@ -267,7 +267,7 @@
     0x00, 0x00, 0x00,
 };
 
-static int test_reparse() {
+static int test_reparse(void) {
   CBS pkcs7;
   CBB cbb;
   STACK_OF(X509) *certs = sk_X509_new_null();
@@ -331,7 +331,7 @@
   return 1;
 }
 
-int main() {
+int main(void) {
   if (!test_reparse()) {
     return 1;
   }
diff --git a/crypto/x509v3/tabtest.c b/crypto/x509v3/tabtest.c
index aa27c1e..06a692e 100644
--- a/crypto/x509v3/tabtest.c
+++ b/crypto/x509v3/tabtest.c
@@ -66,7 +66,7 @@
 
 #include "ext_dat.h"
 
-int main()
+int main(void)
 {
 	int i, prev = -1, bad = 0;
 	const X509V3_EXT_METHOD **tmp;
diff --git a/crypto/x509v3/v3nametest.c b/crypto/x509v3/v3nametest.c
index d0d97ff..326b1f9 100644
--- a/crypto/x509v3/v3nametest.c
+++ b/crypto/x509v3/v3nametest.c
@@ -285,7 +285,7 @@
 	{NULL, NULL, 0}
 	};
 
-static X509 *make_cert()
+static X509 *make_cert(void)
 	{
 	X509 *ret = NULL;
 	X509 *crt = NULL;
diff --git a/include/openssl/aead.h b/include/openssl/aead.h
index 6f66e9c..ad2bbf7 100644
--- a/include/openssl/aead.h
+++ b/include/openssl/aead.h
@@ -99,7 +99,7 @@
 OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_256_gcm(void);
 
 /* EVP_aead_chacha20_poly1305 is an AEAD built from ChaCha20 and Poly1305. */
-OPENSSL_EXPORT const EVP_AEAD *EVP_aead_chacha20_poly1305();
+OPENSSL_EXPORT const EVP_AEAD *EVP_aead_chacha20_poly1305(void);
 
 /* EVP_aead_aes_128_key_wrap is AES-128 Key Wrap mode. This should never be
  * used except to interoperate with existing systems that use this mode.
@@ -107,13 +107,13 @@
  * If the nonce is emtpy then the default nonce will be used, otherwise it must
  * be eight bytes long. The input must be a multiple of eight bytes long. No
  * additional data can be given to this mode. */
-OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_128_key_wrap();
+OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_128_key_wrap(void);
 
 /* EVP_aead_aes_256_key_wrap is AES-256 in Key Wrap mode. This should never be
  * used except to interoperate with existing systems that use this mode.
  *
  * See |EVP_aead_aes_128_key_wrap| for details. */
-OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_256_key_wrap();
+OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_256_key_wrap(void);
 
 /* EVP_has_aes_hardware returns one if we enable hardware support for fast and
  * constant-time AES-GCM. */
@@ -129,7 +129,7 @@
 /* EVP_aead_rc4_md5_tls uses RC4 and HMAC(MD5) in MAC-then-encrypt mode. Unlike
  * a standard AEAD, this is stateful as the RC4 state is carried from operation
  * to operation. */
-OPENSSL_EXPORT const EVP_AEAD *EVP_aead_rc4_md5_tls();
+OPENSSL_EXPORT const EVP_AEAD *EVP_aead_rc4_md5_tls(void);
 
 
 /* Utility functions. */
diff --git a/include/openssl/conf.h b/include/openssl/conf.h
index 51c5525..c67e023 100644
--- a/include/openssl/conf.h
+++ b/include/openssl/conf.h
@@ -91,7 +91,7 @@
 
 
 /* NCONF_new returns a fresh, empty |CONF|, or NULL on error. */
-CONF *NCONF_new();
+CONF *NCONF_new(void);
 
 /* NCONF_free frees all the data owned by |conf| and then |conf| itself. */
 void NCONF_free(CONF *conf);
diff --git a/include/openssl/cpu.h b/include/openssl/cpu.h
index 3cc1e5e..5f60754 100644
--- a/include/openssl/cpu.h
+++ b/include/openssl/cpu.h
@@ -90,7 +90,7 @@
 /* CRYPTO_is_NEON_capable returns true if the current CPU has a NEON unit. Note
  * that |OPENSSL_armcap_P| also exists and contains the same information in a
  * form that's easier for assembly to use. */
-OPENSSL_EXPORT char CRYPTO_is_NEON_capable();
+OPENSSL_EXPORT char CRYPTO_is_NEON_capable(void);
 
 /* CRYPTO_set_NEON_capable sets the return value of |CRYPTO_is_NEON_capable|.
  * By default, unless the code was compiled with |-mfpu=neon|, NEON is assumed
@@ -101,7 +101,7 @@
 /* CRYPTO_is_NEON_functional returns true if the current CPU has a /working/
  * NEON unit. Some phones have a NEON unit, but the Poly1305 NEON code causes
  * it to fail. See https://code.google.com/p/chromium/issues/detail?id=341598 */
-OPENSSL_EXPORT char CRYPTO_is_NEON_functional();
+OPENSSL_EXPORT char CRYPTO_is_NEON_functional(void);
 
 /* CRYPTO_set_NEON_functional sets the "NEON functional" flag. For
  * |CRYPTO_is_NEON_functional| to return true, both this flag and the NEON flag
diff --git a/include/openssl/engine.h b/include/openssl/engine.h
index f2916b3..367e98e 100644
--- a/include/openssl/engine.h
+++ b/include/openssl/engine.h
@@ -37,7 +37,7 @@
 
 /* ENGINE_new returns an empty ENGINE that uses the default method for all
  * algorithms. */
-OPENSSL_EXPORT ENGINE *ENGINE_new();
+OPENSSL_EXPORT ENGINE *ENGINE_new(void);
 
 /* ENGINE_free decrements the reference counts for all methods linked from
  * |engine| and frees |engine| itself. */
diff --git a/include/openssl/err.h b/include/openssl/err.h
index d8e7cd5..67a2601 100644
--- a/include/openssl/err.h
+++ b/include/openssl/err.h
@@ -146,11 +146,11 @@
  * values. If this is not called then the string forms of errors produced by
  * the functions below will contain numeric identifiers rather than
  * human-readable strings. */
-OPENSSL_EXPORT void ERR_load_crypto_strings();
+OPENSSL_EXPORT void ERR_load_crypto_strings(void);
 
 /* ERR_free_strings frees any internal error values that have been loaded. This
  * should only be called at process shutdown. */
-OPENSSL_EXPORT void ERR_free_strings();
+OPENSSL_EXPORT void ERR_free_strings(void);
 
 
 /* Reading and formatting errors. */
@@ -266,7 +266,7 @@
 /* ERR_get_next_error_library returns a value suitable for passing as the
  * |library| argument to |ERR_put_error|. This is intended for code that wishes
  * to push its own, non-standard errors to the error queue. */
-OPENSSL_EXPORT int ERR_get_next_error_library();
+OPENSSL_EXPORT int ERR_get_next_error_library(void);
 
 
 /* Private functions. */
@@ -515,7 +515,7 @@
 /* ERR_load_BIO_strings does nothing.
  *
  * TODO(fork): remove. libjingle calls this. */
-OPENSSL_EXPORT void ERR_load_BIO_strings();
+OPENSSL_EXPORT void ERR_load_BIO_strings(void);
 
 
 #if defined(__cplusplus)
diff --git a/include/openssl/evp.h b/include/openssl/evp.h
index edeb850..091912f 100644
--- a/include/openssl/evp.h
+++ b/include/openssl/evp.h
@@ -83,7 +83,7 @@
 
 /* EVP_PKEY_new creates a new, empty public-key object and returns it or NULL
  * on allocation failure. */
-OPENSSL_EXPORT EVP_PKEY *EVP_PKEY_new();
+OPENSSL_EXPORT EVP_PKEY *EVP_PKEY_new(void);
 
 /* EVP_PKEY_free frees all data referenced by |pkey| and then frees |pkey|
  * itself. */
@@ -708,10 +708,10 @@
 /* Private functions */
 
 /* OpenSSL_add_all_algorithms does nothing. */
-OPENSSL_EXPORT void OpenSSL_add_all_algorithms();
+OPENSSL_EXPORT void OpenSSL_add_all_algorithms(void);
 
 /* EVP_cleanup does nothing. */
-OPENSSL_EXPORT void EVP_cleanup();
+OPENSSL_EXPORT void EVP_cleanup(void);
 
 /* EVP_PKEY_asn1_find returns the ASN.1 method table for the given |nid|, which
  * should be one of the |EVP_PKEY_*| values. It returns NULL if |nid| is
diff --git a/include/openssl/pqueue.h b/include/openssl/pqueue.h
index 8ad023a..af6f7f1 100644
--- a/include/openssl/pqueue.h
+++ b/include/openssl/pqueue.h
@@ -84,7 +84,7 @@
 
 /* pqueue_new allocates a fresh, empty priority queue object and returns it, or
  * NULL on error. */
-pqueue pqueue_new();
+pqueue pqueue_new(void);
 
 /* pqueue_free frees |pq| but not any of the items it points to. Thus |pq| must
  * be empty or a memory leak will occur. */
diff --git a/include/openssl/rand.h b/include/openssl/rand.h
index d17c3ea..5a84a89 100644
--- a/include/openssl/rand.h
+++ b/include/openssl/rand.h
@@ -28,7 +28,7 @@
 
 /* RAND_cleanup frees any resources used by the RNG. This is not safe if other
  * threads might still be calling |RAND_bytes|. */
-OPENSSL_EXPORT void RAND_cleanup();
+OPENSSL_EXPORT void RAND_cleanup(void);
 
 
 /* Deprecated functions */
diff --git a/ssl/pqueue/pqueue.c b/ssl/pqueue/pqueue.c
index e8d0ac5..4c68cb1 100644
--- a/ssl/pqueue/pqueue.c
+++ b/ssl/pqueue/pqueue.c
@@ -87,7 +87,7 @@
   OPENSSL_free(item);
 }
 
-pqueue pqueue_new() {
+pqueue pqueue_new(void) {
   pqueue_s *pq = (pqueue_s *)OPENSSL_malloc(sizeof(pqueue_s));
   if (pq == NULL) {
     return NULL;
diff --git a/ssl/ssl_sess.c b/ssl/ssl_sess.c
index a9f7f9e..8881042 100644
--- a/ssl/ssl_sess.c
+++ b/ssl/ssl_sess.c
@@ -152,7 +152,7 @@
 static void SSL_SESSION_list_add(SSL_CTX *ctx,SSL_SESSION *s);
 static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck);
 
-SSL_SESSION *SSL_magic_pending_session_ptr()
+SSL_SESSION *SSL_magic_pending_session_ptr(void)
 	{
 	return (SSL_SESSION*) &g_pending_session_magic;
 	}
diff --git a/ssl/ssl_test.c b/ssl/ssl_test.c
index 4652e85..97a1967 100644
--- a/ssl/ssl_test.c
+++ b/ssl/ssl_test.c
@@ -16,7 +16,7 @@
 
 #include "openssl/ssl.h"
 
-int main() {
+int main(void) {
   /* Some error codes are special, but the make_errors.go script doesn't know
    * this. This test will catch the case where something regenerates the error
    * codes with the script but doesn't fix up the special ones. */