From 8df455479f8801bbebad8839fc96abbffa711603 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 14 May 2020 00:05:04 +0200 Subject: source cleanup: remove all custom typedef structs - Stick to a single unified way to use structs - Make checksrc complain on 'typedef struct {' - Allow them in tests, public headers and examples - Let MD4_CTX, MD5_CTX, and SHA256_CTX typedefs remain as they actually typedef different types/structs depending on build conditions. Closes #5338 --- lib/vtls/gskit.c | 8 ++++---- lib/vtls/nss.c | 6 +++--- lib/vtls/openssl.c | 8 ++++---- lib/vtls/schannel.c | 4 ++-- lib/vtls/schannel_verify.c | 6 +++--- lib/vtls/vtls.c | 2 +- lib/vtls/wolfssl.c | 4 ++-- 7 files changed, 19 insertions(+), 19 deletions(-) (limited to 'lib/vtls') diff --git a/lib/vtls/gskit.c b/lib/vtls/gskit.c index b0864b5fa..4f29a2137 100644 --- a/lib/vtls/gskit.c +++ b/lib/vtls/gskit.c @@ -108,13 +108,13 @@ struct ssl_backend_data { #define BACKEND connssl->backend /* Supported ciphers. */ -typedef struct { +struct gskit_cipher { const char *name; /* Cipher name. */ const char *gsktoken; /* Corresponding token for GSKit String. */ unsigned int versions; /* SSL version flags. */ -} gskit_cipher; +}; -static const gskit_cipher ciphertable[] = { +static const struct gskit_cipher ciphertable[] = { { "null-md5", "01", CURL_GSKPROTO_SSLV3_MASK | CURL_GSKPROTO_TLSV10_MASK | CURL_GSKPROTO_TLSV11_MASK | CURL_GSKPROTO_TLSV12_MASK }, @@ -307,7 +307,7 @@ static CURLcode set_ciphers(struct connectdata *conn, struct Curl_easy *data = conn->data; const char *cipherlist = SSL_CONN_CONFIG(cipher_list); const char *clp; - const gskit_cipher *ctp; + const struct gskit_cipher *ctp; int i; int l; bool unsupported; diff --git a/lib/vtls/nss.c b/lib/vtls/nss.c index 16ec409e9..fca292613 100644 --- a/lib/vtls/nss.c +++ b/lib/vtls/nss.c @@ -101,10 +101,10 @@ struct ptr_list_wrap { struct curl_llist_element node; }; -typedef struct { +struct cipher_s { const char *name; int num; -} cipher_s; +}; #define PK11_SETATTRS(_attr, _idx, _type, _val, _len) do { \ CK_ATTRIBUTE *ptr = (_attr) + ((_idx)++); \ @@ -116,7 +116,7 @@ typedef struct { #define CERT_NewTempCertificate __CERT_NewTempCertificate #define NUM_OF_CIPHERS sizeof(cipherlist)/sizeof(cipherlist[0]) -static const cipher_s cipherlist[] = { +static const struct cipher_s cipherlist[] = { /* SSL2 cipher suites */ {"rc4", SSL_EN_RC4_128_WITH_MD5}, {"rc4-md5", SSL_EN_RC4_128_WITH_MD5}, diff --git a/lib/vtls/openssl.c b/lib/vtls/openssl.c index a147e9980..5876d196f 100644 --- a/lib/vtls/openssl.c +++ b/lib/vtls/openssl.c @@ -215,11 +215,11 @@ #define ENABLE_SSLKEYLOGFILE #ifdef ENABLE_SSLKEYLOGFILE -typedef struct ssl_tap_state { +struct ssl_tap_state { int master_key_length; unsigned char master_key[SSL_MAX_MASTER_KEY_LENGTH]; unsigned char client_random[SSL3_RANDOM_SIZE]; -} ssl_tap_state_t; +}; #endif /* ENABLE_SSLKEYLOGFILE */ struct ssl_backend_data { @@ -229,7 +229,7 @@ struct ssl_backend_data { X509* server_cert; #ifdef ENABLE_SSLKEYLOGFILE /* tap_state holds the last seen master key if we're logging them */ - ssl_tap_state_t tap_state; + struct ssl_tap_state tap_state; #endif }; @@ -280,7 +280,7 @@ static void ossl_keylog_callback(const SSL *ssl, const char *line) * tap_ssl_key is called by libcurl to make the CLIENT_RANDOMs if the OpenSSL * being used doesn't have native support for doing that. */ -static void tap_ssl_key(const SSL *ssl, ssl_tap_state_t *state) +static void tap_ssl_key(const SSL *ssl, struct ssl_tap_state *state) { const char *hex = "0123456789ABCDEF"; int pos, i; diff --git a/lib/vtls/schannel.c b/lib/vtls/schannel.c index c20a14222..1305205dc 100644 --- a/lib/vtls/schannel.c +++ b/lib/vtls/schannel.c @@ -2243,8 +2243,8 @@ static CURLcode pkp_pin_peer_pubkey(struct connectdata *conn, int sockindex, SECURITY_STATUS sspi_status; const char *x509_der; DWORD x509_der_len; - curl_X509certificate x509_parsed; - curl_asn1Element *pubkey; + struct Curl_X509certificate x509_parsed; + struct Curl_asn1Element *pubkey; sspi_status = s_pSecFn->QueryContextAttributes(&BACKEND->ctxt->ctxt_handle, diff --git a/lib/vtls/schannel_verify.c b/lib/vtls/schannel_verify.c index 9b7b319ce..ead24c177 100644 --- a/lib/vtls/schannel_verify.c +++ b/lib/vtls/schannel_verify.c @@ -57,7 +57,7 @@ #define BEGIN_CERT "-----BEGIN CERTIFICATE-----" #define END_CERT "\n-----END CERTIFICATE-----" -typedef struct { +struct cert_chain_engine_config_win7 { DWORD cbSize; HCERTSTORE hRestrictedRoot; HCERTSTORE hRestrictedTrust; @@ -70,7 +70,7 @@ typedef struct { DWORD CycleDetectionModulus; HCERTSTORE hExclusiveRoot; HCERTSTORE hExclusiveTrustedPeople; -} CERT_CHAIN_ENGINE_CONFIG_WIN7, *PCERT_CHAIN_ENGINE_CONFIG_WIN7; +}; static int is_cr_or_lf(char c) { @@ -585,7 +585,7 @@ CURLcode Curl_verify_certificate(struct connectdata *conn, int sockindex) } if(result == CURLE_OK) { - CERT_CHAIN_ENGINE_CONFIG_WIN7 engine_config; + struct cert_chain_engine_config_win7 engine_config; BOOL create_engine_result; memset(&engine_config, 0, sizeof(engine_config)); diff --git a/lib/vtls/vtls.c b/lib/vtls/vtls.c index 9dc7eaee2..5f18385a5 100644 --- a/lib/vtls/vtls.c +++ b/lib/vtls/vtls.c @@ -1084,7 +1084,7 @@ bool Curl_none_false_start(void) CURLcode Curl_none_md5sum(unsigned char *input, size_t inputlen, unsigned char *md5sum, size_t md5len UNUSED_PARAM) { - MD5_context *MD5pw; + struct MD5_context *MD5pw; (void)md5len; diff --git a/lib/vtls/wolfssl.c b/lib/vtls/wolfssl.c index 4844c9e39..f022f93c1 100644 --- a/lib/vtls/wolfssl.c +++ b/lib/vtls/wolfssl.c @@ -511,8 +511,8 @@ wolfssl_connect_step2(struct connectdata *conn, X509 *x509; const char *x509_der; int x509_der_len; - curl_X509certificate x509_parsed; - curl_asn1Element *pubkey; + struct Curl_X509certificate x509_parsed; + struct Curl_asn1Element *pubkey; CURLcode result; x509 = SSL_get_peer_certificate(backend->handle); -- cgit v1.2.3