]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
Fixed some compilation warnings
authord-Dudas <david.dudas03@e-uvt.ro>
Mon, 13 Apr 2026 18:24:22 +0000 (21:24 +0300)
committerd-Dudas <david.dudas03@e-uvt.ro>
Mon, 13 Apr 2026 18:24:22 +0000 (21:24 +0300)
Signed-off-by: David Dudas <david.dudas03@e-uvt.ro>
84 files changed:
doc/examples/ex-serv-x509.c
doc/examples/tlsproxy/tlsproxy.c
lib/accelerated/x86/x86-common.c
lib/algorithms/ciphers.c
lib/algorithms/ciphersuites.c
lib/algorithms/ecc.c
lib/algorithms/groups.c
lib/algorithms/kx.c
lib/algorithms/mac.c
lib/algorithms/protocols.c
lib/algorithms/publickey.c
lib/algorithms/sign.c
lib/cert-session.c
lib/db.c
lib/dtls.h
lib/ext/status_request.c
lib/nettle/mpi.c
lib/nettle/rnd.c
lib/pkcs11.c
lib/pkcs11/p11_pk.c
lib/pkcs11_int.h
lib/pkcs11_privkey.c
lib/record.c
lib/session_pack.c
lib/state.c
lib/tls13/certificate.c
lib/tpm2/callbacks/ecdh/ecdh_callbacks.c
lib/tpm2/callbacks/esys_crypto_callbacks.c
lib/tpm2/callbacks/rsa/rsa_callbacks.c
lib/verify-tofu.c
lib/x509/dn.c
lib/x509/ip.c
lib/x509/ocsp.c
lib/x509/pkcs7-crypt.c
lib/x509/pkcs7.c
lib/x509/time.c
lib/x509/verify-high.c
lib/x509/verify.c
lib/x509/x509.c
src/certtool-cfg.c
src/certtool-common.c
src/certtool-common.h
src/certtool.c
src/common.c
src/common.h
src/serv.c
src/tests.c
tests/auto-verify.c
tests/cert.c
tests/cipher-neg-common.c
tests/crl-basic.c
tests/crl_apis.c
tests/crq_key_id.c
tests/crt_apis.c
tests/crt_inv_write.c
tests/crt_type-neg-common.c
tests/dh-compute2.c
tests/dtls-pthread.c
tests/dtls/dtls-stress.c
tests/eagain-common.h
tests/ecdh-compute2.c
tests/fips-mode-pthread.c
tests/gnutls_x509_crt_sign.c
tests/key-import-export.c
tests/keylog-env.c
tests/mini-loss-time.c
tests/pkcs11/eddsa-ecpoint-encodings.c
tests/pkcs11/pkcs11-privkey-pthread.c
tests/pkcs11/tls-neg-pkcs11-key.c
tests/pkcs7-gen.c
tests/pkcs7.c
tests/priority-init2.c
tests/rng-pthread.c
tests/server-kx-neg-common.c
tests/set-default-prio.c
tests/slow/cipher-openssl-compat.c
tests/test-chains.h
tests/tls-channel-binding.c
tests/tls-force-ems.c
tests/tls-neg-ext-key.c
tests/tls-neg-ext4-key.c
tests/tls-pthread.c
tests/tls12-ffdhe.c
tests/virt-time.h

index 977aec004de0576a0470b31042f7ec9953f5ce49..ae1f0968e846b56b17104f47203a365f9136dffd 100644 (file)
@@ -99,6 +99,7 @@ int main(void)
        /* Socket operations
         */
        listen_sd = socket(AF_INET, SOCK_STREAM, 0);
+       CHECK(listen_sd);
 
        memset(&sa_serv, '\0', sizeof(sa_serv));
        sa_serv.sin_family = AF_INET;
@@ -108,9 +109,11 @@ int main(void)
        setsockopt(listen_sd, SOL_SOCKET, SO_REUSEADDR, (void *)&optval,
                   sizeof(int));
 
-       bind(listen_sd, (struct sockaddr *)&sa_serv, sizeof(sa_serv));
+       ret = bind(listen_sd, (struct sockaddr *)&sa_serv, sizeof(sa_serv));
+       CHECK(ret);
 
-       listen(listen_sd, 1024);
+       ret = listen(listen_sd, 1024);
+       CHECK(ret);
 
        printf("Server ready. Listening to port '%d'.\n\n", PORT);
 
index dc5bea2aee935cf14e3e95d8a55ec5c216242223..93a9f507192c7307063f0906813bb6182e61e37f 100644 (file)
@@ -250,6 +250,10 @@ static int runlistener(void)
                                close(fd);
                }
        }
+       if (listenfd >= 0) {
+               close(listenfd);
+       }
+
        return 0;
 }
 
@@ -284,18 +288,18 @@ static void processoptions(int argc, char **argv)
 {
        while (1) {
                static const struct option longopts[] = {
-                       { "connect", required_argument, 0, 'c' },
-                       { "listen", required_argument, 0, 'l' },
-                       { "key", required_argument, 0, 'K' },
-                       { "cert", required_argument, 0, 'C' },
-                       { "cacert", required_argument, 0, 'A' },
-                       { "hostname", required_argument, 0, 'H' },
-                       { "server", no_argument, 0, 's' },
-                       { "insecure", no_argument, 0, 'i' },
-                       { "nofork", no_argument, 0, 'n' },
-                       { "debug", no_argument, 0, 'd' },
-                       { "help", no_argument, 0, 'h' },
-                       { 0, 0, 0, 0 }
+                       { "connect", required_argument, NULL, 'c' },
+                       { "listen", required_argument, NULL, 'l' },
+                       { "key", required_argument, NULL, 'K' },
+                       { "cert", required_argument, NULL, 'C' },
+                       { "cacert", required_argument, NULL, 'A' },
+                       { "hostname", required_argument, NULL, 'H' },
+                       { "server", no_argument, NULL, 's' },
+                       { "insecure", no_argument, NULL, 'i' },
+                       { "nofork", no_argument, NULL, 'n' },
+                       { "debug", no_argument, NULL, 'd' },
+                       { "help", no_argument, NULL, 'h' },
+                       { NULL, 0, NULL, 0 }
                };
 
                int optidx = 0;
index db625ac7136fb556db75ee9f2e323f48bfe73900..93dcba3eea7ee797fbca91c06205b6d9e5c398ba 100644 (file)
@@ -131,7 +131,7 @@ static inline void get_cpuid_level7(unsigned int *eax, unsigned int *ebx,
                                    unsigned int *ecx, unsigned int *edx)
 {
        /* we avoid using __get_cpuid_count, because it is not available with gcc 4.8 */
-       if (__get_cpuid_max(7, 0) < 7)
+       if (__get_cpuid_max(7, NULL) < 7)
                return;
 
        __cpuid_count(7, 0, *eax, *ebx, *ecx, *edx);
index e2064cc7a7f384ba1f608f72d8787da4184471e7..e6db6599a49c952293c2803a8e6e1595981b30c8 100644 (file)
@@ -399,7 +399,7 @@ static const cipher_entry_st algorithms[] = {
          .blocksize = 1,
          .keysize = 0,
          .type = CIPHER_STREAM },
-       { 0, 0, 0, 0, 0, 0, 0 }
+       { NULL, 0, 0, 0, 0, 0, 0 }
 };
 
 #define GNUTLS_CIPHER_LOOP(b)                        \
index e53299821a5c085eb93021ebca65df0b6c4cd432..947b632dc62bac4225807885f0e1ec647fb06d98 100644 (file)
@@ -1162,7 +1162,7 @@ static const gnutls_cipher_suite_entry_st cs_algorithms[] = {
                  GNUTLS_VERSION_UNKNOWN, GNUTLS_MAC_STREEBOG_256),
 #endif
 
-       { 0, { 0, 0 }, 0, 0, 0, 0, 0, 0 }
+       { NULL, { 0, 0 }, NULL, 0, 0, 0, 0, 0 }
 };
 
 #define CIPHER_SUITE_LOOP(b)                                    \
index 80d692eaeae0e54541eaf551b7fe76679bb02565..8c63d73ff8f07e1f4453922b93699d83390557de 100644 (file)
@@ -258,7 +258,7 @@ static SYSTEM_CONFIG_OR_CONST gnutls_ecc_curve_entry_st ecc_curves[] = {
                .supported = 1,
        },
 #endif
-       { 0, 0, 0 }
+       { NULL, NULL, 0 }
 };
 
 #define GNUTLS_ECC_CURVE_LOOP(b)                             \
index 8d4af8e291db643ebd6885523142871799bd5306..d1da08d78e5e861d85322888404a4fc0ef00c13f 100644 (file)
@@ -207,7 +207,7 @@ static const gnutls_group_entry_st supported_groups[] = {
                   GNUTLS_GROUP_INVALID },
          .tls_id = 0x11EC },
 #endif
-       { 0, 0, 0 }
+       { NULL, 0, NULL }
 };
 
 #define GNUTLS_GROUP_LOOP(b)                                       \
index 11584f6755ec65be6cd3c798f9b209dbb6b77b94..5762e37ef73de652c1c834dd6960aa4324a23479 100644 (file)
@@ -131,7 +131,7 @@ static const gnutls_kx_algo_entry _gnutls_kx_algorithms[] = {
         * as priority strings, but they will be a no-op.
         */
        { "RSA-EXPORT", GNUTLS_KX_INVALID, NULL, 0, 0 },
-       { 0, 0, 0, 0, 0 }
+       { NULL, 0, NULL, 0, 0 }
 };
 
 #define GNUTLS_KX_LOOP(b)                                       \
index e6a8835a38517f330b921ae885cb29c3f659c822..2a1e0f44f49b67ff235d978081838e70a73fc065 100644 (file)
@@ -205,7 +205,7 @@ static SYSTEM_CONFIG_OR_CONST mac_entry_st hash_algorithms[] = {
          .block_size = 16 },
        { .name = "PBMAC1", .id = GNUTLS_MAC_PBMAC1, .placeholder = 1 },
        { .name = "MAC-NULL", .id = GNUTLS_MAC_NULL },
-       { 0, 0, 0, 0, 0, 0, 0, 0, 0 }
+       { NULL, NULL, NULL, 0, 0, 0, 0, 0, 0 }
 };
 
 #define GNUTLS_HASH_LOOP(b)                               \
index 1ac30d681387656c632f83af82a585eab135cf74..5a3c67c0792666ec68c462d926a2d81079bd39ac 100644 (file)
@@ -155,7 +155,7 @@ static SYSTEM_CONFIG_OR_CONST version_entry_st sup_versions[] = {
          .only_extension = 0,
          .tls_sig_sem = SIG_SEM_PRE_TLS12,
          .false_start = 1 },
-       { 0, 0, 0, 0, 0 }
+       { NULL, 0, 0, 0, 0 }
 };
 
 const version_entry_st *version_to_entry(gnutls_protocol_t version)
index 330aa360ff827feaef4c30f84e81816fd950dfe8..7faefdece2fe8a11c4da53a0ad3fbff876792e8a 100644 (file)
@@ -229,7 +229,7 @@ static const gnutls_pk_entry pk_algorithms[] = {
          .oid = NULL,
          .id = GNUTLS_PK_UNKNOWN,
          .curve = GNUTLS_ECC_CURVE_INVALID },
-       { 0, 0, 0, 0 }
+       { NULL, NULL, 0, 0 }
 };
 
 #define GNUTLS_PK_LOOP(b)                                       \
index b4d2b5684b303173e8e39e3129c362f2b6e0e64e..a42f9351f5d7e69d3f200c4ff70263c2dc32d96f 100644 (file)
@@ -426,8 +426,8 @@ static SYSTEM_CONFIG_OR_CONST gnutls_sign_entry_st sign_algorithms[] = {
          .hash_output_size = 256,
          .aid = { { 9, 6 }, SIG_SEM_TLS13 },
          .flags = GNUTLS_SIGN_FLAG_TLS13_OK },
-       { .name = 0,
-         .oid = 0,
+       { .name = NULL,
+         .oid = NULL,
          .id = 0,
          .pk = 0,
          .hash = 0,
index 963f797eec4e51164d52ee7a6e537cfa5f5e7239..34a15b19eb7d1dacd1fd2eef71f9ac8e3c3aba95 100644 (file)
@@ -240,7 +240,7 @@ static int check_ocsp_response(gnutls_session_t session, gnutls_x509_crt_t cert,
        time_t rtime, vtime, ntime, now;
        int check_failed = 0;
 
-       now = gnutls_time(0);
+       now = gnutls_time(NULL);
 
        ret = gnutls_ocsp_resp_init(&resp);
        if (ret < 0)
index b22c39a406a10e35688bb960e9881d1f86f76624..aa10f62203d669cdc209adde6afece895ea194ad 100644 (file)
--- a/lib/db.c
+++ b/lib/db.c
@@ -291,7 +291,7 @@ int _gnutls_server_register_current_session(gnutls_session_t session)
 
 int _gnutls_check_resumed_params(gnutls_session_t session)
 {
-       time_t timestamp = gnutls_time(0);
+       time_t timestamp = gnutls_time(NULL);
        const version_entry_st *vers;
 
        /* check whether the session is expired */
index 646dbd3741554c72caf32936b462205ec303a05b..52953f351fc88857ab16c676a8fa68f364e51b45 100644 (file)
@@ -82,7 +82,7 @@ inline static void _dtls_async_timer_init(gnutls_session_t session)
                        "DTLS[%p]: Initializing timer for handshake state.\n",
                        session);
                session->internals.dtls.async_term =
-                       gnutls_time(0) + MAX_DTLS_TIMEOUT / 1000;
+                       gnutls_time(NULL) + MAX_DTLS_TIMEOUT / 1000;
        } else {
                _dtls_reset_hsk_state(session);
                _gnutls_handshake_io_buffer_clear(session);
@@ -101,7 +101,7 @@ inline static void _dtls_async_timer_check(gnutls_session_t session)
                return;
 
        if (session->internals.dtls.async_term != 0) {
-               time_t _now = time(0);
+               time_t _now = time(NULL);
 
                /* check if we need to expire the queued handshake data */
                if (_now > session->internals.dtls.async_term) {
index 6ba57dbccea41091d8c0367cb42330d9d3980fb0..6040ff524dbe3dbe504d69231d2d934685bf4bd5 100644 (file)
@@ -175,7 +175,7 @@ static int server_send(gnutls_session_t session, gnutls_buffer_st *extdata,
        if (session->internals.selected_ocsp_length > 0) {
                if (session->internals.selected_ocsp[0].response.data) {
                        if (session->internals.selected_ocsp[0].exptime != 0 &&
-                           (gnutls_time(0) >=
+                           (gnutls_time(NULL) >=
                             session->internals.selected_ocsp[0].exptime)) {
                                gnutls_assert();
                                return 0;
@@ -389,7 +389,7 @@ int _gnutls_parse_ocsp_response(gnutls_session_t session, const uint8_t *data,
        int ret;
        ssize_t r_size;
 
-       resp->data = 0;
+       resp->data = NULL;
        resp->size = 0;
 
        /* minimum message is type (1) + response (3) + data */
index a4485240298ab20e8671d0cc732407daee7f57e6..cc0d8e73e3c89c9e8769c552cfc99acd8c295886 100644 (file)
@@ -113,7 +113,7 @@ static int wrap_nettle_mpi_init_multi(bigint_t *w, ...)
                                goto fail;
                        }
                }
-       } while (next != 0);
+       } while (next != NULL);
 
        va_end(args);
 
index c539aa7ed4b81db2f4ce3026cb289f400219bb4e..1f40ab50d5d9ad8f9a0d83e935db2c7c27273f35 100644 (file)
@@ -190,7 +190,7 @@ static int wrap_nettle_rnd(void *_ctx, int level, void *data, size_t datasize)
         */
        memset(data, 0, datasize);
 
-       now = gnutls_time(0);
+       now = gnutls_time(NULL);
 
        /* We re-seed based on time in addition to output data. That is,
         * to prevent a temporal state compromise to become permanent for low
index 9f3bb551c42e2d2b8bcf84fe0833412becf6105f..53f7cb813d8ee43d4c2950a2770dafbd7ad83a8e 100644 (file)
@@ -275,7 +275,7 @@ static int pkcs11_provider_init(struct gnutls_pkcs11_provider_st *provider,
 
        _gnutls_debug_log("p11: Initializing module: %s\n", module_name);
 
-       if (params && (p = strstr(params, "p11-kit:")) != 0) {
+       if (params && (p = strstr(params, "p11-kit:")) != NULL) {
                reserved = (char *)(p + sizeof("p11-kit:") - 1);
        }
 
@@ -327,7 +327,7 @@ static int pkcs11_provider_init(struct gnutls_pkcs11_provider_st *provider,
        provider->module_name = gnutls_strdup(module_name);
        provider->init_args = args;
        if (p11_kit_module_get_flags(module) & P11_KIT_MODULE_TRUSTED ||
-           (params != NULL && strstr(params, "trusted") != 0))
+           (params != NULL && strstr(params, "trusted") != NULL))
                provider->trusted = 1;
 
        return 0;
@@ -4171,7 +4171,7 @@ static int find_cert_cb(struct ck_function_list *module,
        else
                tries = 1;
 
-       now = gnutls_time(0);
+       now = gnutls_time(NULL);
        for (i = 0; i < tries; i++) {
                a_vals = 0;
                class = CKO_CERTIFICATE;
index 9d071287e59f531da175b43a3c54154faea6b83b..0ff69d6985f5049381e2ecb76e0f3b2bc3a81ffb 100644 (file)
@@ -671,7 +671,7 @@ static int derive_ecdh_secret(ck_session_handle_t session,
                { CKA_DECRYPT, &tval, sizeof(tval) },
        };
        unsigned long attrs_len = sizeof(attrs) / sizeof(attrs[0]);
-       gnutls_datum_t ec_point = { 0 };
+       gnutls_datum_t ec_point = { NULL, 0 };
        struct ck_ecdh1_derive_params param = { 0 };
        struct ck_mechanism mech = { CKM_ECDH1_DERIVE, &param, sizeof(param) };
 
index 046c3353ccb30d8f7e8480e767e660f6e8633a6f..08f253f88f78a9a3c99ea7365d1d1bc7aaf73649 100644 (file)
@@ -426,7 +426,7 @@ const char *pkcs11_strerror(ck_rv_t rv);
  * a token. */
 inline static bool is_pkcs11_url_object(const char *url)
 {
-       if (strstr(url, "id=") != 0 || strstr(url, "object=") != 0)
+       if (strstr(url, "id=") != NULL || strstr(url, "object=") != NULL)
                return 1;
        return 0;
 }
index 568474e48fd9d84ec30609032476f8cecae2ac78..7f5db8d264b800dfbd7ea93596bcd18be5fb1269 100644 (file)
@@ -1470,7 +1470,7 @@ int _pkcs11_privkey_get_pubkey(gnutls_pkcs11_privkey_t pkey,
                goto cleanup;
        }
 
-       obj->pk_algorithm = gnutls_pkcs11_privkey_get_pk_algorithm(pkey, 0);
+       obj->pk_algorithm = gnutls_pkcs11_privkey_get_pk_algorithm(pkey, NULL);
        obj->type = GNUTLS_PKCS11_OBJ_PUBKEY;
        pk_to_genmech(obj->pk_algorithm, &key_type);
 
index ebc75addec66429f4fe19c55bc61e698678d891e..e0f136780da17edbfc1b7453d1417c842dbd4aae 100644 (file)
@@ -1287,7 +1287,7 @@ begin:
        /* receive headers */
        ret = recv_headers(
                session, record_params, type, htype, &record,
-               (!(session->internals.flags & GNUTLS_NONBLOCK)) ? &ms : 0);
+               (!(session->internals.flags & GNUTLS_NONBLOCK)) ? &ms : NULL);
        if (ret < 0) {
                ret = gnutls_assert_val_fatal(ret);
                goto recv_error;
@@ -1302,7 +1302,7 @@ begin:
         */
        ret = _gnutls_io_read_buffered(
                session, record.packet_size, record.type,
-               (!(session->internals.flags & GNUTLS_NONBLOCK)) ? &ms : 0);
+               (!(session->internals.flags & GNUTLS_NONBLOCK)) ? &ms : NULL);
        if (ret != record.packet_size) {
                gnutls_assert();
                goto recv_error;
index bd1ce3361194961e0efc856caa51150b07ddabed..e54917bd78fee05cd118722c3c1f913efa3cc2e7 100644 (file)
@@ -1156,9 +1156,9 @@ int gnutls_session_set_premaster(gnutls_session_t session, unsigned int entity,
                        .max_record_recv_size = DEFAULT_MAX_RECORD_SIZE;
 
        session->internals.resumed_security_parameters.timestamp =
-               gnutls_time(0);
+               gnutls_time(NULL);
 
-       session->internals.resumed_security_parameters.grp = 0;
+       session->internals.resumed_security_parameters.grp = NULL;
 
        session->internals.resumed_security_parameters.post_handshake_auth = 0;
 
index 1105f13c9f322dd0a235a0eef9843ffa6fdf3aa3..e175445d2e256b63c3caf32ae1983073fecaf813 100644 (file)
@@ -194,7 +194,7 @@ gnutls_certificate_type_get2(gnutls_session_t session,
  **/
 gnutls_kx_algorithm_t gnutls_kx_get(gnutls_session_t session)
 {
-       if (session->security_parameters.cs == 0)
+       if (session->security_parameters.cs == NULL)
                return 0;
 
        if (session->security_parameters.cs->kx_algorithm == 0) { /* TLS 1.3 */
@@ -513,8 +513,8 @@ static void handshake_internal_state_clear1(gnutls_session_t session)
        session->internals.dtls.hsk_read_seq = 0;
        session->internals.dtls.hsk_write_seq = 0;
 
-       session->internals.cand_ec_group = 0;
-       session->internals.cand_dh_group = 0;
+       session->internals.cand_ec_group = NULL;
+       session->internals.cand_dh_group = NULL;
 
        session->internals.hrr_cs[0] = CS_INVALID_MAJOR;
        session->internals.hrr_cs[1] = CS_INVALID_MINOR;
index 44e7f2f39b2aae2de94d6440f3f944bf230bbfc5..cde8474f5e7b66041933a1aa42dccc1e64fbd476 100644 (file)
@@ -185,7 +185,7 @@ static int append_status_request(void *_ctx, gnutls_buffer_st *buf)
                if (ctx->cert_index < session->internals.selected_ocsp_length) {
                        if ((session->internals.selected_ocsp[ctx->cert_index]
                                             .exptime != 0 &&
-                            gnutls_time(0) >=
+                            gnutls_time(NULL) >=
                                     session->internals
                                             .selected_ocsp[ctx->cert_index]
                                             .exptime) ||
@@ -217,7 +217,7 @@ static int append_status_request(void *_ctx, gnutls_buffer_st *buf)
        } else
                return 0;
 
-       if (ret == GNUTLS_E_NO_CERTIFICATE_STATUS || resp.data == 0) {
+       if (ret == GNUTLS_E_NO_CERTIFICATE_STATUS || resp.data == NULL) {
                return 0;
        } else if (ret < 0) {
                return gnutls_assert_val(ret);
index 7ebd23f14912ab83895f7090e6bfefc1b8862473..e7dec1eacc7bc800fdac9af00dc603a88a697dd1 100644 (file)
@@ -26,7 +26,6 @@
 #include "gnutls/gnutls.h"
 #include "ecdh_callbacks.h"
 #include "datum.h"
-#include "mem.h"
 
 #include <string.h>
 #include <tss2/tss2_esys.h>
@@ -66,7 +65,7 @@ static TSS2_RC _gnutls_get_ecdh_point(TPM2B_PUBLIC *tpm_key,
                             tpm_key->publicArea.unique.ecc.x.size };
        gnutls_datum_t y = { tpm_key->publicArea.unique.ecc.y.buffer,
                             tpm_key->publicArea.unique.ecc.y.size };
-       gnutls_datum_t shared = { 0 };
+       gnutls_datum_t shared = { NULL, 0 };
        gnutls_ecc_curve_t curve = _gnutls_convert_tpm2_ecc_curve(
                tpm_key->publicArea.parameters.eccDetail.curveID);
 
@@ -90,7 +89,7 @@ static TSS2_RC _gnutls_get_ecdh_point(TPM2B_PUBLIC *tpm_key,
        if (ret < 0)
                goto fail;
 
-       ret = gnutls_privkey_derive_secret(privkey, peerkey, 0, &shared, 0);
+       ret = gnutls_privkey_derive_secret(privkey, peerkey, NULL, &shared, 0);
        if (ret < 0)
                goto fail;
 
index db9f76418bb163450952e86e37a8c5379bce7783..35395c2fa221b5cb78e68ce83c2a5627b01206fc 100644 (file)
@@ -38,7 +38,7 @@ int _gnutls_setup_tss2_callbacks(ESYS_CONTEXT *ctx)
 {
        TSS2_RC rc;
 
-       struct ESYS_CRYPTO_CALLBACKS callbacks = { 0 };
+       struct ESYS_CRYPTO_CALLBACKS callbacks = { NULL };
 
        _gnutls_set_tss2_rsa_callbacks(&callbacks);
        _gnutls_set_tss2_hash_callbacks(&callbacks);
index 5ff1b8d73627e42380a4de1bdd45c327ca1c35d1..d9a4c14095010778933f78328abdf52d57c0d996 100644 (file)
@@ -84,7 +84,7 @@ static TSS2_RC _gnutls_rsa_pk_encrypt(TPM2B_PUBLIC *pub_tpm_key, size_t in_size,
        }
 
        gnutls_datum_t input = { .data = in_buffer, .size = in_size };
-       gnutls_datum_t output = { 0 };
+       gnutls_datum_t output = { NULL, 0 };
 
        ret = gnutls_pubkey_encrypt_data(pubkey, 0, &input, &output);
        gnutls_pubkey_deinit(pubkey);
index 1b92583a7ba42b36cd41d258354a4bc804e0ae91..610218c9f33c4fd99a90b51ed3bd6b8a6fab9b11 100644 (file)
@@ -310,7 +310,7 @@ static int verify_pubkey(const char *file, const char *host,
        size_t line_size = 0;
        int ret, l2, mismatch = 0;
        size_t host_len = 0, service_len = 0;
-       time_t now = gnutls_time(0);
+       time_t now = gnutls_time(NULL);
        gnutls_datum_t b64key = { NULL, 0 };
 
        ret = raw_pubkey_to_base64(pubkey, &b64key);
index 493caafafe0e99da36d8a80e09b0b64509628ab6..7392d668b858d3f69df9357d9fa2eba96a22e7f8 100644 (file)
@@ -846,7 +846,7 @@ int gnutls_x509_rdn_get_by_oid(const gnutls_datum_t *idn, const char *oid,
        asn1_node dn = NULL;
        gnutls_datum_t td;
 
-       if (buf_size == 0) {
+       if (buf_size == NULL) {
                return GNUTLS_E_INVALID_REQUEST;
        }
 
@@ -897,7 +897,7 @@ int gnutls_x509_rdn_get_oid(const gnutls_datum_t *idn, unsigned indx, void *buf,
        int result;
        asn1_node dn = NULL;
 
-       if (buf_size == 0) {
+       if (buf_size == NULL) {
                return GNUTLS_E_INVALID_REQUEST;
        }
 
index 610d2ff66e6d81ae05db127a4c0aed575063b3ed..60c38e146b768a2d2b145ea5936284e43209dad1 100644 (file)
@@ -252,7 +252,7 @@ int gnutls_x509_cidr_to_rfc5280(const char *cidr, gnutls_datum_t *cidr_rfc5280)
                return GNUTLS_E_MALFORMED_CIDR;
        }
 
-       if (strchr(cidr, ':') != 0) { /* IPv6 */
+       if (strchr(cidr, ':') != NULL) { /* IPv6 */
                iplength = 16;
        } else { /* IPv4 */
                iplength = 4;
index 1ed3c05206b5605fc74344d79f8958e15de6068d..8f3423f0a62cfb4e995bb1241b32ace461970e4a 100644 (file)
@@ -2506,7 +2506,7 @@ time_t _gnutls_ocsp_get_validity(gnutls_ocsp_resp_const_t resp)
                return gnutls_assert_val(-1);
        }
 
-       now = gnutls_time(0);
+       now = gnutls_time(NULL);
 
        if (ntime == -1) {
                /* This is a problematic case, and there is no consensus on how
index 10370b2c25fb062acd994fe5d31d3e26a21833d8..7e19b84ba1f642f0f306628f3bd6b593b55c74a8 100644 (file)
@@ -204,7 +204,7 @@ static const struct pkcs_cipher_schema_st avail_pkcs_cipher_schemas[] = {
          .desc = NULL,
          .iv_name = NULL,
          .decrypt_only = 0 },
-       { 0, 0, 0, 0, 0 }
+       { 0, NULL, 0, 0, 0 }
 };
 
 #define PBES2_SCHEMA_LOOP(b)                                                  \
index 0c566ced64f887ddc2a9eebb80c4f9a3d3b860cd..81ac53cdafc5337d5229bece733ce5e3097713d6 100644 (file)
@@ -2210,7 +2210,7 @@ static int write_attributes(asn1_node c2, const char *root,
                }
 
                snprintf(name, sizeof(name), "%s.?LAST.values.?1", root);
-               ret = _gnutls_x509_set_raw_time(c2, name, gnutls_time(0));
+               ret = _gnutls_x509_set_raw_time(c2, name, gnutls_time(NULL));
                if (ret < 0) {
                        gnutls_assert();
                        return ret;
index afd538243ea057d697efdc2414d5abf0fafe3810..d85eb09df054956b387066918e570f7edbef072a 100644 (file)
@@ -219,13 +219,13 @@ time_t _gnutls_x509_generalTime2gtime(const char *ttime)
                return (time_t)-1;
        }
 
-       if (strchr(ttime, 'Z') == 0) {
+       if (strchr(ttime, 'Z') == NULL) {
                gnutls_assert();
                /* required to be in GMT */
                return (time_t)-1;
        }
 
-       if (strchr(ttime, '.') != 0) {
+       if (strchr(ttime, '.') != NULL) {
                gnutls_assert();
                /* no fractional seconds allowed */
                return (time_t)-1;
index aacc24a7d845a0eb528e41018144d1ecbea0788d..b39411507751a1143600b6b6b9d69c4f1fe39f7f 100644 (file)
@@ -29,7 +29,6 @@
 #include "tls-sig.h"
 #include "str.h"
 #include "datum.h"
-#include <hash-pjw-bare.h>
 #include "x509_int.h"
 #include "common.h"
 #include <gnutls/x509-ext.h>
@@ -37,6 +36,7 @@
 #include "intprops.h"
 #include "gl_linkedhash_list.h"
 #include "gl_list.h"
+#include <hashcode-mem.h>
 
 struct named_cert_st {
        gnutls_x509_crt_t cert;
index 0bf41c78be706c315f2749cdaa243323cba09398..3edfec55d6d1a3b68569dd3c8e7fe69e18b63dfe 100644 (file)
@@ -338,7 +338,7 @@ find_issuer(gnutls_x509_crt_t cert, const gnutls_x509_crt_t *trusted_cas,
                        if (issuer == NULL) {
                                issuer = trusted_cas[i];
                        } else {
-                               time_t now = gnutls_time(0);
+                               time_t now = gnutls_time(NULL);
 
                                if (now < gnutls_x509_crt_get_expiration_time(
                                                  trusted_cas[i]) &&
@@ -963,7 +963,7 @@ unsigned int _gnutls_verify_crt_status(
 {
        int i = 0, ret;
        unsigned int status = 0, output;
-       time_t now = gnutls_time(0);
+       time_t now = gnutls_time(NULL);
        verify_state_st vparams;
 
        if (clist_size > 1) {
@@ -1199,7 +1199,7 @@ unsigned int _gnutls_pkcs11_verify_crt_status(
        unsigned int status = 0, i;
        gnutls_x509_crt_t issuer = NULL;
        gnutls_datum_t raw_issuer = { NULL, 0 };
-       time_t now = gnutls_time(0);
+       time_t now = gnutls_time(NULL);
        time_t distrust_after;
 
        if (clist_size > 1) {
@@ -1675,7 +1675,7 @@ int gnutls_x509_crl_verify(gnutls_x509_crl_t crl,
        gnutls_datum_t crl_signature = { NULL, 0 };
        gnutls_x509_crt_t issuer = NULL;
        int result, sigalg;
-       time_t now = gnutls_time(0);
+       time_t now = gnutls_time(NULL);
        time_t nextu;
        unsigned int usage;
 
index a55389b34486ae875ac84fb428e7d8812d8b21ca..a8e59482d966505db28101ab259d7a2e30682b6e 100644 (file)
@@ -40,7 +40,7 @@
 #include "system-keys.h"
 #include "gl_linkedhash_list.h"
 #include "gl_list.h"
-#include "hash-pjw-bare.h"
+#include <hashcode-mem.h>
 
 static int crt_reinit(gnutls_x509_crt_t crt)
 {
@@ -3012,7 +3012,7 @@ int gnutls_x509_crt_get_fingerprint(gnutls_x509_crt_t cert,
        int result;
        gnutls_datum_t tmp;
 
-       if (buf_size == 0 || cert == NULL) {
+       if (buf_size == NULL || cert == NULL) {
                return GNUTLS_E_INVALID_REQUEST;
        }
 
@@ -4518,7 +4518,7 @@ int gnutls_x509_crt_verify_data3(gnutls_x509_crt_t crt,
        gnutls_pubkey_deinit(pubkey);
 
        if (ret >= 0) {
-               time_t now = gnutls_time(0);
+               time_t now = gnutls_time(NULL);
                int res;
                unsigned usage, i;
 
index a398d7989c5bee1c48dd2b8b205a6b7ca1bee48a..74ab1c79cb95de4cd96bce18f392b977bb5924c8 100644 (file)
@@ -1295,7 +1295,7 @@ static unsigned char *decode_ext_string(char *str, unsigned int *ret_size)
        int ret, res;
 
        p = strchr(str, '(');
-       if (p != 0) {
+       if (p != NULL) {
                if (strncmp(str, "octet_string", 12) == 0) {
                        action = ENCODE_OCTET_STRING;
                } else {
@@ -2862,7 +2862,7 @@ void get_tlsfeatures_set(int type, void *crt)
                }
 
                for (i = 0; cfg.tls_features[i]; ++i) {
-                       feature = strtoul(cfg.tls_features[i], 0, 10);
+                       feature = strtoul(cfg.tls_features[i], NULL, 10);
                        ret = gnutls_x509_tlsfeatures_add(features, feature);
                        if (ret < 0) {
                                fprintf(stderr,
index 151104385159f5b7e85c5b3895bbaf8a36523605..c8f73df6a0ce70432912ea8bf50839d0dc04d0d4 100644 (file)
@@ -733,7 +733,7 @@ int get_bits(gnutls_pk_algorithm_t key_type, int info_bits,
                }
                bits = info_bits;
        } else {
-               if (info_sec_param == 0) {
+               if (info_sec_param == NULL) {
                        /* For ECDSA keys use 256 bits or better, as they are widely supported */
                        info_sec_param = "HIGH";
                }
index 4e5719b73b3cf3080c75d16249c2f27b03f47596..ace0f8d43387070cd02d76237ea89ee03f21353f 100644 (file)
@@ -114,7 +114,7 @@ static inline void switch_to_pkcs8_when_needed(common_info_st *cinfo,
                        cinfo->password = "";
        }
 
-       if (gnutls_x509_privkey_get_seed(key, NULL, NULL, 0) !=
+       if (gnutls_x509_privkey_get_seed(key, NULL, NULL, NULL) !=
            GNUTLS_E_INVALID_REQUEST) {
                if (cinfo->verbose)
                        fprintf(stderr,
index 09ae7359586b8f89df1160335bf39b5d019fa4b1..c84948226a8342e4593cba8ff50fd3d929e3fe43 100644 (file)
@@ -2203,7 +2203,7 @@ static int detailed_verification(gnutls_x509_crt_t cert,
        ret = gnutls_x509_crt_get_dn3(cert, &name, 0);
        if (ret < 0) {
                if (ret == GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE) {
-                       name.data = 0;
+                       name.data = NULL;
                        name.size = 0;
                } else {
                        fprintf(stderr, "gnutls_x509_crt_get_dn: %s\n",
@@ -3843,9 +3843,9 @@ static gnutls_pubkey_t find_pubkey(gnutls_x509_crt_t crt, common_info_st *cinfo)
                                }
 
                                if (memmem(pem.data, pem.size,
-                                          "BEGIN CERTIFICATE", 16) != 0 ||
+                                          "BEGIN CERTIFICATE", 16) != NULL ||
                                    memmem(pem.data, pem.size, "BEGIN X509",
-                                          10) != 0) {
+                                          10) != NULL) {
                                        ret = gnutls_x509_crt_init(&crt);
                                        if (ret < 0) {
                                                fprintf(stderr,
@@ -3895,7 +3895,7 @@ void pubkey_info(gnutls_x509_crt_t crt, common_info_st *cinfo)
        gnutls_pubkey_t pubkey;
 
        pubkey = find_pubkey(crt, cinfo);
-       if (pubkey == 0) {
+       if (pubkey == NULL) {
                fprintf(stderr, "find public key error\n");
                app_exit(1);
        }
@@ -3916,7 +3916,7 @@ static void pubkey_keyid(common_info_st *cinfo)
        unsigned flags;
 
        pubkey = find_pubkey(NULL, cinfo);
-       if (pubkey == 0) {
+       if (pubkey == NULL) {
                fprintf(stderr, "find public key error\n");
                app_exit(1);
        }
index 1e308db730dc8355a098f21cc94a2ec5fb975cef..5441e345e7fa85c96ea5c1ea057c94358143b435 100644 (file)
@@ -575,7 +575,7 @@ int print_info(gnutls_session_t session, int verbose, int flags)
        }
 
                if ((flags & P_WAIT_FOR_CERT) &&
-                   gnutls_certificate_get_ours(session) == 0)
+                   gnutls_certificate_get_ours(session) == NULL)
                        log_msg(stdout, "- No certificate was sent to peer\n");
 
                if (flags & P_PRINT_CERT)
index 6d1db224ee973980e174f300d87d1dbc0edbf32b..05c5745ed1090019d916a5ea3019e7879c06b1ab 100644 (file)
@@ -97,7 +97,7 @@ inline static int is_ip(const char *hostname)
 {
        int len = strlen(hostname);
 
-       if (strchr(hostname, ':') != 0)
+       if (strchr(hostname, ':') != NULL)
                return 1;
        else if (len > 2 && c_isdigit(hostname[0]) &&
                 c_isdigit(hostname[len - 1]))
index b66556656e263c2ac3872bf3729a3c6931af7c96..22348ec946c4f1259edff02825f4cdb005df4469 100644 (file)
@@ -1559,7 +1559,7 @@ static void tcp_server(const char *name, int port, int timeout)
                gl_list_t accepted_list = gl_list_create_empty(
                        GL_LINKED_LIST, NULL, NULL, NULL, true);
                fd_set rd, wr;
-               time_t now = time(0);
+               time_t now = time(NULL);
 #ifndef _WIN32
                int val;
 #endif
@@ -1634,7 +1634,7 @@ static void tcp_server(const char *name, int port, int timeout)
                                        perror("accept()");
                                } else {
                                        char timebuf[SIMPLE_CTIME_BUF_SIZE];
-                                       time_t tt = time(0);
+                                       time_t tt = time(NULL);
                                        char *ctt;
                                        listener_item *jj;
 
@@ -2037,7 +2037,7 @@ static void wrap_db_deinit(void)
 static int wrap_db_store(void *dbf, gnutls_datum_t key, gnutls_datum_t data)
 {
        int i;
-       time_t now = time(0);
+       time_t now = time(NULL);
        void *ptr = NULL;
 
        if (key.size > SESSION_ID_SIZE)
@@ -2093,7 +2093,7 @@ static int wrap_db_store(void *dbf, gnutls_datum_t key, gnutls_datum_t data)
 static gnutls_datum_t wrap_db_fetch(void *dbf, gnutls_datum_t key)
 {
        gnutls_datum_t res = { NULL, 0 };
-       time_t now = time(0);
+       time_t now = time(NULL);
        int i;
 
        for (i = 0; i < cache_db_ptr; i++) {
@@ -2138,7 +2138,7 @@ static int wrap_db_delete(void *dbf, gnutls_datum_t key)
 static int anti_replay_db_add(void *dbf, time_t exp, const gnutls_datum_t *key,
                              const gnutls_datum_t *data)
 {
-       time_t now = time(0);
+       time_t now = time(NULL);
        int i;
 
        for (i = 0; i < cache_db_ptr; i++) {
index 2c06c8d669872414529e07bcae8937a12855c2ba..180176bcd324e763651dae116a358cc3fba748d4 100644 (file)
@@ -1632,7 +1632,7 @@ test_code_t test_chain_order(gnutls_session_t session)
        if (cert_list_size == 1)
                return TEST_SUCCEED;
 
-       p = 0;
+       p = NULL;
        p_size = 0;
        pos = NULL;
        for (i = 0; i < cert_list_size; i++) {
index df4c55cf7d80e5e009d900848baf250cdf7a8301..fc69bf10e2e52fa59bff432525b6cc2fa7007bf1 100644 (file)
@@ -235,7 +235,7 @@ static int cert_out_callback(gnutls_x509_crt_t cert, gnutls_x509_crt_t issuer,
        ret = gnutls_x509_crt_get_dn3(cert, &name, 0);
        if (ret < 0) {
                if (ret == GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE) {
-                       name.data = 0;
+                       name.data = NULL;
                        name.size = 0;
                } else {
                        fprintf(stderr, "gnutls_x509_crt_get_dn: %s\n",
index 0586a954eae046657dc28770d9aa507e983e83ec..cbb2a3bf0336cf6800e2eff9a70f095a2788fa6c 100644 (file)
@@ -67,9 +67,9 @@ static int getnextcert(DIR **dirp, gnutls_datum_t *der, int *exp_ret)
                    && d->d_type == DT_REG
 #endif
                ) {
-                       if (strstr(d->d_name, ".der") == 0)
+                       if (strstr(d->d_name, ".der") == NULL)
                                continue;
-                       if (strstr(d->d_name, ".err") != 0)
+                       if (strstr(d->d_name, ".err") != NULL)
                                continue;
                        snprintf(path, sizeof(path), "%s/%s", cert_dir,
                                 d->d_name);
index cad360274d26f6614ceb0756f5b53d35cede5df9..ec65786ae1fb8399c0e6aed62a6cb3f6ba012f8f 100644 (file)
@@ -69,12 +69,14 @@ static void try(test_case_st *test)
        gnutls_transport_set_push_function(server, server_push);
        gnutls_transport_set_pull_function(server, server_pull);
        gnutls_transport_set_ptr(server, server);
-       assert(gnutls_priority_set_direct(server, test->server_prio, 0) >= 0);
+       assert(gnutls_priority_set_direct(server, test->server_prio, NULL) >=
+              0);
 
        gnutls_transport_set_push_function(client, client_push);
        gnutls_transport_set_pull_function(client, client_pull);
        gnutls_transport_set_ptr(client, client);
-       assert(gnutls_priority_set_direct(client, test->client_prio, 0) >= 0);
+       assert(gnutls_priority_set_direct(client, test->client_prio, NULL) >=
+              0);
 
        HANDSHAKE(client, server);
 
index 802a3450360ccecf4467727ae1403dea8ab40006..95ccb63b2ea3bdc0238f68375eef877242db497d 100644 (file)
@@ -129,7 +129,7 @@ static struct {
                   .crt_revoke_time = 1274996231,
                   .crt_serial = "\x0b\x98\x94\xf9\x7c\x6a",
                   .crt_serial_size = 6 },
-                { NULL, NULL, 0, 0 } };
+                { NULL, NULL, 0, NULL } };
 
 static void tls_log_func(int level, const char *str)
 {
index 37c7d32b84e03a381b14d4203816f4f6829b32d8..6c13237cd5390948949fb8ff68428a6c7da52548 100644 (file)
@@ -89,7 +89,7 @@ static void append_crt(gnutls_x509_crl_t crl, const gnutls_datum_t *pem)
 
        assert(gnutls_x509_crt_init(&crt) >= 0);
        assert(gnutls_x509_crt_import(crt, pem, GNUTLS_X509_FMT_PEM) >= 0);
-       ret = gnutls_x509_crl_set_crt(crl, crt, mytime(0));
+       ret = gnutls_x509_crl_set_crt(crl, crt, mytime(NULL));
        if (ret != 0)
                fail("gnutls_x509_crl_set_crt: %s\n", gnutls_strerror(ret));
 
@@ -181,17 +181,18 @@ static gnutls_x509_crl_t generate_crl(unsigned skip_optional)
        if (ret != 0)
                fail("gnutls_x509_crl_set_version\n");
 
-       ret = gnutls_x509_crl_set_this_update(crl, mytime(0));
+       ret = gnutls_x509_crl_set_this_update(crl, mytime(NULL));
        if (ret != 0)
                fail("gnutls_x509_crl_set_this_update\n");
 
        if (!skip_optional) {
-               ret = gnutls_x509_crl_set_next_update(crl, mytime(0) + 120);
+               ret = gnutls_x509_crl_set_next_update(crl, mytime(NULL) + 120);
                if (ret != 0)
                        fail("gnutls_x509_crl_set_next_update\n");
        }
 
-       ret = gnutls_x509_crl_set_crt_serial(crl, "\x01\x02\x03", 3, mytime(0));
+       ret = gnutls_x509_crl_set_crt_serial(crl, "\x01\x02\x03", 3,
+                                            mytime(NULL));
        if (ret != 0)
                fail("gnutls_x509_crl_set_serial %d\n", ret);
 
index 74b6bfcc1443e0fc83796aa4776e0e98b3d6dd7d..90516bc0521d43120f6aeff67e38626413d31616 100644 (file)
@@ -177,15 +177,11 @@ void doit(void)
                             (int)crq_key_id_len, (int)pkey_key_id_len);
                }
 
-               if (pkey_key_id) {
-                       free(pkey_key_id);
-                       pkey_key_id = NULL;
-               }
+               free(pkey_key_id);
+               pkey_key_id = NULL;
 
-               if (crq_key_id) {
-                       free(crq_key_id);
-                       crq_key_id = NULL;
-               }
+               free(crq_key_id);
+               crq_key_id = NULL;
 
                gnutls_x509_crq_deinit(crq);
                gnutls_x509_privkey_deinit(pkey);
index 51d02cdfedf6adcc7935a05ed5f55c12138a6a54..fd4d165a9f9b62c044ad43f5a7cac0ecd32548e3 100644 (file)
@@ -129,7 +129,7 @@ void doit(void)
        if (ret != 0)
                fail("error\n");
 
-       ret = gnutls_x509_crt_set_activation_time(crt, mytime(0));
+       ret = gnutls_x509_crt_set_activation_time(crt, mytime(NULL));
        if (ret != 0)
                fail("error\n");
 
index ad81440cad0af29bdaedef4d92fb2633a15ca4df..61f2aa8a877372217321eae7ee2170e7fbb4faed 100644 (file)
@@ -94,7 +94,7 @@ static void do_crt_with_exts(unsigned version)
        if (ret != 0)
                fail("error\n");
 
-       ret = gnutls_x509_crt_set_activation_time(crt, mytime(0));
+       ret = gnutls_x509_crt_set_activation_time(crt, mytime(NULL));
        if (ret != 0)
                fail("error\n");
 
@@ -179,7 +179,7 @@ static void do_v1_invalid_crt(void)
        if (ret != 0)
                fail("error\n");
 
-       ret = gnutls_x509_crt_set_activation_time(crt, mytime(0));
+       ret = gnutls_x509_crt_set_activation_time(crt, mytime(NULL));
        if (ret != 0)
                fail("error\n");
 
index 5f3637e69578095222bb70fe58df87b44bf42206..edbd9fed022ebabe6caddfb35c29090859b5e741 100644 (file)
@@ -157,7 +157,8 @@ static void try(test_case_st *test)
        gnutls_transport_set_push_function(server, server_push);
        gnutls_transport_set_pull_function(server, server_pull);
        gnutls_transport_set_ptr(server, server);
-       assert(gnutls_priority_set_direct(server, test->server_prio, 0) >= 0);
+       assert(gnutls_priority_set_direct(server, test->server_prio, NULL) >=
+              0);
 
        if (test->request_cli_crt)
                gnutls_certificate_server_set_request(server,
@@ -167,7 +168,8 @@ static void try(test_case_st *test)
        gnutls_transport_set_push_function(client, client_push);
        gnutls_transport_set_pull_function(client, client_pull);
        gnutls_transport_set_ptr(client, client);
-       assert(gnutls_priority_set_direct(client, test->client_prio, 0) >= 0);
+       assert(gnutls_priority_set_direct(client, test->client_prio, NULL) >=
+              0);
 
        // Try handshake
        if (test->client_err && test->server_err) {
index 4098588ca4056d5e0ee54afc15606e04382104f6..eebb03d52f62bd6ee3e542aa9d83b05f2603c5b4 100644 (file)
@@ -29,7 +29,6 @@
 #include <gnutls/abstract.h>
 #include <stdbool.h>
 #include <string.h>
-#include <stdlib.h>
 #include "utils.h"
 #include "dh-compute.h"
 
@@ -161,7 +160,7 @@ static void compute_key(const char *name, const gnutls_dh_params_t dh_params,
                        int expect_error_on_import, int expect_error_on_derive,
                        const gnutls_datum_t *result)
 {
-       gnutls_datum_t Z = { 0 };
+       gnutls_datum_t Z = { NULL, 0 };
        bool ok;
        int ret;
        gnutls_privkey_t privkey = NULL;
index c901095be2d99d2a9e2ed4d80bc64ebbce7913e3..f04af29bdce27f2acb9f5d2967e190b0ee08c9c6 100644 (file)
@@ -27,7 +27,6 @@
 #include <stdlib.h>
 #include <stdint.h>
 #include <string.h>
-#include <errno.h>
 #include <gnutls/gnutls.h>
 #include <gnutls/dtls.h>
 #include <signal.h>
@@ -118,7 +117,7 @@ static void *recv_thread(void *arg)
                success("closing recv thread\n");
        }
 
-       pthread_exit(0);
+       pthread_exit(NULL);
 }
 
 static void do_thread_stuff(gnutls_session_t session)
@@ -154,7 +153,7 @@ static void do_thread_stuff(gnutls_session_t session)
        if (debug)
                success("closing sending thread\n");
        assert(pthread_join(id, &rval) == 0);
-       assert(rval == 0);
+       assert(rval == NULL);
 
        do {
                ret = gnutls_bye(session, GNUTLS_SHUT_RDWR);
index a70cc75b27b461264b87946322e8ca6e4d6866c8..a731859c065d1170ba6780afcd817bd708835a84 100644 (file)
@@ -138,13 +138,13 @@ enum role {
 
 static int permutations2[2][2] = { { 0, 1 }, { 1, 0 } };
 
-static const char *permutation_names2[] = { "01", "10", 0 };
+static const char *permutation_names2[] = { "01", "10", NULL };
 
 static int permutations3[6][3] = { { 0, 1, 2 }, { 0, 2, 1 }, { 1, 0, 2 },
                                   { 1, 2, 0 }, { 2, 0, 1 }, { 2, 1, 0 } };
 
 static const char *permutation_names3[] = { "012", "021", "102", "120",
-                                           "201", "210", 0 };
+                                           "201", "210", NULL };
 
 static int permutations5[120][5] = {
        { 0, 1, 2, 3, 4 }, { 0, 2, 1, 3, 4 }, { 1, 0, 2, 3, 4 },
@@ -205,7 +205,7 @@ static const char *permutation_names5[] = {
        "40123", "40213", "41023", "41203", "42013", "42103", "40132", "40231",
        "41032", "41230", "42031", "42130", "40312", "40321", "41302", "41320",
        "42301", "42310", "43012", "43021", "43102", "43120", "43201", "43210",
-       0
+       NULL
 };
 
 static const char *filter_names[8] = { "SHello",
@@ -338,45 +338,45 @@ filter_packet_state_t state_packet_ServerFinished = { 0 };
 filter_packet_state_t state_packet_ServerFinishedResume = { 0 };
 
 static filter_permute_state_t state_permute_ServerHello = {
-       0,
-       { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } },
-       0,
+       NULL,
+       { { NULL, 0 }, { NULL, 0 }, { NULL, 0 }, { NULL, 0 }, { NULL, 0 } },
+       NULL,
        0
 };
 static filter_permute_state_t state_permute_ServerHelloFull = {
-       0,
-       { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } },
-       0,
+       NULL,
+       { { NULL, 0 }, { NULL, 0 }, { NULL, 0 }, { NULL, 0 }, { NULL, 0 } },
+       NULL,
        0
 };
 static filter_permute_state_t state_permute_ServerFinished = {
-       0,
-       { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } },
-       0,
+       NULL,
+       { { NULL, 0 }, { NULL, 0 }, { NULL, 0 }, { NULL, 0 }, { NULL, 0 } },
+       NULL,
        0
 };
 static filter_permute_state_t state_permute_ServerFinishedResume = {
-       0,
-       { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } },
-       0,
+       NULL,
+       { { NULL, 0 }, { NULL, 0 }, { NULL, 0 }, { NULL, 0 }, { NULL, 0 } },
+       NULL,
        0
 };
 static filter_permute_state_t state_permute_ClientFinished = {
-       0,
-       { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } },
-       0,
+       NULL,
+       { { NULL, 0 }, { NULL, 0 }, { NULL, 0 }, { NULL, 0 }, { NULL, 0 } },
+       NULL,
        0
 };
 static filter_permute_state_t state_permute_ClientFinishedResume = {
-       0,
-       { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } },
-       0,
+       NULL,
+       { { NULL, 0 }, { NULL, 0 }, { NULL, 0 }, { NULL, 0 }, { NULL, 0 } },
+       NULL,
        0
 };
 static filter_permute_state_t state_permute_ClientFinishedFull = {
-       0,
-       { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } },
-       0,
+       NULL,
+       { { NULL, 0 }, { NULL, 0 }, { NULL, 0 }, { NULL, 0 }, { NULL, 0 } },
+       NULL,
        0
 };
 
@@ -678,14 +678,14 @@ DECLARE_PERMUTE(ClientFinishedResume)
 DECLARE_PERMUTE(ClientFinishedFull)
 // }}}
 // {{{ emergency deadlock resolution time bomb
-timer_t killtimer_tid = 0;
+timer_t killtimer_tid = NULL;
 
 static void killtimer_set(void)
 {
        struct sigevent sig;
        struct itimerspec tout = { { 0, 0 }, { 2 * timeout_seconds, 0 } };
 
-       if (killtimer_tid != 0) {
+       if (killtimer_tid != NULL) {
                timer_delete(killtimer_tid);
        }
 
@@ -697,7 +697,7 @@ static void killtimer_set(void)
                exit(3);
        }
 
-       timer_settime(killtimer_tid, 0, &tout, 0);
+       timer_settime(killtimer_tid, 0, &tout, NULL);
 }
 
 // }}}
@@ -739,7 +739,8 @@ static void session_init(int sock, int server)
        gnutls_init(&session, GNUTLS_DATAGRAM |
                                      (server ? GNUTLS_SERVER : GNUTLS_CLIENT) |
                                      GNUTLS_NONBLOCK * nonblock);
-       gnutls_priority_set_direct(session, "NORMAL:+ECDHE-RSA:+ANON-ECDH", 0);
+       gnutls_priority_set_direct(session, "NORMAL:+ECDHE-RSA:+ANON-ECDH",
+                                  NULL);
        gnutls_transport_set_int(session, sock);
 
        if (full) {
@@ -766,7 +767,7 @@ static void session_init(int sock, int server)
 static void client(int sock)
 {
        int err = 0;
-       time_t started = time(0);
+       time_t started = time(NULL);
        const char *line = "foobar!";
        char buffer[8192];
        int len, ret;
@@ -784,7 +785,7 @@ static void client(int sock)
                                await(sock, t ? t : 100);
                        }
                } while (err != 0);
-               process_error_or_timeout(err, time(0) - started);
+               process_error_or_timeout(err, time(NULL) - started);
 
                ret = gnutls_session_get_data2(session, &data);
                if (ret < 0) {
@@ -813,7 +814,7 @@ static void client(int sock)
                        await(sock, t ? t : 100);
                }
        } while (err != 0);
-       process_error_or_timeout(err, time(0) - started);
+       process_error_or_timeout(err, time(NULL) - started);
 
        if (debug) {
                fprintf(stdout, "%i %s| handshake complete\n", run_id,
@@ -891,7 +892,7 @@ static void server(int sock)
 {
        int err;
        const char *line = "server foobar!";
-       time_t started = time(0);
+       time_t started = time(NULL);
        char buffer[8192];
        int len;
 
@@ -913,7 +914,7 @@ static void server(int sock)
                                await(sock, t ? t : 100);
                        }
                } while (err != 0);
-               process_error_or_timeout(err, time(0) - started);
+               process_error_or_timeout(err, time(NULL) - started);
 
                gnutls_deinit(session);
 
@@ -941,7 +942,7 @@ static void server(int sock)
                        await(sock, t ? t : 100);
                }
        } while (err != 0);
-       process_error_or_timeout(err, time(0) - started);
+       process_error_or_timeout(err, time(NULL) - started);
 
        log("handshake complete\n");
 
@@ -1044,7 +1045,7 @@ static int run_test(void)
        while (waitpid(pid2, &status2, 0) < 0 && errno == EINTR)
                ;
        kill(pid1, 15);
-       while (waitpid(pid1, 0, 0) < 0 && errno == EINTR)
+       while (waitpid(pid1, NULL, 0) < 0 && errno == EINTR)
                ;
 
        close(fds[0]);
index 5d81232e8ba38f2dbc25f5ef0d97a286ac130589..87d93e17ac09aac6676572811c1c8295c8d31161 100644 (file)
@@ -176,7 +176,7 @@ static size_t to_client_len = 0;
 
 #ifdef RANDOMIZE
 #define RETURN_RND_EAGAIN(session)                           \
-       unsigned int rnd = time(0);                          \
+       unsigned int rnd = time(NULL);                       \
        if (rnd++ % 3 == 0) {                                \
                gnutls_transport_set_errno(session, EAGAIN); \
                return -1;                                   \
@@ -341,7 +341,7 @@ inline static int record_send_loop(gnutls_session_t session, const void *data,
        size_t retry_sizeofdata;
 
        if (use_null_on_retry) {
-               retry_data = 0;
+               retry_data = NULL;
                retry_sizeofdata = 0;
        } else {
                retry_data = data;
index d2aee542d5127e7137de2edf459b8590b01d757d..2677b66e4e1d4aeab24a0310ef565396316936e9 100644 (file)
@@ -29,7 +29,6 @@
 #include <gnutls/abstract.h>
 #include <stdbool.h>
 #include <string.h>
-#include <stdlib.h>
 #include "utils.h"
 
 static void genkey(gnutls_ecc_curve_t curve, gnutls_datum_t *x,
@@ -61,7 +60,7 @@ static void compute_key(const char *name, gnutls_ecc_curve_t curve,
                        int expect_error_on_import, int expect_error_on_derive,
                        const gnutls_datum_t *result)
 {
-       gnutls_datum_t Z = { 0 };
+       gnutls_datum_t Z = { NULL, 0 };
        bool ok;
        int ret;
        gnutls_privkey_t privkey = NULL;
@@ -129,9 +128,9 @@ void doit(void)
                {
                        "[x == 0, y == 0]",
                        GNUTLS_ECC_CURVE_SECP256R1,
-                       { 0 },
-                       { 0 },
-                       { 0 },
+                       { NULL, 0 },
+                       { NULL, 0 },
+                       { NULL, 0 },
                        { (void *)"\x00", 1 },
                        { (void *)"\x00", 1 },
                        { NULL, 0 },
@@ -143,9 +142,9 @@ void doit(void)
                {
                        "[x > p - 1]",
                        GNUTLS_ECC_CURVE_SECP256R1,
-                       { 0 },
-                       { 0 },
-                       { 0 },
+                       { NULL, 0 },
+                       { NULL, 0 },
+                       { NULL, 0 },
                        { (void *)"\xff\xff\xff\xff\x00\x00\x00\x01"
                                  "\x00\x00\x00\x00\x00\x00\x00\x00"
                                  "\x00\x00\x00\x00\xff\xff\xff\xff"
@@ -159,9 +158,9 @@ void doit(void)
                {
                        "[y > p - 1]",
                        GNUTLS_ECC_CURVE_SECP256R1,
-                       { 0 },
-                       { 0 },
-                       { 0 },
+                       { NULL, 0 },
+                       { NULL, 0 },
+                       { NULL, 0 },
                        { (void *)"\x02", 1 },
                        { (void *)"\xff\xff\xff\xff\x00\x00\x00\x01"
                                  "\x00\x00\x00\x00\x00\x00\x00\x00"
@@ -238,7 +237,7 @@ void doit(void)
                        0,
                        0,
                },
-               { 0 }
+               { NULL, 0 }
        };
 
        global_init();
index 3b379fe97e0afdb613930f05f8579aa4d155580d..d3e547fe7bd8529914d4a28f1094df914d06820d 100644 (file)
 #include "config.h"
 #endif
 
-#include <stdio.h>
 #include <stdlib.h>
 #include <stdint.h>
-#include <string.h>
-#include <errno.h>
 #include <gnutls/gnutls.h>
 #include <gnutls/crypto.h>
 #include <signal.h>
@@ -101,7 +98,7 @@ static void *test_set_per_thread(void *arg)
        /* put to a random state */
        gnutls_fips140_set_mode(data->set_mode, GNUTLS_FIPS140_SET_MODE_THREAD);
 
-       pthread_exit(0);
+       pthread_exit(NULL);
 }
 
 #define MAX_THREADS 48
index d19b2a966d422ee236f887a944bcdbc5d03c173f..f4a0f0b843f8b65223eba8f9046dd3b0deba528c 100644 (file)
@@ -124,7 +124,7 @@ void doit(void)
        if (ret != 0)
                fail("error\n");
 
-       ret = gnutls_x509_crt_set_activation_time(crt, mytime(0));
+       ret = gnutls_x509_crt_set_activation_time(crt, mytime(NULL));
        if (ret != 0)
                fail("error\n");
 
index 51f92840b410bca0ee36a37d945678a3decadd26..b778a7110ca30d412ee218a6c6f99d584b91ef01 100644 (file)
@@ -693,7 +693,7 @@ static int check_dsa(void)
                fail("error\n");
 
        ret = gnutls_privkey_import_x509_raw(key, &dsa_key, GNUTLS_X509_FMT_PEM,
-                                            0, 0);
+                                            NULL, 0);
        if (ret < 0)
                fail("error\n");
 
@@ -774,7 +774,7 @@ static int check_rsa(void)
                fail("error\n");
 
        ret = gnutls_privkey_import_x509_raw(key, &rsa_key, GNUTLS_X509_FMT_PEM,
-                                            0, 0);
+                                            NULL, 0);
        if (ret < 0)
                fail("error\n");
 
@@ -855,7 +855,7 @@ static int check_ecc(void)
                fail("error\n");
 
        ret = gnutls_privkey_import_x509_raw(key, &server_ecc_key,
-                                            GNUTLS_X509_FMT_PEM, 0, 0);
+                                            GNUTLS_X509_FMT_PEM, NULL, 0);
        if (ret < 0)
                fail("error\n");
 
@@ -968,7 +968,7 @@ static int check_ed25519(void)
                fail("error\n");
 
        ret = gnutls_privkey_import_x509_raw(key, &server_ca3_eddsa_key,
-                                            GNUTLS_X509_FMT_PEM, 0, 0);
+                                            GNUTLS_X509_FMT_PEM, NULL, 0);
        if (ret < 0)
                fail("error\n");
 
@@ -1060,7 +1060,7 @@ static int check_gost(void)
                fail("error\n");
 
        ret = gnutls_privkey_import_x509_raw(key, &server_ca3_gost01_key,
-                                            GNUTLS_X509_FMT_PEM, 0, 0);
+                                            GNUTLS_X509_FMT_PEM, NULL, 0);
        if (ret < 0)
                fail("error\n");
 
index 9016967bde72d1eb535bb57fad72359597d531fa..a81d495abdca56c05959e74f748b712843c657a6 100644 (file)
@@ -75,6 +75,10 @@ static void search_for_str(const char *filename, const char *label,
        FILE *fp = fopen(filename, "r");
        char *p;
 
+       if (fp == NULL) {
+               fail("Failed to open file");
+       }
+
        while ((p = fgets(line, sizeof(line), fp)) != NULL) {
                success("%s", line);
                if (strncmp(line, label, strlen(label)) == 0 &&
index ea0fef83865b1039614057cc36455f8ec63ca8f3..610924565077444be70716ddd9c75d3ec05bbeb4 100644 (file)
@@ -298,10 +298,10 @@ void doit(void)
        signal(SIGPIPE, SIG_IGN);
 
        for (; tries >= 0; tries--) {
-               tstart = time(0);
+               tstart = time(NULL);
                start(2, 0);
 
-               tstop = time(0);
+               tstop = time(NULL);
 
                tstop = tstop - tstart;
 
@@ -317,10 +317,10 @@ void doit(void)
        }
 
        for (; tries >= 0; tries--) {
-               tstart = time(0);
+               tstart = time(NULL);
                start(2, 1);
 
-               tstop = time(0);
+               tstop = time(NULL);
 
                tstop = tstop - tstart;
 
index ddbf4ef754529524f49edc09305f61af85763068..084f52d72987ac19a4db53768390ce9a0b71c2a1 100644 (file)
@@ -64,7 +64,7 @@ static void test_eddsa_encoding(const char *name, const gnutls_datum_t *ecpoint,
        int ret;
        gnutls_pubkey_t pubkey;
        gnutls_pk_algorithm_t pk_alg;
-       gnutls_datum_t exported = { 0 };
+       gnutls_datum_t exported = { NULL, 0 };
 
        success("Testing: EdDSA %s encoding\n", name);
 
index 5b8b9785987661bb125cac333f4e7777584c3d0d..2f2eba62d168448e942046f65f1c2256fecf63a5 100644 (file)
@@ -27,7 +27,6 @@
 #include <stdlib.h>
 #include <stdint.h>
 #include <string.h>
-#include <errno.h>
 #include <gnutls/gnutls.h>
 #include <gnutls/abstract.h>
 #include <gnutls/crypto.h>
@@ -103,7 +102,7 @@ static void *start_thread(void *arg)
 
        gnutls_free(sig.data);
 
-       pthread_exit(0);
+       pthread_exit(NULL);
 }
 
 #define MAX_THREADS 48
index 91669af52d1429c20546465c2fc434b816c95211..8c4eb68e441cddcce5f8eaa76d0b244a360ff2c1 100644 (file)
@@ -484,7 +484,7 @@ void doit(void)
                                            tests[i].needs_decryption);
                if (privkey == NULL && tests[i].exp_key_err < 0)
                        continue;
-               assert(privkey != 0);
+               assert(privkey != NULL);
 
                try_with_key(tests[i].name, tests[i].prio, tests[i].exp_kx, 0,
                             0, tests[i].cert, privkey, tests[i].exp_serv_err);
index 0d99e653769504ad6a139c144beb20a05d667e8e..7d4c77c40ff0f90331905a9d8f217d54bff28675 100644 (file)
@@ -118,8 +118,8 @@ void doit(void)
                exit(1);
        }
 
-       ret = gnutls_privkey_import_x509_raw(pkey, &key, GNUTLS_X509_FMT_PEM, 0,
-                                            0);
+       ret = gnutls_privkey_import_x509_raw(pkey, &key, GNUTLS_X509_FMT_PEM,
+                                            NULL, 0);
        if (ret < 0) {
                fail("error in %d: %s\n", __LINE__, gnutls_strerror(ret));
                exit(1);
index dfd5f48c36fe6597be9d4d43133c343f440dc710..d8918b82f50730b9415363c2dd1684f5585ce252 100644 (file)
@@ -68,9 +68,9 @@ static int getnextfile(DIR **dirp, gnutls_datum_t *der, int *exp_ret)
                    && d->d_type == DT_REG
 #endif
                ) {
-                       if (strstr(d->d_name, ".der") == 0)
+                       if (strstr(d->d_name, ".der") == NULL)
                                continue;
-                       if (strstr(d->d_name, ".err") != 0)
+                       if (strstr(d->d_name, ".err") != NULL)
                                continue;
                        snprintf(path, sizeof(path), "%s/%s", cert_dir,
                                 d->d_name);
index 4ca2086b6f1ce9bd2dd9d4081787475689e1d424..fae07011ca47fabe580f74aad7556f8b7e6565ce 100644 (file)
@@ -99,7 +99,7 @@ static void start(struct test_st *test)
                if (ret < 0) {
                        if (test->exp_err == ret) {
                                if (strchr(_gnutls_default_priority_string,
-                                          '@') != 0) {
+                                          '@') != NULL) {
                                        if (ep != test->add_prio) {
                                                fail("error expected error on start of string[%d]: %s\n",
                                                     test->err_pos,
index 851712e0419a49f4df70d732e099a8af1ea2615a..190bfbcf8b88040374cf2b0d5b9fcf14653b222c 100644 (file)
 #include "config.h"
 #endif
 
-#include <stdio.h>
 #include <stdlib.h>
 #include <stdint.h>
 #include <string.h>
-#include <errno.h>
 #include <gnutls/gnutls.h>
 #include <gnutls/crypto.h>
 #include <signal.h>
@@ -73,7 +71,7 @@ static void *start_thread(void *arg)
        if (debug)
                hexprint(data->buf, sizeof(data->buf));
 
-       pthread_exit(0);
+       pthread_exit(NULL);
 }
 
 #define MAX_THREADS 48
index fac330216702b6e811dbc6d07b010030eba1a715..40a41630dd0c5bf711c7f6f1adffcb26f6c3cb02 100644 (file)
@@ -272,12 +272,14 @@ static void try(test_case_st *test)
        gnutls_transport_set_push_function(server, server_push);
        gnutls_transport_set_pull_function(server, server_pull);
        gnutls_transport_set_ptr(server, server);
-       assert(gnutls_priority_set_direct(server, test->server_prio, 0) >= 0);
+       assert(gnutls_priority_set_direct(server, test->server_prio, NULL) >=
+              0);
 
        gnutls_transport_set_push_function(client, client_push);
        gnutls_transport_set_pull_function(client, client_pull);
        gnutls_transport_set_ptr(client, client);
-       assert(gnutls_priority_set_direct(client, test->client_prio, 0) >= 0);
+       assert(gnutls_priority_set_direct(client, test->client_prio, NULL) >=
+              0);
 
        HANDSHAKE_EXPECT(client, server, test->client_ret, test->server_ret);
 
index 7b8cdc1a749ac0e5ed054f7e28cfa57d9697db88..d752a4febc6ca9820b0c36d074844d47e491c097 100644 (file)
@@ -100,7 +100,7 @@ static void start(struct test_st *test)
                                /* the &ep value is only accurate when the default priorities are not overridden;
                                 * otherwise it should be a pointer to the start of the string */
                                if (strchr(_gnutls_default_priority_string,
-                                          '@') != 0) {
+                                          '@') != NULL) {
                                        if (ep != test->add_prio) {
                                                fail("error expected error on start of string[%d]: %s\n",
                                                     test->err_pos,
index 2dcdb0d85a0ec22890370b02d41496831a83e78d..252cac60f1b304421039c2264c7c23d326169412 100644 (file)
@@ -104,17 +104,18 @@ static int cipher_test(const char *ocipher, gnutls_cipher_algorithm_t gcipher,
 #if OPENSSL_VERSION_NUMBER >= 0x10100000L
                if (gcipher == GNUTLS_CIPHER_AES_128_CCM ||
                    gcipher == GNUTLS_CIPHER_AES_256_CCM) {
-                       assert(EVP_CipherInit_ex(ctx, evp_cipher, 0, 0, 0, 0) >
-                              0);
+                       assert(EVP_CipherInit_ex(ctx, evp_cipher, NULL, NULL,
+                                                NULL, 0) > 0);
 
                        assert(EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_CCM_SET_IVLEN,
-                                                  dnonce.size, 0) == 1);
+                                                  dnonce.size, NULL) == 1);
                        assert(EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_CCM_SET_TAG,
                                                   tag_size,
                                                   enc_data + enc_data_size -
                                                           tag_size) == 1);
 
-                       assert(EVP_CipherInit_ex(ctx, 0, 0, key, nonce, 0) > 0);
+                       assert(EVP_CipherInit_ex(ctx, NULL, NULL, key, nonce,
+                                                0) > 0);
 
                        dec_data_size2 = sizeof(dec_data);
                        /* Add plain size */
index a7fe1cdecc86a1eab0bc9297a0119f8d2c109d5c..4dcb849b1654a310c68b7d28426ad2d1e26b34be 100644 (file)
@@ -4735,7 +4735,7 @@ static struct {
          GNUTLS_PROFILE_TO_VFLAGS(GNUTLS_PROFILE_SUITEB192),
          GNUTLS_CERT_INSECURE_ALGORITHM | GNUTLS_CERT_INVALID, NULL },
        { "name constraints: empty CN, empty SAN, permitted dns range",
-         nc_good0, &nc_good0[2], 0, 0, 0, 1427270515 },
+         nc_good0, &nc_good0[2], 0, 0, NULL, 1427270515 },
        { "name constraints: dns in permitted range", nc_good1, &nc_good1[4], 0,
          0, NULL, 1412850586 },
        { "name constraints: ipv6 in permitted range", nc_good2, &nc_good2[4],
@@ -4776,22 +4776,22 @@ static struct {
        { "kp-ok", kp_ok, &kp_ok[3], 0, 0, GNUTLS_KP_OCSP_SIGNING, 1412850586 },
        { "tls features - intermediate no ext", tls_feat_inter_no_ext,
          &tls_feat_inter_no_ext[3], 0,
-         GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE | GNUTLS_CERT_INVALID, 0,
+         GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE | GNUTLS_CERT_INVALID, NULL,
          1466612070 },
        { "tls features - end no ext", tls_feat_no_ext, &tls_feat_no_ext[3], 0,
-         GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE | GNUTLS_CERT_INVALID, 0,
+         GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE | GNUTLS_CERT_INVALID, NULL,
          1466612070 },
        { "tls features - intermediate is subset", tls_feat_inter_subset_fail,
          &tls_feat_inter_subset_fail[3], 0,
-         GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE | GNUTLS_CERT_INVALID, 0,
+         GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE | GNUTLS_CERT_INVALID, NULL,
          1466612070 },
        { "tls features - intermediate has unrelated vals",
          tls_feat_inter_unrelated_fail, &tls_feat_inter_unrelated_fail[3], 0,
-         GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE | GNUTLS_CERT_INVALID, 0,
+         GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE | GNUTLS_CERT_INVALID, NULL,
          1466612070 },
        { "tls features - end is superset", tls_feat_superset,
-         &tls_feat_superset[3], 0, 0, 0, 1466612070 },
-       { "tls features - ok", tls_feat_ok, &tls_feat_ok[3], 0, 0, 0,
+         &tls_feat_superset[3], 0, 0, NULL, 1466612070 },
+       { "tls features - ok", tls_feat_ok, &tls_feat_ok[3], 0, 0, NULL,
          1466612070 },
        { "unknown crit extension on root - fail",
          unknown_critical_extension_on_root,
@@ -4825,51 +4825,51 @@ static struct {
          GNUTLS_KP_TLS_WWW_SERVER, 1488365541 },
        { "rsa pss: invalid self sig - fail", rsa_pss_invalid_self_sig,
          &rsa_pss_invalid_self_sig[0], GNUTLS_VERIFY_DO_NOT_ALLOW_SAME,
-         GNUTLS_CERT_INVALID | GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE, 0,
+         GNUTLS_CERT_INVALID | GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE, NULL,
          1501138253 },
        { "rsa pss: invalid chain with pkcs#1 1.5 sig - fail",
          rsa_pss_invalid_chain_with_pkcs1_sig,
          &rsa_pss_invalid_chain_with_pkcs1_sig[2], 0,
-         GNUTLS_CERT_INVALID | GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE, 0,
+         GNUTLS_CERT_INVALID | GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE, NULL,
          1501138253 },
        { "rsa pss: invalid chain with wrong hash (sha384-sha256) - fail",
          rsa_pss_invalid_chain_with_wrong_hash,
          &rsa_pss_invalid_chain_with_wrong_hash[3], 0,
-         GNUTLS_CERT_INVALID | GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE, 0,
+         GNUTLS_CERT_INVALID | GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE, NULL,
          1501138253 },
        { "rsa pss: smaller salt in sig than spki - fail",
          rsa_pss_chain_smaller_salt_in_sig_fail,
          &rsa_pss_chain_smaller_salt_in_sig_fail[3], 0,
-         GNUTLS_CERT_INVALID | GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE, 0,
+         GNUTLS_CERT_INVALID | GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE, NULL,
          1550005473 },
        { "rsa pss: chain with sha1 hash - fail", rsa_pss_chain_with_sha1_fail,
-         &rsa_pss_chain_with_sha1_fail[3], 0, GNUTLS_CERT_INVALID, 0,
+         &rsa_pss_chain_with_sha1_fail[3], 0, GNUTLS_CERT_INVALID, NULL,
          1501159136 },
        { "rsa pss: chain with different mgf hash - fail",
          rsa_pss_chain_with_diff_mgf_oid_fail,
-         &rsa_pss_chain_with_diff_mgf_oid_fail[3], 0, GNUTLS_CERT_INVALID, 0,
-         1501159136 },
+         &rsa_pss_chain_with_diff_mgf_oid_fail[3], 0, GNUTLS_CERT_INVALID,
+         NULL, 1501159136 },
        { "rsa pss: chain with sha256 - ok", rsa_pss_chain_sha256_ok,
-         &rsa_pss_chain_sha256_ok[3], 0, 0, 0, 1501138253 },
+         &rsa_pss_chain_sha256_ok[3], 0, 0, NULL, 1501138253 },
        { "rsa pss: chain with sha384 - ok", rsa_pss_chain_sha384_ok,
-         &rsa_pss_chain_sha384_ok[3], 0, 0, 0, 1501138253 },
+         &rsa_pss_chain_sha384_ok[3], 0, 0, NULL, 1501138253 },
        { "rsa pss: chain with sha512 - ok", rsa_pss_chain_sha512_ok,
-         &rsa_pss_chain_sha512_ok[3], 0, 0, 0, 1501138253 },
+         &rsa_pss_chain_sha512_ok[3], 0, 0, NULL, 1501138253 },
        { "rsa pss: chain with increasing salt size - ok",
          rsa_pss_chain_increasing_salt_size_ok,
-         &rsa_pss_chain_increasing_salt_size_ok[3], 0, 0, 0, 1501159136 },
+         &rsa_pss_chain_increasing_salt_size_ok[3], 0, 0, NULL, 1501159136 },
        { "rsa pss: chain with alternating signatures - ok",
          rsa_pss_chain_pkcs11_pss_pkcs1_ok,
-         &rsa_pss_chain_pkcs11_pss_pkcs1_ok[3], 0, 0, 0, 1501159136 },
+         &rsa_pss_chain_pkcs11_pss_pkcs1_ok[3], 0, 0, NULL, 1501159136 },
        { "rsa pss: chain with changing hashes - ok",
          rsa_pss_chain_sha512_sha384_sha256_ok,
-         &rsa_pss_chain_sha512_sha384_sha256_ok[3], 0, 0, 0, 1501159136 },
+         &rsa_pss_chain_sha512_sha384_sha256_ok[3], 0, 0, NULL, 1501159136 },
        { "no subject id: chain with missing subject id, but valid auth id - ok",
          chain_with_no_subject_id_in_ca_ok,
-         &chain_with_no_subject_id_in_ca_ok[4], 0, 0, 0, 1537518468 },
+         &chain_with_no_subject_id_in_ca_ok[4], 0, 0, NULL, 1537518468 },
 #ifdef ENABLE_GOST
        { "gost 34.10-01 - ok", gost01, &gost01[2], GNUTLS_VERIFY_ALLOW_BROKEN,
-         0, 0, 1466612070, 1 },
+         0, NULL, 1466612070, 1 },
        { "gost 34.10-01 - not ok (due to gostr94)", gost01, &gost01[2], 0,
          GNUTLS_CERT_INSECURE_ALGORITHM | GNUTLS_CERT_INVALID, NULL,
          1466612070, 1 },
@@ -4878,9 +4878,9 @@ static struct {
                  GNUTLS_PROFILE_TO_VFLAGS(GNUTLS_PROFILE_ULTRA),
          GNUTLS_CERT_INSECURE_ALGORITHM | GNUTLS_CERT_INVALID, NULL,
          1466612070, 1 },
-       { "gost 34.10-12-256 - ok", gost12_256, &gost12_256[0], 0, 0, 0,
+       { "gost 34.10-12-256 - ok", gost12_256, &gost12_256[0], 0, 0, NULL,
          1466612070, 1 },
-       { "gost 34.10-12-512 - ok", gost12_512, &gost12_512[0], 0, 0, 0,
+       { "gost 34.10-12-512 - ok", gost12_512, &gost12_512[0], 0, 0, NULL,
          1466612070, 1 },
 #endif
        { "rsa-512 - not ok (due to profile)", rsa_512, &rsa_512[0],
@@ -4890,7 +4890,7 @@ static struct {
        { "ed448 - ok", ed448, &ed448[0],
          GNUTLS_PROFILE_TO_VFLAGS(GNUTLS_PROFILE_ULTRA), 0, NULL, 1584352960,
          1 },
-       { "superseding - ok", superseding, superseding_ca, 0, 0, 0,
+       { "superseding - ok", superseding, superseding_ca, 0, 0, NULL,
          1590928011 },
        { "rsa-sha1 in trusted - ok", rsa_sha1_in_trusted,
          rsa_sha1_in_trusted_ca,
@@ -4901,9 +4901,9 @@ static struct {
          GNUTLS_PROFILE_TO_VFLAGS(GNUTLS_PROFILE_MEDIUM),
          GNUTLS_CERT_INSECURE_ALGORITHM | GNUTLS_CERT_INVALID, NULL,
          1620118136, 1 },
-       { "cross signed - ok", cross_signed, cross_signed_ca, 0, 0, 0,
+       { "cross signed - ok", cross_signed, cross_signed_ca, 0, 0, NULL,
          1704955300 },
-       { "many intermediates - ok", many_icas, many_icas_ca, 0, 0, 0,
+       { "many intermediates - ok", many_icas, many_icas_ca, 0, 0, NULL,
          1710284400 },
        { NULL, NULL, NULL, 0, 0 }
 };
index 719ca1cf5cf9296650e920edb2decf4d615c1256..7993a9bec4f5b3cf02805d62367655b23746e4c4 100644 (file)
@@ -26,7 +26,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <errno.h>
 #include <gnutls/gnutls.h>
 #include "utils.h"
 #include "eagain-common.h"
@@ -49,8 +48,8 @@ static void tls_log_func(int level, const char *str)
 static int check_binding_data(gnutls_session_t client, gnutls_session_t server,
                              int cbtype, const char *cbname, int negative)
 {
-       gnutls_datum_t client_cb = { 0 };
-       gnutls_datum_t server_cb = { 0 };
+       gnutls_datum_t client_cb = { NULL, 0 };
+       gnutls_datum_t server_cb = { NULL, 0 };
 
        if (gnutls_session_channel_binding(client, cbtype, &client_cb) !=
            GNUTLS_E_SUCCESS) {
index e3a3770e2e6a46c6488aa8c0d31996dc065baa9e..d5331210cc13109a430757ff7da09001ce99b435 100644 (file)
@@ -70,12 +70,12 @@ static void try(const char *name, const char *sprio, const char *cprio,
        gnutls_transport_set_push_function(server, server_push);
        gnutls_transport_set_pull_function(server, server_pull);
        gnutls_transport_set_ptr(server, server);
-       assert(gnutls_priority_set_direct(server, sprio, 0) >= 0);
+       assert(gnutls_priority_set_direct(server, sprio, NULL) >= 0);
 
        gnutls_transport_set_push_function(client, client_push);
        gnutls_transport_set_pull_function(client, client_pull);
        gnutls_transport_set_ptr(client, client);
-       assert(gnutls_priority_set_direct(client, cprio, 0) >= 0);
+       assert(gnutls_priority_set_direct(client, cprio, NULL) >= 0);
 
        HANDSHAKE_EXPECT(client, server, cerr, serr);
 
index 72b239eb2bda892f138d6ee5a9bcfb1ca129e8a8..26007978bcc37f0df5f13e1f7ab50bf0b441763f 100644 (file)
@@ -362,7 +362,7 @@ void doit(void)
                                            tests[i].pk, tests[i].exp_key_err);
                if (privkey == NULL && tests[i].exp_key_err < 0)
                        continue;
-               assert(privkey != 0);
+               assert(privkey != NULL);
 
                try_with_key(tests[i].name, tests[i].prio, tests[i].exp_kx, 0,
                             0, tests[i].cert, privkey, tests[i].exp_serv_err);
index 45c216c5d9e03608fb27c9cdeb60de7d4a317227..e3ad22f31120f307a7f3d7ef5400d8a7c02c787f 100644 (file)
@@ -495,7 +495,7 @@ void doit(void)
                                            tests[i].exp_key_err);
                if (privkey == NULL && tests[i].exp_key_err < 0)
                        continue;
-               assert(privkey != 0);
+               assert(privkey != NULL);
 
                try_with_key(tests[i].name, tests[i].prio, tests[i].exp_kx, 0,
                             0, tests[i].cert, privkey, tests[i].exp_serv_err);
index 3379248f5baf395d2870cc421e4082f514036250..3bf3dbaffe3db441017e060929cf3c4097fcf343 100644 (file)
@@ -125,7 +125,7 @@ static void *recv_thread(void *arg)
                success("closing recv thread\n");
        }
 
-       pthread_exit(0);
+       pthread_exit(NULL);
 }
 
 static void do_thread_stuff(gnutls_session_t session)
@@ -168,7 +168,7 @@ static void do_thread_stuff(gnutls_session_t session)
        /* the receiving thread will receive the EOF and close */
 
        assert(pthread_join(id, &rval) == 0);
-       assert(rval == 0);
+       assert(rval == NULL);
 }
 
 static void do_reflect_stuff(gnutls_session_t session)
index 798883f56edf9c94ca8b955c42b884a83ab514e2..0ec2c2ab2c9014ddb16a9e09d9cec23169a7d4c5 100644 (file)
@@ -142,12 +142,14 @@ static void try(test_case_st *test)
        gnutls_transport_set_push_function(server, server_push);
        gnutls_transport_set_pull_function(server, server_pull);
        gnutls_transport_set_ptr(server, server);
-       assert(gnutls_priority_set_direct(server, test->server_prio, 0) >= 0);
+       assert(gnutls_priority_set_direct(server, test->server_prio, NULL) >=
+              0);
 
        gnutls_transport_set_push_function(client, client_push);
        gnutls_transport_set_pull_function(client, client_pull);
        gnutls_transport_set_ptr(client, client);
-       assert(gnutls_priority_set_direct(client, test->client_prio, 0) >= 0);
+       assert(gnutls_priority_set_direct(client, test->client_prio, NULL) >=
+              0);
 
        HANDSHAKE_EXPECT(client, server, test->client_ret, test->server_ret);
 
index 007414457ec6b69c4df036efab0e98cb0f5211aa..5983ee971c1f19f7d358fafa69e82f107974c2ee 100644 (file)
@@ -45,7 +45,7 @@ static time_t _now;
                gnutls_global_set_time_function(mytime); \
        }
 
-#define virt_time_init() virt_time_init_at(time(0))
+#define virt_time_init() virt_time_init_at(time(NULL))
 
 static time_t mytime(time_t *t)
 {