]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
build: remove dead assignments
authorDaiki Ueno <ueno@gnu.org>
Sun, 13 Sep 2020 15:19:32 +0000 (17:19 +0200)
committerDaiki Ueno <ueno@gnu.org>
Fri, 18 Sep 2020 08:12:24 +0000 (10:12 +0200)
Signed-off-by: Daiki Ueno <ueno@gnu.org>
lib/auth/psk_passwd.c
lib/auth/srp_passwd.c
lib/ext/pre_shared_key.c
lib/x509/key_decode.c
lib/x509/output.c
lib/x509/privkey.c
lib/x509/verify.c
lib/x509_b64.c
libdane/dane.c
src/certtool-common.c
src/srptool.c

index 9a9d68c48877d99b67b1580192a686a05e679f54..2953c2d8add3b89e91d96834103dc1d99efbdf95 100644 (file)
@@ -105,7 +105,7 @@ static bool username_matches(const gnutls_datum_t *username,
                hexline.data = (void *) &line[1];
                hexline.size = i - 1;
 
-               if ((retval = gnutls_hex_decode2(&hexline, &hex_username)) < 0)
+               if (gnutls_hex_decode2(&hexline, &hex_username) < 0)
                        return gnutls_assert_val(0);
 
                if (hex_username.size == username->size)
index 49039a66e708a45fc7cfb009dde4f8dea7da274d..e7d8d602e608c14f53f4115d1c344263fbfb5308 100644 (file)
@@ -218,9 +218,7 @@ pwd_read_conf(const char *pconf_file, SRP_PWD_ENTRY * entry, int idx)
                }
 
                if (strncmp(indexstr, line, MAX(i, len)) == 0) {
-                       if ((idx =
-                            parse_tpasswd_conf_values(entry,
-                                                      line)) >= 0) {
+                       if (parse_tpasswd_conf_values(entry, line) >= 0) {
                                ret = 0;
                                goto cleanup;
                        } else {
index 7965ee760dd9b1e9d8f3f47877123384bf612866..b5a86b7db1f4f0a164972865d87e3506172eb758 100644 (file)
@@ -575,7 +575,7 @@ static int server_recv_params(gnutls_session_t session,
                /* This will unpack the session ticket if it is well
                 * formed and has the expected name */
                if (!(session->internals.flags & GNUTLS_NO_TICKETS) &&
-                   (ret = _gnutls13_unpack_session_ticket(session, &psk.identity, &ticket_data)) == 0) {
+                   _gnutls13_unpack_session_ticket(session, &psk.identity, &ticket_data) == 0) {
                        prf = ticket_data.prf;
 
                        session->internals.resumption_requested = 1;
index c79f6eee37513c5d0aa8c42d97357e12edd2c8b6..00378af94d75dd72c700b6762225711d10645e0d 100644 (file)
@@ -76,16 +76,15 @@ _gnutls_x509_read_rsa_pubkey(uint8_t * der, int dersize,
        }
 
 
-       if ((result =
-            _gnutls_x509_read_int(spk, "modulus",
-                                  &params->params[0])) < 0) {
+       if (_gnutls_x509_read_int(spk, "modulus",
+                                 &params->params[0]) < 0) {
                gnutls_assert();
                asn1_delete_structure(&spk);
                return GNUTLS_E_ASN1_GENERIC_ERROR;
        }
 
-       if ((result = _gnutls_x509_read_int(spk, "publicExponent",
-                                           &params->params[1])) < 0) {
+       if (_gnutls_x509_read_int(spk, "publicExponent",
+                                 &params->params[1]) < 0) {
                gnutls_assert();
                _gnutls_mpi_release(&params->params[0]);
                asn1_delete_structure(&spk);
@@ -200,8 +199,7 @@ _gnutls_x509_read_dsa_params(uint8_t * der, int dersize,
 
        /* Read p */
 
-       if ((result =
-            _gnutls_x509_read_int(spk, "p", &params->params[0])) < 0) {
+       if (_gnutls_x509_read_int(spk, "p", &params->params[0]) < 0) {
                gnutls_assert();
                asn1_delete_structure(&spk);
                return GNUTLS_E_ASN1_GENERIC_ERROR;
@@ -209,8 +207,7 @@ _gnutls_x509_read_dsa_params(uint8_t * der, int dersize,
 
        /* Read q */
 
-       if ((result =
-            _gnutls_x509_read_int(spk, "q", &params->params[1])) < 0) {
+       if (_gnutls_x509_read_int(spk, "q", &params->params[1]) < 0) {
                gnutls_assert();
                asn1_delete_structure(&spk);
                _gnutls_mpi_release(&params->params[0]);
@@ -219,8 +216,7 @@ _gnutls_x509_read_dsa_params(uint8_t * der, int dersize,
 
        /* Read g */
 
-       if ((result =
-            _gnutls_x509_read_int(spk, "g", &params->params[2])) < 0) {
+       if (_gnutls_x509_read_int(spk, "g", &params->params[2]) < 0) {
                gnutls_assert();
                asn1_delete_structure(&spk);
                _gnutls_mpi_release(&params->params[0]);
index 705e8babfa26ee2ed142674c9254092e8de2c75e..b669b86b220eacbe2508acd7017d987b3606a3af 100644 (file)
@@ -897,18 +897,18 @@ static void print_subject_sign_tool(gnutls_buffer_st * str, const char *prefix,
 
 static void print_issuer_sign_tool(gnutls_buffer_st * str, const char *prefix, const gnutls_datum_t *der)
 {
-       int ret, result;
+       int ret;
        ASN1_TYPE tmpasn = ASN1_TYPE_EMPTY;
        char asn1_err[ASN1_MAX_ERROR_DESCRIPTION_SIZE] = "";
        gnutls_datum_t tmp;
 
-       if ((result = asn1_create_element(_gnutls_get_gnutls_asn(), "GNUTLS.IssuerSignTool",
-                                &tmpasn)) != ASN1_SUCCESS) {
+       if (asn1_create_element(_gnutls_get_gnutls_asn(), "GNUTLS.IssuerSignTool",
+                               &tmpasn) != ASN1_SUCCESS) {
                gnutls_assert();
                goto hexdump;
        }
 
-       if ((result = _asn1_strict_der_decode(&tmpasn, der->data, der->size, asn1_err)) != ASN1_SUCCESS) {
+       if (_asn1_strict_der_decode(&tmpasn, der->data, der->size, asn1_err) != ASN1_SUCCESS) {
                gnutls_assert();
                _gnutls_debug_log("_asn1_strict_der_decode: %s\n", asn1_err);
                goto hexdump;
index 3852064648fd3c53bf1c6447809921623b16427a..f35575be9ad92d55633b443f1681f2c50fa8398a 100644 (file)
@@ -135,10 +135,9 @@ _gnutls_privkey_decode_pkcs1_rsa_key(const gnutls_datum_t * raw_key,
 
        gnutls_pk_params_init(&pkey->params);
 
-       if ((result =
-            asn1_create_element(_gnutls_get_gnutls_asn(),
-                                "GNUTLS.RSAPrivateKey",
-                                &pkey_asn)) != ASN1_SUCCESS) {
+       if (asn1_create_element(_gnutls_get_gnutls_asn(),
+                               "GNUTLS.RSAPrivateKey",
+                               &pkey_asn) != ASN1_SUCCESS) {
                gnutls_assert();
                return NULL;
        }
@@ -151,65 +150,58 @@ _gnutls_privkey_decode_pkcs1_rsa_key(const gnutls_datum_t * raw_key,
                goto error;
        }
 
-       if ((result = _gnutls_x509_read_int(pkey_asn, "modulus",
-                                           &pkey->params.params[0])) < 0)
+       if (_gnutls_x509_read_int(pkey_asn, "modulus",
+                                 &pkey->params.params[0]) < 0)
        {
                gnutls_assert();
                goto error;
        }
        pkey->params.params_nr++;
 
-       if ((result =
-            _gnutls_x509_read_int(pkey_asn, "publicExponent",
-                                  &pkey->params.params[1])) < 0) {
+       if (_gnutls_x509_read_int(pkey_asn, "publicExponent",
+                                 &pkey->params.params[1]) < 0) {
                gnutls_assert();
                goto error;
        }
        pkey->params.params_nr++;
 
-       if ((result =
-            _gnutls_x509_read_key_int(pkey_asn, "privateExponent",
-                                  &pkey->params.params[2])) < 0) {
+       if (_gnutls_x509_read_key_int(pkey_asn, "privateExponent",
+                                     &pkey->params.params[2]) < 0) {
                gnutls_assert();
                goto error;
        }
        pkey->params.params_nr++;
 
-       if ((result = _gnutls_x509_read_key_int(pkey_asn, "prime1",
-                                           &pkey->params.params[3])) < 0)
-       {
+       if (_gnutls_x509_read_key_int(pkey_asn, "prime1",
+                                     &pkey->params.params[3]) < 0) {
                gnutls_assert();
                goto error;
        }
        pkey->params.params_nr++;
 
-       if ((result = _gnutls_x509_read_key_int(pkey_asn, "prime2",
-                                           &pkey->params.params[4])) < 0)
-       {
+       if (_gnutls_x509_read_key_int(pkey_asn, "prime2",
+                                     &pkey->params.params[4]) < 0) {
                gnutls_assert();
                goto error;
        }
        pkey->params.params_nr++;
 
-       if ((result = _gnutls_x509_read_key_int(pkey_asn, "coefficient",
-                                           &pkey->params.params[5])) < 0)
-       {
+       if (_gnutls_x509_read_key_int(pkey_asn, "coefficient",
+                                     &pkey->params.params[5]) < 0) {
                gnutls_assert();
                goto error;
        }
        pkey->params.params_nr++;
 
-       if ((result = _gnutls_x509_read_key_int(pkey_asn, "exponent1",
-                                           &pkey->params.params[6])) < 0)
-       {
+       if (_gnutls_x509_read_key_int(pkey_asn, "exponent1",
+                                     &pkey->params.params[6]) < 0) {
                gnutls_assert();
                goto error;
        }
        pkey->params.params_nr++;
 
-       if ((result = _gnutls_x509_read_key_int(pkey_asn, "exponent2",
-                                           &pkey->params.params[7])) < 0)
-       {
+       if (_gnutls_x509_read_key_int(pkey_asn, "exponent2",
+                                     &pkey->params.params[7]) < 0) {
                gnutls_assert();
                goto error;
        }
@@ -353,10 +345,9 @@ decode_dsa_key(const gnutls_datum_t * raw_key, gnutls_x509_privkey_t pkey)
        char oid[MAX_OID_SIZE];
        int oid_size;
 
-       if ((result =
-            asn1_create_element(_gnutls_get_gnutls_asn(),
-                                "GNUTLS.DSAPrivateKey",
-                                &dsa_asn)) != ASN1_SUCCESS) {
+       if (asn1_create_element(_gnutls_get_gnutls_asn(),
+                               "GNUTLS.DSAPrivateKey",
+                               &dsa_asn) != ASN1_SUCCESS) {
                gnutls_assert();
                return NULL;
        }
@@ -372,40 +363,36 @@ decode_dsa_key(const gnutls_datum_t * raw_key, gnutls_x509_privkey_t pkey)
                goto error;
        }
 
-       if ((result =
-            _gnutls_x509_read_int(dsa_asn, "p",
-                                  &pkey->params.params[0])) < 0) {
+       if (_gnutls_x509_read_int(dsa_asn, "p",
+                                 &pkey->params.params[0]) < 0) {
                gnutls_assert();
                goto error;
        }
        pkey->params.params_nr++;
 
-       if ((result =
-            _gnutls_x509_read_int(dsa_asn, "q",
-                                  &pkey->params.params[1])) < 0) {
+       if (_gnutls_x509_read_int(dsa_asn, "q",
+                                 &pkey->params.params[1]) < 0) {
                gnutls_assert();
                goto error;
        }
        pkey->params.params_nr++;
 
-       if ((result =
-            _gnutls_x509_read_int(dsa_asn, "g",
-                                  &pkey->params.params[2])) < 0) {
+       if (_gnutls_x509_read_int(dsa_asn, "g",
+                                 &pkey->params.params[2]) < 0) {
                gnutls_assert();
                goto error;
        }
        pkey->params.params_nr++;
 
-       if ((result =
-            _gnutls_x509_read_int(dsa_asn, "Y",
-                                  &pkey->params.params[3])) < 0) {
+       if (_gnutls_x509_read_int(dsa_asn, "Y",
+                                 &pkey->params.params[3]) < 0) {
                gnutls_assert();
                goto error;
        }
        pkey->params.params_nr++;
 
-       if ((result = _gnutls_x509_read_key_int(dsa_asn, "priv",
-                                           &pkey->params.params[4])) < 0)
+       if (_gnutls_x509_read_key_int(dsa_asn, "priv",
+                                     &pkey->params.params[4]) < 0)
        {
                gnutls_assert();
                goto error;
index 4363e818b12d9e4cf686ebe3a49f38abb9c66ede..bab223ceca9bc982c0cd910a4197b0cd50168698 100644 (file)
@@ -1074,13 +1074,12 @@ _gnutls_verify_crt_status(gnutls_x509_trust_list_t tlist,
                        flags |= GNUTLS_VERIFY_DO_NOT_ALLOW_X509_V1_CA_CRT;
                }
 
-               if ((ret =
-                     verify_crt(tlist,
-                                certificate_list[i - 1],
+               if (!verify_crt(tlist,
+                               certificate_list[i - 1],
                                &certificate_list[i], 1,
                                flags, &output,
                                &vparams,
-                               i==1?1:0)) != 1) {
+                               i==1?1:0)) {
                        gnutls_assert();
                        status |= output;
                        status |= GNUTLS_CERT_INVALID;
index fcace95a6f650477f1e43267879c1bd06e6a118f..668760a0b32d364d679f050356e8ba9e17255814 100644 (file)
@@ -86,7 +86,7 @@ _gnutls_fbase64_encode(const char *msg, const uint8_t * data,
                return GNUTLS_E_MEMORY_ERROR;
        }
 
-       bytes = pos = 0;
+       bytes = 0;
        INCR(bytes, top_len, max);
        pos = top_len;
 
index f05f3ce92cc4a727ea73f9bcdc96c3a19b942e58..a7236f9f7be2213b06bd48afefbefede1d00a805 100644 (file)
@@ -248,13 +248,13 @@ int dane_state_init(dane_state_t * s, unsigned int flags)
        ub_ctx_debugout(ctx, stderr);
 
        if (!(flags & DANE_F_IGNORE_LOCAL_RESOLVER)) {
-               if ((ret = ub_ctx_resolvconf(ctx, NULL)) != 0) {
+               if (ub_ctx_resolvconf(ctx, NULL) != 0) {
                        gnutls_assert();
                        ret = DANE_E_INITIALIZATION_ERROR;
                        goto cleanup;
                }
 
-               if ((ret = ub_ctx_hosts(ctx, NULL)) != 0) {
+               if (ub_ctx_hosts(ctx, NULL) != 0) {
                        gnutls_assert();
                        ret = DANE_E_INITIALIZATION_ERROR;
                        goto cleanup;
@@ -263,9 +263,8 @@ int dane_state_init(dane_state_t * s, unsigned int flags)
 
        /* read public keys for DNSSEC verification */
        if (!(flags & DANE_F_IGNORE_DNSSEC)) {
-               if ((ret =
-                    ub_ctx_add_ta_file(ctx,
-                                       (char *) UNBOUND_ROOT_KEY_FILE)) !=
+               if (ub_ctx_add_ta_file(ctx,
+                                      (char *) UNBOUND_ROOT_KEY_FILE) !=
                    0) {
                        gnutls_assert();
                        ret = DANE_E_INITIALIZATION_ERROR;
index 3af2d0808005d553c7b919ff9eb0b463711a7d6c..31e1c2619f158305a682852126d1185629bb2b1b 100644 (file)
@@ -698,7 +698,7 @@ gnutls_pubkey_t load_public_key_or_import(int mand,
                app_exit(1);
        }
 
-       if (!privkey || (ret = gnutls_pubkey_import_privkey(pubkey, privkey, 0, 0)) < 0) {      /* could not get (e.g. on PKCS #11 */
+       if (!privkey || gnutls_pubkey_import_privkey(pubkey, privkey, 0, 0) < 0) {      /* could not get (e.g. on PKCS #11) */
                gnutls_pubkey_deinit(pubkey);
                pubkey = load_pubkey(0, info);
                if (pubkey == NULL && mand) {
index 7939f6bfabc007694cc91d4f9eafdb615e82bb06..7da14afa6cec25dc8e077c3347edd072d4681445 100644 (file)
@@ -318,7 +318,7 @@ verify_passwd(const char *conffile, const char *tpasswd,
 
        fclose(fp);
 
-       if ((iindex = read_conf_values(&g, &n, line)) < 0) {
+       if (read_conf_values(&g, &n, line) < 0) {
                fprintf(stderr, "Cannot parse conf file '%s'\n", conffile);
                return -1;
        }
@@ -528,7 +528,7 @@ crypt_int(const char *username, const char *passwd, int salt_size,
        do {                    /* find the specified uindex in file */
                p = fgets(line, sizeof(line) - 1, fp);
        }
-       while (p != NULL && (iindex = atoi(p)) != uindex);
+       while (p != NULL && atoi(p) != uindex);
 
        if (p == NULL) {
                fprintf(stderr, "Cannot find entry in %s\n", tpasswd_conf);